- 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:
tchernobog 2006-07-05 15:16:58 +00:00
parent e99b7c80ae
commit d7ca106d89
2 changed files with 76 additions and 6 deletions

View File

@ -2,6 +2,8 @@
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="MainWindow">
<property name="width_request">300</property>
<property name="height_request">200</property>
<child>
<widget class="GtkVBox" id="MainBox">
<property name="visible">True</property>
@ -9,7 +11,7 @@
<widget class="GtkMenuBar" id="MenuBar">
<property name="visible">True</property>
<child>
<widget class="GtkMenuItem" id="MenuBar.File">
<widget class="GtkMenuItem" id="MenuItem.File">
<property name="visible">True</property>
<property name="label">_File</property>
<property name="use_underline">True</property>
@ -17,7 +19,7 @@
<widget class="GtkMenu" id="Menu.File">
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="Menu.File.Quit">
<widget class="GtkImageMenuItem" id="MenuItem.File.Quit">
<property name="visible">True</property>
<property name="label">gtk-quit</property>
<property name="use_underline">True</property>
@ -29,15 +31,15 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuBar.Help">
<widget class="GtkMenuItem" id="MenuItem.Help">
<property name="visible">True</property>
<property name="label">_Help</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="MenuBar.File.Help">
<widget class="GtkMenu" id="Menu.Help">
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="imagemenuitem2">
<widget class="GtkImageMenuItem" id="MenuItem.Help.About">
<property name="visible">True</property>
<property name="label">gtk-about</property>
<property name="use_underline">True</property>
@ -73,6 +75,27 @@
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkToolButton" id="ToolBar.Play">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="stock_id">gtk-media-play</property>
</widget>
</child>
<child>
<widget class="GtkToolButton" id="ToolBar.Pause">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="stock_id">gtk-media-pause</property>
</widget>
</child>
<child>
<widget class="GtkToolButton" id="ToolBar.Stop">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="stock_id">gtk-media-stop</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
@ -95,4 +118,42 @@
</widget>
</child>
</widget>
<widget class="GtkAboutDialog" id="AboutDialog">
<property name="title">SGPEMv2</property>
<property name="version">0.3</property>
<property name="copyright">University of Padova, dept. of Pure and Applied Mathematics</property>
<property name="license">SGPEMv2 comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License; for details see file COPYING contained in the source package.</property>
<property name="authors">Giovanni Giacobbi &lt;ggiacobb@studenti.math.unipd.it&gt;
Filippo Paparella &lt;ironpipp@gmail.com&gt;
Paolo Santi &lt;psanti@studenti.math.unipd.it&gt;
Matteo Settenvini &lt;matteo@member.fsf.org&gt;
Marco Trevisan &lt;mtrevisa@studenti.math.unipd.it&gt;
Djina Verbanac &lt;betalgez@yahoo.com&gt;
Luca Vezzaro &lt;lvezzaro@studenti.math.unipd.it&gt;</property>
<property name="documenters"></property>
<property name="wrap_license">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="border_width">12</property>
<property name="spacing">12</property>
<child>
<placeholder/>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="spacing">6</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -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);