⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example-1.cc

📁 Developing with Gnome一书examples例子代码
💻 CC
字号:
/* 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -