Tutorial |
||
|
||
|
EventBox(); |
eventbox->add(*child_widget); |
#include<inti/main.h> #include <inti/core.h> #include <inti/gdk/cursor.h> using namespace Inti; class EventBoxWindow : public Gtk::Window { Pointer<Gdk::Cursor> hand_cursor; protected: bool on_button_press_event(GdkEventButton *event); public: EventBoxWindow(); virtual ~EventBoxWindow(); }; |
#include"eventbox.h" #include <inti/gtk/eventbox.h> #include <inti/gtk/label.h> #include <inti/gdk/window.h> EventBoxWindow::EventBoxWindow() { set_title("Event Box"); set_border_width(10); // Create an EventBox and add it to our toplevel window Gtk::EventBox *event_box = new Gtk::EventBox; add(*event_box); event_box->show(); // Create a long label Gtk::Label *label = new Gtk::Label("Click here to quit, quit, quit, quit, quit"); event_box->add(*label); label->show(); // Clip it short label->set_size_request(110, 20); // And bind an action to it event_box->set_events(Gdk::BUTTON_PRESS_MASK); event_box->sig_button_press_event().connect(slot(this, &EventBoxWindow::on_button_press_event)); // Yet one more thing you need an X window for ... event_box->realize(); hand_cursor = new Gdk::Cursor(GDK_HAND1); event_box->get_window()->set_cursor(*hand_cursor); show(); } EventBoxWindow::~EventBoxWindow() { } bool EventBoxWindow::on_button_press_event(GdkEventButton*) { dispose(); return true; } int main (int argc, char *argv[]) { using namespace Main; init(&argc, &argv); EventBoxWindow window; window.sig_destroy().connect(slot(&Inti::Main::quit)); run(); return 0; } |
|
|||
|
|||