diff --git a/livesupport/modules/widgets/etc/Makefile.in b/livesupport/modules/widgets/etc/Makefile.in index 62b38d625..fefdb2bb7 100644 --- a/livesupport/modules/widgets/etc/Makefile.in +++ b/livesupport/modules/widgets/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.4 $ +# Version : $Revision: 1.5 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/etc/Makefile.in,v $ # # @configure_input@ @@ -110,6 +110,8 @@ LDFLAGS = @LDFLAGS@ -pthread \ WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \ ${TMP_DIR}/Button.o \ ${TMP_DIR}/BlueBin.o \ + ${TMP_DIR}/WhiteWindow.o \ + ${TMP_DIR}/CornerImages.o \ ${TMP_DIR}/WidgetFactory.o TEST_EXE_OBJS = ${TMP_DIR}/TestWindow.o \ ${TMP_DIR}/main.o diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h index 0a68b8e10..2b6c9ee82 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h,v $ ------------------------------------------------------------------------------*/ @@ -43,6 +43,7 @@ #include <gtkmm/bin.h> #include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Widgets/CornerImages.h" namespace LiveSupport { @@ -62,7 +63,7 @@ using namespace LiveSupport::Core; * A container holding exactly one child, habing a light blue border to it. * * @author $Author: maroy $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class BlueBin : public Gtk::Bin { @@ -88,44 +89,9 @@ class BlueBin : public Gtk::Bin Gdk::Color bgColor; /** - * The top left image of the border. + * The corner images. */ - Glib::RefPtr<Gdk::Pixbuf> topLeftImage; - - /** - * The left image of the border. - */ - Glib::RefPtr<Gdk::Pixbuf> leftImage; - - /** - * The top image of the border. - */ - Glib::RefPtr<Gdk::Pixbuf> topImage; - - /** - * The top right image of the border. - */ - Glib::RefPtr<Gdk::Pixbuf> topRightImage; - - /** - * The right image of the border. - */ - Glib::RefPtr<Gdk::Pixbuf> rightImage; - - /** - * The bottom left image of the border. - */ - Glib::RefPtr<Gdk::Pixbuf> bottomLeftImage; - - /** - * The bottom image of the border. - */ - Glib::RefPtr<Gdk::Pixbuf> bottomImage; - - /** - * The bottom right image of the border. - */ - Glib::RefPtr<Gdk::Pixbuf> bottomRightImage; + Ptr<CornerImages>::Ref cornerImages; /** * Default constructor. @@ -134,6 +100,17 @@ class BlueBin : public Gtk::Bin { } + /** + * 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 (); protected: /** @@ -232,24 +209,10 @@ class BlueBin : public Gtk::Bin * Constructor, with only one state. * * @param backgroundColor the RGB value for the background color. - * @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 + * @param cornerImages the corner images. */ BlueBin(unsigned int backgroundColor, - 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) + Ptr<CornerImages>::Ref cornerImages) throw (); /** diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/CornerImages.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/CornerImages.h new file mode 100644 index 000000000..9199961b4 --- /dev/null +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/CornerImages.h @@ -0,0 +1,193 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/CornerImages.h,v $ + +------------------------------------------------------------------------------*/ +#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: maroy $ + * @version $Revision: 1.1 $ + */ +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 + diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h new file mode 100644 index 000000000..af4397c13 --- /dev/null +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h @@ -0,0 +1,255 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h,v $ + +------------------------------------------------------------------------------*/ +#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 <gtkmm/label.h> +#include <gtkmm/table.h> +#include <gtkmm/alignment.h> +#include <gtkmm/window.h> + +#include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Widgets/CornerImages.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, habing a light blue border to it. + * + * @author $Author: maroy $ + * @version $Revision: 1.1 $ + */ +class WhiteWindow : public Gtk::Window +{ + private: + /** + * The rounded container for the window. + */ + Ptr<BlueBin>::Ref blueBin; + + /** + * The layout of the window. + */ + Ptr<Gtk::Table>::Ref layout; + + /** + * The left alignment contaner for the title. + */ + Ptr<Gtk::Alignment>::Ref titleAlignment; + + /** + * The title of the window. + */ + Ptr<Gtk::Label>::Ref title; + + /** + * The right alignment contaner for the close button. + */ + Ptr<Gtk::Alignment>::Ref closeButtonAlignment; + + /** + * The close button. + */ + Ptr<ImageButton>::Ref closeButton; + + /** + * Just a container for the main content of the window. + */ + Ptr<Gtk::Alignment>::Ref childContainer; + + /** + * 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. + */ + bool + onTitleClicked(GdkEventButton * event) throw (); + + /** + * Signal handler for the close button clicked. + */ + virtual void + onCloseButtonClicked(void) throw (); + + /** + * 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 (); + + + public: + /** + * Constructor. + * + * @param backgroundColor the RGB value for the background color. + * @param cornerImages the corner images. + */ + WhiteWindow(unsigned int backgroundColor, + Ptr<CornerImages>::Ref cornerImages) + throw (); + + /** + * A virtual destructor. + */ + virtual + ~WhiteWindow(void) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Widgets +} // namespace LiveSupport + +#endif // LiveSupport_Widgets_WhiteWindow_h + diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h index 963762028..511fe2270 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $ ------------------------------------------------------------------------------*/ @@ -44,7 +44,9 @@ #include "LiveSupport/Core/Configurable.h" +#include "LiveSupport/Widgets/CornerImages.h" #include "LiveSupport/Widgets/Button.h" +#include "LiveSupport/Widgets/ImageButton.h" #include "LiveSupport/Widgets/BlueBin.h" @@ -80,11 +82,18 @@ using namespace LiveSupport::Core; * </code></pre> * * @author $Author: maroy $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class WidgetFactory : virtual public Configurable { + public: + /** + * The types of available buttons. + */ + typedef enum { deleteButton } ButtonType; + + private: /** * The name of the configuration XML elmenent used by this object. @@ -132,84 +141,19 @@ class WidgetFactory : Glib::RefPtr<Gdk::Pixbuf> buttonRollImageRight; /** - * The top left image of the border for BlueBin. + * The corner images for the blue bin. */ - Glib::RefPtr<Gdk::Pixbuf> blueBinTopLeftImage; + Ptr<CornerImages>::Ref blueBinImages; /** - * The left image of the border for BlueBin. + * The corner images for the dark blue bin. */ - Glib::RefPtr<Gdk::Pixbuf> blueBinLeftImage; + Ptr<CornerImages>::Ref darkBlueBinImages; /** - * The top image of the border for BlueBin. + * The corner images for the white window. */ - Glib::RefPtr<Gdk::Pixbuf> blueBinTopImage; - - /** - * The top right image of the border for BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> blueBinTopRightImage; - - /** - * The right image of the border for BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> blueBinRightImage; - - /** - * The bottom left image of the border for BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> blueBinBottomLeftImage; - - /** - * The bottom image of the border for BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> blueBinBottomImage; - - /** - * The bottom right image of the border for BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> blueBinBottomRightImage; - - /** - * The top left image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinTopLeftImage; - - /** - * The left image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinLeftImage; - - /** - * The top image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinTopImage; - - /** - * The top right image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinTopRightImage; - - /** - * The right image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinRightImage; - - /** - * The bottom left image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinBottomLeftImage; - - /** - * The bottom image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinBottomImage; - - /** - * The bottom right image of the border for dark BlueBin. - */ - Glib::RefPtr<Gdk::Pixbuf> darkBlueBinBottomRightImage; + Ptr<CornerImages>::Ref whiteWindowImages; /** * The default constructor. @@ -281,17 +225,40 @@ class WidgetFactory : Ptr<Button>::Ref createButton(const Glib::ustring & label) throw (); + /** + * Create a stock button. + * + * @param type the type of the button. + */ + Ptr<ImageButton>::Ref + createButton(ButtonType type) throw (); + /** * Create and return a blue singular container. + * + * @return a blue singular container. */ Ptr<BlueBin>::Ref createBlueBin(void) throw (); /** * Create and return a dark blue singular container. + * + * @return a dark blue singular container. */ Ptr<BlueBin>::Ref createDarkBlueBin(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; + } }; diff --git a/livesupport/modules/widgets/src/BlueBin.cxx b/livesupport/modules/widgets/src/BlueBin.cxx index 0a610072b..64881f75e 100644 --- a/livesupport/modules/widgets/src/BlueBin.cxx +++ b/livesupport/modules/widgets/src/BlueBin.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/BlueBin.cxx,v $ ------------------------------------------------------------------------------*/ @@ -33,6 +33,8 @@ #include "configure.h" #endif +#include <iostream> + #include "LiveSupport/Widgets/BlueBin.h" @@ -49,32 +51,17 @@ using namespace LiveSupport::Widgets; /* ============================================================= module code */ -#include <iostream> /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -BlueBin :: BlueBin(unsigned int backgroundColor, - 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) +BlueBin :: BlueBin(unsigned int backgroundColor, + Ptr<CornerImages>::Ref cornerImages) throw () { set_flags(Gtk::NO_WINDOW); - this->topLeftImage = topLeftImage; - this->leftImage = leftImage; - this->topImage = topImage; - this->topRightImage = topRightImage; - this->rightImage = rightImage; - this->bottomLeftImage = bottomLeftImage; - this->bottomImage = bottomImage; - this->bottomRightImage = bottomRightImage; + this->cornerImages = cornerImages; child = 0; @@ -114,11 +101,11 @@ BlueBin :: on_size_request(Gtk::Requisition* requisition) throw () } requisition->width = width - + leftImage->get_width() - + rightImage->get_width(); + + cornerImages->leftImage->get_width() + + cornerImages->rightImage->get_width(); requisition->height = height - + topImage->get_height() - + bottomImage->get_height(); + + cornerImages->topImage->get_height() + + cornerImages->bottomImage->get_height(); } @@ -142,14 +129,14 @@ BlueBin :: on_size_allocate(Gtk::Allocation& allocation) throw () if (child) { Gtk::Allocation childAlloc; - childAlloc.set_x(leftImage->get_width()); - childAlloc.set_y(topImage->get_height()); + childAlloc.set_x(cornerImages->leftImage->get_width()); + childAlloc.set_y(cornerImages->topImage->get_height()); childAlloc.set_width(allocation.get_width() - - leftImage->get_width() - - rightImage->get_width()); + - cornerImages->leftImage->get_width() + - cornerImages->rightImage->get_width()); childAlloc.set_height(allocation.get_height() - - topImage->get_height() - - bottomImage->get_height()); + - cornerImages->topImage->get_height() + - cornerImages->bottomImage->get_height()); child->size_allocate(childAlloc); } @@ -160,7 +147,6 @@ BlueBin :: on_size_allocate(Gtk::Allocation& allocation) throw () /*------------------------------------------------------------------------------ * Execute a function on all the children. - * As this widget has no children, don't do anything. *----------------------------------------------------------------------------*/ void BlueBin :: forall_vfunc(gboolean includeInternals, @@ -175,7 +161,6 @@ BlueBin :: forall_vfunc(gboolean includeInternals, /*------------------------------------------------------------------------------ * Handle the add child widget event. - * As this widget has no children, don't do anything. *----------------------------------------------------------------------------*/ void BlueBin :: on_add(Gtk::Widget* child) throw () @@ -189,7 +174,6 @@ BlueBin :: on_add(Gtk::Widget* child) throw () /*------------------------------------------------------------------------------ * Handle the remove child widget event. - * As this widget has no children, don't do anything. *----------------------------------------------------------------------------*/ void BlueBin :: on_remove(Gtk::Widget* child) throw () @@ -207,7 +191,6 @@ BlueBin :: 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 BlueBin :: child_type_vfunc() const throw () @@ -313,109 +296,55 @@ BlueBin :: on_expose_event(GdkEventExpose* event) throw () int y; int maxY; - topLeftImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - 0, - 0, - topLeftImage->get_width(), - topLeftImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); + renderImage(cornerImages->topLeftImage, 0, 0); // draw the top side as many times as necessary - x = topLeftImage->get_width(); - maxX = width - topRightImage->get_width(); + x = cornerImages->topLeftImage->get_width(); + maxX = width - cornerImages->topRightImage->get_width(); while (x < maxX) { - topImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - x, - 0, - topImage->get_width(), - topImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); - x += topImage->get_width(); + renderImage(cornerImages->topImage, x, 0); + x += cornerImages->topImage->get_width(); } - topRightImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - width - topRightImage->get_width(), - 0, - topRightImage->get_width(), - topRightImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); + renderImage(cornerImages->topRightImage, + width - cornerImages->topRightImage->get_width(), + 0); // draw the left side as many times as necessary - y = topLeftImage->get_height(); - maxY = height - bottomLeftImage->get_height(); + y = cornerImages->topLeftImage->get_height(); + maxY = height - cornerImages->bottomLeftImage->get_height(); while (y < maxY) { - leftImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - 0, - y, - leftImage->get_width(), - leftImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); - y += leftImage->get_height(); + renderImage(cornerImages->leftImage, 0, y); + y += cornerImages->leftImage->get_height(); } - bottomLeftImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - 0, - height - bottomLeftImage->get_height(), - bottomLeftImage->get_width(), - bottomLeftImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); + renderImage(cornerImages->bottomLeftImage, + 0, + height - cornerImages->bottomLeftImage->get_height()); // draw the right side as many times as necessary - y = topRightImage->get_height(); - maxY = height - bottomRightImage->get_height(); + y = cornerImages->topRightImage->get_height(); + maxY = height - cornerImages->bottomRightImage->get_height(); while (y < maxY) { - rightImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - width - rightImage->get_width(), - y, - rightImage->get_width(), - rightImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); - y += rightImage->get_height(); + renderImage(cornerImages->rightImage, + width - cornerImages->rightImage->get_width(), + y); + y += cornerImages->rightImage->get_height(); } // draw the bottom side as many times as necessary - x = bottomLeftImage->get_width(); - maxX = width - bottomRightImage->get_width(); + x = cornerImages->bottomLeftImage->get_width(); + maxX = width - cornerImages->bottomRightImage->get_width(); while (x < maxX) { - bottomImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - x, - height - bottomImage->get_height(), - bottomImage->get_width(), - bottomImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); - x += bottomImage->get_width(); + renderImage(cornerImages->bottomImage, + x, + height - cornerImages->bottomImage->get_height()); + x += cornerImages->bottomImage->get_width(); } - bottomRightImage->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), - 0, 0, - width - bottomRightImage->get_width(), - height - bottomRightImage->get_height(), - bottomRightImage->get_width(), - bottomRightImage->get_height(), - Gdk::RGB_DITHER_NONE, - 0, 0); + renderImage(cornerImages->bottomRightImage, + width - cornerImages->bottomRightImage->get_width(), + height - cornerImages->bottomRightImage->get_height()); } Gtk::Bin::on_expose_event(event); @@ -424,3 +353,22 @@ BlueBin :: on_expose_event(GdkEventExpose* event) throw () } +/*------------------------------------------------------------------------------ + * Render an image + *----------------------------------------------------------------------------*/ +void +BlueBin :: renderImage(Glib::RefPtr<Gdk::Pixbuf> image, + int x, + int y) throw () +{ + image->render_to_drawable(gdkWindow, + get_style()->get_black_gc(), + 0, 0, + x, + y, + image->get_width(), + image->get_height(), + Gdk::RGB_DITHER_NONE, + 0, 0); +} + diff --git a/livesupport/modules/widgets/src/CornerImages.cxx b/livesupport/modules/widgets/src/CornerImages.cxx new file mode 100644 index 000000000..2941d0bfd --- /dev/null +++ b/livesupport/modules/widgets/src/CornerImages.cxx @@ -0,0 +1,129 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/CornerImages.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ 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; + + if (!(image = Gdk::Pixbuf::create_from_file(path + imageName))) { + throw std::invalid_argument("Missing " + image); + } + + return image; +} + diff --git a/livesupport/modules/widgets/src/ImageButton.cxx b/livesupport/modules/widgets/src/ImageButton.cxx index 1adacb713..62beba415 100644 --- a/livesupport/modules/widgets/src/ImageButton.cxx +++ b/livesupport/modules/widgets/src/ImageButton.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ImageButton.cxx,v $ ------------------------------------------------------------------------------*/ @@ -218,6 +218,12 @@ ImageButton :: on_realize() throw () unset_flags(Gtk::NO_WINDOW); set_window(gdkWindow); + Gdk::Color bgColor; + bgColor.set_rgb(0xffff, 0xffff, 0xffff); + Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap(); + colormap->alloc_color(bgColor); + modify_bg(Gtk::STATE_NORMAL, bgColor); + // make the widget receive expose events gdkWindow->set_user_data(gobj()); @@ -271,7 +277,7 @@ ImageButton :: on_expose_event(GdkEventExpose* event) throw () int y = (get_height() - image->get_height()) / 2; image->render_to_drawable(gdkWindow, - get_style()->get_black_gc(), + get_style()->get_white_gc(), 0, 0, x, y, diff --git a/livesupport/modules/widgets/src/TestWindow.cxx b/livesupport/modules/widgets/src/TestWindow.cxx index bcaf32481..74fcd6dbb 100644 --- a/livesupport/modules/widgets/src/TestWindow.cxx +++ b/livesupport/modules/widgets/src/TestWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -57,17 +57,13 @@ using namespace LiveSupport::Widgets; *----------------------------------------------------------------------------*/ TestWindow :: TestWindow (void) throw () + : WhiteWindow(0xffffff, + WidgetFactory::getInstance()->getWhiteWindowCorners()) { Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance(); // init the imageButton - Glib::RefPtr<Gdk::Pixbuf> passiveImage; - Glib::RefPtr<Gdk::Pixbuf> rollImage; - - passiveImage = Gdk::Pixbuf::create_from_file("var/delete.png"); - rollImage = Gdk::Pixbuf::create_from_file("var/delete_roll.png"); - - imageButton.reset(new ImageButton(passiveImage, rollImage)); + imageButton = widgetFactory->createButton(WidgetFactory::deleteButton); // create a button button = widgetFactory->createButton("Hello, World!"); diff --git a/livesupport/modules/widgets/src/TestWindow.h b/livesupport/modules/widgets/src/TestWindow.h index f084ae54c..d2df6e0ea 100644 --- a/livesupport/modules/widgets/src/TestWindow.h +++ b/livesupport/modules/widgets/src/TestWindow.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -48,6 +48,7 @@ #include "LiveSupport/Widgets/Button.h" #include "LiveSupport/Widgets/ImageButton.h" #include "LiveSupport/Widgets/BlueBin.h" +#include "LiveSupport/Widgets/WhiteWindow.h" namespace LiveSupport { @@ -67,9 +68,9 @@ using namespace LiveSupport::Core; * A window, enabling interactive testing of UI components. * * @author $Author: maroy $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ -class TestWindow : public Gtk::Window +class TestWindow : public WhiteWindow { protected: /** diff --git a/livesupport/modules/widgets/src/WhiteWindow.cxx b/livesupport/modules/widgets/src/WhiteWindow.cxx new file mode 100644 index 000000000..9f636e128 --- /dev/null +++ b/livesupport/modules/widgets/src/WhiteWindow.cxx @@ -0,0 +1,254 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WhiteWindow.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ 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 */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Constructor. + *----------------------------------------------------------------------------*/ +WhiteWindow :: WhiteWindow(unsigned int backgroundColor, + Ptr<CornerImages>::Ref cornerImages) + throw () + : Gtk::Window(Gtk::WINDOW_TOPLEVEL) +{ + set_decorated(false); + + Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance(); + + layout.reset(new Gtk::Table()); + + title.reset(new Gtk::Label("Window Title")); + titleAlignment.reset(new Gtk::Alignment(Gtk::ALIGN_LEFT, + Gtk::ALIGN_CENTER, + 0, 0)); + titleAlignment->add(*title); + layout->attach(*titleAlignment, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK); + + closeButton = wf->createButton(WidgetFactory::deleteButton); + closeButtonAlignment.reset(new Gtk::Alignment(Gtk::ALIGN_RIGHT, + Gtk::ALIGN_CENTER, + 0, 0)); + closeButtonAlignment->add(*closeButton); + layout->attach(*closeButtonAlignment, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); + + childContainer.reset(new Gtk::Alignment(Gtk::ALIGN_CENTER)); + layout->attach(*childContainer, 0, 2, 1, 2); + + blueBin.reset(new BlueBin(backgroundColor, cornerImages)); + blueBin->add(*layout); + Gtk::Window::add(*blueBin); + + show_all(); + + // register signal handlers + add_events(Gdk::ALL_EVENTS_MASK); + title->add_events(Gdk::ALL_EVENTS_MASK); + title->signal_button_press_event().connect(sigc::mem_fun(*this, + &WhiteWindow::onTitleClicked)); + + closeButton->signal_clicked().connect(sigc::mem_fun(*this, + &WhiteWindow::onCloseButtonClicked)); + +} + + +/*------------------------------------------------------------------------------ + * Destructor. + *----------------------------------------------------------------------------*/ +WhiteWindow :: ~WhiteWindow(void) throw () +{ +} + + +/*------------------------------------------------------------------------------ + * Handle the size request event. + *----------------------------------------------------------------------------*/ +void +WhiteWindow :: on_size_request(Gtk::Requisition* requisition) throw () +{ + Gtk::Window::on_size_request(requisition); +} + + +/*------------------------------------------------------------------------------ + * 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.get()) { + 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 == blueBin.get()) { + Gtk::Window::on_remove(child); + } else { + 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 () +{ + return false; +} + + +/*------------------------------------------------------------------------------ + * Event handler for the close button getting clicked. + *----------------------------------------------------------------------------*/ +void +WhiteWindow :: onCloseButtonClicked (void) throw () +{ + hide(); +} + + diff --git a/livesupport/modules/widgets/src/WidgetFactory.cxx b/livesupport/modules/widgets/src/WidgetFactory.cxx index 44bf329c7..02c4dfb43 100644 --- a/livesupport/modules/widgets/src/WidgetFactory.cxx +++ b/livesupport/modules/widgets/src/WidgetFactory.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $ ------------------------------------------------------------------------------*/ @@ -90,88 +90,29 @@ static const std::string buttonRollCenterName = "button/centerRoll.png"; static const std::string buttonRollRightName = "button/rightRoll.png"; /** - * The name of the top left image for BlueBin. + * The relative path for the blue bin images. */ -static const std::string blueBinTopLeftName = "blueBin/topLeft.png"; +static const std::string blueBinPath = "blueBin/"; /** - * The name of the left image for BlueBin. + * The relative path for the dark blue bin images. */ -static const std::string blueBinLeftName = "blueBin/left.png"; +static const std::string darkBlueBinPath = "darkBlueBin/"; /** - * The name of the top image for BlueBin. + * The relative path for the white window images. */ -static const std::string blueBinTopName = "blueBin/top.png"; +static const std::string whiteWindowPath = "whiteWindow/"; /** - * The name of the top right image for BlueBin. + * The name of the passive image for the delete button. */ -static const std::string blueBinTopRightName = "blueBin/topRight.png"; +static const std::string deleteButtonPassiveName = "imageButton/delete.png"; /** - * The name of the right image for BlueBin. + * The name of the rollover image for the delete button. */ -static const std::string blueBinRightName = "blueBin/right.png"; - -/** - * The name of the bottom left image for BlueBin. - */ -static const std::string blueBinBottomLeftName = "blueBin/bottomLeft.png"; - -/** - * The name of the bottom image for BlueBin. - */ -static const std::string blueBinBottomName = "blueBin/bottom.png"; - -/** - * The name of the bottom right image for BlueBin. - */ -static const std::string blueBinBottomRightName = "blueBin/bottomRight.png"; - - -/** - * The name of the top left image for dark BlueBin. - */ -static const std::string darkBlueBinTopLeftName = "darkBlueBin/topLeft.png"; - -/** - * The name of the left image for dark BlueBin. - */ -static const std::string darkBlueBinLeftName = "darkBlueBin/left.png"; - -/** - * The name of the top image for dark BlueBin. - */ -static const std::string darkBlueBinTopName = "darkBlueBin/top.png"; - -/** - * The name of the top right image for dark BlueBin. - */ -static const std::string darkBlueBinTopRightName - = "darkBlueBin/topRight.png"; - -/** - * The name of the right image for dark BlueBin. - */ -static const std::string darkBlueBinRightName = "darkBlueBin/right.png"; - -/** - * The name of the bottom left image for dark BlueBin. - */ -static const std::string darkBlueBinBottomLeftName = - "darkBlueBin/bottomLeft.png"; - -/** - * The name of the bottom image for dark BlueBin. - */ -static const std::string darkBlueBinBottomName = "darkBlueBin/bottom.png"; - -/** - * The name of the bottom right image for dark BlueBin. - */ -static const std::string darkBlueBinBottomRightName - = "darkBlueBin/bottomRight.png"; +static const std::string deleteButtonRollName = "imageButton/deleteRoll.png"; /* =============================================== local function prototypes */ @@ -222,26 +163,12 @@ WidgetFactory :: configure(const xmlpp::Element & element) buttonRollImageCenter = loadImage(buttonRollCenterName); buttonRollImageRight = loadImage(buttonRollRightName); - // load the blue bin images. - blueBinTopLeftImage = loadImage(blueBinTopLeftName); - blueBinLeftImage = loadImage(blueBinLeftName); - blueBinTopImage = loadImage(blueBinTopName); - blueBinTopRightImage = loadImage(blueBinTopRightName); - blueBinRightImage = loadImage(blueBinRightName); - blueBinBottomLeftImage = loadImage(blueBinBottomLeftName); - blueBinBottomImage = loadImage(blueBinBottomName); - blueBinBottomRightImage = loadImage(blueBinBottomRightName); - - // load the dark blue bin images. - darkBlueBinTopLeftImage = loadImage(darkBlueBinTopLeftName); - darkBlueBinLeftImage = loadImage(darkBlueBinLeftName); - darkBlueBinTopImage = loadImage(darkBlueBinTopName); - darkBlueBinTopRightImage = loadImage(darkBlueBinTopRightName); - darkBlueBinRightImage = loadImage(darkBlueBinRightName); - darkBlueBinBottomLeftImage = loadImage(darkBlueBinBottomLeftName); - darkBlueBinBottomImage = loadImage(darkBlueBinBottomName); - darkBlueBinBottomRightImage = loadImage(darkBlueBinBottomRightName); + // load the images for the bins + blueBinImages.reset(new CornerImages(path + blueBinPath)); + darkBlueBinImages.reset(new CornerImages(path + darkBlueBinPath)); + // load the white window corner images + whiteWindowImages.reset(new CornerImages(path + whiteWindowPath)); } @@ -286,15 +213,7 @@ WidgetFactory :: createButton(const Glib::ustring & label) throw () Ptr<BlueBin>::Ref WidgetFactory :: createBlueBin(void) throw () { - Ptr<BlueBin>::Ref blueBin(new BlueBin(0xcfdee7, - blueBinTopLeftImage, - blueBinLeftImage, - blueBinTopImage, - blueBinTopRightImage, - blueBinRightImage, - blueBinBottomLeftImage, - blueBinBottomImage, - blueBinBottomRightImage)); + Ptr<BlueBin>::Ref blueBin(new BlueBin(0xcfdee7, blueBinImages)); return blueBin; } @@ -306,17 +225,30 @@ WidgetFactory :: createBlueBin(void) throw () Ptr<BlueBin>::Ref WidgetFactory :: createDarkBlueBin(void) throw () { - Ptr<BlueBin>::Ref blueBin(new BlueBin(0x99cdff, - darkBlueBinTopLeftImage, - darkBlueBinLeftImage, - darkBlueBinTopImage, - darkBlueBinTopRightImage, - darkBlueBinRightImage, - darkBlueBinBottomLeftImage, - darkBlueBinBottomImage, - darkBlueBinBottomRightImage)); + Ptr<BlueBin>::Ref blueBin(new BlueBin(0x99cdff, darkBlueBinImages)); return blueBin; } +/*------------------------------------------------------------------------------ + * Create a stock button + *----------------------------------------------------------------------------*/ +Ptr<ImageButton>::Ref +WidgetFactory :: createButton(ButtonType type) throw () +{ + Glib::RefPtr<Gdk::Pixbuf> passiveImage; + Glib::RefPtr<Gdk::Pixbuf> rollImage; + + switch (type) { + case deleteButton: + default: + passiveImage = loadImage(deleteButtonPassiveName); + rollImage = loadImage(deleteButtonRollName); + } + + Ptr<ImageButton>::Ref button(new ImageButton(passiveImage, rollImage)); + + return button; +} + diff --git a/livesupport/modules/widgets/var/imageButton/delete.png b/livesupport/modules/widgets/var/imageButton/delete.png new file mode 100644 index 000000000..b899310ea Binary files /dev/null and b/livesupport/modules/widgets/var/imageButton/delete.png differ diff --git a/livesupport/modules/widgets/var/imageButton/deleteRoll.png b/livesupport/modules/widgets/var/imageButton/deleteRoll.png new file mode 100644 index 000000000..e47755ec0 Binary files /dev/null and b/livesupport/modules/widgets/var/imageButton/deleteRoll.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/bottom.png b/livesupport/modules/widgets/var/whiteWindow/bottom.png new file mode 100644 index 000000000..b177658af Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/bottom.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/bottomLeft.png b/livesupport/modules/widgets/var/whiteWindow/bottomLeft.png new file mode 100644 index 000000000..bd9231441 Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/bottomLeft.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/bottomRight.png b/livesupport/modules/widgets/var/whiteWindow/bottomRight.png new file mode 100644 index 000000000..eb9afc633 Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/bottomRight.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/left.png b/livesupport/modules/widgets/var/whiteWindow/left.png new file mode 100644 index 000000000..4ff356163 Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/left.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/right.png b/livesupport/modules/widgets/var/whiteWindow/right.png new file mode 100644 index 000000000..b676e704f Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/right.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/top.png b/livesupport/modules/widgets/var/whiteWindow/top.png new file mode 100644 index 000000000..d2d5906b5 Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/top.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/topLeft.png b/livesupport/modules/widgets/var/whiteWindow/topLeft.png new file mode 100644 index 000000000..5d8b8f67a Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/topLeft.png differ diff --git a/livesupport/modules/widgets/var/whiteWindow/topRight.png b/livesupport/modules/widgets/var/whiteWindow/topRight.png new file mode 100644 index 000000000..d474ba11b Binary files /dev/null and b/livesupport/modules/widgets/var/whiteWindow/topRight.png differ