added darkBlueBin

added set_label and get_label for Button
This commit is contained in:
maroy 2005-02-03 13:08:40 +00:00
parent 689fbf12d5
commit c92e65a824
14 changed files with 164 additions and 14 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h,v $
------------------------------------------------------------------------------*/
@ -62,7 +62,7 @@ using namespace LiveSupport::Core;
* A container holding exactly one child, habing a light blue border to it.
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class BlueBin : public Gtk::Bin
{
@ -231,6 +231,7 @@ 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
@ -240,7 +241,8 @@ class BlueBin : public Gtk::Bin
* @param bottomImage the bottom image of the border
* @param bottomRightImage the bottom right image of the border
*/
BlueBin(Glib::RefPtr<Gdk::Pixbuf> topLeftImage,
BlueBin(unsigned int backgroundColor,
Glib::RefPtr<Gdk::Pixbuf> topLeftImage,
Glib::RefPtr<Gdk::Pixbuf> leftImage,
Glib::RefPtr<Gdk::Pixbuf> topImage,
Glib::RefPtr<Gdk::Pixbuf> topRightImage,

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/Button.h,v $
------------------------------------------------------------------------------*/
@ -63,7 +63,7 @@ using namespace LiveSupport::Core;
* A button holding a text.
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class Button : public Gtk::Button
{
@ -274,6 +274,28 @@ class Button : public Gtk::Button
*/
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 ()
{
this->label->set_label(label);
}
/**
* Get the label of the button.
*
* @return the current label of the button.
*/
Glib::ustring
get_label(void) const throw ()
{
return this->label->get_label();
}
};

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
------------------------------------------------------------------------------*/
@ -80,7 +80,7 @@ using namespace LiveSupport::Core;
* </code></pre>
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class WidgetFactory :
virtual public Configurable
@ -171,6 +171,46 @@ class WidgetFactory :
*/
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;
/**
* The default constructor.
*/
@ -246,6 +286,12 @@ class WidgetFactory :
*/
Ptr<BlueBin>::Ref
createBlueBin(void) throw ();
/**
* Create and return a dark blue singular container.
*/
Ptr<BlueBin>::Ref
createDarkBlueBin(void) throw ();
};

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/BlueBin.cxx,v $
------------------------------------------------------------------------------*/
@ -49,11 +49,13 @@ using namespace LiveSupport::Widgets;
/* ============================================================= module code */
#include <iostream>
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
BlueBin :: BlueBin(Glib::RefPtr<Gdk::Pixbuf> topLeftImage,
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,
@ -77,7 +79,10 @@ BlueBin :: BlueBin(Glib::RefPtr<Gdk::Pixbuf> topLeftImage,
child = 0;
bgColor = Gdk::Color();
bgColor.set_rgb(0xcf00, 0xde00, 0xe700);
unsigned int red = (backgroundColor & 0xff0000) >> 8;
unsigned int green = (backgroundColor & 0x00ff00);
unsigned int blue = (backgroundColor & 0x0000ff) << 8;
bgColor.set_rgb(red, green, blue);
Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();
colormap->alloc_color(bgColor);
}

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -73,7 +73,7 @@ TestWindow :: TestWindow (void)
button = widgetFactory->createButton("Hello, World!");
// create a blue container
blueBin = widgetFactory->createBlueBin();
blueBin = widgetFactory->createDarkBlueBin();
// create and set up the layout
layout.reset(new Gtk::Table());

View File

@ -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/WidgetFactory.cxx,v $
------------------------------------------------------------------------------*/
@ -130,6 +130,50 @@ static const std::string blueBinBottomName = "blueBin/bottom.png";
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";
/* =============================================== local function prototypes */
@ -188,6 +232,16 @@ WidgetFactory :: configure(const xmlpp::Element & element)
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);
}
@ -232,7 +286,8 @@ WidgetFactory :: createButton(const Glib::ustring & label) throw ()
Ptr<BlueBin>::Ref
WidgetFactory :: createBlueBin(void) throw ()
{
Ptr<BlueBin>::Ref blueBin(new BlueBin(blueBinTopLeftImage,
Ptr<BlueBin>::Ref blueBin(new BlueBin(0xcfdee7,
blueBinTopLeftImage,
blueBinLeftImage,
blueBinTopImage,
blueBinTopRightImage,
@ -245,3 +300,23 @@ WidgetFactory :: createBlueBin(void) throw ()
}
/*------------------------------------------------------------------------------
* Create a dark blue bin
*----------------------------------------------------------------------------*/
Ptr<BlueBin>::Ref
WidgetFactory :: createDarkBlueBin(void) throw ()
{
Ptr<BlueBin>::Ref blueBin(new BlueBin(0x99cdff,
darkBlueBinTopLeftImage,
darkBlueBinLeftImage,
darkBlueBinTopImage,
darkBlueBinTopRightImage,
darkBlueBinRightImage,
darkBlueBinBottomLeftImage,
darkBlueBinBottomImage,
darkBlueBinBottomRightImage));
return blueBin;
}

Binary file not shown.

After

(image error) Size: 2.8 KiB

Binary file not shown.

After

(image error) Size: 2.8 KiB

Binary file not shown.

After

(image error) Size: 2.8 KiB

Binary file not shown.

After

(image error) Size: 2.8 KiB

Binary file not shown.

After

(image error) Size: 2.8 KiB

Binary file not shown.

After

(image error) Size: 2.7 KiB

Binary file not shown.

After

(image error) Size: 2.8 KiB

Binary file not shown.

After

(image error) Size: 2.8 KiB