added minimize and maximize buttons to WhiteWindow class
This commit is contained in:
parent
272062ed16
commit
7885cd91da
4 changed files with 159 additions and 25 deletions
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.11 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.12 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -46,6 +46,7 @@
|
|||
#include <gtkmm/eventbox.h>
|
||||
#include <gtkmm/image.h>
|
||||
#include <gtkmm/window.h>
|
||||
#include <gtkmm/buttonbox.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/CornerImages.h"
|
||||
|
@ -92,8 +93,8 @@ using namespace LiveSupport::Core;
|
|||
* }
|
||||
* </code></pre>
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.11 $
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.12 $
|
||||
* @see WidgetFactory
|
||||
* @see WidgetFactory#getWhiteWindowCorners
|
||||
*/
|
||||
|
@ -136,9 +137,20 @@ class WhiteWindow : public Gtk::Window
|
|||
Gtk::Label * titleLabel;
|
||||
|
||||
/**
|
||||
* The right alignment contaner for the close button.
|
||||
* The right alignment contaner for the minimize, maximize and
|
||||
* close buttons.
|
||||
*/
|
||||
Gtk::Alignment * closeButtonAlignment;
|
||||
Gtk::Alignment * cornerButtonAlignment;
|
||||
|
||||
/**
|
||||
* The close button.
|
||||
*/
|
||||
ImageButton * minimizeButton;
|
||||
|
||||
/**
|
||||
* The close button.
|
||||
*/
|
||||
ImageButton * maximizeButton;
|
||||
|
||||
/**
|
||||
* The close button.
|
||||
|
@ -174,6 +186,23 @@ class WhiteWindow : public Gtk::Window
|
|||
bool
|
||||
onTitleClicked(GdkEventButton * event) throw ();
|
||||
|
||||
/**
|
||||
* True if the window has been minimized.
|
||||
*/
|
||||
bool isMaximized;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.22 $
|
||||
Version : $Revision: 1.23 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -92,7 +92,7 @@ class ZebraTreeView;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.22 $
|
||||
* @version $Revision: 1.23 $
|
||||
*/
|
||||
class WidgetFactory :
|
||||
virtual public Configurable
|
||||
|
@ -110,7 +110,9 @@ class WidgetFactory :
|
|||
smallPlayButton, smallPauseButton, smallStopButton,
|
||||
hugePlayButton,
|
||||
cuePlayButton, cueStopButton,
|
||||
masterPlayButton, masterPauseButton, masterStopButton }
|
||||
masterPlayButton, masterPauseButton, masterStopButton,
|
||||
windowMinimizeButton, windowMaximizeButton,
|
||||
windowCloseButton }
|
||||
ImageButtonType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.14 $
|
||||
Version : $Revision: 1.15 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WhiteWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -60,7 +60,8 @@ WhiteWindow :: WhiteWindow(WidgetFactory::ImageType title,
|
|||
Ptr<CornerImages>::Ref cornerImages,
|
||||
bool resizable)
|
||||
throw ()
|
||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL)
|
||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL),
|
||||
isMaximized(false)
|
||||
{
|
||||
// do the image title-specific stuff
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
|
@ -80,11 +81,13 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
|
|||
Ptr<CornerImages>::Ref cornerImages,
|
||||
bool resizable)
|
||||
throw ()
|
||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL)
|
||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL),
|
||||
isMaximized(false)
|
||||
{
|
||||
// do the text title-specific stuff
|
||||
titleLabel = Gtk::manage(new Gtk::Label(title));
|
||||
titleLabel->modify_font(Pango::FontDescription("Bitstream Vera 10"));
|
||||
titleLabel->modify_font(Pango::FontDescription(
|
||||
"Bitstream Vera Sans 10"));
|
||||
titleEventBox = Gtk::manage(new Gtk::EventBox());
|
||||
titleEventBox->add(*titleLabel);
|
||||
|
||||
|
@ -121,13 +124,30 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
|
|||
titleAlignment->add(*titleEventBox);
|
||||
layout->attach(*titleAlignment, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
||||
|
||||
// create the close button
|
||||
closeButton = Gtk::manage(wf->createButton(WidgetFactory::deleteButton));
|
||||
closeButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
|
||||
// create the minimize, maximize and close buttons
|
||||
minimizeButton = Gtk::manage(wf->createButton(
|
||||
WidgetFactory::windowMinimizeButton));
|
||||
if (resizable) {
|
||||
maximizeButton = Gtk::manage(wf->createButton(
|
||||
WidgetFactory::windowMaximizeButton));
|
||||
}
|
||||
closeButton = Gtk::manage(wf->createButton(
|
||||
WidgetFactory::windowCloseButton));
|
||||
Gtk::Box * cornerButtonBox = Gtk::manage(new Gtk::HBox);
|
||||
if (resizable) {
|
||||
cornerButtonBox->pack_start(*minimizeButton, Gtk::PACK_SHRINK, 5);
|
||||
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,
|
||||
Gtk::ALIGN_CENTER,
|
||||
0, 0));
|
||||
closeButtonAlignment->add(*closeButton);
|
||||
layout->attach(*closeButtonAlignment, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
||||
cornerButtonAlignment->add(*cornerButtonBox);
|
||||
layout->attach(*cornerButtonAlignment, 1, 2, 0, 1,
|
||||
Gtk::FILL, Gtk::SHRINK);
|
||||
|
||||
// add the child container
|
||||
childContainer = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_CENTER));
|
||||
|
@ -159,10 +179,14 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
|
|||
titleEventBox->signal_button_press_event().connect(sigc::mem_fun(*this,
|
||||
&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));
|
||||
|
@ -327,6 +351,32 @@ WhiteWindow :: onTitleClicked(GdkEventButton * event) throw ()
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the close button getting clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: onMinimizeButtonClicked (void) throw ()
|
||||
{
|
||||
iconify();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the maximize button getting clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: onMaximizeButtonClicked (void) throw ()
|
||||
{
|
||||
if (isMaximized) {
|
||||
unmaximize();
|
||||
isMaximized = false;
|
||||
} else {
|
||||
maximize();
|
||||
isMaximized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the close button getting clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -343,8 +393,11 @@ WhiteWindow :: onCloseButtonClicked (void) throw ()
|
|||
void
|
||||
WhiteWindow :: set_title(const Glib::ustring & title) throw ()
|
||||
{
|
||||
Gtk::Window::set_title(title);
|
||||
if (titleLabel) {
|
||||
titleLabel->set_label(title);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
@ -353,7 +406,7 @@ WhiteWindow :: set_title(const Glib::ustring & title) throw ()
|
|||
Glib::ustring
|
||||
WhiteWindow :: get_title(void) const throw ()
|
||||
{
|
||||
return titleLabel->get_label();
|
||||
return titleLabel ? titleLabel->get_label() : "";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.24 $
|
||||
Version : $Revision: 1.25 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -274,6 +274,42 @@ static const std::string playlistsWindowTitleImageName
|
|||
static const std::string schedulerWindowTitleImageName
|
||||
= "titleImages/schedulerWindowTitle.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the minimize window button.
|
||||
*/
|
||||
static const std::string windowMinimizeButtonPassiveName
|
||||
= "imageButton/windowMin.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the minimize window button.
|
||||
*/
|
||||
static const std::string windowMinimizeButtonRollName
|
||||
= "imageButton/windowMinRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the maximize window button.
|
||||
*/
|
||||
static const std::string windowMaximizeButtonPassiveName
|
||||
= "imageButton/windowMax.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the maximize window button.
|
||||
*/
|
||||
static const std::string windowMaximizeButtonRollName
|
||||
= "imageButton/windowMaxRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the close window button.
|
||||
*/
|
||||
static const std::string windowCloseButtonPassiveName
|
||||
= "imageButton/windowClose.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the close window button.
|
||||
*/
|
||||
static const std::string windowCloseButtonRollName
|
||||
= "imageButton/windowCloseRoll.png";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
@ -508,6 +544,21 @@ WidgetFactory :: createButton(ImageButtonType type) throw ()
|
|||
rollImage = loadImage(masterStopButtonRollName);
|
||||
break;
|
||||
|
||||
case windowMinimizeButton:
|
||||
passiveImage = loadImage(windowMinimizeButtonPassiveName);
|
||||
rollImage = loadImage(windowMinimizeButtonRollName);
|
||||
break;
|
||||
|
||||
case windowMaximizeButton:
|
||||
passiveImage = loadImage(windowMaximizeButtonPassiveName);
|
||||
rollImage = loadImage(windowMaximizeButtonRollName);
|
||||
break;
|
||||
|
||||
case windowCloseButton:
|
||||
passiveImage = loadImage(windowCloseButtonPassiveName);
|
||||
rollImage = loadImage(windowCloseButtonRollName);
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -530,7 +581,6 @@ WidgetFactory :: createImage(ImageType imageName) throw ()
|
|||
rawImage = loadImage(resizeImageName);
|
||||
break;
|
||||
|
||||
|
||||
case scratchpadWindowTitleImage:
|
||||
rawImage = loadImage(scratchpadWindowTitleImageName);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue