updated code, so that all child widgets are Gtk::manage'd
This commit is contained in:
parent
9f224b6fb5
commit
59c4e916c0
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/BlueBin.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -63,7 +63,7 @@ using namespace LiveSupport::Core;
|
||||||
* A container holding exactly one child, habing a light blue border to it.
|
* A container holding exactly one child, habing a light blue border to it.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.5 $
|
||||||
*/
|
*/
|
||||||
class BlueBin : public Gtk::Bin
|
class BlueBin : public Gtk::Bin
|
||||||
{
|
{
|
||||||
|
@ -112,6 +112,7 @@ class BlueBin : public Gtk::Bin
|
||||||
int x,
|
int x,
|
||||||
int y) throw ();
|
int y) throw ();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Return the background color.
|
* Return the background color.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/Button.h,v $
|
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.
|
* A button holding a text.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.2 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
class Button : public Gtk::Button
|
class Button : public Gtk::Button
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ class Button : public Gtk::Button
|
||||||
/**
|
/**
|
||||||
* The text displayed inside the button.
|
* The text displayed inside the button.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Label>::Ref label;
|
Gtk::Label * label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The state of the button.
|
* The state of the button.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -64,7 +64,7 @@ using namespace LiveSupport::Core;
|
||||||
* A combo box holding text entries.
|
* A combo box holding text entries.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
class ComboBoxText : public Gtk::ComboBoxText
|
class ComboBoxText : public Gtk::ComboBoxText
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ class ComboBoxText : public Gtk::ComboBoxText
|
||||||
/**
|
/**
|
||||||
* The text displayed inside the button.
|
* The text displayed inside the button.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Label>::Ref label;
|
Gtk::Label * label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The X coordinate of the label.
|
* The X coordinate of the label.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -64,7 +64,7 @@ using namespace LiveSupport::Core;
|
||||||
* A container, holding a Gtk::Entry as its only child.
|
* A container, holding a Gtk::Entry as its only child.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
class EntryBin : public BlueBin
|
class EntryBin : public BlueBin
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ class EntryBin : public BlueBin
|
||||||
/**
|
/**
|
||||||
* The text entry for this container.
|
* The text entry for this container.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Entry>::Ref entry;
|
Gtk::Entry * entry;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -97,7 +97,7 @@ class EntryBin : public BlueBin
|
||||||
*
|
*
|
||||||
* @return the entry held in this container.
|
* @return the entry held in this container.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Entry>::Ref
|
Gtk::Entry *
|
||||||
getEntry(void) throw ()
|
getEntry(void) throw ()
|
||||||
{
|
{
|
||||||
return entry;
|
return entry;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -69,7 +69,7 @@ using namespace LiveSupport::Core;
|
||||||
* A container holding exactly one child, habing a light blue border to it.
|
* A container holding exactly one child, habing a light blue border to it.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
class WhiteWindow : public Gtk::Window
|
class WhiteWindow : public Gtk::Window
|
||||||
{
|
{
|
||||||
|
@ -77,42 +77,42 @@ class WhiteWindow : public Gtk::Window
|
||||||
/**
|
/**
|
||||||
* The rounded container for the window.
|
* The rounded container for the window.
|
||||||
*/
|
*/
|
||||||
Ptr<BlueBin>::Ref blueBin;
|
BlueBin * blueBin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The layout of the window.
|
* The layout of the window.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Table>::Ref layout;
|
Gtk::Table * layout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The event box for the title, enabling capturing mouse events.
|
* The event box for the title, enabling capturing mouse events.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::EventBox>::Ref titleEventBox;
|
Gtk::EventBox * titleEventBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The left alignment contaner for the title.
|
* The left alignment contaner for the title.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Alignment>::Ref titleAlignment;
|
Gtk::Alignment * titleAlignment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The title of the window.
|
* The title of the window.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Label>::Ref title;
|
Gtk::Label * title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The right alignment contaner for the close button.
|
* The right alignment contaner for the close button.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Alignment>::Ref closeButtonAlignment;
|
Gtk::Alignment * closeButtonAlignment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The close button.
|
* The close button.
|
||||||
*/
|
*/
|
||||||
Ptr<ImageButton>::Ref closeButton;
|
ImageButton * closeButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just a container for the main content of the window.
|
* Just a container for the main content of the window.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Alignment>::Ref childContainer;
|
Gtk::Alignment * childContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The event handler for the title being clicked on.
|
* The event handler for the title being clicked on.
|
||||||
|
@ -247,6 +247,22 @@ class WhiteWindow : public Gtk::Window
|
||||||
*/
|
*/
|
||||||
virtual
|
virtual
|
||||||
~WhiteWindow(void) throw ();
|
~WhiteWindow(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the title of the window.
|
||||||
|
*
|
||||||
|
* @param title the title of the window.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
set_title(const Glib::ustring & title) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the title of the window.
|
||||||
|
*
|
||||||
|
* @return the title of the window.
|
||||||
|
*/
|
||||||
|
Glib::ustring
|
||||||
|
get_title(void) const throw ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -84,7 +84,7 @@ using namespace LiveSupport::Core;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.6 $
|
||||||
*/
|
*/
|
||||||
class WidgetFactory :
|
class WidgetFactory :
|
||||||
virtual public Configurable
|
virtual public Configurable
|
||||||
|
@ -241,50 +241,64 @@ class WidgetFactory :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and return a button.
|
* Create and return a button.
|
||||||
|
* It is the reponsibility of the caller to dispose of the created
|
||||||
|
* object properly.
|
||||||
*
|
*
|
||||||
* @param label the label shown inside the button.
|
* @param label the label shown inside the button.
|
||||||
|
* @return a button with the specified label.
|
||||||
*/
|
*/
|
||||||
Ptr<Button>::Ref
|
Button *
|
||||||
createButton(const Glib::ustring & label) throw ();
|
createButton(const Glib::ustring & label) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a stock button.
|
* 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.
|
* @param type the type of the button.
|
||||||
|
* @return a button of the requested type, or 0
|
||||||
*/
|
*/
|
||||||
Ptr<ImageButton>::Ref
|
ImageButton *
|
||||||
createButton(ButtonType type) throw ();
|
createButton(ButtonType type) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a combo box, that holds text entries.
|
* 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.
|
* @return a combo box, that holds text entries.
|
||||||
*/
|
*/
|
||||||
Ptr<ComboBoxText>::Ref
|
ComboBoxText *
|
||||||
createComboBoxText(void) throw ();
|
createComboBoxText(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and return a blue singular container.
|
* 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.
|
* @return a blue singular container.
|
||||||
*/
|
*/
|
||||||
Ptr<BlueBin>::Ref
|
BlueBin *
|
||||||
createBlueBin(void) throw ();
|
createBlueBin(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and return a dark blue singular container.
|
* 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.
|
* @return a dark blue singular container.
|
||||||
*/
|
*/
|
||||||
Ptr<BlueBin>::Ref
|
BlueBin *
|
||||||
createDarkBlueBin(void) throw ();
|
createDarkBlueBin(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and return a singular container holding a text entry.
|
* 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.
|
* @return a singular container holding a text entry.
|
||||||
*/
|
*/
|
||||||
Ptr<EntryBin>::Ref
|
EntryBin *
|
||||||
createEntryBin(void) throw ();
|
createEntryBin(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/BlueBin.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/BlueBin.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -63,7 +63,7 @@ BlueBin :: BlueBin(unsigned int backgroundColor,
|
||||||
this->cornerImages = cornerImages;
|
this->cornerImages = cornerImages;
|
||||||
|
|
||||||
child = 0;
|
child = 0;
|
||||||
|
|
||||||
bgColor = Gdk::Color();
|
bgColor = Gdk::Color();
|
||||||
unsigned int red = (backgroundColor & 0xff0000) >> 8;
|
unsigned int red = (backgroundColor & 0xff0000) >> 8;
|
||||||
unsigned int green = (backgroundColor & 0x00ff00);
|
unsigned int green = (backgroundColor & 0x00ff00);
|
||||||
|
@ -79,6 +79,7 @@ BlueBin :: BlueBin(unsigned int backgroundColor,
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
BlueBin :: ~BlueBin(void) throw ()
|
BlueBin :: ~BlueBin(void) throw ()
|
||||||
{
|
{
|
||||||
|
on_remove(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +178,7 @@ BlueBin :: on_add(Gtk::Widget* child) throw ()
|
||||||
void
|
void
|
||||||
BlueBin :: on_remove(Gtk::Widget* child) throw ()
|
BlueBin :: on_remove(Gtk::Widget* child) throw ()
|
||||||
{
|
{
|
||||||
if (this->child == child) {
|
if (child && this->child == child && child->get_parent() == this) {
|
||||||
this->child = 0;
|
this->child = 0;
|
||||||
bool visible = child->is_visible();
|
bool visible = child->is_visible();
|
||||||
child->unparent();
|
child->unparent();
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/Button.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/Button.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -69,7 +69,7 @@ Button :: Button(const Glib::ustring & label,
|
||||||
this->rollImageCenter.clear();
|
this->rollImageCenter.clear();
|
||||||
this->rollImageRight.clear();
|
this->rollImageRight.clear();
|
||||||
|
|
||||||
this->label.reset(new Gtk::Label(label));
|
this->label = Gtk::manage(new Gtk::Label(label));
|
||||||
this->label->set_parent(*this);
|
this->label->set_parent(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ Button :: Button(const Glib::ustring & label,
|
||||||
this->rollImageCenter = rollImageCenter;
|
this->rollImageCenter = rollImageCenter;
|
||||||
this->rollImageRight = rollImageRight;
|
this->rollImageRight = rollImageRight;
|
||||||
|
|
||||||
this->label.reset(new Gtk::Label(label));
|
this->label = Gtk::manage(new Gtk::Label(label));
|
||||||
this->label->modify_font(Pango::FontDescription("Bitstream Vera 10"));
|
this->label->modify_font(Pango::FontDescription("Bitstream Vera 10"));
|
||||||
this->label->set_parent(*this);
|
this->label->set_parent(*this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ComboBoxText.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ComboBoxText.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -64,7 +64,7 @@ ComboBoxText :: ComboBoxText(Glib::RefPtr<Gdk::Pixbuf> leftImage,
|
||||||
this->centerImage = centerImage;
|
this->centerImage = centerImage;
|
||||||
this->rightImage = rightImage;
|
this->rightImage = rightImage;
|
||||||
|
|
||||||
label.reset(new Gtk::Label(""));
|
label = Gtk::manage(new Gtk::Label(""));
|
||||||
label->set_parent(*this);
|
label->set_parent(*this);
|
||||||
|
|
||||||
// specify a white background
|
// specify a white background
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/EntryBin.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/EntryBin.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -59,12 +59,20 @@ EntryBin :: EntryBin(unsigned int backgroundColor,
|
||||||
throw ()
|
throw ()
|
||||||
: BlueBin(backgroundColor, cornerImages)
|
: BlueBin(backgroundColor, cornerImages)
|
||||||
{
|
{
|
||||||
entry.reset(new Gtk::Entry());
|
entry = Gtk::manage(new Gtk::Entry());
|
||||||
entry->set_has_frame(false);
|
entry->set_has_frame(false);
|
||||||
|
|
||||||
// TODO: this doesn't change the background color, for some reason :(
|
// TODO: this doesn't change the background color, for some reason :(
|
||||||
entry->modify_bg(Gtk::STATE_NORMAL, getBgColor());
|
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);
|
add(*entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.9 $
|
Version : $Revision: 1.10 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -64,27 +64,28 @@ TestWindow :: TestWindow (void)
|
||||||
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
||||||
|
|
||||||
// init the imageButton
|
// init the imageButton
|
||||||
imageButton = widgetFactory->createButton(WidgetFactory::deleteButton);
|
imageButton = Gtk::manage(
|
||||||
|
widgetFactory->createButton(WidgetFactory::deleteButton));
|
||||||
|
|
||||||
// create a button
|
// create a button
|
||||||
button = widgetFactory->createButton("Hello, World!");
|
button = Gtk::manage(widgetFactory->createButton("Hello, World!"));
|
||||||
|
|
||||||
// create a combo box
|
// create a combo box
|
||||||
comboBoxText = widgetFactory->createComboBoxText();
|
comboBoxText = Gtk::manage(widgetFactory->createComboBoxText());
|
||||||
comboBoxText->append_text("item1");
|
comboBoxText->append_text("item1");
|
||||||
comboBoxText->append_text("long item2");
|
comboBoxText->append_text("long item2");
|
||||||
comboBoxText->append_text("very very very long item3");
|
comboBoxText->append_text("very very very long item3");
|
||||||
comboBoxText->set_active_text("item2");
|
comboBoxText->set_active_text("item2");
|
||||||
|
|
||||||
// create a text entry, ant put it inside a blue bin
|
// create a text entry, ant put it inside a blue bin
|
||||||
entryBin = widgetFactory->createEntryBin();
|
entryBin = Gtk::manage(widgetFactory->createEntryBin());
|
||||||
entry = entryBin->getEntry();
|
entry = entryBin->getEntry();
|
||||||
|
|
||||||
// create a blue container
|
// create a blue container
|
||||||
blueBin = widgetFactory->createDarkBlueBin();
|
blueBin = Gtk::manage(widgetFactory->createDarkBlueBin());
|
||||||
|
|
||||||
// create and set up the layout
|
// create and set up the layout
|
||||||
layout.reset(new Gtk::Table());
|
layout = Gtk::manage(new Gtk::Table());
|
||||||
layout->attach(*imageButton, 0, 1, 0, 1);
|
layout->attach(*imageButton, 0, 1, 0, 1);
|
||||||
layout->attach(*button, 0, 1, 1, 2);
|
layout->attach(*button, 0, 1, 1, 2);
|
||||||
layout->attach(*comboBoxText, 0, 1, 2, 3);
|
layout->attach(*comboBoxText, 0, 1, 2, 3);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/TestWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -71,7 +71,7 @@ using namespace LiveSupport::Core;
|
||||||
* A window, enabling interactive testing of UI components.
|
* A window, enabling interactive testing of UI components.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
class TestWindow : public WhiteWindow
|
class TestWindow : public WhiteWindow
|
||||||
{
|
{
|
||||||
|
@ -79,37 +79,37 @@ class TestWindow : public WhiteWindow
|
||||||
/**
|
/**
|
||||||
* The layout used in the window.
|
* The layout used in the window.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Table>::Ref layout;
|
Gtk::Table * layout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An image button.
|
* An image button.
|
||||||
*/
|
*/
|
||||||
Ptr<ImageButton>::Ref imageButton;
|
ImageButton * imageButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A button.
|
* A button.
|
||||||
*/
|
*/
|
||||||
Ptr<Button>::Ref button;
|
Button * button;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A combo box.
|
* A combo box.
|
||||||
*/
|
*/
|
||||||
Ptr<ComboBoxText>::Ref comboBoxText;
|
ComboBoxText * comboBoxText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A text entry.
|
* A text entry.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Entry>::Ref entry;
|
Gtk::Entry * entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container holding a text entry.
|
* A container holding a text entry.
|
||||||
*/
|
*/
|
||||||
Ptr<EntryBin>::Ref entryBin;
|
EntryBin * entryBin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A blue container.
|
* A blue container.
|
||||||
*/
|
*/
|
||||||
Ptr<BlueBin>::Ref blueBin;
|
BlueBin * blueBin;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WhiteWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WhiteWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -66,7 +66,7 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
|
||||||
|
|
||||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||||
|
|
||||||
layout.reset(new Gtk::Table());
|
layout = Gtk::manage(new Gtk::Table());
|
||||||
|
|
||||||
// create the background color, as it is needed by the event box
|
// create the background color, as it is needed by the event box
|
||||||
Gdk::Color bgColor = Gdk::Color();
|
Gdk::Color bgColor = Gdk::Color();
|
||||||
|
@ -78,12 +78,12 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
|
||||||
colormap->alloc_color(bgColor);
|
colormap->alloc_color(bgColor);
|
||||||
|
|
||||||
// set the window title
|
// set the window title
|
||||||
this->title.reset(new Gtk::Label(title));
|
this->title = Gtk::manage(new Gtk::Label(title));
|
||||||
this->title->modify_font(Pango::FontDescription("Bitstream Vera 10"));
|
this->title->modify_font(Pango::FontDescription("Bitstream Vera 10"));
|
||||||
titleAlignment.reset(new Gtk::Alignment(Gtk::ALIGN_LEFT,
|
titleAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_LEFT,
|
||||||
Gtk::ALIGN_CENTER,
|
Gtk::ALIGN_CENTER,
|
||||||
0, 0));
|
0, 0));
|
||||||
titleEventBox.reset(new Gtk::EventBox());
|
titleEventBox = Gtk::manage(new Gtk::EventBox());
|
||||||
titleEventBox->set_visible_window();
|
titleEventBox->set_visible_window();
|
||||||
titleEventBox->modify_bg(Gtk::STATE_NORMAL, bgColor);
|
titleEventBox->modify_bg(Gtk::STATE_NORMAL, bgColor);
|
||||||
titleAlignment->add(*this->title);
|
titleAlignment->add(*this->title);
|
||||||
|
@ -91,19 +91,19 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
|
||||||
layout->attach(*titleEventBox, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
layout->attach(*titleEventBox, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
||||||
|
|
||||||
// create the close button
|
// create the close button
|
||||||
closeButton = wf->createButton(WidgetFactory::deleteButton);
|
closeButton = Gtk::manage(wf->createButton(WidgetFactory::deleteButton));
|
||||||
closeButtonAlignment.reset(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
|
closeButtonAlignment = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_RIGHT,
|
||||||
Gtk::ALIGN_CENTER,
|
Gtk::ALIGN_CENTER,
|
||||||
0, 0));
|
0, 0));
|
||||||
closeButtonAlignment->add(*closeButton);
|
closeButtonAlignment->add(*closeButton);
|
||||||
layout->attach(*closeButtonAlignment, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
layout->attach(*closeButtonAlignment, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
|
||||||
|
|
||||||
// add the child container
|
// add the child container
|
||||||
childContainer.reset(new Gtk::Alignment(Gtk::ALIGN_CENTER));
|
childContainer = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_CENTER));
|
||||||
layout->attach(*childContainer, 0, 2, 1, 2);
|
layout->attach(*childContainer, 0, 2, 1, 2);
|
||||||
|
|
||||||
// add the corners
|
// add the corners
|
||||||
blueBin.reset(new BlueBin(backgroundColor, cornerImages));
|
blueBin = Gtk::manage(new BlueBin(backgroundColor, cornerImages));
|
||||||
blueBin->add(*layout);
|
blueBin->add(*layout);
|
||||||
Gtk::Window::add(*blueBin);
|
Gtk::Window::add(*blueBin);
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ WhiteWindow :: WhiteWindow(Glib::ustring title,
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
WhiteWindow :: ~WhiteWindow(void) throw ()
|
WhiteWindow :: ~WhiteWindow(void) throw ()
|
||||||
{
|
{
|
||||||
|
on_remove(blueBin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ WhiteWindow :: forall_vfunc(gboolean includeInternals,
|
||||||
void
|
void
|
||||||
WhiteWindow :: on_add(Gtk::Widget* child) throw ()
|
WhiteWindow :: on_add(Gtk::Widget* child) throw ()
|
||||||
{
|
{
|
||||||
if (child == blueBin.get()) {
|
if (child == blueBin) {
|
||||||
Gtk::Window::on_add(child);
|
Gtk::Window::on_add(child);
|
||||||
} else {
|
} else {
|
||||||
childContainer->add(*child);
|
childContainer->add(*child);
|
||||||
|
@ -183,10 +184,12 @@ WhiteWindow :: on_add(Gtk::Widget* child) throw ()
|
||||||
void
|
void
|
||||||
WhiteWindow :: on_remove(Gtk::Widget* child) throw ()
|
WhiteWindow :: on_remove(Gtk::Widget* child) throw ()
|
||||||
{
|
{
|
||||||
if (child == blueBin.get()) {
|
if (child) {
|
||||||
Gtk::Window::on_remove(child);
|
if (child == blueBin && child->get_parent() == this) {
|
||||||
} else {
|
Gtk::Window::on_remove(child);
|
||||||
childContainer->remove();
|
} else if (child == childContainer->get_child()) {
|
||||||
|
childContainer->remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,3 +281,22 @@ WhiteWindow :: onCloseButtonClicked (void) throw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set the title of the window.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
WhiteWindow :: set_title(const Glib::ustring & title) throw ()
|
||||||
|
{
|
||||||
|
this->title->set_label(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Get the title of the window.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Glib::ustring
|
||||||
|
WhiteWindow :: get_title(void) const throw ()
|
||||||
|
{
|
||||||
|
return title->get_label();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -220,75 +220,65 @@ WidgetFactory :: loadImage(const std::string imageName)
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create a button
|
* Create a button
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<Button>::Ref
|
Button *
|
||||||
WidgetFactory :: createButton(const Glib::ustring & label) throw ()
|
WidgetFactory :: createButton(const Glib::ustring & label) throw ()
|
||||||
{
|
{
|
||||||
Ptr<Button>::Ref button(new Button(label,
|
return new Button(label,
|
||||||
buttonPassiveImageLeft,
|
buttonPassiveImageLeft,
|
||||||
buttonPassiveImageCenter,
|
buttonPassiveImageCenter,
|
||||||
buttonPassiveImageRight,
|
buttonPassiveImageRight,
|
||||||
buttonRollImageLeft,
|
buttonRollImageLeft,
|
||||||
buttonRollImageCenter,
|
buttonRollImageCenter,
|
||||||
buttonRollImageRight));
|
buttonRollImageRight);
|
||||||
|
|
||||||
return button;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create a combo box
|
* Create a combo box
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<ComboBoxText>::Ref
|
ComboBoxText *
|
||||||
WidgetFactory :: createComboBoxText(void) throw ()
|
WidgetFactory :: createComboBoxText(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<ComboBoxText>::Ref comboBox(new ComboBoxText(comboBoxLeftImage,
|
return new ComboBoxText(comboBoxLeftImage,
|
||||||
comboBoxCenterImage,
|
comboBoxCenterImage,
|
||||||
comboBoxRightImage));
|
comboBoxRightImage);
|
||||||
|
|
||||||
return comboBox;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create a blue bin
|
* Create a blue bin
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<BlueBin>::Ref
|
BlueBin *
|
||||||
WidgetFactory :: createBlueBin(void) throw ()
|
WidgetFactory :: createBlueBin(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<BlueBin>::Ref blueBin(new BlueBin(0xcfdee7, blueBinImages));
|
return new BlueBin(0xcfdee7, blueBinImages);
|
||||||
|
|
||||||
return blueBin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create a dark blue bin
|
* Create a dark blue bin
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<BlueBin>::Ref
|
BlueBin *
|
||||||
WidgetFactory :: createDarkBlueBin(void) throw ()
|
WidgetFactory :: createDarkBlueBin(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<BlueBin>::Ref blueBin(new BlueBin(0x99cdff, darkBlueBinImages));
|
return new BlueBin(0x99cdff, darkBlueBinImages);
|
||||||
|
|
||||||
return blueBin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create an entry bin
|
* Create an entry bin
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<EntryBin>::Ref
|
EntryBin *
|
||||||
WidgetFactory :: createEntryBin(void) throw ()
|
WidgetFactory :: createEntryBin(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<EntryBin>::Ref entryBin(new EntryBin(0x99cdff, entryBinImages));
|
return new EntryBin(0xcfdfe7, entryBinImages);
|
||||||
|
|
||||||
return entryBin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create a stock button
|
* Create a stock button
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<ImageButton>::Ref
|
ImageButton *
|
||||||
WidgetFactory :: createButton(ButtonType type) throw ()
|
WidgetFactory :: createButton(ButtonType type) throw ()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gdk::Pixbuf> passiveImage;
|
Glib::RefPtr<Gdk::Pixbuf> passiveImage;
|
||||||
|
@ -296,13 +286,14 @@ WidgetFactory :: createButton(ButtonType type) throw ()
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case deleteButton:
|
case deleteButton:
|
||||||
default:
|
|
||||||
passiveImage = loadImage(deleteButtonPassiveName);
|
passiveImage = loadImage(deleteButtonPassiveName);
|
||||||
rollImage = loadImage(deleteButtonRollName);
|
rollImage = loadImage(deleteButtonRollName);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<ImageButton>::Ref button(new ImageButton(passiveImage, rollImage));
|
return new ImageButton(passiveImage, rollImage);
|
||||||
|
|
||||||
return button;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/main.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/main.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -166,8 +166,10 @@ int main ( int argc,
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestWindow testWindow;
|
{
|
||||||
Gtk::Main::run(testWindow);
|
TestWindow testWindow;
|
||||||
|
Gtk::Main::run(testWindow);
|
||||||
|
}
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue