minor adjustments to WhiteWindow, DialogWindow and TestWindow

This commit is contained in:
fgerlits 2005-06-29 20:11:18 +00:00
parent 1ffef04932
commit 5ec6a76d74
5 changed files with 85 additions and 72 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -94,7 +94,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.15 $ * @version $Revision: 1.16 $
* @see WidgetFactory * @see WidgetFactory
* @see WidgetFactory#getWhiteWindowCorners * @see WidgetFactory#getWhiteWindowCorners
*/ */
@ -182,42 +182,6 @@ class WhiteWindow : public Gtk::Window
*/ */
Gtk::Alignment * childContainer; 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. * Default constructor.
*/ */
@ -330,6 +294,42 @@ class WhiteWindow : public Gtk::Window
int properties) int properties)
throw (); 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: public:
/** /**

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/DialogWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -121,7 +121,7 @@ DialogWindow :: DialogWindow (Ptr<Glib::ustring>::Ref message,
} }
set_default_size(100*buttonCount + 50, 120); 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); add(*layout);
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -76,11 +76,11 @@ TestWindow :: TestWindow (void)
cuePlayImageButton = Gtk::manage( cuePlayImageButton = Gtk::manage(
widgetFactory->createButton(WidgetFactory::cuePlayButton)); widgetFactory->createButton(WidgetFactory::cuePlayButton));
cuePlayImageButton->signal_clicked().connect(sigc::mem_fun(*this, cuePlayImageButton->signal_clicked().connect(sigc::mem_fun(*this,
&TestWindow::onPlayButtonPressed)); &TestWindow::onPlayButtonClicked));
cueStopImageButton = Gtk::manage( cueStopImageButton = Gtk::manage(
widgetFactory->createButton(WidgetFactory::cueStopButton)); widgetFactory->createButton(WidgetFactory::cueStopButton));
cueStopImageButton->signal_clicked().connect(sigc::mem_fun(*this, cueStopImageButton->signal_clicked().connect(sigc::mem_fun(*this,
&TestWindow::onStopButtonPressed)); &TestWindow::onStopButtonClicked));
// create a button // create a button
button = Gtk::manage(widgetFactory->createButton("Hello, World!")); button = Gtk::manage(widgetFactory->createButton("Hello, World!"));
@ -139,7 +139,6 @@ TestWindow :: TestWindow (void)
Ptr<Glib::ustring>::Ref confirmationMessage(new Glib::ustring( Ptr<Glib::ustring>::Ref confirmationMessage(new Glib::ustring(
"Are you sure?" )); "Are you sure?" ));
dialogWindow = new DialogWindow(confirmationMessage, dialogWindow = new DialogWindow(confirmationMessage,
DialogWindow::cancelButton |
DialogWindow::noButton | DialogWindow::noButton |
DialogWindow::yesButton, DialogWindow::yesButton,
resourceBundle); 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 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(); cuePlayImageButton->hide();
cueStopImageButton->show(); 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 void
TestWindow :: onStopButtonPressed(void) throw () TestWindow :: onStopButtonClicked(void) throw ()
{ {
cueStopImageButton->hide(); cueStopImageButton->hide();
cuePlayImageButton->show(); 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;
}
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ 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. * A window, enabling interactive testing of UI components.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.11 $ * @version $Revision: 1.12 $
*/ */
class TestWindow : public WhiteWindow class TestWindow : public WhiteWindow
{ {
@ -82,13 +82,13 @@ class TestWindow : public WhiteWindow
* Change the image from "play" to "stop" on the button when pressed. * Change the image from "play" to "stop" on the button when pressed.
*/ */
void void
onPlayButtonPressed(void) throw (); onPlayButtonClicked(void) throw ();
/** /**
* Change the image from "stop" to "play" on the button when pressed. * Change the image from "stop" to "play" on the button when pressed.
*/ */
void void
onStopButtonPressed(void) throw (); onStopButtonClicked(void) throw ();
/** /**
* The "are you sure?" dialog window. * The "are you sure?" dialog window.
@ -148,11 +148,18 @@ class TestWindow : public WhiteWindow
BlueBin * blueBin; BlueBin * blueBin;
/** /**
* Event handler for the button being clicked. * Event handler for the large button being clicked.
*/ */
virtual void virtual void
onButtonClicked(void) throw (); onButtonClicked(void) throw ();
/**
* Event handler for the close button being clicked
* (overrides WhiteWindow::onCloseButtonClicked()).
*/
virtual void
onCloseButtonClicked(void) throw ();
public: public:
/** /**

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ 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 $ 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; padding = (padding == 0) ? 5 : 0;
maximizeButton->signal_clicked().connect(sigc::mem_fun(*this, maximizeButton->signal_clicked().connect(sigc::mem_fun(*this,
&WhiteWindow::onMaximizeButtonClicked)); &WhiteWindow::onMaximizeButtonClicked));
}
minimizeButton = Gtk::manage(wf->createButton( minimizeButton = Gtk::manage(wf->createButton(
WidgetFactory::windowMinimizeButton)); WidgetFactory::windowMinimizeButton));
cornerButtonBox->pack_end(*minimizeButton, Gtk::PACK_SHRINK, padding); cornerButtonBox->pack_end(*minimizeButton, Gtk::PACK_SHRINK, padding);
minimizeButton->signal_clicked().connect(sigc::mem_fun(*this, minimizeButton->signal_clicked().connect(sigc::mem_fun(*this,
&WhiteWindow::onMinimizeButtonClicked)); &WhiteWindow::onMinimizeButtonClicked));
}
cornerButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT, cornerButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER,