example-1.cc

来自「Developing with Gnome一书examples例子代码」· CC 代码 · 共 42 行

CC
42
字号
/* This program displays a simple window and has a simple callback for * when the OK button is clicked. */#include <gtkmm.h>#include <libglademm/xml.h>#include <iostream>using namespace std;voidok_button_clicked(){  cout << "Thanks for trying out my program." << endl;  Gtk::Main::quit();}intmain (int argc, char *argv[]){  Glib::RefPtr<Gnome::Glade::Xml> main_window;  Gtk::Main kit(argc, argv);  // load the interface  main_window = Gnome::Glade::Xml::create("example-1.glade");  // connect the signals in the interface  Gtk::Button& ok_button =     dynamic_cast<Gtk::Button&>( *main_window->get_widget("OKButton") );  ok_button.signal_clicked().connect( sigc::ptr_fun(&ok_button_clicked) );  // start the event loop; exit when the specified window is closed  Gtk::Dialog& dialog =    dynamic_cast<Gtk::Dialog&>( *main_window->get_widget("MainWindow") );  //dialog.signal_delete_event().connect( sigc::ptr_fun(&Gtk::Main::quit) );  Gtk::Main::run( dialog );  //Gtk::Main::run( );  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?