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
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.11 $
|
Version : $Revision: 1.12 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -46,6 +46,7 @@
|
||||||
#include <gtkmm/eventbox.h>
|
#include <gtkmm/eventbox.h>
|
||||||
#include <gtkmm/image.h>
|
#include <gtkmm/image.h>
|
||||||
#include <gtkmm/window.h>
|
#include <gtkmm/window.h>
|
||||||
|
#include <gtkmm/buttonbox.h>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Widgets/CornerImages.h"
|
#include "LiveSupport/Widgets/CornerImages.h"
|
||||||
|
@ -92,8 +93,8 @@ using namespace LiveSupport::Core;
|
||||||
* }
|
* }
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.11 $
|
* @version $Revision: 1.12 $
|
||||||
* @see WidgetFactory
|
* @see WidgetFactory
|
||||||
* @see WidgetFactory#getWhiteWindowCorners
|
* @see WidgetFactory#getWhiteWindowCorners
|
||||||
*/
|
*/
|
||||||
|
@ -136,9 +137,20 @@ class WhiteWindow : public Gtk::Window
|
||||||
Gtk::Label * titleLabel;
|
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.
|
* The close button.
|
||||||
|
@ -174,6 +186,23 @@ class WhiteWindow : public Gtk::Window
|
||||||
bool
|
bool
|
||||||
onTitleClicked(GdkEventButton * event) throw ();
|
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.
|
* Signal handler for the close button clicked.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
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 $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -92,7 +92,7 @@ class ZebraTreeView;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.22 $
|
* @version $Revision: 1.23 $
|
||||||
*/
|
*/
|
||||||
class WidgetFactory :
|
class WidgetFactory :
|
||||||
virtual public Configurable
|
virtual public Configurable
|
||||||
|
@ -110,7 +110,9 @@ class WidgetFactory :
|
||||||
smallPlayButton, smallPauseButton, smallStopButton,
|
smallPlayButton, smallPauseButton, smallStopButton,
|
||||||
hugePlayButton,
|
hugePlayButton,
|
||||||
cuePlayButton, cueStopButton,
|
cuePlayButton, cueStopButton,
|
||||||
masterPlayButton, masterPauseButton, masterStopButton }
|
masterPlayButton, masterPauseButton, masterStopButton,
|
||||||
|
windowMinimizeButton, windowMaximizeButton,
|
||||||
|
windowCloseButton }
|
||||||
ImageButtonType;
|
ImageButtonType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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/src/WhiteWindow.cxx,v $
|
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,
|
Ptr<CornerImages>::Ref cornerImages,
|
||||||
bool resizable)
|
bool resizable)
|
||||||
throw ()
|
throw ()
|
||||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL)
|
: Gtk::Window(Gtk::WINDOW_TOPLEVEL),
|
||||||
|
isMaximized(false)
|
||||||
{
|
{
|
||||||
// do the image title-specific stuff
|
// do the image title-specific stuff
|
||||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||||
|
@ -80,11 +81,13 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
|
||||||
Ptr<CornerImages>::Ref cornerImages,
|
Ptr<CornerImages>::Ref cornerImages,
|
||||||
bool resizable)
|
bool resizable)
|
||||||
throw ()
|
throw ()
|
||||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL)
|
: Gtk::Window(Gtk::WINDOW_TOPLEVEL),
|
||||||
|
isMaximized(false)
|
||||||
{
|
{
|
||||||
// do the text title-specific stuff
|
// do the text title-specific stuff
|
||||||
titleLabel = Gtk::manage(new Gtk::Label(title));
|
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 = Gtk::manage(new Gtk::EventBox());
|
||||||
titleEventBox->add(*titleLabel);
|
titleEventBox->add(*titleLabel);
|
||||||
|
|
||||||
|
@ -121,13 +124,30 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
|
||||||
titleAlignment->add(*titleEventBox);
|
titleAlignment->add(*titleEventBox);
|
||||||
layout->attach(*titleAlignment, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
layout->attach(*titleAlignment, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
||||||
|
|
||||||
// create the close button
|
// create the minimize, maximize and close buttons
|
||||||
closeButton = Gtk::manage(wf->createButton(WidgetFactory::deleteButton));
|
minimizeButton = Gtk::manage(wf->createButton(
|
||||||
closeButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
|
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,
|
Gtk::ALIGN_CENTER,
|
||||||
0, 0));
|
0, 0));
|
||||||
closeButtonAlignment->add(*closeButton);
|
cornerButtonAlignment->add(*cornerButtonBox);
|
||||||
layout->attach(*closeButtonAlignment, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
layout->attach(*cornerButtonAlignment, 1, 2, 0, 1,
|
||||||
|
Gtk::FILL, Gtk::SHRINK);
|
||||||
|
|
||||||
// add the child container
|
// add the child container
|
||||||
childContainer = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_CENTER));
|
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,
|
titleEventBox->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,
|
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
&WhiteWindow::onCloseButtonClicked));
|
&WhiteWindow::onCloseButtonClicked));
|
||||||
|
|
||||||
if (resizable) {
|
if (resizable) {
|
||||||
|
maximizeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&WhiteWindow::onMaximizeButtonClicked));
|
||||||
resizeEventBox->add_events(Gdk::BUTTON_PRESS_MASK);
|
resizeEventBox->add_events(Gdk::BUTTON_PRESS_MASK);
|
||||||
resizeEventBox->signal_button_press_event().connect(sigc::mem_fun(*this,
|
resizeEventBox->signal_button_press_event().connect(sigc::mem_fun(*this,
|
||||||
&WhiteWindow::onResizeClicked));
|
&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.
|
* Event handler for the close button getting clicked.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -343,8 +393,11 @@ WhiteWindow :: onCloseButtonClicked (void) throw ()
|
||||||
void
|
void
|
||||||
WhiteWindow :: set_title(const Glib::ustring & title) throw ()
|
WhiteWindow :: set_title(const Glib::ustring & title) throw ()
|
||||||
{
|
{
|
||||||
|
Gtk::Window::set_title(title);
|
||||||
|
if (titleLabel) {
|
||||||
titleLabel->set_label(title);
|
titleLabel->set_label(title);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
@ -353,7 +406,7 @@ WhiteWindow :: set_title(const Glib::ustring & title) throw ()
|
||||||
Glib::ustring
|
Glib::ustring
|
||||||
WhiteWindow :: get_title(void) const throw ()
|
WhiteWindow :: get_title(void) const throw ()
|
||||||
{
|
{
|
||||||
return titleLabel->get_label();
|
return titleLabel ? titleLabel->get_label() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
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 $
|
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
|
static const std::string schedulerWindowTitleImageName
|
||||||
= "titleImages/schedulerWindowTitle.png";
|
= "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 */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -508,6 +544,21 @@ WidgetFactory :: createButton(ImageButtonType type) throw ()
|
||||||
rollImage = loadImage(masterStopButtonRollName);
|
rollImage = loadImage(masterStopButtonRollName);
|
||||||
break;
|
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:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -530,7 +581,6 @@ WidgetFactory :: createImage(ImageType imageName) throw ()
|
||||||
rawImage = loadImage(resizeImageName);
|
rawImage = loadImage(resizeImageName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case scratchpadWindowTitleImage:
|
case scratchpadWindowTitleImage:
|
||||||
rawImage = loadImage(scratchpadWindowTitleImageName);
|
rawImage = loadImage(scratchpadWindowTitleImageName);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue