decimated the Widgets module
|
@ -136,26 +136,13 @@ LDFLAGS = @LDFLAGS@ -pthread \
|
|||
#-------------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
#-------------------------------------------------------------------------------
|
||||
WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \
|
||||
${TMP_DIR}/Button.o \
|
||||
${TMP_DIR}/BlueBin.o \
|
||||
${TMP_DIR}/EntryBin.o \
|
||||
${TMP_DIR}/WhiteWindow.o \
|
||||
${TMP_DIR}/CornerImages.o \
|
||||
${TMP_DIR}/ButtonImages.o \
|
||||
${TMP_DIR}/ComboBoxText.o \
|
||||
WIDGETS_LIB_OBJS = ${TMP_DIR}/ComboBoxText.o \
|
||||
${TMP_DIR}/MetadataComboBoxText.o \
|
||||
${TMP_DIR}/OperatorComboBoxText.o \
|
||||
${TMP_DIR}/Notebook.o \
|
||||
${TMP_DIR}/WidgetFactory.o \
|
||||
${TMP_DIR}/ZebraTreeView.o \
|
||||
${TMP_DIR}/ZebraCellRenderer.o \
|
||||
${TMP_DIR}/Colors.o \
|
||||
${TMP_DIR}/DialogWindow.o \
|
||||
${TMP_DIR}/ScrolledWindow.o \
|
||||
${TMP_DIR}/ScrolledNotebook.o \
|
||||
${TMP_DIR}/RadioButtons.o \
|
||||
${TMP_DIR}/MasterPanelBin.o \
|
||||
${TMP_DIR}/ZebraTreeView.o \
|
||||
${TMP_DIR}/ZebraCellRenderer.o
|
||||
|
||||
TEST_EXE_OBJS = ${TMP_DIR}/TestWindow.o \
|
||||
${TMP_DIR}/main.o
|
||||
|
@ -204,34 +191,9 @@ install: all
|
|||
${CP} ${INCLUDE_DIR}/LiveSupport/Widgets/*.h \
|
||||
${USR_INCLUDE_DIR}/LiveSupport/Widgets
|
||||
${CP} ${WIDGETS_LIB_FILE} ${USR_LIB_DIR}
|
||||
${MKDIR} ${USR_VAR_DIR}/Campcaster/Widgets
|
||||
${MKDIR} ${USR_VAR_DIR}/Campcaster/Widgets/blueBin \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/button \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/combo \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/darkBlueBin \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/entryBin \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/icons \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/imageButton \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/tabButton \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/whiteWindow
|
||||
${CP} ${VAR_DIR}/blueBin/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/blueBin
|
||||
${CP} ${VAR_DIR}/button/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/button
|
||||
${CP} ${VAR_DIR}/combo/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/combo
|
||||
${CP} ${VAR_DIR}/darkBlueBin/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/darkBlueBin
|
||||
${CP} ${VAR_DIR}/entryBin/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/entryBin
|
||||
${MKDIR} ${USR_VAR_DIR}/Campcaster/Widgets/icons
|
||||
${CP} ${VAR_DIR}/icons/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/icons
|
||||
${CP} ${VAR_DIR}/imageButton/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/imageButton
|
||||
${CP} ${VAR_DIR}/tabButton/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/tabButton
|
||||
${CP} ${VAR_DIR}/whiteWindow/*.png \
|
||||
${USR_VAR_DIR}/Campcaster/Widgets/whiteWindow
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
|
|
@ -37,7 +37,7 @@ AC_PREREQ(2.59)
|
|||
AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL])
|
||||
AC_REVISION($Revision$)
|
||||
|
||||
AC_CONFIG_SRCDIR(../include/LiveSupport/Widgets/ImageButton.h)
|
||||
AC_CONFIG_SRCDIR(../src/ComboBoxText.cxx)
|
||||
|
||||
AC_CONFIG_HEADERS(configure.h)
|
||||
AC_PROG_CXX()
|
||||
|
|
|
@ -1,262 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_BlueBin_h
|
||||
#define LiveSupport_Widgets_BlueBin_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/bin.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/CornerImages.h"
|
||||
#include "LiveSupport/Widgets/CornerBitmaps.h"
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A container holding exactly one child, habing a light blue border to it.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class BlueBin : public Gtk::Bin
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* Flag to indicate if the bin should try to make its border
|
||||
* transparent (only where the border images are transparent,
|
||||
* of course).
|
||||
*/
|
||||
bool transparentBorder;
|
||||
|
||||
/**
|
||||
* The Gdk::Window object, used to draw inside this button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Window> gdkWindow;
|
||||
|
||||
/**
|
||||
* The Graphics Context, used to draw.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::GC> gc;
|
||||
|
||||
/**
|
||||
* The widget contained inside this container.
|
||||
*/
|
||||
Gtk::Widget * child;
|
||||
|
||||
/**
|
||||
* The background color of the widget.
|
||||
*/
|
||||
Gdk::Color bgColor;
|
||||
|
||||
/**
|
||||
* The corner images.
|
||||
*/
|
||||
Ptr<CornerImages>::Ref cornerImages;
|
||||
|
||||
/**
|
||||
* The corner bitmaps, for masking for transparency.
|
||||
*/
|
||||
Ptr<CornerBitmaps>::Ref cornerBitmaps;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
BlueBin(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an image.
|
||||
*
|
||||
* @param image the image to render
|
||||
* @param x the x coordinate to render to
|
||||
* @param y the y coordinate to render to
|
||||
*/
|
||||
void
|
||||
renderImage(Glib::RefPtr<Gdk::Pixbuf> image,
|
||||
int x,
|
||||
int y) throw ();
|
||||
|
||||
/**
|
||||
* Return the background color.
|
||||
*/
|
||||
const Gdk::Color &
|
||||
getBgColor(void) const throw ()
|
||||
{
|
||||
return bgColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the size request event.
|
||||
*
|
||||
* @param requisition the size request, also being the ouptut
|
||||
* parameter.
|
||||
*/
|
||||
virtual void
|
||||
on_size_request(Gtk::Requisition* requisition)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the size allocate event.
|
||||
*
|
||||
* @param allocation the allocated size.
|
||||
*/
|
||||
virtual void
|
||||
on_size_allocate(Gtk::Allocation& allocation)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the map event.
|
||||
*/
|
||||
virtual void
|
||||
on_map() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unmap event.
|
||||
*/
|
||||
virtual void
|
||||
on_unmap() throw ();
|
||||
|
||||
/**
|
||||
* Handle the realize event.
|
||||
*/
|
||||
virtual void
|
||||
on_realize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unrealize event.
|
||||
*/
|
||||
virtual void
|
||||
on_unrealize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the expose event.
|
||||
*
|
||||
* @param event the actual expose event recieved.
|
||||
* @return true if something was drawn (?)
|
||||
*/
|
||||
virtual bool
|
||||
on_expose_event(GdkEventExpose* event) throw ();
|
||||
|
||||
/**
|
||||
* Execute a function on all children of this container.
|
||||
*
|
||||
* @param includeInternals true if the callback function should
|
||||
* also be called on the internals, false otherwise.
|
||||
* @param callback the callback function to execute on the children.
|
||||
* @param callbackData the data passed to the callback function.
|
||||
*/
|
||||
virtual void
|
||||
forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the add event.
|
||||
*
|
||||
* @param child the child being added to the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_add(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Handle the remove event.
|
||||
*
|
||||
* @param child the child to remove from the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_remove(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Tell what kind of children this container accepts.
|
||||
*
|
||||
* @return the type of children this container accepts.
|
||||
*/
|
||||
virtual GtkType
|
||||
child_type_vfunc() const throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor, with only one state.
|
||||
*
|
||||
* @param backgroundColor the RGB value for the background color.
|
||||
* @param cornerImages the corner images.
|
||||
* @param transparentBorder flag to indicate if the widget should
|
||||
* make its border transparent, where the border images
|
||||
* are transparent themselves
|
||||
*/
|
||||
BlueBin(Colors::ColorName backgroundColor,
|
||||
Ptr<CornerImages>::Ref cornerImages,
|
||||
bool transparentBorder = false)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~BlueBin(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_BlueBin_h
|
||||
|
|
@ -1,351 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_Button_h
|
||||
#define LiveSupport_Widgets_Button_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/ButtonImages.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A button holding a text.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class Button : public Gtk::Button
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The possible states of the button.
|
||||
*/
|
||||
typedef enum { passiveState,
|
||||
rollState,
|
||||
selectedState,
|
||||
disabledState } State;
|
||||
|
||||
/**
|
||||
* The font definition used in the button.
|
||||
*/
|
||||
static const std::string fontDefinition;
|
||||
|
||||
/**
|
||||
* The Gdk::Window object, used to draw inside this button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Window> gdkWindow;
|
||||
|
||||
/**
|
||||
* The Graphics Context, used to draw.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::GC> gc;
|
||||
|
||||
/**
|
||||
* The widget inside the button.
|
||||
*/
|
||||
Gtk::Widget * child;
|
||||
|
||||
/**
|
||||
* The text label for the button.
|
||||
*/
|
||||
Glib::ustring label;
|
||||
|
||||
/**
|
||||
* The state of the button.
|
||||
*/
|
||||
State state;
|
||||
|
||||
/**
|
||||
* The non-interactive state of the button
|
||||
* (not rollover -- either passive, selected or disabled)
|
||||
*/
|
||||
State stationaryState;
|
||||
|
||||
/**
|
||||
* Whether the button can be selected and unselected.
|
||||
*/
|
||||
bool useSelected;
|
||||
|
||||
/**
|
||||
* The button images.
|
||||
*/
|
||||
Ptr<ButtonImages>::Ref buttonImages;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
Button(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the button 'dirty' and request a redraw.
|
||||
* The button will be redrawn by the wm when it next goes into its
|
||||
* idle loop (ie, not immediately, but very soon).
|
||||
*/
|
||||
void
|
||||
requestRedraw(void) throw ();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Handle the size request event.
|
||||
*
|
||||
* @param requisition the size request, also being the ouptut
|
||||
* parameter.
|
||||
*/
|
||||
virtual void
|
||||
on_size_request(Gtk::Requisition* requisition)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the size allocate event.
|
||||
*
|
||||
* @param allocation the allocated size.
|
||||
*/
|
||||
virtual void
|
||||
on_size_allocate(Gtk::Allocation& allocation)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the map event.
|
||||
*/
|
||||
virtual void
|
||||
on_map() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unmap event.
|
||||
*/
|
||||
virtual void
|
||||
on_unmap() throw ();
|
||||
|
||||
/**
|
||||
* Handle the realize event.
|
||||
*/
|
||||
virtual void
|
||||
on_realize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unrealize event.
|
||||
*/
|
||||
virtual void
|
||||
on_unrealize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the expose event.
|
||||
*
|
||||
* @param event the actual expose event recieved.
|
||||
* @return true if something was drawn (?)
|
||||
*/
|
||||
virtual bool
|
||||
on_expose_event(GdkEventExpose* event) throw ();
|
||||
|
||||
/**
|
||||
* Execute a function on all children of this container.
|
||||
*
|
||||
* @param includeInternals true if the callback function should
|
||||
* also be called on the internals, false otherwise.
|
||||
* @param callback the callback function to execute on the children.
|
||||
* @param callbackData the data passed to the callback function.
|
||||
*/
|
||||
virtual void
|
||||
forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the add event.
|
||||
*
|
||||
* @param child the child being added to the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_add(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Handle the remove event.
|
||||
*
|
||||
* @param child the child to remove from the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_remove(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Tell what kind of children this container accepts.
|
||||
*
|
||||
* @return the type of children this container accepts.
|
||||
*/
|
||||
virtual GtkType
|
||||
child_type_vfunc() const throw ();
|
||||
|
||||
/**
|
||||
* Handle the event when the mouse enters the button area.
|
||||
*/
|
||||
virtual void
|
||||
on_enter(void) throw ();
|
||||
|
||||
/**
|
||||
* Handle the event when the mouse leaves the button area.
|
||||
*/
|
||||
virtual void
|
||||
on_leave(void) throw ();
|
||||
|
||||
/**
|
||||
* Handle the event when the button is clicked.
|
||||
*/
|
||||
virtual void
|
||||
on_clicked(void) throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor, with only one state.
|
||||
*
|
||||
* @param label the text to display in the button
|
||||
* @param buttonImages the images of the button
|
||||
*/
|
||||
Button(const Glib::ustring & label,
|
||||
Ptr<ButtonImages>::Ref buttonImages) throw ();
|
||||
|
||||
/**
|
||||
* Constructor, with only one state.
|
||||
*
|
||||
* @param child the widget that should be displayed inside the button.
|
||||
* @param buttonImages the images of the button
|
||||
*/
|
||||
Button(Gtk::Widget & child,
|
||||
Ptr<ButtonImages>::Ref buttonImages) throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~Button(void) throw ();
|
||||
|
||||
/**
|
||||
* Set the label of the button.
|
||||
*
|
||||
* @param label the text the button should display.
|
||||
*/
|
||||
virtual void
|
||||
set_label(const Glib::ustring & label) throw ()
|
||||
{
|
||||
if (child && child->is_managed_()) {
|
||||
// as the child is managed, unparent will delete it
|
||||
child->unparent();
|
||||
}
|
||||
this->label = label;
|
||||
child = Gtk::manage(new Gtk::Label(label));
|
||||
child->modify_font(Pango::FontDescription(fontDefinition));
|
||||
child->set_parent(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the label of the button.
|
||||
*
|
||||
* @return the current label of the button.
|
||||
*/
|
||||
Glib::ustring
|
||||
get_label(void) const throw ()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the state of the button to selected or not.
|
||||
* This only has an effect if selection is enabled by setUseSelected().
|
||||
*
|
||||
* @param toggle if 'true' then set to selected,
|
||||
* if 'false' then set to unselected (passive).
|
||||
* @see setUseSelected()
|
||||
*/
|
||||
void
|
||||
setSelected(bool toggle) throw ();
|
||||
|
||||
/**
|
||||
* Enable or disable the setSelected() methods.
|
||||
* The default is "false".
|
||||
*
|
||||
* @param toggle if 'true' then set to selected,
|
||||
* if 'false' then set to unselected (passive).
|
||||
* @see setSelected()
|
||||
*/
|
||||
void
|
||||
setUseSelected(bool toggle) throw ()
|
||||
{
|
||||
useSelected = toggle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the button, or re-enable it.
|
||||
*
|
||||
* @param toggle if 'true' then disable the button,
|
||||
* if 'false' then re-enable it (set to passive).
|
||||
*/
|
||||
void
|
||||
setDisabled(bool toggle) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_Button_h
|
||||
|
|
@ -1,221 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_ButtonImages_h
|
||||
#define LiveSupport_Widgets_ButtonImages_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "gdkmm/pixbuf.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A helper class to hold a set of images related to buttons.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class ButtonImages
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* Load an image relative the path, and signal error if not found.
|
||||
*
|
||||
* @param path the path to find the image for.
|
||||
* @param imageName the name of the image, relative to path
|
||||
* @return the loaded image
|
||||
* @exception std::invalid_argument if the image was not found
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
loadImage(const std::string path,
|
||||
const std::string imageName)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* The passive left image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageLeft;
|
||||
|
||||
/**
|
||||
* The passive center image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageCenter;
|
||||
|
||||
/**
|
||||
* The passive right image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageRight;
|
||||
|
||||
/**
|
||||
* The rollover left image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageLeft;
|
||||
|
||||
/**
|
||||
* The rollover center image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageCenter;
|
||||
|
||||
/**
|
||||
* The rollover right image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageRight;
|
||||
|
||||
/**
|
||||
* The selected left image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> selectedImageLeft;
|
||||
|
||||
/**
|
||||
* The selected center image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> selectedImageCenter;
|
||||
|
||||
/**
|
||||
* The selected right image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> selectedImageRight;
|
||||
|
||||
/**
|
||||
* The disabled left image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> disabledImageLeft;
|
||||
|
||||
/**
|
||||
* The disabled center image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> disabledImageCenter;
|
||||
|
||||
/**
|
||||
* The disabled right image for the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> disabledImageRight;
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
*/
|
||||
ButtonImages(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with image references.
|
||||
* If any of the images is not available, the result is undefined.
|
||||
*
|
||||
* @param passiveImageLeft the passive left image
|
||||
* @param passiveImageCenter the passive center image
|
||||
* @param passiveImageRight the passive right image
|
||||
* @param rollImageLeft the left rollover image
|
||||
* @param rollImageCenter the center rollover image
|
||||
* @param rollImageRight the right rollover image
|
||||
* @param selectedImageLeft the left rollover image
|
||||
* @param selectedImageCenter the center rollover image
|
||||
* @param selectedImageRight the right rollover image
|
||||
*/
|
||||
ButtonImages(Glib::RefPtr<Gdk::Pixbuf> passiveImageLeft,
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageCenter,
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageRight,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageLeft,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageCenter,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageRight,
|
||||
Glib::RefPtr<Gdk::Pixbuf> selectedImageLeft,
|
||||
Glib::RefPtr<Gdk::Pixbuf> selectedImageCenter,
|
||||
Glib::RefPtr<Gdk::Pixbuf> selectedImageRight,
|
||||
Glib::RefPtr<Gdk::Pixbuf> disabledImageLeft,
|
||||
Glib::RefPtr<Gdk::Pixbuf> disabledImageCenter,
|
||||
Glib::RefPtr<Gdk::Pixbuf> disabledImageRight)
|
||||
throw ()
|
||||
{
|
||||
this->passiveImageLeft = passiveImageLeft;
|
||||
this->passiveImageCenter = passiveImageCenter;
|
||||
this->passiveImageRight = passiveImageRight;
|
||||
this->rollImageLeft = rollImageLeft;
|
||||
this->rollImageCenter = rollImageCenter;
|
||||
this->rollImageRight = rollImageRight;
|
||||
this->selectedImageLeft = selectedImageLeft;
|
||||
this->selectedImageCenter = selectedImageCenter;
|
||||
this->selectedImageRight = selectedImageRight;
|
||||
this->disabledImageLeft = disabledImageLeft;
|
||||
this->disabledImageCenter = disabledImageCenter;
|
||||
this->disabledImageRight = disabledImageRight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor based on a path, where all the images can be loaded
|
||||
* from.
|
||||
*
|
||||
* @param path the path where all the images can be loaded from.
|
||||
*/
|
||||
ButtonImages(const std::string path) throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor, as this class has virtual functions.
|
||||
*/
|
||||
virtual
|
||||
~ButtonImages(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_ButtonImages_h
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_CornerImages_h
|
||||
#define LiveSupport_Widgets_CornerImages_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "gdkmm/pixbuf.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A helper class to hold a set of corner images.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class CornerImages
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* Load an image relative the path, and signal error if not found.
|
||||
*
|
||||
* @param path the path to find the image for.
|
||||
* @param imageName the name of the image, relative to path
|
||||
* @return the loaded image
|
||||
* @exception std::invalid_argument if the image was not found
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
loadImage(const std::string path,
|
||||
const std::string imageName)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* The top left image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> topLeftImage;
|
||||
|
||||
/**
|
||||
* The left image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> leftImage;
|
||||
|
||||
/**
|
||||
* The top image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> topImage;
|
||||
|
||||
/**
|
||||
* The top right image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> topRightImage;
|
||||
|
||||
/**
|
||||
* The right image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rightImage;
|
||||
|
||||
/**
|
||||
* The bottom left image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> bottomLeftImage;
|
||||
|
||||
/**
|
||||
* The bottom image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> bottomImage;
|
||||
|
||||
/**
|
||||
* The bottom right image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> bottomRightImage;
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
*/
|
||||
CornerImages(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with image references.
|
||||
* If any of the images is not available, the result is undefined.
|
||||
*
|
||||
* @param topLeftImage the top left image of the border
|
||||
* @param leftImage the left image of the border
|
||||
* @param topImage the top image of the border
|
||||
* @param topRightImage the top right image of the border
|
||||
* @param rightImage the right image of the border
|
||||
* @param bottomLeftImage the bottom left image of the border
|
||||
* @param bottomImage the bottom image of the border
|
||||
* @param bottomRightImage the bottom right image of the border
|
||||
*/
|
||||
CornerImages(Glib::RefPtr<Gdk::Pixbuf> topLeftImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> leftImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> topImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> topRightImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rightImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> bottomLeftImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> bottomImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> bottomRightImage)
|
||||
throw ()
|
||||
{
|
||||
this->topLeftImage = topLeftImage;
|
||||
this->leftImage = leftImage;
|
||||
this->topImage = topImage;
|
||||
this->topRightImage = topRightImage;
|
||||
this->rightImage = rightImage;
|
||||
this->bottomLeftImage = bottomLeftImage;
|
||||
this->bottomImage = bottomImage;
|
||||
this->bottomRightImage = bottomRightImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor based on a path, where all the images can be loaded
|
||||
* from.
|
||||
*
|
||||
* @param path the path where all the images can be loaded from.
|
||||
*/
|
||||
CornerImages(const std::string path) throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor, as this class has virtual functions.
|
||||
*/
|
||||
virtual
|
||||
~CornerImages(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_CornerImages_h
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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 DialogWindow_h
|
||||
#define DialogWindow_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/main.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Core/LocalizedObject.h"
|
||||
|
||||
#include "LiveSupport/Widgets/WhiteWindow.h"
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A dialog window, displaying a single line of message,
|
||||
* with a pair of buttons: Yes and No, or OK and Cancel etc.
|
||||
*
|
||||
* The constructor is called with a message, a list of ButtonType values
|
||||
* (e.g. cancelButton|okButton), and a resource bundle. The resource bundle
|
||||
* is expected to contain keys named cancelButtonLabel, noButtonLabel,
|
||||
* yesButtonLabel and okButtonLabel.
|
||||
*
|
||||
* The return value of the run() method is a single ButtonType value.
|
||||
* The DialogWindow object is not destroyed when it returns from run();
|
||||
* it is the responsibility of the caller to delete it (or it can be
|
||||
* reused a few times first).
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class DialogWindow : public WhiteWindow,
|
||||
public LocalizedObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* The types of possible buttons.
|
||||
*/
|
||||
typedef enum { cancelButton = 1,
|
||||
noButton = 2,
|
||||
yesButton = 4,
|
||||
okButton = 8 } ButtonType;
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* The type of the button clicked.
|
||||
*/
|
||||
ButtonType buttonClicked;
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The event handler for the Cancel button clicked.
|
||||
*/
|
||||
virtual void
|
||||
onCancelButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* The event handler for the No button clicked.
|
||||
*/
|
||||
virtual void
|
||||
onNoButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* The event handler for the Yes button clicked.
|
||||
*/
|
||||
virtual void
|
||||
onYesButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* The event handler for the OK button clicked.
|
||||
*/
|
||||
virtual void
|
||||
onOkButtonClicked(void) throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param message the message to display in the window
|
||||
* @param buttonTypes a list of button types, e.g.,
|
||||
* <code>noButton|yesButton</code>
|
||||
* @param bundle a resource bundle containing the localized
|
||||
* button labels
|
||||
*/
|
||||
DialogWindow(Ptr<const Glib::ustring>::Ref message,
|
||||
int buttonTypes,
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~DialogWindow(void) throw ();
|
||||
|
||||
/**
|
||||
* Run the window and return the button pressed.
|
||||
*/
|
||||
virtual ButtonType
|
||||
run(void) throw ();
|
||||
|
||||
};
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // DialogWindow_h
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_EntryBin_h
|
||||
#define LiveSupport_Widgets_EntryBin_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/entry.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/CornerImages.h"
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
#include "LiveSupport/Widgets/BlueBin.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A container, holding a Gtk::Entry as its only child.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class EntryBin : public BlueBin
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The text entry for this container.
|
||||
*/
|
||||
Gtk::Entry * entry;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor, with only one state.
|
||||
*
|
||||
* @param backgroundColor the RGB value for the background color.
|
||||
* @param cornerImages the corner images.
|
||||
*/
|
||||
EntryBin(Colors::ColorName backgroundColor,
|
||||
Ptr<CornerImages>::Ref cornerImages)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~EntryBin(void) throw ();
|
||||
|
||||
/**
|
||||
* Return the entry held in this container.
|
||||
*
|
||||
* @return the entry held in this container.
|
||||
*/
|
||||
Gtk::Entry *
|
||||
getEntry(void) throw ()
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entry held in this container (const version).
|
||||
*
|
||||
* @return the entry held in this container.
|
||||
*/
|
||||
const Gtk::Entry *
|
||||
getEntry(void) const throw ()
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text of the entry.
|
||||
*
|
||||
* @return the get_text() string of the Gtk::Entry.
|
||||
*/
|
||||
Glib::ustring
|
||||
get_text(void) const throw ()
|
||||
{
|
||||
return getEntry()->get_text();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text of the entry.
|
||||
*
|
||||
* @return the get_text() string of the Gtk::Entry.
|
||||
*/
|
||||
void
|
||||
set_text(const Glib::ustring & text) throw ()
|
||||
{
|
||||
getEntry()->set_text(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* The signal proxy for pressing enter in the entry field.
|
||||
*
|
||||
* @return the signal_activate() proxy of the Gtk::Entry.
|
||||
*/
|
||||
Glib::SignalProxy0<void>
|
||||
signal_activate(void) throw ()
|
||||
{
|
||||
return getEntry()->signal_activate();
|
||||
}
|
||||
|
||||
/**
|
||||
* The signal proxy for the text having changed in the entry field.
|
||||
*
|
||||
* @return the signal_changed() proxy of the Gtk::Entry.
|
||||
*/
|
||||
Glib::SignalProxy0<void>
|
||||
signal_changed(void) throw ()
|
||||
{
|
||||
return getEntry()->signal_changed();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_EntryBin_h
|
||||
|
|
@ -1,270 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_ImageButton_h
|
||||
#define LiveSupport_Widgets_ImageButton_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A button that is represented by a bitmap totally.
|
||||
* The button is fixed in size, which is determined by the images used
|
||||
* to represent it.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class ImageButton : public Gtk::Button
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The possible states of the button.
|
||||
*/
|
||||
typedef enum { passiveState, rollState, selectedState } State;
|
||||
|
||||
/**
|
||||
* The Gdk::Window object, used to draw inside this button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Window> gdkWindow;
|
||||
|
||||
/**
|
||||
* The Graphics Context, used to draw.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::GC> gc;
|
||||
|
||||
/**
|
||||
* The state of the button.
|
||||
*/
|
||||
State state;
|
||||
|
||||
/**
|
||||
* The image of the button itself, in passive state
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImage;
|
||||
|
||||
/**
|
||||
* The image of the button, when the mouse hovers above it.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImage;
|
||||
|
||||
/**
|
||||
* The transparency mask for the button, in passive state.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Bitmap> passiveMask;
|
||||
|
||||
/**
|
||||
* The transparency mask for the button, in rollover state.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Bitmap> rollMask;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
ImageButton(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Handle the size request event.
|
||||
*
|
||||
* @param requisition the size request, also being the ouptut
|
||||
* parameter.
|
||||
*/
|
||||
virtual void
|
||||
on_size_request(Gtk::Requisition* requisition)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the size allocate event.
|
||||
*
|
||||
* @param allocation the allocated size.
|
||||
*/
|
||||
virtual void
|
||||
on_size_allocate(Gtk::Allocation& allocation)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the map event.
|
||||
*/
|
||||
virtual void
|
||||
on_map() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unmap event.
|
||||
*/
|
||||
virtual void
|
||||
on_unmap() throw ();
|
||||
|
||||
/**
|
||||
* Handle the realize event.
|
||||
*/
|
||||
virtual void
|
||||
on_realize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unrealize event.
|
||||
*/
|
||||
virtual void
|
||||
on_unrealize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the expose event.
|
||||
*
|
||||
* @param event the actual expose event recieved.
|
||||
* @return true if something was drawn (?)
|
||||
*/
|
||||
virtual bool
|
||||
on_expose_event(GdkEventExpose* event) throw ();
|
||||
|
||||
/**
|
||||
* Execute a function on all children of this container.
|
||||
*
|
||||
* @param includeInternals true if the callback function should
|
||||
* also be called on the internals, false otherwise.
|
||||
* @param callback the callback function to execute on the children.
|
||||
* @param callbackData the data passed to the callback function.
|
||||
*/
|
||||
virtual void
|
||||
forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the add event.
|
||||
*
|
||||
* @param child the child being added to the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_add(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Handle the remove event.
|
||||
*
|
||||
* @param child the child to remove from the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_remove(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Tell what kind of children this container accepts.
|
||||
*
|
||||
* @return the type of children this container accepts.
|
||||
*/
|
||||
virtual GtkType
|
||||
child_type_vfunc() const throw ();
|
||||
|
||||
/**
|
||||
* Handle the event when the mouse enters the button area.
|
||||
*/
|
||||
virtual void
|
||||
on_enter(void) throw ();
|
||||
|
||||
/**
|
||||
* Handle the event when the mouse leaves the button area.
|
||||
*/
|
||||
virtual void
|
||||
on_leave(void) throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor, with only one image.
|
||||
*
|
||||
* @param image the image of the button.
|
||||
*/
|
||||
ImageButton(Glib::RefPtr<Gdk::Pixbuf> image) throw ();
|
||||
|
||||
/**
|
||||
* Constructor, with a passive and a rollover image.
|
||||
* The two images are assumed to be of the same size.
|
||||
*
|
||||
* @param passiveImage the passive image of the button.
|
||||
* @param rollImage the image of the button when the mouse rolls
|
||||
* over it.
|
||||
*/
|
||||
ImageButton(Glib::RefPtr<Gdk::Pixbuf> passiveImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImage) throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~ImageButton(void) throw ();
|
||||
|
||||
/**
|
||||
* Return the passive image of this button.
|
||||
* This is used by ZebraTreeView::addColumn(), but should be
|
||||
* removed later.
|
||||
*
|
||||
* @return a pointer to the image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
getPassiveImage(void) throw ()
|
||||
{
|
||||
return passiveImage;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_ImageButton_h
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision$
|
||||
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/MasterPanelBin.h $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef LiveSupport_Widgets_MasterPanelBin_h
|
||||
#define LiveSupport_Widgets_MasterPanelBin_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/BlueBin.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A BlueBin with only a bottom border, no top, side, and corner borders.
|
||||
* This is used for the Master Panel.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision$
|
||||
*/
|
||||
class MasterPanelBin : public BlueBin
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* Handle the size request event.
|
||||
*
|
||||
* @param requisition the size request, also being the ouptut
|
||||
* parameter.
|
||||
*/
|
||||
virtual void
|
||||
on_size_request(Gtk::Requisition* requisition) throw ();
|
||||
|
||||
/**
|
||||
* Handle the size allocate event.
|
||||
*
|
||||
* @param allocation the allocated size.
|
||||
*/
|
||||
virtual void
|
||||
on_size_allocate(Gtk::Allocation& allocation) throw ();
|
||||
|
||||
/**
|
||||
* Handle the expose event.
|
||||
*
|
||||
* @param event the actual expose event recieved.
|
||||
* @return true if something was drawn (?)
|
||||
*/
|
||||
virtual bool
|
||||
on_expose_event(GdkEventExpose* event) throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor, with only one state.
|
||||
* This simply calls the BlueBin constructor.
|
||||
*/
|
||||
MasterPanelBin(void) throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~MasterPanelBin(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_MasterPanelBin_h
|
||||
|
|
@ -1,348 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_Notebook_h
|
||||
#define LiveSupport_Widgets_Notebook_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <gtkmm/table.h>
|
||||
#include <gtkmm/buttonbox.h>
|
||||
#include <gtkmm/alignment.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/CornerImages.h"
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ImageButton.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A container holding a range of children, showing one a time, in tabs.
|
||||
*
|
||||
* After adding pages to a Notebook object, call the function pagesAdded().
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class Notebook : public Gtk::Alignment
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* A container class, holding all that is needed to represent
|
||||
* a page in the notepad.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class Page
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* The Notebook this page is contained in.
|
||||
*/
|
||||
Notebook * notebook;
|
||||
|
||||
/**
|
||||
* The index of the page.
|
||||
*/
|
||||
unsigned int index;
|
||||
|
||||
/**
|
||||
* The container for the widget.
|
||||
*/
|
||||
Gtk::Alignment * container;
|
||||
|
||||
/**
|
||||
* The contents of the page.
|
||||
*/
|
||||
Gtk::Widget * widget;
|
||||
|
||||
/**
|
||||
* The button of the page.
|
||||
*/
|
||||
Button * button;
|
||||
|
||||
/**
|
||||
* Signal handler for the tab button clicked.
|
||||
*/
|
||||
virtual void
|
||||
onTabClicked(void) throw ()
|
||||
{
|
||||
notebook->setActivePage(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param notebook the notebook this page is contained in.
|
||||
* @param index the index of the page.
|
||||
* @param widget the widget of the page.
|
||||
* @param button the button of the page.
|
||||
*/
|
||||
Page(Notebook * notebook,
|
||||
unsigned int index,
|
||||
Gtk::Widget * widget,
|
||||
Button * button) throw ()
|
||||
{
|
||||
this->notebook = notebook;
|
||||
this->index = index;
|
||||
this->widget = widget;
|
||||
this->button = button;
|
||||
|
||||
container = new Gtk::Alignment;
|
||||
container->add(*widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual
|
||||
~Page(void) throw ()
|
||||
{
|
||||
delete container;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The list type, for the list of pages.
|
||||
*/
|
||||
typedef std::vector<Page*> PageList;
|
||||
|
||||
/**
|
||||
* The list of pages in the notebook.
|
||||
*/
|
||||
PageList pageList;
|
||||
|
||||
/**
|
||||
* The layout of the window.
|
||||
*/
|
||||
Gtk::VBox * layout;
|
||||
|
||||
/**
|
||||
* The horizontal box holding the tabs.
|
||||
*/
|
||||
Gtk::HBox * tabBox;
|
||||
|
||||
/**
|
||||
* The container for the displaying a page at a time.
|
||||
*/
|
||||
Gtk::Alignment * pageHolder;
|
||||
|
||||
/**
|
||||
* The index of the current active page.
|
||||
*/
|
||||
unsigned int activePage;
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Handle the size request event.
|
||||
*
|
||||
* @param requisition the size request, also being the ouptut
|
||||
* parameter.
|
||||
*/
|
||||
virtual void
|
||||
on_size_request(Gtk::Requisition* requisition)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the size allocate event.
|
||||
*
|
||||
* @param allocation the allocated size.
|
||||
*/
|
||||
virtual void
|
||||
on_size_allocate(Gtk::Allocation& allocation)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the map event.
|
||||
*/
|
||||
virtual void
|
||||
on_map() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unmap event.
|
||||
*/
|
||||
virtual void
|
||||
on_unmap() throw ();
|
||||
|
||||
/**
|
||||
* Handle the realize event.
|
||||
*/
|
||||
virtual void
|
||||
on_realize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unrealize event.
|
||||
*/
|
||||
virtual void
|
||||
on_unrealize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the expose event.
|
||||
*
|
||||
* @param event the actual expose event recieved.
|
||||
* @return true if something was drawn (?)
|
||||
*/
|
||||
virtual bool
|
||||
on_expose_event(GdkEventExpose* event) throw ();
|
||||
|
||||
/**
|
||||
* Execute a function on all children of this container.
|
||||
*
|
||||
* @param includeInternals true if the callback function should
|
||||
* also be called on the internals, false otherwise.
|
||||
* @param callback the callback function to execute on the children.
|
||||
* @param callbackData the data passed to the callback function.
|
||||
*/
|
||||
virtual void
|
||||
forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the add event.
|
||||
*
|
||||
* @param child the child being added to the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_add(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Handle the remove event.
|
||||
*
|
||||
* @param child the child to remove from the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_remove(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Tell what kind of children this container accepts.
|
||||
*
|
||||
* @return the type of children this container accepts.
|
||||
*/
|
||||
virtual GtkType
|
||||
child_type_vfunc() const throw ();
|
||||
|
||||
/**
|
||||
* Call this function after finished adding pages to this object.
|
||||
* This call will make the object prepare the visuals to display.
|
||||
*/
|
||||
virtual void
|
||||
pagesAdded(void) throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
Notebook() throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~Notebook(void) throw ();
|
||||
|
||||
/**
|
||||
* Append a page to the notebook.
|
||||
*
|
||||
* @param widget the widget that is the page itself.
|
||||
* @param label the label of the page.
|
||||
*/
|
||||
virtual void
|
||||
appendPage(Gtk::Widget & widget,
|
||||
const Glib::ustring & label) throw ();
|
||||
|
||||
/**
|
||||
* Get the number of the active page.
|
||||
*
|
||||
* @return the index of the active page.
|
||||
*/
|
||||
virtual unsigned int
|
||||
getActivePage(void) throw ()
|
||||
{
|
||||
return activePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a specific page active.
|
||||
*
|
||||
* @param pageNo the index of the page to make active.
|
||||
*/
|
||||
virtual void
|
||||
setActivePage(unsigned int pageNo) throw ();
|
||||
|
||||
/**
|
||||
* Enable or disable a page in the notebook.
|
||||
*
|
||||
* @param pageNo the index of the page to enable or disable.
|
||||
* @param sensitive true (default) to enable, false to disable.
|
||||
*/
|
||||
virtual void
|
||||
setPageSensitive(unsigned int pageNo,
|
||||
bool sensitive) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_Notebook_h
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision$
|
||||
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/RadioButtons.h $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef LiveSupport_Widgets_RadioButtons_h
|
||||
#define LiveSupport_Widgets_RadioButtons_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/radiobutton.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A group of radio buttons.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision$
|
||||
*/
|
||||
class RadioButtons : public Gtk::VBox
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The list of radio buttons contained in the widget.
|
||||
*/
|
||||
std::vector<Gtk::RadioButton*> buttons;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
RadioButtons(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~RadioButtons(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new radio button.
|
||||
*
|
||||
* @param label the label of the new button.
|
||||
*/
|
||||
void
|
||||
add(Ptr<const Glib::ustring>::Ref label) throw ();
|
||||
|
||||
/**
|
||||
* Return the number of the active (selected) button.
|
||||
* The buttons are numbered in the order they were added, starting
|
||||
* with 0.
|
||||
* It returns -1 if no radio buttons have been added, and returns
|
||||
* the number of radio buttons if none of them is active [this
|
||||
* should never happen].
|
||||
*
|
||||
* @return the number of the active button.
|
||||
*/
|
||||
int
|
||||
getActiveButton(void) const throw ();
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_RadioButtons_h
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_ScrolledNotebook_h
|
||||
#define LiveSupport_Widgets_ScrolledNotebook_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/Notebook.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A Widgets::Notebook subclass, which puts pages inside
|
||||
* a Widgets::ScrolledWindow before appending them.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class ScrolledNotebook : public Notebook
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
ScrolledNotebook() throw ()
|
||||
: Notebook()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~ScrolledNotebook(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a page to the notebook.
|
||||
*
|
||||
* @param widget the widget that is the page itself.
|
||||
* @param label the label of the page.
|
||||
*/
|
||||
virtual void
|
||||
appendPage(Gtk::Widget & widget,
|
||||
const Glib::ustring & label) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_ScrolledNotebook_h
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_ScrolledWindow_h
|
||||
#define LiveSupport_Widgets_ScrolledWindow_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A subclass of Gtk::ScrolledWindow. The only difference is that the
|
||||
* background color is hard-coded to be LiveSupport::Widgets::Colors::White.
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class ScrolledWindow : public Gtk::ScrolledWindow
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The shadow type of the child widget.
|
||||
*/
|
||||
Gtk::ShadowType shadowType;
|
||||
|
||||
/**
|
||||
* Whether the shadow type has been manually set on the child widget.
|
||||
*/
|
||||
bool useShadowType;
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Handle the realize event.
|
||||
*/
|
||||
virtual void
|
||||
on_realize() throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
ScrolledWindow() throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~ScrolledWindow(void) throw ();
|
||||
|
||||
/**
|
||||
* Set the shadow_type of the child widget.
|
||||
* Must be called before the window is realized.
|
||||
*/
|
||||
void
|
||||
setShadowType(Gtk::ShadowType st) throw ()
|
||||
{
|
||||
shadowType = st;
|
||||
useShadowType = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_ScrolledWindow_h
|
||||
|
|
@ -1,397 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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_WhiteWindow_h
|
||||
#define LiveSupport_Widgets_WhiteWindow_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/table.h>
|
||||
#include <gtkmm/alignment.h>
|
||||
#include <gtkmm/eventbox.h>
|
||||
#include <gtkmm/image.h>
|
||||
#include <gtkmm/window.h>
|
||||
#include <gtkmm/buttonbox.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/WidgetConstants.h"
|
||||
#include "LiveSupport/Widgets/CornerImages.h"
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
#include "LiveSupport/Widgets/ImageButton.h"
|
||||
#include "LiveSupport/Widgets/BlueBin.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A container holding exactly one child, having a light blue border to it.
|
||||
*
|
||||
* To create a white window, subclass your window class from WhiteWindow,
|
||||
* and supply appropriate parameters to the WhiteWindow constructor,
|
||||
* upon construction.
|
||||
*
|
||||
* For example:
|
||||
* <code><pre>
|
||||
* class MyWindow : public WhiteWindow
|
||||
* {
|
||||
* MyWindow(void);
|
||||
* ...
|
||||
* };
|
||||
*
|
||||
* MyWindow::MyWindow(void)
|
||||
* : WhiteWindow("window title",
|
||||
* Colors::White,
|
||||
* WidgetFactory::getInstance()->getWhiteWindowCorners())
|
||||
* {
|
||||
* ...
|
||||
* }
|
||||
* </code></pre>
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @see WidgetFactory
|
||||
* @see WidgetFactory#getWhiteWindowCorners
|
||||
*/
|
||||
class WhiteWindow : public Gtk::Window,
|
||||
public boost::enable_shared_from_this<WhiteWindow>
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The default width of the window, of -1, automatic.
|
||||
*/
|
||||
int defaultWidth;
|
||||
|
||||
/**
|
||||
* The default height of the window, if -1, automatic
|
||||
*/
|
||||
int defaultHeight;
|
||||
|
||||
/**
|
||||
* The rounded container for the window.
|
||||
*/
|
||||
BlueBin * blueBin;
|
||||
|
||||
/**
|
||||
* The layout of the window.
|
||||
*/
|
||||
Gtk::Table * layout;
|
||||
|
||||
/**
|
||||
* The left alignment contaner for the title.
|
||||
*/
|
||||
Gtk::Alignment * titleAlignment;
|
||||
|
||||
/**
|
||||
* The title of the window (if it's of text type, otherwise 0).
|
||||
*/
|
||||
Gtk::Label * titleLabel;
|
||||
|
||||
/**
|
||||
* The right alignment contaner for the minimize, maximize and
|
||||
* close buttons.
|
||||
*/
|
||||
Gtk::Alignment * cornerButtonAlignment;
|
||||
|
||||
/**
|
||||
* True if the window has been minimized.
|
||||
*/
|
||||
bool isMaximized;
|
||||
|
||||
/**
|
||||
* The close button.
|
||||
*/
|
||||
ImageButton * minimizeButton;
|
||||
|
||||
/**
|
||||
* The close button.
|
||||
*/
|
||||
ImageButton * maximizeButton;
|
||||
|
||||
/**
|
||||
* The close button.
|
||||
*/
|
||||
ImageButton * closeButton;
|
||||
|
||||
/**
|
||||
* The right alignment contaner for the resize image.
|
||||
*/
|
||||
Gtk::Alignment * resizeAlignment;
|
||||
|
||||
/**
|
||||
* The event box container for the resize image.
|
||||
*/
|
||||
Gtk::EventBox * resizeEventBox;
|
||||
|
||||
/**
|
||||
* The resize image.
|
||||
*/
|
||||
Gtk::Image * resizeImage;
|
||||
|
||||
/**
|
||||
* Just a container for the main content of the window.
|
||||
*/
|
||||
Gtk::Alignment * childContainer;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
WhiteWindow(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Handle the size request event.
|
||||
*
|
||||
* @param requisition the size request, also being the ouptut
|
||||
* parameter.
|
||||
*/
|
||||
virtual void
|
||||
on_size_request(Gtk::Requisition* requisition)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the size allocate event.
|
||||
*
|
||||
* @param allocation the allocated size.
|
||||
*/
|
||||
virtual void
|
||||
on_size_allocate(Gtk::Allocation& allocation)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the map event.
|
||||
*/
|
||||
virtual void
|
||||
on_map() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unmap event.
|
||||
*/
|
||||
virtual void
|
||||
on_unmap() throw ();
|
||||
|
||||
/**
|
||||
* Handle the realize event.
|
||||
*/
|
||||
virtual void
|
||||
on_realize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the unrealize event.
|
||||
*/
|
||||
virtual void
|
||||
on_unrealize() throw ();
|
||||
|
||||
/**
|
||||
* Handle the expose event.
|
||||
*
|
||||
* @param event the actual expose event recieved.
|
||||
* @return true if something was drawn (?)
|
||||
*/
|
||||
virtual bool
|
||||
on_expose_event(GdkEventExpose* event) throw ();
|
||||
|
||||
/**
|
||||
* Execute a function on all children of this container.
|
||||
*
|
||||
* @param includeInternals true if the callback function should
|
||||
* also be called on the internals, false otherwise.
|
||||
* @param callback the callback function to execute on the children.
|
||||
* @param callbackData the data passed to the callback function.
|
||||
*/
|
||||
virtual void
|
||||
forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Handle the add event.
|
||||
*
|
||||
* @param child the child being added to the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_add(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Handle the remove event.
|
||||
*
|
||||
* @param child the child to remove from the widget.
|
||||
*/
|
||||
virtual void
|
||||
on_remove(Gtk::Widget* child) throw ();
|
||||
|
||||
/**
|
||||
* Tell what kind of children this container accepts.
|
||||
*
|
||||
* @return the type of children this container accepts.
|
||||
*/
|
||||
virtual GtkType
|
||||
child_type_vfunc() const throw ();
|
||||
|
||||
/**
|
||||
* The common part of both constructors.
|
||||
*
|
||||
* @param backgroundColor the background color.
|
||||
* @param cornerImages the corner images.
|
||||
* @param properties some WindowProperties flags
|
||||
*/
|
||||
void
|
||||
constructWindow(Colors::ColorName backgroundColor,
|
||||
Ptr<CornerImages>::Ref cornerImages,
|
||||
int properties)
|
||||
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:
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param title the title of the window.
|
||||
* @param applicationTitle the name of the application.
|
||||
* @param backgroundColor the background color.
|
||||
* @param cornerImages the corner images.
|
||||
* @param properties some WindowProperties flags
|
||||
*/
|
||||
WhiteWindow(Colors::ColorName backgroundColor,
|
||||
Ptr<CornerImages>::Ref cornerImages,
|
||||
int properties = 0)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~WhiteWindow(void) throw ();
|
||||
|
||||
/**
|
||||
* Set the title of the window.
|
||||
*
|
||||
* This sets the title shown in the upper left corner of the window
|
||||
* to "TITLE", and sets the window manager title shown in the task
|
||||
* bar to "title - applicationTitle".
|
||||
*
|
||||
* @param title the title of the window.
|
||||
* @param applicationTitle the name of the application.
|
||||
*/
|
||||
void
|
||||
setTitle(const Glib::ustring & title,
|
||||
const Glib::ustring & applicationTitle)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Set the default size of the window.
|
||||
*
|
||||
* @param width the default width of the window.
|
||||
* @param height the default height of the window.
|
||||
*/
|
||||
void
|
||||
set_default_size(int width,
|
||||
int height) throw ();
|
||||
|
||||
/**
|
||||
* Properties the WhiteWindow can have. This is passed as the
|
||||
* properties parameter to the constructors.
|
||||
*/
|
||||
typedef enum { hasNoTitle = 1,
|
||||
isNotResizable = 2,
|
||||
isModal = 4 } WindowProperties;
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_WhiteWindow_h
|
||||
|
|
@ -50,46 +50,17 @@ namespace Widgets {
|
|||
/**
|
||||
* 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.
|
||||
*
|
||||
* A pushButton is a button like OK, Cancel, etc.
|
||||
* A radioButton is a button with an "in" and an "out" state,
|
||||
* like the window opener buttons on the Master Panel.
|
||||
* A tabButton is one of selection tabs at the top of a Notebook.
|
||||
*/
|
||||
typedef enum { pushButton,
|
||||
radioButton,
|
||||
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,
|
||||
windowTitleLogoImage,
|
||||
audioClipIconImage,
|
||||
typedef enum { audioClipIconImage,
|
||||
playlistIconImage } ImageType;
|
||||
};
|
||||
|
||||
|
|
|
@ -44,20 +44,7 @@
|
|||
#include <gtkmm/image.h>
|
||||
|
||||
#include "LiveSupport/Core/Configurable.h"
|
||||
#include "LiveSupport/Core/MetadataTypeContainer.h"
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetConstants.h"
|
||||
#include "LiveSupport/Widgets/CornerImages.h"
|
||||
#include "LiveSupport/Widgets/ButtonImages.h"
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ImageButton.h"
|
||||
#include "LiveSupport/Widgets/ComboBoxText.h"
|
||||
#include "LiveSupport/Widgets/MetadataComboBoxText.h"
|
||||
#include "LiveSupport/Widgets/OperatorComboBoxText.h"
|
||||
#include "LiveSupport/Widgets/BlueBin.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
#include "LiveSupport/Widgets/DialogWindow.h"
|
||||
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
|
@ -74,7 +61,9 @@ using namespace LiveSupport::Core;
|
|||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A factory to provide access to LiveSupport Widgets.
|
||||
* A factory to provide access to some Campcaster Widgets.
|
||||
* As of Aug 2007, it is only used to retrieve the audio clip and playlist
|
||||
* icon images. It may be extended later, or it may be removed.
|
||||
*
|
||||
* The singleton instance of this class has to be configured with an XML
|
||||
* element, which looks like the following:
|
||||
|
@ -94,10 +83,10 @@ using namespace LiveSupport::Core;
|
|||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class WidgetFactory :
|
||||
virtual public Configurable
|
||||
class WidgetFactory : public Configurable
|
||||
{
|
||||
private:
|
||||
|
||||
/**
|
||||
* The name of the configuration XML elmenent used by this object.
|
||||
*/
|
||||
|
@ -113,51 +102,6 @@ class WidgetFactory :
|
|||
*/
|
||||
std::string path;
|
||||
|
||||
/**
|
||||
* The images for the standard button.
|
||||
*/
|
||||
Ptr<ButtonImages>::Ref buttonImages;
|
||||
|
||||
/**
|
||||
* The images for the tab button.
|
||||
*/
|
||||
Ptr<ButtonImages>::Ref tabButtonImages;
|
||||
|
||||
/**
|
||||
* The corner images for the blue bin.
|
||||
*/
|
||||
Ptr<CornerImages>::Ref blueBinImages;
|
||||
|
||||
/**
|
||||
* The corner images for the dark blue bin.
|
||||
*/
|
||||
Ptr<CornerImages>::Ref darkBlueBinImages;
|
||||
|
||||
/**
|
||||
* The corner images for the entry bin.
|
||||
*/
|
||||
Ptr<CornerImages>::Ref entryBinImages;
|
||||
|
||||
/**
|
||||
* The corner images for the white window.
|
||||
*/
|
||||
Ptr<CornerImages>::Ref whiteWindowImages;
|
||||
|
||||
/**
|
||||
* The combo box left image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> comboBoxLeftImage;
|
||||
|
||||
/**
|
||||
* The combo box center image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> comboBoxCenterImage;
|
||||
|
||||
/**
|
||||
* The combo box right image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> comboBoxRightImage;
|
||||
|
||||
/**
|
||||
* A container holding the miscallenous image pixbuf references.
|
||||
*/
|
||||
|
@ -182,20 +126,9 @@ class WidgetFactory :
|
|||
loadImage(const std::string imageName)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Convert an integer to a string.
|
||||
*
|
||||
* @param number the number to be converted.
|
||||
* @param minLength the minimum length of the result; smaller
|
||||
* numbers get padded with zeroes (optional).
|
||||
* @return the string value of the number (in base 10).
|
||||
*/
|
||||
static Glib::ustring
|
||||
itoa(int number,
|
||||
int minLength = 0) throw ();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* A virtual destructor, as this class has virtual functions.
|
||||
*/
|
||||
|
@ -237,141 +170,6 @@ class WidgetFactory :
|
|||
configure(const xmlpp::Element & element)
|
||||
throw (std::invalid_argument,
|
||||
std::logic_error);
|
||||
|
||||
/**
|
||||
* Create and return a generic button.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @param label the label shown inside the button.
|
||||
* @param type the type of the button to create
|
||||
* @return a button with the specified label.
|
||||
*/
|
||||
Button *
|
||||
createButton(
|
||||
Gtk::Widget & label,
|
||||
WidgetConstants::ButtonType type = WidgetConstants::pushButton)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Create and return a button with a text label.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @param label the label shown inside the button.
|
||||
* @param type the type of the button to create
|
||||
* @return a button with the specified label.
|
||||
*/
|
||||
Button *
|
||||
createButton(
|
||||
const Glib::ustring & label,
|
||||
WidgetConstants::ButtonType type = WidgetConstants::pushButton)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Create a stock button.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @param type the type of the button.
|
||||
* @return a button of the requested type, or 0
|
||||
*/
|
||||
ImageButton *
|
||||
createButton(WidgetConstants::ImageButtonType type) throw ();
|
||||
|
||||
/**
|
||||
* Create a combo box that holds text entries.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @return a combo box, that holds text entries.
|
||||
*/
|
||||
ComboBoxText *
|
||||
createComboBoxText(void) throw ();
|
||||
|
||||
/**
|
||||
* Create a metadata combo box that holds metadata types.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @param metadataTypes a container of metadata types to display.
|
||||
* @return a combo box, that holds metadata types.
|
||||
*/
|
||||
MetadataComboBoxText *
|
||||
createMetadataComboBoxText(
|
||||
Ptr<MetadataTypeContainer>::Ref metadataTypes)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Create a combo box that holds comparison operators.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @param bundle a localization bundle.
|
||||
* @return a combo box, that holds comparison operators.
|
||||
*/
|
||||
OperatorComboBoxText *
|
||||
createOperatorComboBoxText(
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Create a combo box that holds a range of numeric entries.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @param lowerLimit the lowest entry in the combo box.
|
||||
* @param upperLimit the highest entry in the combo box.
|
||||
* @param minLength the minimum length of the entries; smaller
|
||||
* numbers get padded with zeroes (optional).
|
||||
* @return a combo box, that holds numeric entries.
|
||||
*/
|
||||
ComboBoxText *
|
||||
createNumericComboBoxText(int lowerLimit,
|
||||
int upperLimit,
|
||||
int minLength = 0) throw ();
|
||||
|
||||
/**
|
||||
* Create and return a blue singular container.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @return a blue singular container.
|
||||
*/
|
||||
BlueBin *
|
||||
createBlueBin(void) throw ();
|
||||
|
||||
/**
|
||||
* Create and return a dark blue singular container.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @return a dark blue singular container.
|
||||
*/
|
||||
BlueBin *
|
||||
createDarkBlueBin(void) throw ();
|
||||
|
||||
/**
|
||||
* Create and return a singular container holding a text entry.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @return a singular container holding a text entry.
|
||||
*/
|
||||
EntryBin *
|
||||
createEntryBin(void) throw ();
|
||||
|
||||
/**
|
||||
* Return the images for the white window.
|
||||
*
|
||||
* @return the corner images for the white window.
|
||||
*/
|
||||
Ptr<CornerImages>::Ref
|
||||
getWhiteWindowCorners(void) throw ()
|
||||
{
|
||||
return whiteWindowImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a smart pointer to a Gdk::Pixbuf holding a named image.
|
||||
*
|
||||
|
@ -379,44 +177,6 @@ class WidgetFactory :
|
|||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
getPixbuf(WidgetConstants::ImageType imageName) throw ();
|
||||
|
||||
/**
|
||||
* Create and return a container holding an image.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @return the container holding the requested image.
|
||||
*/
|
||||
Gtk::Image *
|
||||
createImage(WidgetConstants::ImageType imageName) throw ();
|
||||
|
||||
/**
|
||||
* Create and return a ZebraTreeView instance.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @return the ZebraTreeView object.
|
||||
*/
|
||||
ZebraTreeView *
|
||||
createTreeView(Glib::RefPtr<Gtk::TreeModel> treeModel)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Create a DialogWindow.
|
||||
* Good for displaying error messages, confirmation messages, etc.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
* object properly.
|
||||
*
|
||||
* @param message the message to include in the window.
|
||||
* @param bundle localization for the button(s).
|
||||
* @param buttons a list of buttons; default is a single OK button.
|
||||
* @return the DialogWindow object.
|
||||
*/
|
||||
DialogWindow *
|
||||
createDialogWindow(Ptr<const Glib::ustring>::Ref message,
|
||||
Ptr<ResourceBundle>::Ref bundle,
|
||||
int buttons = DialogWindow::okButton)
|
||||
throw ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/WidgetConstants.h"
|
||||
#include "LiveSupport/Widgets/ImageButton.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
|
@ -289,7 +288,7 @@ class ZebraTreeView : public Gtk::TreeView
|
|||
* Add an image column to the TreeView.
|
||||
*
|
||||
* @param title the title of the column
|
||||
* @param image the type of button this view will display
|
||||
* @param modelColumn the model column this view will display
|
||||
* @param minimumWidth the minimum width of the column, in pixels
|
||||
* (optional)
|
||||
* @return the number of columns after adding this one
|
||||
|
@ -302,21 +301,6 @@ class ZebraTreeView : public Gtk::TreeView
|
|||
int minimumWidth = 0)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Add a button column to the TreeView.
|
||||
*
|
||||
* @param title the title of the column
|
||||
* @param buttonType the type of button this view will display
|
||||
* @param minimumWidth the minimum width of the column, in pixels
|
||||
* (optional)
|
||||
* @return the number of columns after adding this one
|
||||
*/
|
||||
int
|
||||
appendColumn(const Glib::ustring& title,
|
||||
WidgetConstants::ImageButtonType buttonType,
|
||||
int minimumWidth = 0)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Add a centered text column to the TreeView.
|
||||
*
|
||||
|
|
|
@ -1,416 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "LiveSupport/Widgets/BlueBin.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
BlueBin :: BlueBin(Colors::ColorName backgroundColor,
|
||||
Ptr<CornerImages>::Ref cornerImages,
|
||||
bool transparentBorder)
|
||||
throw ()
|
||||
{
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
|
||||
this->cornerImages = cornerImages;
|
||||
this->transparentBorder = transparentBorder;
|
||||
|
||||
child = 0;
|
||||
|
||||
bgColor = Colors::getColor(backgroundColor);
|
||||
|
||||
// generate the transparency mask bitmaps for the corners.
|
||||
cornerBitmaps.reset(new CornerBitmaps());
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap;
|
||||
|
||||
cornerImages->topLeftImage->render_pixmap_and_mask(pixmap,
|
||||
cornerBitmaps->topLeftBitmap, 100);
|
||||
cornerImages->topRightImage->render_pixmap_and_mask(pixmap,
|
||||
cornerBitmaps->topRightBitmap, 100);
|
||||
cornerImages->bottomLeftImage->render_pixmap_and_mask(pixmap,
|
||||
cornerBitmaps->bottomLeftBitmap, 100);
|
||||
cornerImages->bottomRightImage->render_pixmap_and_mask(pixmap,
|
||||
cornerBitmaps->bottomRightBitmap, 100);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
BlueBin :: ~BlueBin(void) throw ()
|
||||
{
|
||||
on_remove(child);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size request event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_size_request(Gtk::Requisition* requisition) throw ()
|
||||
{
|
||||
*requisition = Gtk::Requisition();
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
if (child) {
|
||||
Gtk::Requisition childRequisition = child->size_request();
|
||||
width = childRequisition.width;
|
||||
height = childRequisition.height;
|
||||
}
|
||||
|
||||
requisition->width = width
|
||||
+ cornerImages->leftImage->get_width()
|
||||
+ cornerImages->rightImage->get_width();
|
||||
requisition->height = height
|
||||
+ cornerImages->topImage->get_height()
|
||||
+ cornerImages->bottomImage->get_height();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size allocate event.
|
||||
* We will not be given heights or widths less than we have requested,
|
||||
* though we might get more.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_size_allocate(Gtk::Allocation& allocation) throw ()
|
||||
{
|
||||
set_allocation(allocation);
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->move_resize( allocation.get_x(),
|
||||
allocation.get_y(),
|
||||
allocation.get_width(),
|
||||
allocation.get_height() );
|
||||
}
|
||||
|
||||
if (child) {
|
||||
Gtk::Allocation childAlloc;
|
||||
|
||||
childAlloc.set_x(cornerImages->leftImage->get_width());
|
||||
childAlloc.set_y(cornerImages->topImage->get_height());
|
||||
childAlloc.set_width(allocation.get_width()
|
||||
- cornerImages->leftImage->get_width()
|
||||
- cornerImages->rightImage->get_width());
|
||||
childAlloc.set_height(allocation.get_height()
|
||||
- cornerImages->topImage->get_height()
|
||||
- cornerImages->bottomImage->get_height());
|
||||
|
||||
child->size_allocate(childAlloc);
|
||||
}
|
||||
|
||||
Gtk::Bin::on_size_allocate(allocation);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Execute a function on all the children.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData) throw ()
|
||||
{
|
||||
if (child) {
|
||||
callback(child->gobj(), callbackData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the add child widget event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_add(Gtk::Widget* child) throw ()
|
||||
{
|
||||
if (!this->child) {
|
||||
this->child = child;
|
||||
this->child->set_parent(*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the remove child widget event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_remove(Gtk::Widget* child) throw ()
|
||||
{
|
||||
if (child && this->child == child && child->get_parent() == this) {
|
||||
this->child = 0;
|
||||
bool visible = child->is_visible();
|
||||
child->unparent();
|
||||
if (visible) {
|
||||
queue_resize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return what kind of widgets can be added to this container.
|
||||
*----------------------------------------------------------------------------*/
|
||||
GtkType
|
||||
BlueBin :: child_type_vfunc() const throw ()
|
||||
{
|
||||
return child ? G_TYPE_NONE : Gtk::Widget::get_type();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the map event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_map() throw ()
|
||||
{
|
||||
Gtk::Bin::on_map();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unmap event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_unmap() throw ()
|
||||
{
|
||||
Gtk::Bin::on_unmap();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the realize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_realize() throw ()
|
||||
{
|
||||
// trick to make GTK-- allocate a window for the later get_window() call
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
Gtk::Bin::on_realize();
|
||||
|
||||
if (!gdkWindow) {
|
||||
// create the Gdk::Window, if it didn't exist before
|
||||
Gtk::Allocation allocation = get_allocation();
|
||||
|
||||
GdkWindowAttr attributes;
|
||||
memset(&attributes, 0, sizeof(attributes));
|
||||
|
||||
// set initial position and size of the Gdk::Window
|
||||
attributes.x = allocation.get_x();
|
||||
attributes.y = allocation.get_y();
|
||||
attributes.width = allocation.get_width();
|
||||
attributes.height = allocation.get_height();
|
||||
|
||||
attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
||||
|
||||
gdkWindow = Gdk::Window::create(get_window(),
|
||||
&attributes,
|
||||
GDK_WA_X | GDK_WA_Y);
|
||||
unset_flags(Gtk::NO_WINDOW);
|
||||
set_window(gdkWindow);
|
||||
|
||||
modify_bg(Gtk::STATE_NORMAL, bgColor);
|
||||
|
||||
// make the widget receive expose events
|
||||
gdkWindow->set_user_data(gobj());
|
||||
|
||||
// allocate a GC for use in on_expose_event()
|
||||
gc = Gdk::GC::create(gdkWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unrealize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: on_unrealize() throw ()
|
||||
{
|
||||
gdkWindow.clear();
|
||||
gc.clear();
|
||||
|
||||
Gtk::Bin::on_unrealize();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the expose event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
BlueBin :: on_expose_event(GdkEventExpose* event) throw ()
|
||||
{
|
||||
if (event->count > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int width = get_width();
|
||||
int height = get_height();
|
||||
|
||||
if (transparentBorder) {
|
||||
unsigned int bitmapSize = 1 + (width * height);
|
||||
|
||||
char * bitmapData = new char[bitmapSize];
|
||||
memset(bitmapData, 0xff, bitmapSize);
|
||||
|
||||
Glib::RefPtr<Gdk::Bitmap> mask = Gdk::Bitmap::create(bitmapData,
|
||||
width,
|
||||
height);
|
||||
delete[] bitmapData;
|
||||
|
||||
Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(mask);
|
||||
Glib::RefPtr<Gdk::Bitmap> borderMask;
|
||||
|
||||
mask->draw_drawable(gc, cornerBitmaps->topLeftBitmap, 0, 0, 0, 0);
|
||||
|
||||
mask->draw_drawable(gc, cornerBitmaps->topRightBitmap, 0, 0,
|
||||
width - cornerImages->topRightImage->get_width(),
|
||||
0);
|
||||
|
||||
mask->draw_drawable(gc, cornerBitmaps->bottomLeftBitmap, 0, 0,
|
||||
0,
|
||||
height - cornerImages->bottomLeftImage->get_height());
|
||||
|
||||
mask->draw_drawable(gc, cornerBitmaps->bottomRightBitmap, 0, 0,
|
||||
width - cornerImages->bottomRightImage->get_width(),
|
||||
height - cornerImages->bottomRightImage->get_height());
|
||||
|
||||
get_parent_window()->shape_combine_mask(mask, 0, 0);
|
||||
}
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->clear();
|
||||
|
||||
int x;
|
||||
int maxX;
|
||||
int y;
|
||||
int maxY;
|
||||
|
||||
renderImage(cornerImages->topLeftImage, 0, 0);
|
||||
|
||||
// draw the top side as many times as necessary
|
||||
x = cornerImages->topLeftImage->get_width();
|
||||
maxX = width - cornerImages->topRightImage->get_width();
|
||||
while (x < maxX) {
|
||||
renderImage(cornerImages->topImage, x, 0);
|
||||
x += cornerImages->topImage->get_width();
|
||||
}
|
||||
|
||||
renderImage(cornerImages->topRightImage,
|
||||
width - cornerImages->topRightImage->get_width(),
|
||||
0);
|
||||
|
||||
// draw the left side as many times as necessary
|
||||
y = cornerImages->topLeftImage->get_height();
|
||||
maxY = height - cornerImages->bottomLeftImage->get_height();
|
||||
while (y < maxY) {
|
||||
renderImage(cornerImages->leftImage, 0, y);
|
||||
y += cornerImages->leftImage->get_height();
|
||||
}
|
||||
|
||||
renderImage(cornerImages->bottomLeftImage,
|
||||
0,
|
||||
height - cornerImages->bottomLeftImage->get_height());
|
||||
|
||||
// draw the right side as many times as necessary
|
||||
y = cornerImages->topRightImage->get_height();
|
||||
maxY = height - cornerImages->bottomRightImage->get_height();
|
||||
while (y < maxY) {
|
||||
renderImage(cornerImages->rightImage,
|
||||
width - cornerImages->rightImage->get_width(),
|
||||
y);
|
||||
y += cornerImages->rightImage->get_height();
|
||||
}
|
||||
|
||||
// draw the bottom side as many times as necessary
|
||||
x = cornerImages->bottomLeftImage->get_width();
|
||||
maxX = width - cornerImages->bottomRightImage->get_width();
|
||||
while (x < maxX) {
|
||||
renderImage(cornerImages->bottomImage,
|
||||
x,
|
||||
height - cornerImages->bottomImage->get_height());
|
||||
x += cornerImages->bottomImage->get_width();
|
||||
}
|
||||
|
||||
renderImage(cornerImages->bottomRightImage,
|
||||
width - cornerImages->bottomRightImage->get_width(),
|
||||
height - cornerImages->bottomRightImage->get_height());
|
||||
}
|
||||
|
||||
Gtk::Bin::on_expose_event(event);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Render an image
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BlueBin :: renderImage(Glib::RefPtr<Gdk::Pixbuf> image,
|
||||
int x,
|
||||
int y) throw ()
|
||||
{
|
||||
gdkWindow->draw_pixbuf(get_style()->get_black_gc(),
|
||||
image,
|
||||
0, 0,
|
||||
x,
|
||||
y,
|
||||
image->get_width(),
|
||||
image->get_height(),
|
||||
Gdk::RGB_DITHER_NONE,
|
||||
0, 0);
|
||||
}
|
||||
|
|
@ -1,484 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The font definition used by the button.
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string Button :: fontDefinition = "Bitstream Vera 10";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Button :: Button(const Glib::ustring & label,
|
||||
Ptr<ButtonImages>::Ref buttonImages)
|
||||
throw ()
|
||||
: useSelected(false),
|
||||
buttonImages(buttonImages)
|
||||
{
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
|
||||
state = passiveState;
|
||||
stationaryState = passiveState;
|
||||
|
||||
this->child = Gtk::manage(new Gtk::Label(label));
|
||||
this->child->modify_font(Pango::FontDescription(fontDefinition));
|
||||
this->child->set_parent(*this);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Button :: Button(Gtk::Widget & child,
|
||||
Ptr<ButtonImages>::Ref buttonImages)
|
||||
throw ()
|
||||
: useSelected(false),
|
||||
buttonImages(buttonImages)
|
||||
{
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
|
||||
state = passiveState;
|
||||
|
||||
this->child = &child;
|
||||
this->child->set_parent(*this);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Button :: ~Button(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size request event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_size_request(Gtk::Requisition* requisition) throw ()
|
||||
{
|
||||
*requisition = Gtk::Requisition();
|
||||
|
||||
Gtk::Requisition childRequisition = child->size_request();;
|
||||
|
||||
requisition->width = buttonImages->passiveImageLeft->get_width()
|
||||
+ childRequisition.width
|
||||
+ buttonImages->passiveImageRight->get_width();
|
||||
requisition->height = buttonImages->passiveImageCenter->get_height();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size allocate event.
|
||||
* We will not be given heights or widths less than we have requested,
|
||||
* though we might get more.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_size_allocate(Gtk::Allocation& allocation) throw ()
|
||||
{
|
||||
allocation.set_height(buttonImages->passiveImageCenter->get_height());
|
||||
set_allocation(allocation);
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->move_resize( allocation.get_x(),
|
||||
allocation.get_y(),
|
||||
allocation.get_width(),
|
||||
allocation.get_height() );
|
||||
}
|
||||
|
||||
Gtk::Allocation childAlloc;
|
||||
|
||||
childAlloc.set_x(buttonImages->passiveImageLeft->get_width());
|
||||
childAlloc.set_y((allocation.get_height()
|
||||
- buttonImages->passiveImageCenter->get_height())
|
||||
/ 2);
|
||||
childAlloc.set_width(allocation.get_width()
|
||||
- buttonImages->passiveImageLeft->get_width()
|
||||
- buttonImages->passiveImageRight->get_width());
|
||||
childAlloc.set_height(buttonImages->passiveImageCenter->get_height());
|
||||
|
||||
child->size_allocate(childAlloc);
|
||||
|
||||
Gtk::Button::on_size_allocate(allocation);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Execute a function on all the children.
|
||||
* As this widget has no children, don't do anything.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData) throw ()
|
||||
{
|
||||
callback((GtkWidget*) child->gobj(), callbackData);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the add child widget event.
|
||||
* As this widget has no children, don't do anything.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_add(Gtk::Widget* child) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the remove child widget event.
|
||||
* As this widget has no children, don't do anything.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_remove(Gtk::Widget* child) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return what kind of widgets can be added to this container.
|
||||
* As this widget has no children, return G_TYPE_NONE always.
|
||||
*----------------------------------------------------------------------------*/
|
||||
GtkType
|
||||
Button :: child_type_vfunc() const throw ()
|
||||
{
|
||||
return G_TYPE_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the map event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_map() throw ()
|
||||
{
|
||||
Gtk::Button::on_map();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unmap event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_unmap() throw ()
|
||||
{
|
||||
Gtk::Button::on_unmap();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the realize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_realize() throw ()
|
||||
{
|
||||
// trick to make GTK-- allocate a window for the later get_window() call
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
Gtk::Button::on_realize();
|
||||
|
||||
if (!gdkWindow) {
|
||||
// create the Gdk::Window, if it didn't exist before
|
||||
|
||||
GdkWindowAttr attributes;
|
||||
memset(&attributes, 0, sizeof(attributes));
|
||||
|
||||
Gtk::Allocation allocation = get_allocation();
|
||||
|
||||
// set initial position and size of the Gdk::Window
|
||||
attributes.x = allocation.get_x();
|
||||
attributes.y = allocation.get_y();
|
||||
attributes.width = allocation.get_width();
|
||||
attributes.height = allocation.get_height();
|
||||
|
||||
attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
||||
|
||||
gdkWindow = Gdk::Window::create(get_window(),
|
||||
&attributes,
|
||||
GDK_WA_X | GDK_WA_Y);
|
||||
unset_flags(Gtk::NO_WINDOW);
|
||||
set_window(gdkWindow);
|
||||
|
||||
// make the widget receive expose events
|
||||
gdkWindow->set_user_data(gobj());
|
||||
|
||||
// allocate a GC for use in on_expose_event()
|
||||
gc = Gdk::GC::create(gdkWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unrealize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_unrealize() throw ()
|
||||
{
|
||||
gdkWindow.clear();
|
||||
gc.clear();
|
||||
|
||||
Gtk::Button::on_unrealize();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the expose event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
Button :: on_expose_event(GdkEventExpose* event) throw ()
|
||||
{
|
||||
if (event->count > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->clear();
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> leftImage;
|
||||
Glib::RefPtr<Gdk::Pixbuf> centerImage;
|
||||
Glib::RefPtr<Gdk::Pixbuf> rightImage;
|
||||
|
||||
switch (state) {
|
||||
case passiveState:
|
||||
default:
|
||||
leftImage = buttonImages->passiveImageLeft;
|
||||
centerImage = buttonImages->passiveImageCenter;
|
||||
rightImage = buttonImages->passiveImageRight;
|
||||
break;
|
||||
|
||||
case rollState:
|
||||
leftImage = buttonImages->rollImageLeft
|
||||
? buttonImages->rollImageLeft
|
||||
: buttonImages->passiveImageLeft;
|
||||
centerImage = buttonImages->rollImageCenter
|
||||
? buttonImages->rollImageCenter
|
||||
: buttonImages->passiveImageCenter;
|
||||
rightImage = buttonImages->rollImageRight
|
||||
? buttonImages->rollImageRight
|
||||
: buttonImages->passiveImageRight;
|
||||
break;
|
||||
|
||||
case selectedState:
|
||||
leftImage = buttonImages->selectedImageLeft
|
||||
? buttonImages->selectedImageLeft
|
||||
: buttonImages->passiveImageLeft;
|
||||
centerImage = buttonImages->selectedImageCenter
|
||||
? buttonImages->selectedImageCenter
|
||||
: buttonImages->passiveImageCenter;
|
||||
rightImage = buttonImages->selectedImageRight
|
||||
? buttonImages->selectedImageRight
|
||||
: buttonImages->passiveImageRight;
|
||||
break;
|
||||
|
||||
case disabledState:
|
||||
leftImage = buttonImages->disabledImageLeft
|
||||
? buttonImages->disabledImageLeft
|
||||
: buttonImages->passiveImageLeft;
|
||||
centerImage = buttonImages->disabledImageCenter
|
||||
? buttonImages->disabledImageCenter
|
||||
: buttonImages->passiveImageCenter;
|
||||
rightImage = buttonImages->disabledImageRight
|
||||
? buttonImages->disabledImageRight
|
||||
: buttonImages->passiveImageRight;
|
||||
break;
|
||||
}
|
||||
|
||||
// draw everything vertically centered, but horizontally stretched
|
||||
// out
|
||||
int x = 0;
|
||||
int y = (get_height() - centerImage->get_height()) / 2;
|
||||
int maxX = get_width() - rightImage->get_width();
|
||||
|
||||
// draw the left image
|
||||
leftImage->render_to_drawable(gdkWindow,
|
||||
get_style()->get_black_gc(),
|
||||
0, 0,
|
||||
x,
|
||||
y,
|
||||
leftImage->get_width(),
|
||||
leftImage->get_height(),
|
||||
Gdk::RGB_DITHER_NONE,
|
||||
0, 0);
|
||||
|
||||
// draw as many center images, as necessary
|
||||
for (x = leftImage->get_width();
|
||||
x < maxX;
|
||||
x += centerImage->get_width()) {
|
||||
|
||||
centerImage->render_to_drawable(gdkWindow,
|
||||
get_style()->get_black_gc(),
|
||||
0, 0,
|
||||
x,
|
||||
y,
|
||||
centerImage->get_width(),
|
||||
centerImage->get_height(),
|
||||
Gdk::RGB_DITHER_NONE,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
// draw the right image
|
||||
rightImage->render_to_drawable(gdkWindow,
|
||||
get_style()->get_black_gc(),
|
||||
0, 0,
|
||||
maxX,
|
||||
y,
|
||||
rightImage->get_width(),
|
||||
rightImage->get_height(),
|
||||
Gdk::RGB_DITHER_NONE,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
Gtk::Container::on_expose_event(event);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the mouse enter event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_enter(void) throw ()
|
||||
{
|
||||
if (stationaryState == passiveState) {
|
||||
state = rollState;
|
||||
}
|
||||
|
||||
Gtk::Button::on_enter();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the mouse leave event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_leave(void) throw ()
|
||||
{
|
||||
if (stationaryState != disabledState) {
|
||||
state = stationaryState;
|
||||
}
|
||||
|
||||
Gtk::Button::on_leave();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the button click event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: on_clicked(void) throw ()
|
||||
{
|
||||
if (useSelected) {
|
||||
switch(stationaryState) {
|
||||
case disabledState: break;
|
||||
|
||||
case passiveState: stationaryState = selectedState;
|
||||
state = selectedState;
|
||||
break;
|
||||
|
||||
case selectedState: stationaryState = passiveState;
|
||||
state = rollState;
|
||||
break;
|
||||
|
||||
case rollState: break; // can't happen, but gcc 4.0 wants it
|
||||
}
|
||||
}
|
||||
|
||||
Gtk::Button::on_clicked();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Change the state of the button to selected or not.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: setSelected(bool toggle) throw ()
|
||||
{
|
||||
if (useSelected && stationaryState != disabledState) {
|
||||
state = toggle ? selectedState : passiveState;
|
||||
stationaryState = toggle ? selectedState : passiveState;
|
||||
requestRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Change the state of the button to selected or not.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: setDisabled(bool toggle) throw ()
|
||||
{
|
||||
state = toggle ? disabledState : passiveState;
|
||||
stationaryState = toggle ? disabledState : passiveState;
|
||||
set_sensitive(!toggle);
|
||||
requestRedraw();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Mark the button 'dirty' and request a redraw.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Button :: requestRedraw(void) throw ()
|
||||
{
|
||||
Glib::RefPtr<Gdk::Window> gdkWindow = get_window();
|
||||
|
||||
if (gdkWindow) {
|
||||
Gdk::Region region = gdkWindow->get_visible_region();
|
||||
gdkWindow->invalidate_region(region, true /* true == recursive */);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/ButtonImages.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
/**
|
||||
* The name of the passive left image.
|
||||
*/
|
||||
static const std::string passiveLeftName = "left.png";
|
||||
|
||||
/**
|
||||
* The name of the passive center image.
|
||||
*/
|
||||
static const std::string passiveCenterName = "center.png";
|
||||
|
||||
/**
|
||||
* The name of the passive right image.
|
||||
*/
|
||||
static const std::string passiveRightName = "right.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover left image
|
||||
*/
|
||||
static const std::string rollLeftName = "leftRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover center image
|
||||
*/
|
||||
static const std::string rollCenterName = "centerRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover right image
|
||||
*/
|
||||
static const std::string rollRightName = "rightRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the selected left image
|
||||
*/
|
||||
static const std::string selectedLeftName = "leftSel.png";
|
||||
|
||||
/**
|
||||
* The name of the selected center image
|
||||
*/
|
||||
static const std::string selectedCenterName = "centerSel.png";
|
||||
|
||||
/**
|
||||
* The name of the selected right image
|
||||
*/
|
||||
static const std::string selectedRightName = "rightSel.png";
|
||||
|
||||
/**
|
||||
* The name of the disabled left image
|
||||
*/
|
||||
static const std::string disabledLeftName = "leftGray.png";
|
||||
|
||||
/**
|
||||
* The name of the disabled center image
|
||||
*/
|
||||
static const std::string disabledCenterName = "centerGray.png";
|
||||
|
||||
/**
|
||||
* The name of the disabled right image
|
||||
*/
|
||||
static const std::string disabledRightName = "rightGray.png";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor, based on relative path
|
||||
*----------------------------------------------------------------------------*/
|
||||
ButtonImages :: ButtonImages(const std::string path)
|
||||
throw ()
|
||||
{
|
||||
try {
|
||||
passiveImageLeft = loadImage(path, passiveLeftName);
|
||||
passiveImageCenter = loadImage(path, passiveCenterName);
|
||||
passiveImageRight = loadImage(path, passiveRightName);
|
||||
rollImageLeft = loadImage(path, rollLeftName);
|
||||
rollImageCenter = loadImage(path, rollCenterName);
|
||||
rollImageRight = loadImage(path, rollRightName);
|
||||
selectedImageLeft = loadImage(path, selectedLeftName);
|
||||
selectedImageCenter = loadImage(path, selectedCenterName);
|
||||
selectedImageRight = loadImage(path, selectedRightName);
|
||||
disabledImageLeft = loadImage(path, disabledLeftName);
|
||||
disabledImageCenter = loadImage(path, disabledCenterName);
|
||||
disabledImageRight = loadImage(path, disabledRightName);
|
||||
} catch (std::invalid_argument &e) {
|
||||
// just ignore, it's not polite to through exceptions from constructors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Load an image
|
||||
*----------------------------------------------------------------------------*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
ButtonImages :: loadImage(const std::string path,
|
||||
const std::string imageName)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
Glib::RefPtr<Gdk::Pixbuf> image;
|
||||
|
||||
bool success = true;
|
||||
try {
|
||||
image = Gdk::Pixbuf::create_from_file(path + imageName);
|
||||
} catch (Glib::FileError &e) {
|
||||
success = false;
|
||||
} catch (Gdk::PixbufError &e) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (!success || !image) {
|
||||
throw std::invalid_argument("Missing " + imageName);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/CornerImages.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
/**
|
||||
* The name of the top left image.
|
||||
*/
|
||||
static const std::string topLeftName = "topLeft.png";
|
||||
|
||||
/**
|
||||
* The name of the left image.
|
||||
*/
|
||||
static const std::string leftName = "left.png";
|
||||
|
||||
/**
|
||||
* The name of the top image.
|
||||
*/
|
||||
static const std::string topName = "top.png";
|
||||
|
||||
/**
|
||||
* The name of the top right image.
|
||||
*/
|
||||
static const std::string topRightName = "topRight.png";
|
||||
|
||||
/**
|
||||
* The name of the right image.
|
||||
*/
|
||||
static const std::string rightName = "right.png";
|
||||
|
||||
/**
|
||||
* The name of the bottom left image.
|
||||
*/
|
||||
static const std::string bottomLeftName = "bottomLeft.png";
|
||||
|
||||
/**
|
||||
* The name of the bottom image.
|
||||
*/
|
||||
static const std::string bottomName = "bottom.png";
|
||||
|
||||
/**
|
||||
* The name of the bottom right image.
|
||||
*/
|
||||
static const std::string bottomRightName = "bottomRight.png";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor, based on relative path
|
||||
*----------------------------------------------------------------------------*/
|
||||
CornerImages :: CornerImages(const std::string path)
|
||||
throw ()
|
||||
{
|
||||
try {
|
||||
topLeftImage = loadImage(path, topLeftName);
|
||||
leftImage = loadImage(path, leftName);
|
||||
topImage = loadImage(path, topName);
|
||||
topRightImage = loadImage(path, topRightName);
|
||||
rightImage = loadImage(path, rightName);
|
||||
bottomLeftImage = loadImage(path, bottomLeftName);
|
||||
bottomImage = loadImage(path, bottomName);
|
||||
bottomRightImage = loadImage(path, bottomRightName);
|
||||
} catch (std::invalid_argument &e) {
|
||||
// just ignore, it's not polite to through exceptions from constructors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Load an image
|
||||
*----------------------------------------------------------------------------*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
CornerImages :: loadImage(const std::string path,
|
||||
const std::string imageName)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
Glib::RefPtr<Gdk::Pixbuf> image;
|
||||
|
||||
bool success = true;
|
||||
try {
|
||||
image = Gdk::Pixbuf::create_from_file(path + imageName);
|
||||
} catch (Glib::FileError &e) {
|
||||
success = false;
|
||||
} catch (Gdk::PixbufError &e) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (!success || !image) {
|
||||
throw std::invalid_argument("Missing " + imageName);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
|
@ -1,204 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
|
||||
#include "LiveSupport/Widgets/DialogWindow.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
DialogWindow :: DialogWindow (Ptr<const Glib::ustring>::Ref message,
|
||||
int buttonTypes,
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ()
|
||||
: WhiteWindow(Colors::White,
|
||||
WidgetFactory::getInstance()->getWhiteWindowCorners(),
|
||||
WhiteWindow::hasNoTitle || WhiteWindow::isModal),
|
||||
LocalizedObject(bundle)
|
||||
{
|
||||
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
||||
|
||||
Gtk::Label * messageLabel = Gtk::manage(new Gtk::Label(*message,
|
||||
Gtk::ALIGN_CENTER,
|
||||
Gtk::ALIGN_CENTER ));
|
||||
messageLabel->set_justify(Gtk::JUSTIFY_CENTER);
|
||||
|
||||
Gtk::Box * messageBox = Gtk::manage(new Gtk::HBox);
|
||||
messageBox->pack_start(*messageLabel, true, false, 10);
|
||||
|
||||
Gtk::ButtonBox * buttonBox = Gtk::manage(new Gtk::HButtonBox(
|
||||
Gtk::BUTTONBOX_END, 5));
|
||||
|
||||
int buttonCount = 0;
|
||||
try {
|
||||
if (buttonTypes & cancelButton) {
|
||||
Button * button = Gtk::manage(widgetFactory->createButton(
|
||||
*getResourceUstring("cancelButtonLabel") ));
|
||||
button->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&DialogWindow::onCancelButtonClicked));
|
||||
buttonBox->pack_start(*button);
|
||||
++buttonCount;
|
||||
}
|
||||
|
||||
if (buttonTypes & noButton) {
|
||||
Button * button = Gtk::manage(widgetFactory->createButton(
|
||||
*getResourceUstring("noButtonLabel") ));
|
||||
button->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&DialogWindow::onNoButtonClicked));
|
||||
buttonBox->pack_start(*button);
|
||||
++buttonCount;
|
||||
}
|
||||
|
||||
if (buttonTypes & yesButton) {
|
||||
Button * button = Gtk::manage(widgetFactory->createButton(
|
||||
*getResourceUstring("yesButtonLabel") ));
|
||||
button->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&DialogWindow::onYesButtonClicked));
|
||||
buttonBox->pack_start(*button);
|
||||
++buttonCount;
|
||||
}
|
||||
|
||||
if (buttonTypes & okButton) {
|
||||
Button * button = Gtk::manage(widgetFactory->createButton(
|
||||
*getResourceUstring("okButtonLabel") ));
|
||||
button->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&DialogWindow::onOkButtonClicked));
|
||||
buttonBox->pack_start(*button);
|
||||
++buttonCount;
|
||||
}
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
Gtk::Box * bottomBox = Gtk::manage(new Gtk::HBox);
|
||||
bottomBox->pack_start(*buttonBox, true, true, 10);
|
||||
|
||||
Gtk::Box * layout = Gtk::manage(new Gtk::VBox);
|
||||
layout->pack_start(*messageBox, true, false, 5);
|
||||
layout->pack_start(*bottomBox, false, false, 0);
|
||||
|
||||
set_default_size(100*buttonCount + 50, 120);
|
||||
property_window_position().set_value(Gtk::WIN_POS_CENTER);
|
||||
set_skip_taskbar_hint(true); // do not show in the task bar
|
||||
set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
|
||||
set_keep_above(true);
|
||||
|
||||
add(*layout);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
DialogWindow :: ~DialogWindow (void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the Cancel button clicked
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
DialogWindow :: onCancelButtonClicked(void) throw ()
|
||||
{
|
||||
buttonClicked = cancelButton;
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the No button clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
DialogWindow :: onNoButtonClicked(void) throw ()
|
||||
{
|
||||
buttonClicked = noButton;
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the Yes button clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
DialogWindow :: onYesButtonClicked(void) throw ()
|
||||
{
|
||||
buttonClicked = yesButton;
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the OK button clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
DialogWindow :: onOkButtonClicked(void) throw ()
|
||||
{
|
||||
buttonClicked = okButton;
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Show the window and return the button clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
DialogWindow::ButtonType
|
||||
DialogWindow :: run(void) throw ()
|
||||
{
|
||||
show_all();
|
||||
Gtk::Main::run(*this);
|
||||
return buttonClicked;
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
EntryBin :: EntryBin(Colors::ColorName backgroundColor,
|
||||
Ptr<CornerImages>::Ref cornerImages)
|
||||
throw ()
|
||||
: BlueBin(backgroundColor, cornerImages)
|
||||
{
|
||||
entry = Gtk::manage(new Gtk::Entry());
|
||||
entry->set_has_frame(false);
|
||||
|
||||
// TODO: this doesn't change the background color, for some reason :(
|
||||
entry->modify_bg(Gtk::STATE_NORMAL, getBgColor());
|
||||
|
||||
Glib::RefPtr<Gtk::Style> style = entry->get_style();
|
||||
style->set_base(Gtk::STATE_NORMAL, getBgColor());
|
||||
style->set_base(Gtk::STATE_ACTIVE, getBgColor());
|
||||
style->set_base(Gtk::STATE_PRELIGHT, getBgColor());
|
||||
style->set_base(Gtk::STATE_SELECTED, getBgColor());
|
||||
style->set_base(Gtk::STATE_INSENSITIVE, getBgColor());
|
||||
entry->set_style(style);
|
||||
|
||||
add(*entry);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
EntryBin :: ~EntryBin(void) throw ()
|
||||
{
|
||||
}
|
||||
|
|
@ -1,331 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
#include "LiveSupport/Widgets/ImageButton.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
ImageButton :: ImageButton(Glib::RefPtr<Gdk::Pixbuf> image)
|
||||
throw ()
|
||||
{
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
|
||||
state = passiveState;
|
||||
this->passiveImage = image;
|
||||
this->rollImage.clear();
|
||||
|
||||
// read the mask from a transparent PNG, and set it to this widget
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap;
|
||||
passiveImage->render_pixmap_and_mask(pixmap, passiveMask, 100);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
ImageButton :: ImageButton(Glib::RefPtr<Gdk::Pixbuf> passiveImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImage)
|
||||
throw ()
|
||||
{
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
|
||||
state = passiveState;
|
||||
this->passiveImage = passiveImage;
|
||||
this->rollImage = rollImage;
|
||||
|
||||
// read the mask from a transparent PNG, and set it to this widget
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap;
|
||||
passiveImage->render_pixmap_and_mask(pixmap, passiveMask, 100);
|
||||
rollImage->render_pixmap_and_mask(pixmap, rollMask, 100);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
ImageButton :: ~ImageButton(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size request event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_size_request(Gtk::Requisition* requisition) throw ()
|
||||
{
|
||||
*requisition = Gtk::Requisition();
|
||||
|
||||
requisition->width = passiveImage->get_width();
|
||||
requisition->height = passiveImage->get_height();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size allocate event.
|
||||
* We will not be given heights or widths less than we have requested,
|
||||
* though we might get more.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_size_allocate(Gtk::Allocation& allocation) throw ()
|
||||
{
|
||||
allocation.set_width(passiveImage->get_width());
|
||||
allocation.set_height(passiveImage->get_height());
|
||||
set_allocation(allocation);
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->move_resize( allocation.get_x(),
|
||||
allocation.get_y(),
|
||||
allocation.get_width(),
|
||||
allocation.get_height() );
|
||||
}
|
||||
|
||||
Gtk::Button::on_size_allocate(allocation);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Execute a function on all the children.
|
||||
* As this widget has no children, don't do anything.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the add child widget event.
|
||||
* As this widget has no children, don't do anything.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_add(Gtk::Widget* child) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the remove child widget event.
|
||||
* As this widget has no children, don't do anything.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_remove(Gtk::Widget* child) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return what kind of widgets can be added to this container.
|
||||
* As this widget has no children, return G_TYPE_NONE always.
|
||||
*----------------------------------------------------------------------------*/
|
||||
GtkType
|
||||
ImageButton :: child_type_vfunc() const throw ()
|
||||
{
|
||||
return G_TYPE_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the map event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_map() throw ()
|
||||
{
|
||||
Gtk::Button::on_map();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unmap event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_unmap() throw ()
|
||||
{
|
||||
Gtk::Button::on_unmap();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the realize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_realize() throw ()
|
||||
{
|
||||
// trick to make GTK-- allocate a window for the later get_window() call
|
||||
set_flags(Gtk::NO_WINDOW);
|
||||
Gtk::Button::on_realize();
|
||||
|
||||
if (!gdkWindow) {
|
||||
// create the Gdk::Window, if it didn't exist before
|
||||
|
||||
GdkWindowAttr attributes;
|
||||
memset(&attributes, 0, sizeof(attributes));
|
||||
|
||||
Gtk::Allocation allocation = get_allocation();
|
||||
|
||||
// set initial position and size of the Gdk::Window
|
||||
attributes.x = allocation.get_x();
|
||||
attributes.y = allocation.get_y();
|
||||
attributes.width = allocation.get_width();
|
||||
attributes.height = allocation.get_height();
|
||||
|
||||
attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
||||
|
||||
gdkWindow = Gdk::Window::create(get_window(),
|
||||
&attributes,
|
||||
GDK_WA_X | GDK_WA_Y);
|
||||
unset_flags(Gtk::NO_WINDOW);
|
||||
set_window(gdkWindow);
|
||||
|
||||
Gdk::Color bgColor = Colors::getColor(Colors::White);
|
||||
modify_bg(Gtk::STATE_NORMAL, bgColor);
|
||||
|
||||
// make the widget receive expose events
|
||||
gdkWindow->set_user_data(gobj());
|
||||
|
||||
// allocate a GC for use in on_expose_event()
|
||||
gc = Gdk::GC::create(gdkWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unrealize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_unrealize() throw ()
|
||||
{
|
||||
gdkWindow.clear();
|
||||
gc.clear();
|
||||
|
||||
Gtk::Button::on_unrealize();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the expose event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
ImageButton :: on_expose_event(GdkEventExpose* event) throw ()
|
||||
{
|
||||
if (event->count > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->clear();
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> image;
|
||||
Glib::RefPtr<Gdk::Bitmap> mask;
|
||||
|
||||
switch (state) {
|
||||
case passiveState:
|
||||
default:
|
||||
image = passiveImage;
|
||||
mask = passiveMask;
|
||||
break;
|
||||
|
||||
case rollState:
|
||||
image = rollImage ? rollImage : passiveImage;
|
||||
mask = rollMask ? rollMask : passiveMask;
|
||||
break;
|
||||
}
|
||||
|
||||
// set the transparency mask
|
||||
get_window()->shape_combine_mask(mask, 0, 0);
|
||||
|
||||
// just draw the button image at the centre of the available space
|
||||
int x = (get_width() - image->get_width()) / 2;
|
||||
int y = (get_height() - image->get_height()) / 2;
|
||||
|
||||
image->render_to_drawable(gdkWindow,
|
||||
get_style()->get_white_gc(),
|
||||
0, 0,
|
||||
x,
|
||||
y,
|
||||
image->get_width(),
|
||||
image->get_height(),
|
||||
Gdk::RGB_DITHER_NONE,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the mouse enter event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_enter(void) throw ()
|
||||
{
|
||||
state = rollState;
|
||||
|
||||
Gtk::Button::on_enter();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the mouse leave event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ImageButton :: on_leave(void) throw ()
|
||||
{
|
||||
state = passiveState;
|
||||
|
||||
Gtk::Button::on_leave();
|
||||
}
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision$
|
||||
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/src/MasterPanelBin.cxx $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
|
||||
#include "LiveSupport/Widgets/MasterPanelBin.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
MasterPanelBin :: MasterPanelBin(void)
|
||||
throw ()
|
||||
: BlueBin(Colors::White,
|
||||
WidgetFactory::getInstance()->getWhiteWindowCorners(),
|
||||
false /*transparent corners*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
MasterPanelBin :: ~MasterPanelBin(void) throw ()
|
||||
{
|
||||
on_remove(child);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size request event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
MasterPanelBin :: on_size_request(Gtk::Requisition* requisition) throw ()
|
||||
{
|
||||
*requisition = Gtk::Requisition();
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
if (child) {
|
||||
Gtk::Requisition childRequisition = child->size_request();
|
||||
width = childRequisition.width;
|
||||
height = childRequisition.height;
|
||||
}
|
||||
|
||||
requisition->width = width;
|
||||
requisition->height = height
|
||||
+ cornerImages->bottomImage->get_height();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size allocate event.
|
||||
* We will not be given heights or widths less than we have requested,
|
||||
* though we might get more.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
MasterPanelBin :: on_size_allocate(Gtk::Allocation& allocation) throw ()
|
||||
{
|
||||
set_allocation(allocation);
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->move_resize( allocation.get_x(),
|
||||
allocation.get_y(),
|
||||
allocation.get_width(),
|
||||
allocation.get_height() );
|
||||
}
|
||||
|
||||
if (child) {
|
||||
Gtk::Allocation childAlloc;
|
||||
|
||||
childAlloc.set_x(0);
|
||||
childAlloc.set_y(0);
|
||||
childAlloc.set_width(allocation.get_width());
|
||||
childAlloc.set_height(allocation.get_height()
|
||||
- cornerImages->bottomImage->get_height());
|
||||
|
||||
child->size_allocate(childAlloc);
|
||||
}
|
||||
|
||||
Gtk::Bin::on_size_allocate(allocation);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the expose event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
MasterPanelBin :: on_expose_event(GdkEventExpose* event) throw ()
|
||||
{
|
||||
if (event->count > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int width = get_width();
|
||||
int height = get_height();
|
||||
|
||||
if (gdkWindow) {
|
||||
gdkWindow->clear();
|
||||
|
||||
// draw the bottom side as many times as necessary
|
||||
for (int x = 0; x < width;
|
||||
x += cornerImages->bottomImage->get_width()) {
|
||||
renderImage(cornerImages->bottomImage,
|
||||
x,
|
||||
height - cornerImages->bottomImage->get_height());
|
||||
}
|
||||
}
|
||||
|
||||
Gtk::Bin::on_expose_event(event);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1,284 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
#include "LiveSupport/Widgets/Notebook.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Notebook :: Notebook(void) throw ()
|
||||
{
|
||||
layout = Gtk::manage(new Gtk::VBox());
|
||||
tabBox = Gtk::manage(new Gtk::HBox());
|
||||
pageHolder = Gtk::manage(new Gtk::Alignment());
|
||||
|
||||
layout->pack_start(*tabBox, Gtk::PACK_SHRINK, 0);
|
||||
layout->pack_start(*pageHolder, Gtk::PACK_EXPAND_WIDGET, 0);
|
||||
|
||||
add(*layout);
|
||||
|
||||
// show all
|
||||
show_all();
|
||||
|
||||
activePage = 0;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Notebook :: ~Notebook(void) throw ()
|
||||
{
|
||||
while (!pageList.empty()) {
|
||||
Page * page = pageList.back();
|
||||
pageList.pop_back();
|
||||
delete page;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size request event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_size_request(Gtk::Requisition* requisition) throw ()
|
||||
{
|
||||
*requisition = Gtk::Requisition();
|
||||
|
||||
Gtk::Requisition layoutRequisition = layout->size_request();
|
||||
requisition->width = layoutRequisition.width;
|
||||
requisition->height = layoutRequisition.height;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size allocate event.
|
||||
* We will not be given heights or widths less than we have requested,
|
||||
* though we might get more.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_size_allocate(Gtk::Allocation& allocation) throw ()
|
||||
{
|
||||
Gtk::Alignment::on_size_allocate(allocation);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Execute a function on all the children.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData) throw ()
|
||||
{
|
||||
Gtk::Alignment::forall_vfunc(includeInternals, callback, callbackData);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the add child widget event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_add(Gtk::Widget* child) throw ()
|
||||
{
|
||||
Gtk::Alignment::on_add(child);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the remove child widget event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_remove(Gtk::Widget* child) throw ()
|
||||
{
|
||||
Gtk::Alignment::on_remove(child);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return what kind of widgets can be added to this container.
|
||||
*----------------------------------------------------------------------------*/
|
||||
GtkType
|
||||
Notebook :: child_type_vfunc() const throw ()
|
||||
{
|
||||
return Gtk::Alignment::child_type_vfunc();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the map event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_map() throw ()
|
||||
{
|
||||
Gtk::Alignment::on_map();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unmap event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_unmap() throw ()
|
||||
{
|
||||
Gtk::Alignment::on_unmap();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the realize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_realize() throw ()
|
||||
{
|
||||
Gtk::Alignment::on_realize();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unrealize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: on_unrealize() throw ()
|
||||
{
|
||||
Gtk::Alignment::on_unrealize();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the expose event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
Notebook :: on_expose_event(GdkEventExpose* event) throw ()
|
||||
{
|
||||
return Gtk::Alignment::on_expose_event(event);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Append a page to the notebook
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: appendPage(Gtk::Widget & widget,
|
||||
const Glib::ustring & label) throw ()
|
||||
{
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
Button * button = wf->createButton(label,
|
||||
WidgetConstants::tabButton);
|
||||
|
||||
Page * page = new Page(this, pageList.size(), &widget, button);
|
||||
pageList.push_back(page);
|
||||
|
||||
pagesAdded();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Prepare the visuals for the widget
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: pagesAdded(void) throw ()
|
||||
{
|
||||
// clean already existing widgets
|
||||
tabBox->children().clear();
|
||||
|
||||
// build up the widgets based on the current pages
|
||||
PageList::iterator pagesIt = pageList.begin();
|
||||
PageList::iterator pagesEnd = pageList.end();
|
||||
|
||||
while (pagesIt != pagesEnd) {
|
||||
Page * page = *pagesIt;
|
||||
|
||||
tabBox->pack_start(*page->button, Gtk::PACK_SHRINK, 0);
|
||||
page->button->signal_clicked().connect(sigc::mem_fun(*page,
|
||||
&Notebook::Page::onTabClicked));
|
||||
pagesIt++;
|
||||
}
|
||||
|
||||
// reset the active page to 0, and show it
|
||||
setActivePage(0);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Make a page active
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: setActivePage(unsigned int pageNo) throw ()
|
||||
{
|
||||
if (pageNo >= pageList.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pageList[activePage]->button->setSelected(false);
|
||||
pageList[activePage]->container->hide();
|
||||
pageHolder->remove();
|
||||
activePage = pageNo;
|
||||
pageHolder->add(*(pageList[pageNo]->container));
|
||||
pageList[pageNo]->button->setSelected(true);
|
||||
show_all();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Enable or disable a page in the notebook.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Notebook :: setPageSensitive(unsigned int pageNo,
|
||||
bool sensitive) throw ()
|
||||
{
|
||||
if (pageNo < pageList.size()) {
|
||||
pageList[pageNo]->button->setDisabled(!sensitive);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision$
|
||||
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/src/RadioButtons.cxx $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/RadioButtons.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add a new radio button.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
RadioButtons :: add(Ptr<const Glib::ustring>::Ref label) throw ()
|
||||
{
|
||||
Gtk::RadioButton * button;
|
||||
|
||||
if (buttons.size() == 0) {
|
||||
button = Gtk::manage(new Gtk::RadioButton(*label));
|
||||
} else {
|
||||
Gtk::RadioButton * firstButton = buttons.front();
|
||||
Gtk::RadioButton::Group group = firstButton->get_group();
|
||||
button = Gtk::manage(new Gtk::RadioButton(group, *label));
|
||||
}
|
||||
|
||||
buttons.push_back(button);
|
||||
pack_start(*button, Gtk::PACK_SHRINK, 5);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return the number of the active (selected) button.
|
||||
*----------------------------------------------------------------------------*/
|
||||
int
|
||||
RadioButtons :: getActiveButton(void) const throw ()
|
||||
{
|
||||
int i = -1;
|
||||
|
||||
for (i = 0; i < int(buttons.size()); ++i) {
|
||||
if (buttons[i]->get_active()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Widgets/ScrolledWindow.h"
|
||||
#include "LiveSupport/Widgets/ScrolledNotebook.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Append a page to the notebook
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ScrolledNotebook :: appendPage(Gtk::Widget & widget,
|
||||
const Glib::ustring & label) throw ()
|
||||
{
|
||||
ScrolledWindow * scrolledWindow = Gtk::manage(new ScrolledWindow);
|
||||
scrolledWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
||||
|
||||
scrolledWindow->add(widget);
|
||||
|
||||
Notebook::appendPage(*scrolledWindow, label);
|
||||
}
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <gtkmm/viewport.h>
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
#include "LiveSupport/Widgets/ScrolledWindow.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
ScrolledWindow :: ScrolledWindow(void) throw ()
|
||||
: Gtk::ScrolledWindow(),
|
||||
useShadowType(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
ScrolledWindow :: ~ScrolledWindow(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the realize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
ScrolledWindow :: on_realize() throw ()
|
||||
{
|
||||
Gdk::Color bgColor = Colors::getColor(Colors::WindowBackground);
|
||||
Widget * child = get_child();
|
||||
child->modify_bg(Gtk::STATE_NORMAL, bgColor);
|
||||
|
||||
if (useShadowType) {
|
||||
Gtk::Viewport * viewport = dynamic_cast<Gtk::Viewport*>(child);
|
||||
if (viewport) {
|
||||
viewport->set_shadow_type(shadowType);
|
||||
}
|
||||
}
|
||||
|
||||
Gtk::ScrolledWindow::on_realize();
|
||||
}
|
||||
|
|
@ -40,20 +40,12 @@
|
|||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/entry.h>
|
||||
#include <gtkmm/window.h>
|
||||
#include <gtkmm/table.h>
|
||||
#include <gtkmm.h>
|
||||
#include <libglademm.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ImageButton.h"
|
||||
#include "LiveSupport/Widgets/ComboBoxText.h"
|
||||
#include "LiveSupport/Widgets/BlueBin.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
#include "LiveSupport/Widgets/Notebook.h"
|
||||
#include "LiveSupport/Widgets/WhiteWindow.h"
|
||||
#include "LiveSupport/Widgets/DialogWindow.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
|
@ -75,9 +67,10 @@ using namespace LiveSupport::Core;
|
|||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
class TestWindow : public WhiteWindow
|
||||
class TestWindow : public LocalizedObject
|
||||
{
|
||||
private:
|
||||
|
||||
/**
|
||||
* Change the image from "play" to "stop" on the button when pressed.
|
||||
*/
|
||||
|
@ -90,72 +83,43 @@ class TestWindow : public WhiteWindow
|
|||
void
|
||||
onStopButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* The resource bundle.
|
||||
*/
|
||||
Ptr<ResourceBundle>::Ref bundle;
|
||||
|
||||
/**
|
||||
* The "are you sure?" dialog window.
|
||||
*/
|
||||
Ptr<DialogWindow>::Ref dialogWindow;
|
||||
Ptr<Gtk::Dialog>::Ref dialogWindow;
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The layout used in the window.
|
||||
*/
|
||||
Gtk::Table * layout;
|
||||
|
||||
/**
|
||||
* A notebook, to tab through pages.
|
||||
* A large button.
|
||||
*/
|
||||
Notebook * notebook;
|
||||
Gtk::Button * largeButton;
|
||||
|
||||
/**
|
||||
* An image button with transparent background.
|
||||
* A button showing a "play" icon.
|
||||
*/
|
||||
ImageButton * hugeImageButton;
|
||||
Gtk::Button * cuePlayButton;
|
||||
|
||||
/**
|
||||
* A clickable image button showing a "play" icon.
|
||||
* A button showing a "stop" icon.
|
||||
*/
|
||||
ImageButton * cuePlayImageButton;
|
||||
|
||||
/**
|
||||
* A clickable image button showing a "stop" icon.
|
||||
*/
|
||||
ImageButton * cueStopImageButton;
|
||||
Gtk::Button * cueStopButton;
|
||||
|
||||
/**
|
||||
* A button.
|
||||
*/
|
||||
Button * button;
|
||||
Gtk::Button * button;
|
||||
|
||||
/**
|
||||
* A button which sometimes gets disabled.
|
||||
*/
|
||||
Button * disableTestButton;
|
||||
Gtk::Button * disableTestButton;
|
||||
|
||||
/**
|
||||
* A combo box.
|
||||
*/
|
||||
ComboBoxText * comboBoxText;
|
||||
|
||||
/**
|
||||
* A text entry.
|
||||
*/
|
||||
Gtk::Entry * entry;
|
||||
|
||||
/**
|
||||
* A container holding a text entry.
|
||||
*/
|
||||
EntryBin * entryBin;
|
||||
|
||||
/**
|
||||
* A blue container.
|
||||
*/
|
||||
BlueBin * blueBin;
|
||||
ComboBoxText * comboBoxText;
|
||||
|
||||
/**
|
||||
* Event handler for the large button being clicked.
|
||||
|
@ -172,6 +136,7 @@ class TestWindow : public WhiteWindow
|
|||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
|
|
@ -1,417 +0,0 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster 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.
|
||||
|
||||
Campcaster 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 Campcaster; 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$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
|
||||
#include "LiveSupport/Widgets/WhiteWindow.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
namespace {
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The font used for the window title.
|
||||
*----------------------------------------------------------------------------*/
|
||||
const Glib::ustring windowTitleFont = "Bitstream Vera Sans Bold 8";
|
||||
|
||||
}
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
WhiteWindow :: WhiteWindow(Colors::ColorName backgroundColor,
|
||||
Ptr<CornerImages>::Ref cornerImages,
|
||||
int properties)
|
||||
throw ()
|
||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL),
|
||||
isMaximized(false)
|
||||
{
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
|
||||
set_decorated(false);
|
||||
defaultWidth = -1;
|
||||
defaultHeight = -1;
|
||||
set_resizable(!(properties & isNotResizable));
|
||||
set_modal(properties & isModal);
|
||||
|
||||
layout = Gtk::manage(new Gtk::Table());
|
||||
|
||||
// create the background color, as it is needed by the event box
|
||||
Gdk::Color bgColor = Colors::getColor(backgroundColor);
|
||||
|
||||
// create the title
|
||||
Gtk::Box * titleBox = Gtk::manage(new Gtk::VBox());
|
||||
titleLabel = 0;
|
||||
|
||||
if (!(properties & hasNoTitle)) {
|
||||
Gtk::Image * titleImage = Gtk::manage(wf->createImage(
|
||||
WidgetConstants::windowTitleLogoImage));
|
||||
|
||||
titleLabel = Gtk::manage(new Gtk::Label());
|
||||
titleLabel->modify_font(Pango::FontDescription(windowTitleFont));
|
||||
titleLabel->modify_fg(Gtk::STATE_NORMAL, Colors::getColor(
|
||||
Colors::Orange));
|
||||
|
||||
titleBox->pack_start(*titleImage, Gtk::PACK_SHRINK, 0);
|
||||
titleBox->pack_start(*titleLabel, Gtk::PACK_SHRINK, 2);
|
||||
}
|
||||
|
||||
titleBox->modify_bg(Gtk::STATE_NORMAL, bgColor);
|
||||
titleAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_LEFT,
|
||||
Gtk::ALIGN_CENTER,
|
||||
0, 0));
|
||||
titleAlignment->add(*titleBox);
|
||||
layout->attach(*titleAlignment, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
||||
|
||||
// create the minimize, maximize and close buttons
|
||||
Gtk::Box * cornerButtonBox = Gtk::manage(new Gtk::HBox);
|
||||
|
||||
int padding = 5;
|
||||
if (!(properties & isModal)) {
|
||||
closeButton = Gtk::manage(wf->createButton(
|
||||
WidgetConstants::windowCloseButton));
|
||||
cornerButtonBox->pack_end(*closeButton, Gtk::PACK_SHRINK, padding);
|
||||
padding = 0;
|
||||
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&WhiteWindow::onCloseButtonClicked));
|
||||
}
|
||||
if (!(properties & isNotResizable)) {
|
||||
maximizeButton = Gtk::manage(wf->createButton(
|
||||
WidgetConstants::windowMaximizeButton));
|
||||
cornerButtonBox->pack_end(*maximizeButton, Gtk::PACK_SHRINK, padding);
|
||||
padding = (padding == 0) ? 5 : 0;
|
||||
maximizeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&WhiteWindow::onMaximizeButtonClicked));
|
||||
|
||||
minimizeButton = Gtk::manage(wf->createButton(
|
||||
WidgetConstants::windowMinimizeButton));
|
||||
cornerButtonBox->pack_end(*minimizeButton, Gtk::PACK_SHRINK, padding);
|
||||
minimizeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&WhiteWindow::onMinimizeButtonClicked));
|
||||
}
|
||||
|
||||
cornerButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
|
||||
Gtk::ALIGN_CENTER,
|
||||
0, 0));
|
||||
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));
|
||||
layout->attach(*childContainer, 0, 2, 1, 2);
|
||||
|
||||
// create the resize image
|
||||
if (!(properties & isNotResizable)) {
|
||||
resizeImage = Gtk::manage(wf->createImage(WidgetConstants::resizeImage));
|
||||
resizeEventBox = Gtk::manage(new Gtk::EventBox());
|
||||
resizeEventBox->modify_bg(Gtk::STATE_NORMAL, bgColor);
|
||||
resizeEventBox->add(*resizeImage);
|
||||
resizeAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
|
||||
Gtk::ALIGN_CENTER,
|
||||
0, 0));
|
||||
resizeAlignment->add(*resizeEventBox);
|
||||
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
|
||||
blueBin = Gtk::manage(new BlueBin(backgroundColor, cornerImages, true));
|
||||
blueBin->add(*layout);
|
||||
Gtk::Window::add(*blueBin);
|
||||
|
||||
// register signal handlers
|
||||
this->add_events(Gdk::BUTTON_PRESS_MASK);
|
||||
this->signal_button_press_event().connect(sigc::mem_fun(*this,
|
||||
&WhiteWindow::onTitleClicked));
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
WhiteWindow :: ~WhiteWindow(void) throw ()
|
||||
{
|
||||
on_remove(blueBin);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size request event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_size_request(Gtk::Requisition* requisition) throw ()
|
||||
{
|
||||
Gtk::Window::on_size_request(requisition);
|
||||
|
||||
if (defaultWidth >= 0 && requisition->width < defaultWidth) {
|
||||
requisition->width = defaultWidth;
|
||||
}
|
||||
if (defaultHeight >= 0 && requisition->height < defaultHeight) {
|
||||
requisition->height = defaultHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the size allocate event.
|
||||
* We will not be given heights or widths less than we have requested,
|
||||
* though we might get more.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_size_allocate(Gtk::Allocation& allocation) throw ()
|
||||
{
|
||||
Gtk::Window::on_size_allocate(allocation);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Execute a function on all the children.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: forall_vfunc(gboolean includeInternals,
|
||||
GtkCallback callback,
|
||||
gpointer callbackData) throw ()
|
||||
{
|
||||
Gtk::Window::forall_vfunc(includeInternals, callback, callbackData);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the add child widget event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_add(Gtk::Widget* child) throw ()
|
||||
{
|
||||
if (child == blueBin) {
|
||||
Gtk::Window::on_add(child);
|
||||
} else {
|
||||
childContainer->add(*child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the remove child widget event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_remove(Gtk::Widget* child) throw ()
|
||||
{
|
||||
if (child) {
|
||||
if (child == blueBin && child->get_parent() == this) {
|
||||
Gtk::Window::on_remove(child);
|
||||
} else if (child == childContainer->get_child()) {
|
||||
childContainer->remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return what kind of widgets can be added to this container.
|
||||
*----------------------------------------------------------------------------*/
|
||||
GtkType
|
||||
WhiteWindow :: child_type_vfunc() const throw ()
|
||||
{
|
||||
return Gtk::Window::child_type_vfunc();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the map event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_map() throw ()
|
||||
{
|
||||
Gtk::Window::on_map();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unmap event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_unmap() throw ()
|
||||
{
|
||||
Gtk::Window::on_unmap();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the realize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_realize() throw ()
|
||||
{
|
||||
Gtk::Window::on_realize();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the unrealize event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: on_unrealize() throw ()
|
||||
{
|
||||
Gtk::Window::on_unrealize();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Handle the expose event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
WhiteWindow :: on_expose_event(GdkEventExpose* event) throw ()
|
||||
{
|
||||
return Gtk::Window::on_expose_event(event);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The event of the title being clicked
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
WhiteWindow :: onTitleClicked(GdkEventButton * event) throw ()
|
||||
{
|
||||
if (event->button == 1) {
|
||||
begin_move_drag(event->button,
|
||||
(int) event->x_root,
|
||||
(int) event->y_root,
|
||||
event->time);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* 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.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: onCloseButtonClicked (void) throw ()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set the title of the window.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: setTitle(const Glib::ustring & title,
|
||||
const Glib::ustring & applicationTitle)
|
||||
throw ()
|
||||
{
|
||||
Gtk::Window::set_title(title + " - " + applicationTitle);
|
||||
if (titleLabel) {
|
||||
titleLabel->set_label(title.uppercase());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set the default window size.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
WhiteWindow :: set_default_size(int width,
|
||||
int height) throw ()
|
||||
{
|
||||
defaultWidth = width;
|
||||
defaultHeight = height;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The event of the resize image being clicked
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
WhiteWindow :: onResizeClicked(GdkEventButton * event) throw ()
|
||||
{
|
||||
if (event->button == 1) {
|
||||
begin_resize_drag(Gdk::WINDOW_EDGE_SOUTH_EAST,
|
||||
event->button,
|
||||
(int) event->x_root,
|
||||
(int) event->y_root,
|
||||
event->time);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,13 +33,6 @@
|
|||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <unicode/resbund.h>
|
||||
#include <gtkmm/entry.h>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
|
||||
|
||||
|
@ -54,258 +47,36 @@ using namespace LiveSupport::Widgets;
|
|||
/*------------------------------------------------------------------------------
|
||||
* The name of the config element for this class
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string WidgetFactory::configElementNameStr = "widgetFactory";
|
||||
const std::string WidgetFactory::configElementNameStr = "widgetFactory";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The singleton instance of WidgetFactory
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<WidgetFactory>::Ref WidgetFactory::singleton;
|
||||
|
||||
/**
|
||||
namespace {
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the attribute to get the path for the widget images.
|
||||
*/
|
||||
static const std::string pathAttrName = "path";
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string pathAttrName = "path";
|
||||
|
||||
/**
|
||||
/*------------------------------------------------------------------------------
|
||||
* The relative path for the standard button images.
|
||||
*/
|
||||
static const std::string buttonPath = "button/";
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string buttonPath = "button/";
|
||||
|
||||
/**
|
||||
* The relative path for the tab button images.
|
||||
*/
|
||||
static const std::string tabButtonPath = "tabButton/";
|
||||
|
||||
/**
|
||||
* The relative path for the blue bin images.
|
||||
*/
|
||||
static const std::string blueBinPath = "blueBin/";
|
||||
|
||||
/**
|
||||
* The relative path for the dark blue bin images.
|
||||
*/
|
||||
static const std::string darkBlueBinPath = "darkBlueBin/";
|
||||
|
||||
/**
|
||||
* The relative path for the entry bin images.
|
||||
*/
|
||||
static const std::string entryBinPath = "entryBin/";
|
||||
|
||||
/**
|
||||
* The relative path for the white window images.
|
||||
*/
|
||||
static const std::string whiteWindowPath = "whiteWindow/";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the delete button.
|
||||
*/
|
||||
static const std::string deleteButtonPassiveName = "imageButton/delete.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the delete button.
|
||||
*/
|
||||
static const std::string deleteButtonRollName = "imageButton/deleteRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the plus button.
|
||||
*/
|
||||
static const std::string plusButtonPassiveName = "imageButton/plus.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the plus button.
|
||||
*/
|
||||
static const std::string plusButtonRollName = "imageButton/plusRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the minus button.
|
||||
*/
|
||||
static const std::string minusButtonPassiveName = "imageButton/minus.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the minus button.
|
||||
*/
|
||||
static const std::string minusButtonRollName = "imageButton/minusRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the small play button.
|
||||
*/
|
||||
static const std::string smallPlayButtonPassiveName
|
||||
= "imageButton/smallPlay.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the small play button.
|
||||
*/
|
||||
static const std::string smallPlayButtonRollName
|
||||
= "imageButton/smallPlayRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the small pause button.
|
||||
*/
|
||||
static const std::string smallPauseButtonPassiveName
|
||||
= "imageButton/smallPause.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the small pause button.
|
||||
*/
|
||||
static const std::string smallPauseButtonRollName
|
||||
= "imageButton/smallPauseRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the small stop button.
|
||||
*/
|
||||
static const std::string smallStopButtonPassiveName
|
||||
= "imageButton/smallStop.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the small stop button.
|
||||
*/
|
||||
static const std::string smallStopButtonRollName
|
||||
= "imageButton/smallStopRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the huge play button.
|
||||
*/
|
||||
static const std::string hugePlayButtonPassiveName
|
||||
= "imageButton/hugePlay.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the huge play button.
|
||||
*/
|
||||
static const std::string hugePlayButtonRollName
|
||||
= "imageButton/hugePlayRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the cue play button.
|
||||
*/
|
||||
static const std::string cuePlayButtonPassiveName
|
||||
= "imageButton/cuePlay.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the cue play button.
|
||||
*/
|
||||
static const std::string cuePlayButtonRollName
|
||||
= "imageButton/cuePlayRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the cue stop button.
|
||||
*/
|
||||
static const std::string cueStopButtonPassiveName
|
||||
= "imageButton/cueStop.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the cue stop button.
|
||||
*/
|
||||
static const std::string cueStopButtonRollName
|
||||
= "imageButton/cueStopRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the master panel play button.
|
||||
*/
|
||||
static const std::string masterPlayButtonPassiveName
|
||||
= "imageButton/masterPlay.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the master panel play button.
|
||||
*/
|
||||
static const std::string masterPlayButtonRollName
|
||||
= "imageButton/masterPlayRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the master panel pause button.
|
||||
*/
|
||||
static const std::string masterPauseButtonPassiveName
|
||||
= "imageButton/masterPause.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the master panel pause button.
|
||||
*/
|
||||
static const std::string masterPauseButtonRollName
|
||||
= "imageButton/masterPauseRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the passive image for the master panel stop button.
|
||||
*/
|
||||
static const std::string masterStopButtonPassiveName
|
||||
= "imageButton/masterStop.png";
|
||||
|
||||
/**
|
||||
* The name of the rollover image for the master panel stop button.
|
||||
*/
|
||||
static const std::string masterStopButtonRollName
|
||||
= "imageButton/masterStopRoll.png";
|
||||
|
||||
/**
|
||||
* The name of the combo box left image.
|
||||
*/
|
||||
static const std::string comboBoxLeftName = "combo/left.png";
|
||||
|
||||
/**
|
||||
* The name of the combo box center image.
|
||||
*/
|
||||
static const std::string comboBoxCenterName = "combo/center.png";
|
||||
|
||||
/**
|
||||
* The name of the combo box right image.
|
||||
*/
|
||||
static const std::string comboBoxRightName = "combo/right.png";
|
||||
|
||||
/**
|
||||
* The name of the image for the resize handle.
|
||||
*/
|
||||
static const std::string resizeImageName = "whiteWindow/resize.png";
|
||||
|
||||
/**
|
||||
* The name of the image for the title logo of the GUI windows.
|
||||
*/
|
||||
static const std::string windowTitleLogoImageName
|
||||
= "whiteWindow/windowTitleLogo.png";
|
||||
|
||||
/**
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the image for the audio clip icon.
|
||||
*/
|
||||
static const std::string audioClipIconImageName = "icons/audioClipIcon.png";
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string audioClipIconImageName = "icons/audioClipIcon.png";
|
||||
|
||||
/**
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the image for the playlist icon.
|
||||
*/
|
||||
static const std::string playlistIconImageName = "icons/playlistIcon.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";
|
||||
*----------------------------------------------------------------------------*/
|
||||
const std::string playlistIconImageName = "icons/playlistIcon.png";
|
||||
|
||||
}
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
@ -347,28 +118,6 @@ WidgetFactory :: configure(const xmlpp::Element & element)
|
|||
}
|
||||
path = attribute->get_value();
|
||||
|
||||
// load the button images, and check if all exist
|
||||
buttonImages.reset(new ButtonImages(path + buttonPath));
|
||||
tabButtonImages.reset(new ButtonImages(path + tabButtonPath));
|
||||
|
||||
// load the combo box images
|
||||
comboBoxLeftImage = loadImage(comboBoxLeftName);
|
||||
comboBoxCenterImage = loadImage(comboBoxCenterName);
|
||||
comboBoxRightImage = loadImage(comboBoxRightName);
|
||||
|
||||
// load the images for the bins
|
||||
blueBinImages.reset(new CornerImages(path + blueBinPath));
|
||||
darkBlueBinImages.reset(new CornerImages(path + darkBlueBinPath));
|
||||
entryBinImages.reset(new CornerImages(path + entryBinPath));
|
||||
|
||||
// load the white window corner images
|
||||
whiteWindowImages.reset(new CornerImages(path + whiteWindowPath));
|
||||
|
||||
// load the miscellaneous images
|
||||
imageTypePixbufs[WidgetConstants::resizeImage]
|
||||
= loadImage(resizeImageName);
|
||||
imageTypePixbufs[WidgetConstants::windowTitleLogoImage]
|
||||
= loadImage(windowTitleLogoImageName);
|
||||
imageTypePixbufs[WidgetConstants::audioClipIconImage]
|
||||
= loadImage(audioClipIconImageName);
|
||||
imageTypePixbufs[WidgetConstants::playlistIconImage]
|
||||
|
@ -402,259 +151,6 @@ WidgetFactory :: loadImage(const std::string imageName)
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a generic button.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Button *
|
||||
WidgetFactory :: createButton(Gtk::Widget & label,
|
||||
WidgetConstants::ButtonType type) throw ()
|
||||
{
|
||||
Button * button = 0;
|
||||
|
||||
switch (type) {
|
||||
case WidgetConstants::pushButton:
|
||||
button = new Button(label, buttonImages);
|
||||
break;
|
||||
|
||||
case WidgetConstants::radioButton:
|
||||
button = new Button(label, buttonImages);
|
||||
button->setUseSelected(true);
|
||||
break;
|
||||
|
||||
case WidgetConstants::tabButton:
|
||||
button = new Button(label, tabButtonImages);
|
||||
button->setUseSelected(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a text button.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Button *
|
||||
WidgetFactory :: createButton(const Glib::ustring & label,
|
||||
WidgetConstants::ButtonType type) throw ()
|
||||
{
|
||||
Button * button = 0;
|
||||
|
||||
switch (type) {
|
||||
case WidgetConstants::pushButton:
|
||||
button = new Button(label, buttonImages);
|
||||
break;
|
||||
|
||||
case WidgetConstants::radioButton:
|
||||
button = new Button(label, buttonImages);
|
||||
button->setUseSelected(true);
|
||||
break;
|
||||
|
||||
case WidgetConstants::tabButton:
|
||||
button = new Button(label, tabButtonImages);
|
||||
button->setUseSelected(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a combo box
|
||||
*----------------------------------------------------------------------------*/
|
||||
ComboBoxText *
|
||||
WidgetFactory :: createComboBoxText(void) throw ()
|
||||
{
|
||||
return 0;
|
||||
// return new ComboBoxText(comboBoxLeftImage,
|
||||
// comboBoxCenterImage,
|
||||
// comboBoxRightImage);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a metadata combo box
|
||||
*----------------------------------------------------------------------------*/
|
||||
MetadataComboBoxText *
|
||||
WidgetFactory :: createMetadataComboBoxText(
|
||||
Ptr<MetadataTypeContainer>::Ref metadataTypes)
|
||||
throw ()
|
||||
{
|
||||
return 0;
|
||||
// return new MetadataComboBoxText(comboBoxLeftImage,
|
||||
// comboBoxCenterImage,
|
||||
// comboBoxRightImage,
|
||||
// metadataTypes);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a comparison operator combo box
|
||||
*----------------------------------------------------------------------------*/
|
||||
OperatorComboBoxText *
|
||||
WidgetFactory :: createOperatorComboBoxText(
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ()
|
||||
{
|
||||
return 0;
|
||||
// return new OperatorComboBoxText(comboBoxLeftImage,
|
||||
// comboBoxCenterImage,
|
||||
// comboBoxRightImage,
|
||||
// bundle);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a numeric combo box
|
||||
*----------------------------------------------------------------------------*/
|
||||
ComboBoxText *
|
||||
WidgetFactory :: createNumericComboBoxText(int lowerLimit,
|
||||
int upperLimit,
|
||||
int minLength)
|
||||
throw ()
|
||||
{
|
||||
return 0;
|
||||
// ComboBoxText * comboBox = new ComboBoxText(comboBoxLeftImage,
|
||||
// comboBoxCenterImage,
|
||||
// comboBoxRightImage);
|
||||
// for (int i = lowerLimit; i <= upperLimit; ++i) {
|
||||
// comboBox->append_text(itoa(i, minLength));
|
||||
// }
|
||||
// return comboBox;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a blue bin
|
||||
*----------------------------------------------------------------------------*/
|
||||
BlueBin *
|
||||
WidgetFactory :: createBlueBin(void) throw ()
|
||||
{
|
||||
return new BlueBin(Colors::LightBlue, blueBinImages);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a dark blue bin
|
||||
*----------------------------------------------------------------------------*/
|
||||
BlueBin *
|
||||
WidgetFactory :: createDarkBlueBin(void) throw ()
|
||||
{
|
||||
return new BlueBin(Colors::MasterPanelCenterBlue, darkBlueBinImages);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create an entry bin
|
||||
*----------------------------------------------------------------------------*/
|
||||
EntryBin *
|
||||
WidgetFactory :: createEntryBin(void) throw ()
|
||||
{
|
||||
return new EntryBin(Colors::LightBlue, entryBinImages);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a stock button
|
||||
*----------------------------------------------------------------------------*/
|
||||
ImageButton *
|
||||
WidgetFactory :: createButton(WidgetConstants::ImageButtonType type)
|
||||
throw ()
|
||||
{
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImage;
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImage;
|
||||
|
||||
switch (type) {
|
||||
case WidgetConstants::deleteButton:
|
||||
passiveImage = loadImage(deleteButtonPassiveName);
|
||||
rollImage = loadImage(deleteButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::plusButton:
|
||||
passiveImage = loadImage(plusButtonPassiveName);
|
||||
rollImage = loadImage(plusButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::minusButton:
|
||||
passiveImage = loadImage(minusButtonPassiveName);
|
||||
rollImage = loadImage(minusButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::smallPlayButton:
|
||||
passiveImage = loadImage(smallPlayButtonPassiveName);
|
||||
rollImage = loadImage(smallPlayButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::smallPauseButton:
|
||||
passiveImage = loadImage(smallPauseButtonPassiveName);
|
||||
rollImage = loadImage(smallPauseButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::smallStopButton:
|
||||
passiveImage = loadImage(smallStopButtonPassiveName);
|
||||
rollImage = loadImage(smallStopButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::hugePlayButton:
|
||||
passiveImage = loadImage(hugePlayButtonPassiveName);
|
||||
rollImage = loadImage(hugePlayButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::cuePlayButton:
|
||||
passiveImage = loadImage(cuePlayButtonPassiveName);
|
||||
rollImage = loadImage(cuePlayButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::cueStopButton:
|
||||
passiveImage = loadImage(cueStopButtonPassiveName);
|
||||
rollImage = loadImage(cueStopButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::masterPlayButton:
|
||||
passiveImage = loadImage(masterPlayButtonPassiveName);
|
||||
rollImage = loadImage(masterPlayButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::masterPauseButton:
|
||||
passiveImage = loadImage(masterPauseButtonPassiveName);
|
||||
rollImage = loadImage(masterPauseButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::masterStopButton:
|
||||
passiveImage = loadImage(masterStopButtonPassiveName);
|
||||
rollImage = loadImage(masterStopButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::windowMinimizeButton:
|
||||
passiveImage = loadImage(windowMinimizeButtonPassiveName);
|
||||
rollImage = loadImage(windowMinimizeButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::windowMaximizeButton:
|
||||
passiveImage = loadImage(windowMaximizeButtonPassiveName);
|
||||
rollImage = loadImage(windowMaximizeButtonRollName);
|
||||
break;
|
||||
|
||||
case WidgetConstants::windowCloseButton:
|
||||
passiveImage = loadImage(windowCloseButtonPassiveName);
|
||||
rollImage = loadImage(windowCloseButtonRollName);
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new ImageButton(passiveImage, rollImage);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return a Gdk::Pixbuf reference to a named image
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -664,55 +160,3 @@ WidgetFactory :: getPixbuf(WidgetConstants::ImageType imageName) throw ()
|
|||
return imageTypePixbufs[imageName];
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a Gtk::Image
|
||||
*----------------------------------------------------------------------------*/
|
||||
Gtk::Image *
|
||||
WidgetFactory :: createImage(WidgetConstants::ImageType imageName) throw ()
|
||||
{
|
||||
return new Gtk::Image(getPixbuf(imageName));
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a ZebraTreeView table
|
||||
*----------------------------------------------------------------------------*/
|
||||
ZebraTreeView *
|
||||
WidgetFactory :: createTreeView(Glib::RefPtr<Gtk::TreeModel> treeModel)
|
||||
throw ()
|
||||
{
|
||||
return new ZebraTreeView(treeModel);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a dialog window.
|
||||
*----------------------------------------------------------------------------*/
|
||||
DialogWindow *
|
||||
WidgetFactory :: createDialogWindow(Ptr<const Glib::ustring>::Ref message,
|
||||
Ptr<ResourceBundle>::Ref bundle,
|
||||
int buttons)
|
||||
throw ()
|
||||
{
|
||||
return new DialogWindow(message, buttons, bundle);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Convert an integer to a string.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Glib::ustring
|
||||
WidgetFactory :: itoa(int number,
|
||||
int minLength) throw ()
|
||||
{
|
||||
std::ostringstream stream;
|
||||
if (minLength > 0) {
|
||||
stream << std::setw(minLength)
|
||||
<< std::setfill('0');
|
||||
}
|
||||
stream << number;
|
||||
Glib::ustring string = stream.str();
|
||||
return string;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
|
||||
#include "LiveSupport/Widgets/Colors.h"
|
||||
|
||||
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
||||
|
||||
|
@ -165,46 +166,6 @@ ZebraTreeView :: appendColumn(
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add a button column to the TreeView.
|
||||
*----------------------------------------------------------------------------*/
|
||||
int
|
||||
ZebraTreeView :: appendColumn(
|
||||
const Glib::ustring & title,
|
||||
WidgetConstants::ImageButtonType buttonType,
|
||||
int minimumWidth)
|
||||
throw ()
|
||||
{
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
ImageButton * button = Gtk::manage(wf->createButton(
|
||||
buttonType ));
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImage = button->getPassiveImage();
|
||||
|
||||
// a standard cell renderer
|
||||
Gtk::CellRendererPixbuf* renderer
|
||||
= Gtk::manage(new Gtk::CellRendererPixbuf);
|
||||
|
||||
// set the image of the renderer
|
||||
renderer->property_pixbuf() = passiveImage;
|
||||
|
||||
// the constructor packs the renderer into the TreeViewColumn
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
|
||||
new Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// this cell data function will do the blue-gray zebra stripes
|
||||
viewColumn->set_cell_data_func(
|
||||
*renderer,
|
||||
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
|
||||
|
||||
// set the minimum width of the column
|
||||
if (minimumWidth) {
|
||||
viewColumn->set_min_width(minimumWidth);
|
||||
}
|
||||
|
||||
return append_column(*viewColumn);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The callback function.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
|
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 176 B |
Before Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 352 B |