added new property flags to WhiteWindow constructor (isModal = modal, and no close button, isBornHidden = do not call show_all())

This commit is contained in:
fgerlits 2005-06-29 15:53:08 +00:00
parent dcb053cacc
commit feed3d69e9
5 changed files with 61 additions and 53 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.14 $ Version : $Revision: 1.15 $
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.14 $ * @version $Revision: 1.15 $
* @see WidgetFactory * @see WidgetFactory
* @see WidgetFactory#getWhiteWindowCorners * @see WidgetFactory#getWhiteWindowCorners
*/ */
@ -322,12 +322,12 @@ class WhiteWindow : public Gtk::Window
* *
* @param backgroundColor the background color. * @param backgroundColor the background color.
* @param cornerImages the corner images. * @param cornerImages the corner images.
* @param resizable true if the user can resize the window. * @param properties some WindowProperties flags
*/ */
void void
constructWindow(Colors::ColorName backgroundColor, constructWindow(Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
bool resizable = true) int properties)
throw (); throw ();
@ -338,12 +338,12 @@ class WhiteWindow : public Gtk::Window
* @param title the title of the window. * @param title the title of the window.
* @param backgroundColor the background color. * @param backgroundColor the background color.
* @param cornerImages the corner images. * @param cornerImages the corner images.
* @param resizable true if the user can resize the window. * @param properties some WindowProperties flags
*/ */
WhiteWindow(WidgetFactory::ImageType title, WhiteWindow(WidgetFactory::ImageType title,
Colors::ColorName backgroundColor, Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
bool resizable = true) int properties = isResizable)
throw (); throw ();
/** /**
@ -352,12 +352,12 @@ class WhiteWindow : public Gtk::Window
* @param title the title of the window. * @param title the title of the window.
* @param backgroundColor the background color. * @param backgroundColor the background color.
* @param cornerImages the corner images. * @param cornerImages the corner images.
* @param resizable true if the user can resize the window. * @param properties some WindowProperties flags
*/ */
WhiteWindow(Glib::ustring title, WhiteWindow(Glib::ustring title,
Colors::ColorName backgroundColor, Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
bool resizable = true) int properties = isResizable)
throw (); throw ();
/** /**
@ -391,6 +391,14 @@ class WhiteWindow : public Gtk::Window
void void
set_default_size(int width, set_default_size(int width,
int height) throw (); int height) throw ();
/**
* Properties the WhiteWindow can have. This is passed as the
* properties parameter to the constructors.
*/
typedef enum { isResizable = 1,
isModal = 2,
isBornHidden = 4 } WindowProperties;
}; };

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -64,10 +64,9 @@ DialogWindow :: DialogWindow (Ptr<Glib::ustring>::Ref message,
: WhiteWindow("", : WhiteWindow("",
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners(), WidgetFactory::getInstance()->getWhiteWindowCorners(),
false), WhiteWindow::isModal | WhiteWindow::isBornHidden),
LocalizedObject(bundle) LocalizedObject(bundle)
{ {
hide();
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
layout = Gtk::manage(new Gtk::VBox()); layout = Gtk::manage(new Gtk::VBox());
@ -122,7 +121,6 @@ DialogWindow :: DialogWindow (Ptr<Glib::ustring>::Ref message,
} }
set_default_size(100*buttonCount + 50, 120); set_default_size(100*buttonCount + 50, 120);
set_modal(true);
property_window_position().set_value(Gtk::WIN_POS_NONE); property_window_position().set_value(Gtk::WIN_POS_NONE);
add(*layout); add(*layout);

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/MessageWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/MessageWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -59,7 +59,7 @@ MessageWindow :: MessageWindow (Ptr<Glib::ustring>::Ref message)
: WhiteWindow(*message, : WhiteWindow(*message,
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners(), WidgetFactory::getInstance()->getWhiteWindowCorners(),
false) 0)
{ {
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.17 $ Version : $Revision: 1.18 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -58,7 +58,7 @@ using namespace LiveSupport::Widgets;
WhiteWindow :: WhiteWindow(WidgetFactory::ImageType title, WhiteWindow :: WhiteWindow(WidgetFactory::ImageType title,
Colors::ColorName backgroundColor, Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
bool resizable) int properties)
throw () throw ()
: Gtk::Window(Gtk::WINDOW_TOPLEVEL), : Gtk::Window(Gtk::WINDOW_TOPLEVEL),
isMaximized(false) isMaximized(false)
@ -70,7 +70,7 @@ WhiteWindow :: WhiteWindow(WidgetFactory::ImageType title,
titleBox = Gtk::manage(new Gtk::HBox()); titleBox = Gtk::manage(new Gtk::HBox());
titleBox->add(*titleImage); titleBox->add(*titleImage);
constructWindow(backgroundColor, cornerImages, resizable); constructWindow(backgroundColor, cornerImages, properties);
} }
@ -80,7 +80,7 @@ WhiteWindow :: WhiteWindow(WidgetFactory::ImageType title,
WhiteWindow :: WhiteWindow(Glib::ustring title, WhiteWindow :: WhiteWindow(Glib::ustring title,
Colors::ColorName backgroundColor, Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
bool resizable) int properties)
throw () throw ()
: Gtk::Window(Gtk::WINDOW_TOPLEVEL), : Gtk::Window(Gtk::WINDOW_TOPLEVEL),
isMaximized(false) isMaximized(false)
@ -93,7 +93,7 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
titleBox = Gtk::manage(new Gtk::HBox()); titleBox = Gtk::manage(new Gtk::HBox());
titleBox->add(*titleLabel); titleBox->add(*titleLabel);
constructWindow(backgroundColor, cornerImages, resizable); constructWindow(backgroundColor, cornerImages, properties);
} }
@ -103,13 +103,14 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
void void
WhiteWindow :: constructWindow(Colors::ColorName backgroundColor, WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
bool resizable) int properties)
throw () throw ()
{ {
set_decorated(false); set_decorated(false);
defaultWidth = -1; defaultWidth = -1;
defaultHeight = -1; defaultHeight = -1;
set_resizable(resizable); set_resizable(properties & isResizable);
set_modal(properties & isModal);
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
@ -127,23 +128,31 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
layout->attach(*titleAlignment, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK); layout->attach(*titleAlignment, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
// create the minimize, maximize and close buttons // create the minimize, maximize and close buttons
minimizeButton = Gtk::manage(wf->createButton( Gtk::Box * cornerButtonBox = Gtk::manage(new Gtk::HBox);
WidgetFactory::windowMinimizeButton));
if (resizable) { int padding = 5;
if (!(properties & isModal)) {
closeButton = Gtk::manage(wf->createButton(
WidgetFactory::windowCloseButton));
cornerButtonBox->pack_end(*closeButton, Gtk::PACK_SHRINK, padding);
padding = 0;
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&WhiteWindow::onCloseButtonClicked));
}
if (properties & isResizable) {
maximizeButton = Gtk::manage(wf->createButton( maximizeButton = Gtk::manage(wf->createButton(
WidgetFactory::windowMaximizeButton)); WidgetFactory::windowMaximizeButton));
cornerButtonBox->pack_end(*maximizeButton, Gtk::PACK_SHRINK, padding);
padding = (padding == 0) ? 5 : 0;
maximizeButton->signal_clicked().connect(sigc::mem_fun(*this,
&WhiteWindow::onMaximizeButtonClicked));
} }
closeButton = Gtk::manage(wf->createButton( minimizeButton = Gtk::manage(wf->createButton(
WidgetFactory::windowCloseButton)); WidgetFactory::windowMinimizeButton));
Gtk::Box * cornerButtonBox = Gtk::manage(new Gtk::HBox); cornerButtonBox->pack_end(*minimizeButton, Gtk::PACK_SHRINK, padding);
if (resizable) { minimizeButton->signal_clicked().connect(sigc::mem_fun(*this,
cornerButtonBox->pack_start(*minimizeButton, Gtk::PACK_SHRINK, 5); &WhiteWindow::onMinimizeButtonClicked));
cornerButtonBox->pack_start(*maximizeButton, Gtk::PACK_SHRINK, 0);
cornerButtonBox->pack_start(*closeButton, Gtk::PACK_SHRINK, 5);
} else {
cornerButtonBox->pack_start(*minimizeButton, Gtk::PACK_SHRINK, 0);
cornerButtonBox->pack_start(*closeButton, Gtk::PACK_SHRINK, 5);
}
cornerButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT, cornerButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER,
0, 0)); 0, 0));
@ -156,7 +165,7 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
layout->attach(*childContainer, 0, 2, 1, 2); layout->attach(*childContainer, 0, 2, 1, 2);
// create the resize image // create the resize image
if (resizable) { if (properties & isResizable) {
resizeImage = Gtk::manage(wf->createImage(WidgetFactory::resizeImage)); resizeImage = Gtk::manage(wf->createImage(WidgetFactory::resizeImage));
resizeEventBox = Gtk::manage(new Gtk::EventBox()); resizeEventBox = Gtk::manage(new Gtk::EventBox());
resizeEventBox->modify_bg(Gtk::STATE_NORMAL, bgColor); resizeEventBox->modify_bg(Gtk::STATE_NORMAL, bgColor);
@ -166,6 +175,10 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
0, 0)); 0, 0));
resizeAlignment->add(*resizeEventBox); resizeAlignment->add(*resizeEventBox);
layout->attach(*resizeAlignment, 1, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); layout->attach(*resizeAlignment, 1, 2, 2, 3, Gtk::FILL, Gtk::SHRINK);
resizeEventBox->add_events(Gdk::BUTTON_PRESS_MASK);
resizeEventBox->signal_button_press_event().connect(sigc::mem_fun(*this,
&WhiteWindow::onResizeClicked));
} }
// add the corners // add the corners
@ -174,25 +187,14 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
Gtk::Window::add(*blueBin); Gtk::Window::add(*blueBin);
// show all // show all
show_all(); if (!(properties & isBornHidden)) {
show_all();
}
// register signal handlers // register signal handlers
this->add_events(Gdk::BUTTON_PRESS_MASK); this->add_events(Gdk::BUTTON_PRESS_MASK);
this->signal_button_press_event().connect(sigc::mem_fun(*this, this->signal_button_press_event().connect(sigc::mem_fun(*this,
&WhiteWindow::onTitleClicked)); &WhiteWindow::onTitleClicked));
minimizeButton->signal_clicked().connect(sigc::mem_fun(*this,
&WhiteWindow::onMinimizeButtonClicked));
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&WhiteWindow::onCloseButtonClicked));
if (resizable) {
maximizeButton->signal_clicked().connect(sigc::mem_fun(*this,
&WhiteWindow::onMaximizeButtonClicked));
resizeEventBox->add_events(Gdk::BUTTON_PRESS_MASK);
resizeEventBox->signal_button_press_event().connect(sigc::mem_fun(*this,
&WhiteWindow::onResizeClicked));
}
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.13 $ Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -66,7 +66,7 @@ LoginWindow :: LoginWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
: WhiteWindow("", : WhiteWindow("",
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners(), WidgetFactory::getInstance()->getWhiteWindowCorners(),
false), 0),
LocalizedObject(bundle) LocalizedObject(bundle)
{ {
this->gLiveSupport = gLiveSupport; this->gLiveSupport = gLiveSupport;