- Add about dialog as an extra example on how to use libglade with
signals - Remember that sigc::bind exists for passing extra parameters to called methods/functions git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@729 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
e99b7c80ae
commit
d7ca106d89
2 changed files with 76 additions and 6 deletions
|
@ -24,6 +24,8 @@
|
|||
#include "start_gui.hh"
|
||||
|
||||
#include <libglademm/xml.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/aboutdialog.h>
|
||||
#include <gtkmm/main.h>
|
||||
#include <gtkmm/menuitem.h>
|
||||
#include <gtkmm/window.h>
|
||||
|
@ -49,9 +51,16 @@ start_gui(int argc, char** argv)
|
|||
// here -- ugly -- derive widgets and then use
|
||||
// Glade::Xml::get_widget_derived -- better --)
|
||||
MenuItem* file_quit = NULL;
|
||||
refXml->get_widget("Menu.File.Quit", file_quit);
|
||||
refXml->get_widget("MenuItem.File.Quit", file_quit);
|
||||
file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit));
|
||||
|
||||
// About dialog
|
||||
MenuItem* help_about = NULL;
|
||||
refXml->get_widget("MenuItem.Help.About", help_about);
|
||||
AboutDialog* about_dialog = NULL;
|
||||
refXml->get_widget("AboutDialog", about_dialog);
|
||||
help_about->signal_activate().connect(sigc::mem_fun(*about_dialog, &Window::show));
|
||||
|
||||
main_window->show_all_children();
|
||||
|
||||
Main::run(*main_window);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue