📄 eventbox.cc
字号:
#include "eventbox.hh"#include <gfc/gtk/box.hh>#include <gfc/gtk/eventbox.hh>#include <gfc/gtk/label.hh>#include <gfc/gdk/window.hh>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(sigc::mem_fun(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(){}boolEventBoxWindow::on_button_press_event(const Gdk::EventButton&){ dispose(); return true;}int main (int argc, char *argv[]){ using namespace Main; init(&argc, &argv); EventBoxWindow window; window.sig_destroy().connect(sigc::ptr_fun(&GFC::Main::quit)); run(); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -