diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h index ae73928cb..5fe968d35 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.5 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include #include #include +#include #include #include "LiveSupport/Core/Ptr.h" @@ -68,8 +69,8 @@ using namespace LiveSupport::Core; /** * A container holding exactly one child, habing a light blue border to it. * - * @author $Author: maroy $ - * @version $Revision: 1.5 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.6 $ */ class WhiteWindow : public Gtk::Window { @@ -119,6 +120,21 @@ class WhiteWindow : public Gtk::Window */ 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. */ @@ -139,6 +155,15 @@ class WhiteWindow : public Gtk::Window 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. + */ + bool + onResizeClicked(GdkEventButton * event) throw (); + /** * Default constructor. */ diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h index 4be797617..da3949fb9 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: fgerlits $ - Version : $Revision: 1.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $ ------------------------------------------------------------------------------*/ @@ -41,6 +41,7 @@ #endif #include +#include #include "LiveSupport/Core/Configurable.h" @@ -85,7 +86,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ class WidgetFactory : virtual public Configurable @@ -165,6 +166,11 @@ class WidgetFactory : */ Glib::RefPtr comboBoxRightImage; + /** + * The image for the resize handle. + */ + Glib::RefPtr resizeImage; + /** * The default constructor. */ @@ -302,6 +308,16 @@ class WidgetFactory : { return whiteWindowImages; } + + /** + * Create and return a container holding a resize image. + * It is the reponsibility of the caller to dispose of the created + * object properly. + * + * @return the container holding the resize image. + */ + Gtk::Image * + createResizeImage(void) throw (); }; diff --git a/livesupport/modules/widgets/src/CornerImages.cxx b/livesupport/modules/widgets/src/CornerImages.cxx index 2941d0bfd..d300a80c4 100644 --- a/livesupport/modules/widgets/src/CornerImages.cxx +++ b/livesupport/modules/widgets/src/CornerImages.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/CornerImages.cxx,v $ ------------------------------------------------------------------------------*/ @@ -123,6 +123,10 @@ CornerImages :: loadImage(const std::string path, if (!(image = Gdk::Pixbuf::create_from_file(path + imageName))) { throw std::invalid_argument("Missing " + image); } + + // activate alpha channel (transparency) +// but it doesn't seem to work :( +// image->add_alpha(false, 0, 0, 0); return image; } diff --git a/livesupport/modules/widgets/src/WhiteWindow.cxx b/livesupport/modules/widgets/src/WhiteWindow.cxx index fa88a721f..c60b2bf31 100644 --- a/livesupport/modules/widgets/src/WhiteWindow.cxx +++ b/livesupport/modules/widgets/src/WhiteWindow.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.6 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WhiteWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -104,6 +104,17 @@ WhiteWindow :: WhiteWindow(Glib::ustring title, childContainer = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_CENTER)); layout->attach(*childContainer, 0, 2, 1, 2); + // create the resize image + resizeImage = Gtk::manage(wf->createResizeImage()); + 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); + // add the corners blueBin = Gtk::manage(new BlueBin(backgroundColor, cornerImages)); blueBin->add(*layout); @@ -120,6 +131,9 @@ WhiteWindow :: WhiteWindow(Glib::ustring title, closeButton->signal_clicked().connect(sigc::mem_fun(*this, &WhiteWindow::onCloseButtonClicked)); + resizeEventBox->add_events(Gdk::BUTTON_PRESS_MASK); + resizeEventBox->signal_button_press_event().connect(sigc::mem_fun(*this, + &WhiteWindow::onResizeClicked)); } @@ -321,3 +335,21 @@ WhiteWindow :: set_default_size(int 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 false; +} + diff --git a/livesupport/modules/widgets/src/WidgetFactory.cxx b/livesupport/modules/widgets/src/WidgetFactory.cxx index a4f218013..2385fb557 100644 --- a/livesupport/modules/widgets/src/WidgetFactory.cxx +++ b/livesupport/modules/widgets/src/WidgetFactory.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $ ------------------------------------------------------------------------------*/ @@ -152,6 +152,11 @@ static const std::string comboBoxCenterName = "combo/center.png"; */ static const std::string comboBoxRightName = "combo/right.png"; +/** + * The name of the image for the resize handle. + */ +static const std::string resizeName = "whiteWindow/resize.png"; + /* =============================================== local function prototypes */ @@ -209,6 +214,9 @@ WidgetFactory :: configure(const xmlpp::Element & element) // load the white window corner images whiteWindowImages.reset(new CornerImages(path + whiteWindowPath)); + + // load the bottom right resize image + resizeImage = loadImage(resizeName); } @@ -328,3 +336,13 @@ WidgetFactory :: createButton(ImageButtonType type) throw () return new ImageButton(passiveImage, rollImage); } + +/*------------------------------------------------------------------------------ + * Create a resize image + *----------------------------------------------------------------------------*/ +Gtk::Image * +WidgetFactory :: createResizeImage(void) throw () +{ + return new Gtk::Image(resizeImage); +} +