diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h index f1884748a..24d307a5a 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.15 $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -94,7 +94,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ * @see WidgetFactory * @see WidgetFactory#getWhiteWindowCorners */ @@ -182,42 +182,6 @@ class WhiteWindow : public Gtk::Window */ Gtk::Alignment * childContainer; - /** - * The event handler for the title being clicked on. - * - * @param event the button click event. - * @return true if the the event was handled, false otherwise. - */ - bool - onTitleClicked(GdkEventButton * event) throw (); - - /** - * Signal handler for the minimize button clicked. - */ - virtual void - onMinimizeButtonClicked(void) throw (); - - /** - * Signal handler for the maximize button clicked. - */ - virtual void - onMaximizeButtonClicked(void) throw (); - - /** - * Signal handler for the close button clicked. - */ - virtual void - onCloseButtonClicked(void) throw (); - - /** - * The event handler for the resize being clicked on. - * - * @param event the button click event. - * @return true if the the event was handled, false otherwise. - */ - bool - onResizeClicked(GdkEventButton * event) throw (); - /** * Default constructor. */ @@ -330,6 +294,42 @@ class WhiteWindow : public Gtk::Window int properties) throw (); + /** + * The event handler for the title being clicked on. + * + * @param event the button click event. + * @return true if the the event was handled, false otherwise. + */ + virtual bool + onTitleClicked(GdkEventButton * event) throw (); + + /** + * Signal handler for the minimize button clicked. + */ + virtual void + onMinimizeButtonClicked(void) throw (); + + /** + * Signal handler for the maximize button clicked. + */ + virtual void + onMaximizeButtonClicked(void) throw (); + + /** + * Signal handler for the close button clicked. + */ + virtual void + onCloseButtonClicked(void) throw (); + + /** + * The event handler for the resize being clicked on. + * + * @param event the button click event. + * @return true if the the event was handled, false otherwise. + */ + virtual bool + onResizeClicked(GdkEventButton * event) throw (); + public: /** diff --git a/livesupport/modules/widgets/src/DialogWindow.cxx b/livesupport/modules/widgets/src/DialogWindow.cxx index e380f7c21..803945ed4 100644 --- a/livesupport/modules/widgets/src/DialogWindow.cxx +++ b/livesupport/modules/widgets/src/DialogWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/DialogWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -121,7 +121,7 @@ DialogWindow :: DialogWindow (Ptr::Ref message, } set_default_size(100*buttonCount + 50, 120); - property_window_position().set_value(Gtk::WIN_POS_NONE); + property_window_position().set_value(Gtk::WIN_POS_CENTER); add(*layout); } diff --git a/livesupport/modules/widgets/src/TestWindow.cxx b/livesupport/modules/widgets/src/TestWindow.cxx index 3b872b2f1..70b873119 100644 --- a/livesupport/modules/widgets/src/TestWindow.cxx +++ b/livesupport/modules/widgets/src/TestWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.18 $ + Version : $Revision: 1.19 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -76,11 +76,11 @@ TestWindow :: TestWindow (void) cuePlayImageButton = Gtk::manage( widgetFactory->createButton(WidgetFactory::cuePlayButton)); cuePlayImageButton->signal_clicked().connect(sigc::mem_fun(*this, - &TestWindow::onPlayButtonPressed)); + &TestWindow::onPlayButtonClicked)); cueStopImageButton = Gtk::manage( widgetFactory->createButton(WidgetFactory::cueStopButton)); cueStopImageButton->signal_clicked().connect(sigc::mem_fun(*this, - &TestWindow::onStopButtonPressed)); + &TestWindow::onStopButtonClicked)); // create a button button = Gtk::manage(widgetFactory->createButton("Hello, World!")); @@ -139,7 +139,6 @@ TestWindow :: TestWindow (void) Ptr::Ref confirmationMessage(new Glib::ustring( "Are you sure?" )); dialogWindow = new DialogWindow(confirmationMessage, - DialogWindow::cancelButton | DialogWindow::noButton | DialogWindow::yesButton, resourceBundle); @@ -171,37 +170,43 @@ TestWindow :: onButtonClicked(void) throw () /*------------------------------------------------------------------------------ - * Change the image from "play" to "stop" on the button when pressed. + * Change the image from "play" to "stop" on the button when clicked. *----------------------------------------------------------------------------*/ void -TestWindow :: onPlayButtonPressed(void) throw () +TestWindow :: onPlayButtonClicked(void) throw () { - DialogWindow::ButtonType result = dialogWindow->run(); - switch (result) { - case DialogWindow::cancelButton: - std::cerr << "Cancelled." << std::endl; - break; - case DialogWindow::noButton: - std::cerr << "No." << std::endl; - break; - case DialogWindow::yesButton: - std::cerr << "Yes." << std::endl; - break; - default: std::cerr << "This can never happen." << std::endl; - } - cuePlayImageButton->hide(); cueStopImageButton->show(); } /*------------------------------------------------------------------------------ - * Change the image from "stop" to "play" on the button when pressed. + * Change the image from "stop" to "play" on the button when clicked. *----------------------------------------------------------------------------*/ void -TestWindow :: onStopButtonPressed(void) throw () +TestWindow :: onStopButtonClicked(void) throw () { cueStopImageButton->hide(); cuePlayImageButton->show(); } + +/*------------------------------------------------------------------------------ + * Override the close button functionality. + *----------------------------------------------------------------------------*/ +void +TestWindow :: onCloseButtonClicked(void) throw () +{ + DialogWindow::ButtonType result = dialogWindow->run(); + switch (result) { + case DialogWindow::noButton: + return; + + case DialogWindow::yesButton: + hide(); + break; + + default: std::cerr << "This can never happen." << std::endl; + } +} + diff --git a/livesupport/modules/widgets/src/TestWindow.h b/livesupport/modules/widgets/src/TestWindow.h index 686244ec1..2fbc14147 100644 --- a/livesupport/modules/widgets/src/TestWindow.h +++ b/livesupport/modules/widgets/src/TestWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -73,7 +73,7 @@ using namespace LiveSupport::Core; * A window, enabling interactive testing of UI components. * * @author $Author: fgerlits $ - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ class TestWindow : public WhiteWindow { @@ -82,13 +82,13 @@ class TestWindow : public WhiteWindow * Change the image from "play" to "stop" on the button when pressed. */ void - onPlayButtonPressed(void) throw (); + onPlayButtonClicked(void) throw (); /** * Change the image from "stop" to "play" on the button when pressed. */ void - onStopButtonPressed(void) throw (); + onStopButtonClicked(void) throw (); /** * The "are you sure?" dialog window. @@ -148,11 +148,18 @@ class TestWindow : public WhiteWindow BlueBin * blueBin; /** - * Event handler for the button being clicked. + * Event handler for the large button being clicked. */ virtual void onButtonClicked(void) throw (); + /** + * Event handler for the close button being clicked + * (overrides WhiteWindow::onCloseButtonClicked()). + */ + virtual void + onCloseButtonClicked(void) throw (); + public: /** diff --git a/livesupport/modules/widgets/src/WhiteWindow.cxx b/livesupport/modules/widgets/src/WhiteWindow.cxx index f526db793..632222712 100644 --- a/livesupport/modules/widgets/src/WhiteWindow.cxx +++ b/livesupport/modules/widgets/src/WhiteWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.18 $ + Version : $Revision: 1.19 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WhiteWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -146,12 +146,13 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor, padding = (padding == 0) ? 5 : 0; maximizeButton->signal_clicked().connect(sigc::mem_fun(*this, &WhiteWindow::onMaximizeButtonClicked)); - } - minimizeButton = Gtk::manage(wf->createButton( + + minimizeButton = Gtk::manage(wf->createButton( WidgetFactory::windowMinimizeButton)); - cornerButtonBox->pack_end(*minimizeButton, Gtk::PACK_SHRINK, padding); - minimizeButton->signal_clicked().connect(sigc::mem_fun(*this, + cornerButtonBox->pack_end(*minimizeButton, Gtk::PACK_SHRINK, padding); + minimizeButton->signal_clicked().connect(sigc::mem_fun(*this, &WhiteWindow::onMinimizeButtonClicked)); + } cornerButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER,