moved the public constants from WidgetFactory to a separate class;

this solves some circular reference isssues
This commit is contained in:
fgerlits 2006-02-10 19:06:14 +00:00
parent 5183197c69
commit ae820b8d59
21 changed files with 192 additions and 112 deletions

View file

@ -48,6 +48,7 @@
#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/WhiteWindow.h" #include "LiveSupport/Widgets/WhiteWindow.h"
#include "LiveSupport/Widgets/Button.h"
namespace LiveSupport { namespace LiveSupport {
namespace Widgets { namespace Widgets {

View file

@ -40,6 +40,7 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <boost/enable_shared_from_this.hpp>
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include <gtkmm/table.h> #include <gtkmm/table.h>
#include <gtkmm/alignment.h> #include <gtkmm/alignment.h>
@ -49,11 +50,11 @@
#include <gtkmm/buttonbox.h> #include <gtkmm/buttonbox.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/WidgetConstants.h"
#include "LiveSupport/Widgets/CornerImages.h" #include "LiveSupport/Widgets/CornerImages.h"
#include "LiveSupport/Widgets/Colors.h" #include "LiveSupport/Widgets/Colors.h"
#include "LiveSupport/Widgets/ImageButton.h" #include "LiveSupport/Widgets/ImageButton.h"
#include "LiveSupport/Widgets/BlueBin.h" #include "LiveSupport/Widgets/BlueBin.h"
#include "LiveSupport/Widgets/WidgetFactory.h"
namespace LiveSupport { namespace LiveSupport {
@ -341,7 +342,7 @@ class WhiteWindow : public Gtk::Window,
* @param cornerImages the corner images. * @param cornerImages the corner images.
* @param properties some WindowProperties flags * @param properties some WindowProperties flags
*/ */
WhiteWindow(WidgetFactory::ImageType title, WhiteWindow(WidgetConstants::ImageType title,
Colors::ColorName backgroundColor, Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
int properties = isResizable) int properties = isResizable)

View file

@ -0,0 +1,105 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author $
Version : $Revision $
Location : $URL $
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_WidgetConstants_h
#define LiveSupport_Widgets_WidgetConstants_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A collection of constants used by the widgets.
*
* Constants which are either used by more than one widget or used by
* the WidgetFactory class are collected here. This way widget headers
* do not need to include each other's or WidgetFactory's header.
*
* @author $Author $
* @version $Revision $
*/
class WidgetConstants
{
public:
/**
* The types of available buttons.
*/
typedef enum { pushButton, tabButton } ButtonType;
/**
* The types of available image buttons.
*/
typedef enum { deleteButton, plusButton, minusButton,
smallPlayButton, smallPauseButton, smallStopButton,
hugePlayButton,
cuePlayButton, cueStopButton,
masterPlayButton, masterPauseButton, masterStopButton,
windowMinimizeButton, windowMaximizeButton,
windowCloseButton }
ImageButtonType;
/**
* The list of available miscellaneous images.
*/
typedef enum { resizeImage,
scratchpadWindowTitleImage,
searchWindowTitleImage,
liveModeWindowTitleImage,
playlistsWindowTitleImage,
schedulerWindowTitleImage,
audioClipIconImage,
playlistIconImage }
ImageType;
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_WidgetConstants_h

View file

@ -46,6 +46,7 @@
#include "LiveSupport/Core/Configurable.h" #include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/MetadataTypeContainer.h" #include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Widgets/WidgetConstants.h"
#include "LiveSupport/Widgets/CornerImages.h" #include "LiveSupport/Widgets/CornerImages.h"
#include "LiveSupport/Widgets/ButtonImages.h" #include "LiveSupport/Widgets/ButtonImages.h"
#include "LiveSupport/Widgets/Button.h" #include "LiveSupport/Widgets/Button.h"
@ -55,6 +56,8 @@
#include "LiveSupport/Widgets/OperatorComboBoxText.h" #include "LiveSupport/Widgets/OperatorComboBoxText.h"
#include "LiveSupport/Widgets/BlueBin.h" #include "LiveSupport/Widgets/BlueBin.h"
#include "LiveSupport/Widgets/EntryBin.h" #include "LiveSupport/Widgets/EntryBin.h"
#include "LiveSupport/Widgets/DialogWindow.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
namespace LiveSupport { namespace LiveSupport {
@ -70,9 +73,6 @@ using namespace LiveSupport::Core;
/* =============================================================== data types */ /* =============================================================== data types */
class WhiteWindow;
class ZebraTreeView;
/** /**
* A factory to provide access to LiveSupport Widgets. * A factory to provide access to LiveSupport Widgets.
* *
@ -97,38 +97,6 @@ class ZebraTreeView;
class WidgetFactory : class WidgetFactory :
virtual public Configurable virtual public Configurable
{ {
public:
/**
* The types of available buttons.
*/
typedef enum { pushButton, tabButton } ButtonType;
/**
* The types of available image buttons.
*/
typedef enum { deleteButton, plusButton, minusButton,
smallPlayButton, smallPauseButton, smallStopButton,
hugePlayButton,
cuePlayButton, cueStopButton,
masterPlayButton, masterPauseButton, masterStopButton,
windowMinimizeButton, windowMaximizeButton,
windowCloseButton }
ImageButtonType;
/**
* The list of available miscellaneous images.
*/
typedef enum { resizeImage,
scratchpadWindowTitleImage,
searchWindowTitleImage,
liveModeWindowTitleImage,
playlistsWindowTitleImage,
schedulerWindowTitleImage,
audioClipIconImage,
playlistIconImage }
ImageType;
private: private:
/** /**
* The name of the configuration XML elmenent used by this object. * The name of the configuration XML elmenent used by this object.
@ -193,7 +161,7 @@ class WidgetFactory :
/** /**
* A container holding the miscallenous image pixbuf references. * A container holding the miscallenous image pixbuf references.
*/ */
std::map<ImageType, Glib::RefPtr<Gdk::Pixbuf> > std::map<WidgetConstants::ImageType, Glib::RefPtr<Gdk::Pixbuf> >
imageTypePixbufs; imageTypePixbufs;
/** /**
@ -268,8 +236,9 @@ class WidgetFactory :
* @return a button with the specified label. * @return a button with the specified label.
*/ */
Button * Button *
createButton(const Glib::ustring & label, createButton(
ButtonType type = pushButton) const Glib::ustring & label,
WidgetConstants::ButtonType type = WidgetConstants::pushButton)
throw (); throw ();
/** /**
@ -281,7 +250,7 @@ class WidgetFactory :
* @return a button of the requested type, or 0 * @return a button of the requested type, or 0
*/ */
ImageButton * ImageButton *
createButton(ImageButtonType type) throw (); createButton(WidgetConstants::ImageButtonType type) throw ();
/** /**
* Create a combo box that holds text entries. * Create a combo box that holds text entries.
@ -366,7 +335,7 @@ class WidgetFactory :
* @return the image. * @return the image.
*/ */
Glib::RefPtr<Gdk::Pixbuf> Glib::RefPtr<Gdk::Pixbuf>
getPixbuf(ImageType imageName) throw (); getPixbuf(WidgetConstants::ImageType imageName) throw ();
/** /**
* Create and return a container holding an image. * Create and return a container holding an image.
@ -376,7 +345,7 @@ class WidgetFactory :
* @return the container holding the requested image. * @return the container holding the requested image.
*/ */
Gtk::Image * Gtk::Image *
createImage(ImageType imageName) throw (); createImage(WidgetConstants::ImageType imageName) throw ();
/** /**
* Create and return a ZebraTreeView instance. * Create and return a ZebraTreeView instance.

View file

@ -50,7 +50,7 @@
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/WidgetFactory.h" #include "LiveSupport/Widgets/WidgetConstants.h"
#include "LiveSupport/Widgets/CornerImages.h" #include "LiveSupport/Widgets/CornerImages.h"
#include "LiveSupport/Widgets/ImageButton.h" #include "LiveSupport/Widgets/ImageButton.h"
#include "LiveSupport/Widgets/BlueBin.h" #include "LiveSupport/Widgets/BlueBin.h"
@ -269,7 +269,7 @@ class ZebraTreeView : public Gtk::TreeView
*/ */
int int
appendColumn(const Glib::ustring& title, appendColumn(const Glib::ustring& title,
WidgetFactory::ImageButtonType buttonType, WidgetConstants::ImageButtonType buttonType,
int minimumWidth = 0) int minimumWidth = 0)
throw (); throw ();

View file

@ -45,6 +45,7 @@
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/Button.h"
#include "LiveSupport/Widgets/WhiteWindow.h" #include "LiveSupport/Widgets/WhiteWindow.h"
namespace LiveSupport { namespace LiveSupport {

View file

@ -58,8 +58,6 @@ using namespace LiveSupport::Widgets;
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Notebook :: Notebook(void) throw () Notebook :: Notebook(void) throw ()
{ {
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
layout = Gtk::manage(new Gtk::VBox()); layout = Gtk::manage(new Gtk::VBox());
tabBox = Gtk::manage(new Gtk::HBox()); tabBox = Gtk::manage(new Gtk::HBox());
pageHolder = Gtk::manage(new Gtk::Alignment()); pageHolder = Gtk::manage(new Gtk::Alignment());
@ -216,7 +214,7 @@ Notebook :: appendPage(Gtk::Widget & widget,
{ {
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
Button * button = wf->createButton(label, Button * button = wf->createButton(label,
WidgetFactory::tabButton); WidgetConstants::tabButton);
Page * page = new Page(this, pageList.size(), &widget, button); Page * page = new Page(this, pageList.size(), &widget, button);
pageList.push_back(page); pageList.push_back(page);

View file

@ -72,13 +72,13 @@ TestWindow :: TestWindow (void)
// init the imageButtons // init the imageButtons
hugeImageButton = Gtk::manage( hugeImageButton = Gtk::manage(
widgetFactory->createButton(WidgetFactory::hugePlayButton)); widgetFactory->createButton(WidgetConstants::hugePlayButton));
cuePlayImageButton = Gtk::manage( cuePlayImageButton = Gtk::manage(
widgetFactory->createButton(WidgetFactory::cuePlayButton)); widgetFactory->createButton(WidgetConstants::cuePlayButton));
cuePlayImageButton->signal_clicked().connect(sigc::mem_fun(*this, cuePlayImageButton->signal_clicked().connect(sigc::mem_fun(*this,
&TestWindow::onPlayButtonClicked)); &TestWindow::onPlayButtonClicked));
cueStopImageButton = Gtk::manage( cueStopImageButton = Gtk::manage(
widgetFactory->createButton(WidgetFactory::cueStopButton)); widgetFactory->createButton(WidgetConstants::cueStopButton));
cueStopImageButton->signal_clicked().connect(sigc::mem_fun(*this, cueStopImageButton->signal_clicked().connect(sigc::mem_fun(*this,
&TestWindow::onStopButtonClicked)); &TestWindow::onStopButtonClicked));

View file

@ -35,6 +35,8 @@
#include <iostream> #include <iostream>
#include "LiveSupport/Widgets/WidgetFactory.h"
#include "LiveSupport/Widgets/WhiteWindow.h" #include "LiveSupport/Widgets/WhiteWindow.h"
@ -55,7 +57,7 @@ using namespace LiveSupport::Widgets;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor for windows with image titles. * Constructor for windows with image titles.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
WhiteWindow :: WhiteWindow(WidgetFactory::ImageType title, WhiteWindow :: WhiteWindow(WidgetConstants::ImageType title,
Colors::ColorName backgroundColor, Colors::ColorName backgroundColor,
Ptr<CornerImages>::Ref cornerImages, Ptr<CornerImages>::Ref cornerImages,
int properties) int properties)
@ -133,7 +135,7 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
int padding = 5; int padding = 5;
if (!(properties & isModal)) { if (!(properties & isModal)) {
closeButton = Gtk::manage(wf->createButton( closeButton = Gtk::manage(wf->createButton(
WidgetFactory::windowCloseButton)); WidgetConstants::windowCloseButton));
cornerButtonBox->pack_end(*closeButton, Gtk::PACK_SHRINK, padding); cornerButtonBox->pack_end(*closeButton, Gtk::PACK_SHRINK, padding);
padding = 0; padding = 0;
closeButton->signal_clicked().connect(sigc::mem_fun(*this, closeButton->signal_clicked().connect(sigc::mem_fun(*this,
@ -141,14 +143,14 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
} }
if (properties & isResizable) { if (properties & isResizable) {
maximizeButton = Gtk::manage(wf->createButton( maximizeButton = Gtk::manage(wf->createButton(
WidgetFactory::windowMaximizeButton)); WidgetConstants::windowMaximizeButton));
cornerButtonBox->pack_end(*maximizeButton, Gtk::PACK_SHRINK, padding); cornerButtonBox->pack_end(*maximizeButton, Gtk::PACK_SHRINK, padding);
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)); WidgetConstants::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));
@ -167,7 +169,7 @@ WhiteWindow :: constructWindow(Colors::ColorName backgroundColor,
// create the resize image // create the resize image
if (properties & isResizable) { if (properties & isResizable) {
resizeImage = Gtk::manage(wf->createImage(WidgetFactory::resizeImage)); resizeImage = Gtk::manage(wf->createImage(WidgetConstants::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);
resizeEventBox->add(*resizeImage); resizeEventBox->add(*resizeImage);

View file

@ -37,7 +37,6 @@
#include <gtkmm/entry.h> #include <gtkmm/entry.h>
#include "LiveSupport/Widgets/Colors.h" #include "LiveSupport/Widgets/Colors.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "MessageWindow.h" #include "MessageWindow.h"
#include "LiveSupport/Widgets/WidgetFactory.h" #include "LiveSupport/Widgets/WidgetFactory.h"
@ -389,20 +388,21 @@ WidgetFactory :: configure(const xmlpp::Element & element)
whiteWindowImages.reset(new CornerImages(path + whiteWindowPath)); whiteWindowImages.reset(new CornerImages(path + whiteWindowPath));
// load the miscellaneous images // load the miscellaneous images
imageTypePixbufs[resizeImage] = loadImage(resizeImageName); imageTypePixbufs[WidgetConstants::resizeImage]
imageTypePixbufs[scratchpadWindowTitleImage] = loadImage(resizeImageName);
imageTypePixbufs[WidgetConstants::scratchpadWindowTitleImage]
= loadImage(scratchpadWindowTitleImageName); = loadImage(scratchpadWindowTitleImageName);
imageTypePixbufs[searchWindowTitleImage] imageTypePixbufs[WidgetConstants::searchWindowTitleImage]
= loadImage(searchWindowTitleImageName); = loadImage(searchWindowTitleImageName);
imageTypePixbufs[liveModeWindowTitleImage] imageTypePixbufs[WidgetConstants::liveModeWindowTitleImage]
= loadImage(liveModeWindowTitleImageName); = loadImage(liveModeWindowTitleImageName);
imageTypePixbufs[playlistsWindowTitleImage] imageTypePixbufs[WidgetConstants::playlistsWindowTitleImage]
= loadImage(playlistsWindowTitleImageName); = loadImage(playlistsWindowTitleImageName);
imageTypePixbufs[schedulerWindowTitleImage] imageTypePixbufs[WidgetConstants::schedulerWindowTitleImage]
= loadImage(schedulerWindowTitleImageName); = loadImage(schedulerWindowTitleImageName);
imageTypePixbufs[audioClipIconImage] imageTypePixbufs[WidgetConstants::audioClipIconImage]
= loadImage(audioClipIconImageName); = loadImage(audioClipIconImageName);
imageTypePixbufs[playlistIconImage] imageTypePixbufs[WidgetConstants::playlistIconImage]
= loadImage(playlistIconImageName); = loadImage(playlistIconImageName);
} }
@ -437,14 +437,14 @@ WidgetFactory :: loadImage(const std::string imageName)
* Create a button * Create a button
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Button * Button *
WidgetFactory :: createButton(const Glib::ustring & label, WidgetFactory :: createButton(const Glib::ustring & label,
ButtonType type) throw () WidgetConstants::ButtonType type) throw ()
{ {
switch (type) { switch (type) {
case pushButton: case WidgetConstants::pushButton:
return new Button(label, buttonImages); return new Button(label, buttonImages);
case tabButton: case WidgetConstants::tabButton:
return new Button(label, tabButtonImages); return new Button(label, tabButtonImages);
default: default:
@ -529,83 +529,84 @@ WidgetFactory :: createEntryBin(void) throw ()
* Create a stock button * Create a stock button
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
ImageButton * ImageButton *
WidgetFactory :: createButton(ImageButtonType type) throw () WidgetFactory :: createButton(WidgetConstants::ImageButtonType type)
throw ()
{ {
Glib::RefPtr<Gdk::Pixbuf> passiveImage; Glib::RefPtr<Gdk::Pixbuf> passiveImage;
Glib::RefPtr<Gdk::Pixbuf> rollImage; Glib::RefPtr<Gdk::Pixbuf> rollImage;
switch (type) { switch (type) {
case deleteButton: case WidgetConstants::deleteButton:
passiveImage = loadImage(deleteButtonPassiveName); passiveImage = loadImage(deleteButtonPassiveName);
rollImage = loadImage(deleteButtonRollName); rollImage = loadImage(deleteButtonRollName);
break; break;
case plusButton: case WidgetConstants::plusButton:
passiveImage = loadImage(plusButtonPassiveName); passiveImage = loadImage(plusButtonPassiveName);
rollImage = loadImage(plusButtonRollName); rollImage = loadImage(plusButtonRollName);
break; break;
case minusButton: case WidgetConstants::minusButton:
passiveImage = loadImage(minusButtonPassiveName); passiveImage = loadImage(minusButtonPassiveName);
rollImage = loadImage(minusButtonRollName); rollImage = loadImage(minusButtonRollName);
break; break;
case smallPlayButton: case WidgetConstants::smallPlayButton:
passiveImage = loadImage(smallPlayButtonPassiveName); passiveImage = loadImage(smallPlayButtonPassiveName);
rollImage = loadImage(smallPlayButtonRollName); rollImage = loadImage(smallPlayButtonRollName);
break; break;
case smallPauseButton: case WidgetConstants::smallPauseButton:
passiveImage = loadImage(smallPauseButtonPassiveName); passiveImage = loadImage(smallPauseButtonPassiveName);
rollImage = loadImage(smallPauseButtonRollName); rollImage = loadImage(smallPauseButtonRollName);
break; break;
case smallStopButton: case WidgetConstants::smallStopButton:
passiveImage = loadImage(smallStopButtonPassiveName); passiveImage = loadImage(smallStopButtonPassiveName);
rollImage = loadImage(smallStopButtonRollName); rollImage = loadImage(smallStopButtonRollName);
break; break;
case hugePlayButton: case WidgetConstants::hugePlayButton:
passiveImage = loadImage(hugePlayButtonPassiveName); passiveImage = loadImage(hugePlayButtonPassiveName);
rollImage = loadImage(hugePlayButtonRollName); rollImage = loadImage(hugePlayButtonRollName);
break; break;
case cuePlayButton: case WidgetConstants::cuePlayButton:
passiveImage = loadImage(cuePlayButtonPassiveName); passiveImage = loadImage(cuePlayButtonPassiveName);
rollImage = loadImage(cuePlayButtonRollName); rollImage = loadImage(cuePlayButtonRollName);
break; break;
case cueStopButton: case WidgetConstants::cueStopButton:
passiveImage = loadImage(cueStopButtonPassiveName); passiveImage = loadImage(cueStopButtonPassiveName);
rollImage = loadImage(cueStopButtonRollName); rollImage = loadImage(cueStopButtonRollName);
break; break;
case masterPlayButton: case WidgetConstants::masterPlayButton:
passiveImage = loadImage(masterPlayButtonPassiveName); passiveImage = loadImage(masterPlayButtonPassiveName);
rollImage = loadImage(masterPlayButtonRollName); rollImage = loadImage(masterPlayButtonRollName);
break; break;
case masterPauseButton: case WidgetConstants::masterPauseButton:
passiveImage = loadImage(masterPauseButtonPassiveName); passiveImage = loadImage(masterPauseButtonPassiveName);
rollImage = loadImage(masterPauseButtonRollName); rollImage = loadImage(masterPauseButtonRollName);
break; break;
case masterStopButton: case WidgetConstants::masterStopButton:
passiveImage = loadImage(masterStopButtonPassiveName); passiveImage = loadImage(masterStopButtonPassiveName);
rollImage = loadImage(masterStopButtonRollName); rollImage = loadImage(masterStopButtonRollName);
break; break;
case windowMinimizeButton: case WidgetConstants::windowMinimizeButton:
passiveImage = loadImage(windowMinimizeButtonPassiveName); passiveImage = loadImage(windowMinimizeButtonPassiveName);
rollImage = loadImage(windowMinimizeButtonRollName); rollImage = loadImage(windowMinimizeButtonRollName);
break; break;
case windowMaximizeButton: case WidgetConstants::windowMaximizeButton:
passiveImage = loadImage(windowMaximizeButtonPassiveName); passiveImage = loadImage(windowMaximizeButtonPassiveName);
rollImage = loadImage(windowMaximizeButtonRollName); rollImage = loadImage(windowMaximizeButtonRollName);
break; break;
case windowCloseButton: case WidgetConstants::windowCloseButton:
passiveImage = loadImage(windowCloseButtonPassiveName); passiveImage = loadImage(windowCloseButtonPassiveName);
rollImage = loadImage(windowCloseButtonRollName); rollImage = loadImage(windowCloseButtonRollName);
break; break;
@ -622,7 +623,7 @@ WidgetFactory :: createButton(ImageButtonType type) throw ()
* Return a Gdk::Pixbuf reference to a named image * Return a Gdk::Pixbuf reference to a named image
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Glib::RefPtr<Gdk::Pixbuf> Glib::RefPtr<Gdk::Pixbuf>
WidgetFactory :: getPixbuf(ImageType imageName) throw () WidgetFactory :: getPixbuf(WidgetConstants::ImageType imageName) throw ()
{ {
return imageTypePixbufs[imageName]; return imageTypePixbufs[imageName];
} }
@ -632,7 +633,7 @@ WidgetFactory :: getPixbuf(ImageType imageName) throw ()
* Create a Gtk::Image * Create a Gtk::Image
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Gtk::Image * Gtk::Image *
WidgetFactory :: createImage(ImageType imageName) throw () WidgetFactory :: createImage(WidgetConstants::ImageType imageName) throw ()
{ {
return new Gtk::Image(getPixbuf(imageName)); return new Gtk::Image(getPixbuf(imageName));
} }

View file

@ -36,6 +36,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include "LiveSupport/Widgets/WidgetFactory.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h" #include "LiveSupport/Widgets/ZebraTreeView.h"
@ -155,7 +156,7 @@ ZebraTreeView :: appendColumn(
int int
ZebraTreeView :: appendColumn( ZebraTreeView :: appendColumn(
const Glib::ustring & title, const Glib::ustring & title,
WidgetFactory::ImageButtonType buttonType, WidgetConstants::ImageButtonType buttonType,
int minimumWidth) int minimumWidth)
throw () throw ()
{ {

View file

@ -89,12 +89,13 @@ AdvancedSearchItem :: AdvancedSearchItem(
pack_start(*valueEntry, Gtk::PACK_EXPAND_WIDGET, 5); pack_start(*valueEntry, Gtk::PACK_EXPAND_WIDGET, 5);
if (isFirst) { if (isFirst) {
plusButton = Gtk::manage(wf->createButton(WidgetFactory::plusButton)); plusButton = Gtk::manage(wf->createButton(WidgetConstants::plusButton));
pack_start(*plusButton, Gtk::PACK_SHRINK, 5); pack_start(*plusButton, Gtk::PACK_SHRINK, 5);
plusButton->signal_clicked().connect(sigc::mem_fun(*this, plusButton->signal_clicked().connect(sigc::mem_fun(*this,
&AdvancedSearchItem::onPlusButtonClicked )); &AdvancedSearchItem::onPlusButtonClicked ));
} else { } else {
closeButton = Gtk::manage(wf->createButton(WidgetFactory::minusButton)); closeButton = Gtk::manage(wf->createButton(
WidgetConstants::minusButton));
closeButton->signal_clicked().connect(sigc::mem_fun(*this, closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&AdvancedSearchItem::destroy_ )); &AdvancedSearchItem::destroy_ ));
pack_start(*closeButton, Gtk::PACK_SHRINK, 5); pack_start(*closeButton, Gtk::PACK_SHRINK, 5);

View file

@ -69,11 +69,11 @@ CuePlayer :: CuePlayer(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
playButton = Gtk::manage(wf->createButton( playButton = Gtk::manage(wf->createButton(
WidgetFactory::smallPlayButton )); WidgetConstants::smallPlayButton ));
pauseButton = Gtk::manage(wf->createButton( pauseButton = Gtk::manage(wf->createButton(
WidgetFactory::smallPauseButton )); WidgetConstants::smallPauseButton ));
stopButton = Gtk::manage(wf->createButton( stopButton = Gtk::manage(wf->createButton(
WidgetFactory::smallStopButton )); WidgetConstants::smallStopButton ));
playButton->signal_clicked().connect(sigc::mem_fun(*this, playButton->signal_clicked().connect(sigc::mem_fun(*this,
&CuePlayer::onPlayButtonClicked )); &CuePlayer::onPlayButtonClicked ));

View file

@ -71,7 +71,7 @@ static const Glib::ustring windowName = "liveModeWindow";
LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport, LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle) Ptr<ResourceBundle>::Ref bundle)
throw () throw ()
: WhiteWindow(WidgetFactory::liveModeWindowTitleImage, : WhiteWindow(WidgetConstants::liveModeWindowTitleImage,
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()), WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle), LocalizedObject(bundle),
@ -98,7 +98,7 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
// Add the TreeView's view columns: // Add the TreeView's view columns:
try { try {
treeView->appendLineNumberColumn("", 2 /* offset */, 50); treeView->appendLineNumberColumn("", 2 /* offset */, 50);
// treeView->appendColumn("", WidgetFactory::hugePlayButton, 82); // treeView->appendColumn("", WidgetConstants::hugePlayButton, 82);
treeView->appendColumn("", modelColumns.infoColumn, 200); treeView->appendColumn("", modelColumns.infoColumn, 200);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
@ -124,7 +124,7 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
// Create the play etc buttons: // Create the play etc buttons:
Gtk::HBox * buttonBox = Gtk::manage(new Gtk::HBox); Gtk::HBox * buttonBox = Gtk::manage(new Gtk::HBox);
ImageButton * outputPlayButton = Gtk::manage(wf->createButton( ImageButton * outputPlayButton = Gtk::manage(wf->createButton(
WidgetFactory::hugePlayButton )); WidgetConstants::hugePlayButton ));
Gtk::VBox * cueAudioBox = Gtk::manage(new Gtk::VBox); Gtk::VBox * cueAudioBox = Gtk::manage(new Gtk::VBox);
Gtk::HBox * cueAudioLabelBox = Gtk::manage(new Gtk::HBox); Gtk::HBox * cueAudioLabelBox = Gtk::manage(new Gtk::HBox);
Gtk::Label * cueAudioLabel; Gtk::Label * cueAudioLabel;

View file

@ -75,7 +75,7 @@ MasterPanelUserInfoWidget :: MasterPanelUserInfoWidget (
logInOutButton->signal_clicked().connect(sigc::mem_fun(*this, logInOutButton->signal_clicked().connect(sigc::mem_fun(*this,
&MasterPanelUserInfoWidget::onLoginButtonClicked)); &MasterPanelUserInfoWidget::onLoginButtonClicked));
closeButton = Gtk::manage(wf->createButton(WidgetFactory::deleteButton)); closeButton = Gtk::manage(wf->createButton(WidgetConstants::deleteButton));
closeButton->signal_clicked().connect(sigc::mem_fun(*this, closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&MasterPanelUserInfoWidget::onCloseButtonClicked)); &MasterPanelUserInfoWidget::onCloseButtonClicked));

View file

@ -74,11 +74,11 @@ NowPlaying :: NowPlaying(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
playButton = Gtk::manage(wf->createButton( playButton = Gtk::manage(wf->createButton(
WidgetFactory::masterPlayButton )); WidgetConstants::masterPlayButton ));
pauseButton = Gtk::manage(wf->createButton( pauseButton = Gtk::manage(wf->createButton(
WidgetFactory::masterPauseButton )); WidgetConstants::masterPauseButton ));
stopButton = Gtk::manage(wf->createButton( stopButton = Gtk::manage(wf->createButton(
WidgetFactory::masterStopButton )); WidgetConstants::masterStopButton ));
playButton->signal_clicked().connect(sigc::mem_fun(*this, playButton->signal_clicked().connect(sigc::mem_fun(*this,
&NowPlaying::onPlayButtonClicked )); &NowPlaying::onPlayButtonClicked ));

View file

@ -66,7 +66,7 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow (
Ptr<ResourceBundle>::Ref bundle, Ptr<ResourceBundle>::Ref bundle,
Ptr<Playlist>::Ref playlist) Ptr<Playlist>::Ref playlist)
throw () throw ()
: WhiteWindow(WidgetFactory::schedulerWindowTitleImage, : WhiteWindow(WidgetConstants::schedulerWindowTitleImage,
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()), WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle), LocalizedObject(bundle),

View file

@ -68,7 +68,7 @@ static const Glib::ustring windowName = "schedulerWindow";
SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport, SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle) Ptr<ResourceBundle>::Ref bundle)
throw () throw ()
: WhiteWindow(WidgetFactory::schedulerWindowTitleImage, : WhiteWindow(WidgetConstants::schedulerWindowTitleImage,
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()), WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle), LocalizedObject(bundle),

View file

@ -70,7 +70,7 @@ static const Glib::ustring windowName = "scratchpadWindow";
ScratchpadWindow :: ScratchpadWindow (Ptr<GLiveSupport>::Ref gLiveSupport, ScratchpadWindow :: ScratchpadWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle) Ptr<ResourceBundle>::Ref bundle)
throw () throw ()
: WhiteWindow(WidgetFactory::scratchpadWindowTitleImage, : WhiteWindow(WidgetConstants::scratchpadWindowTitleImage,
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()), WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle), LocalizedObject(bundle),
@ -575,17 +575,17 @@ ScratchpadWindow :: addItem(Ptr<Playable>::Ref playable)
switch (playable->getType()) { switch (playable->getType()) {
case Playable::AudioClipType: case Playable::AudioClipType:
row[modelColumns.typeColumn] = widgetFactory->getPixbuf( row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::audioClipIconImage); WidgetConstants::audioClipIconImage);
break; break;
case Playable::PlaylistType: case Playable::PlaylistType:
row[modelColumns.typeColumn] = widgetFactory->getPixbuf( row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::playlistIconImage); WidgetConstants::playlistIconImage);
break; break;
} }
row[modelColumns.titleColumn] = Glib::Markup::escape_text( row[modelColumns.titleColumn] = Glib::Markup::escape_text(
*playable->getTitle()); *playable->getTitle());
// cache the item if it hasn't been cached yet // cache the item if it hasn't been cached yet

View file

@ -69,7 +69,7 @@ using namespace LiveSupport::GLiveSupport;
SearchWindow :: SearchWindow (Ptr<GLiveSupport>::Ref gLiveSupport, SearchWindow :: SearchWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle) Ptr<ResourceBundle>::Ref bundle)
throw () throw ()
: WhiteWindow(WidgetFactory::searchWindowTitleImage, : WhiteWindow(WidgetConstants::searchWindowTitleImage,
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()), WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle), LocalizedObject(bundle),
@ -373,11 +373,11 @@ SearchWindow :: onSearch(Ptr<SearchCriteria>::Ref criteria)
switch (playable->getType()) { switch (playable->getType()) {
case Playable::AudioClipType: case Playable::AudioClipType:
row[modelColumns.typeColumn] = widgetFactory->getPixbuf( row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::audioClipIconImage); WidgetConstants::audioClipIconImage);
break; break;
case Playable::PlaylistType: case Playable::PlaylistType:
row[modelColumns.typeColumn] = widgetFactory->getPixbuf( row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::playlistIconImage); WidgetConstants::playlistIconImage);
break; break;
default: default:
break; break;

View file

@ -70,7 +70,7 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
Ptr<GLiveSupport>::Ref gLiveSupport, Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle) Ptr<ResourceBundle>::Ref bundle)
throw () throw ()
: WhiteWindow(WidgetFactory::playlistsWindowTitleImage, : WhiteWindow(WidgetConstants::playlistsWindowTitleImage,
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()), WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle), LocalizedObject(bundle),