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

📄 examplewindow.cc

📁 Developing with Gnome一书examples例子代码
💻 CC
字号:
#include "ExampleWindow.h"#include <iostream>using namespace std;ExampleWindow::ExampleWindow(  BaseObjectType* base_object,  const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml)  : Gtk::Window(base_object){  // Get the necessary widgets  glade_xml->get_widget("SensitivityCheckButton", d_sensitivity_check_button);  glade_xml->get_widget("OohTellMe",              d_ooh_tell_me);  glade_xml->get_widget("QuitButton",             d_quit_button);  // Connect the appropriate callbacks...  d_sensitivity_check_button->signal_toggled().connect(    sigc::mem_fun(*this, &ExampleWindow::sensitivity_toggled) );  d_quit_button->signal_clicked().connect(     sigc::mem_fun(*this, &ExampleWindow::time_to_quit) );}ExampleWindow::~ExampleWindow(){}voidExampleWindow::sensitivity_toggled(){  d_ooh_tell_me->set_sensitive( d_sensitivity_check_button->get_active() );}voidExampleWindow::time_to_quit(){  // If the user checked the OohTellMe button, we need to do some work...  if (d_ooh_tell_me->get_active()) {    // Change the checkbutton's label    d_ooh_tell_me->set_label("M_ock me");    /* Since we don't return to the main event loop, we have to     * manually tell gtk+ to process the set_label change (and any     * other changes that require processing).     */    while (Glib::MainContext::get_default()->iteration(false))        ;    // Mock the user and give them some time to notice the change    cout << "Ha ha, you fell for it!  ";    cout << "I will not tell you what that checkbutton does!" << endl;    sleep(1);  }  hide();}boolExampleWindow::on_delete_event(GdkEventAny* event){  time_to_quit();  // No other handlers need be called...  return true;}

⌨️ 快捷键说明

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