examplewindow.cc

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

CC
67
字号
#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 + =
减小字号Ctrl + -
显示快捷键?