added Notebook
This commit is contained in:
parent
0e0e9e164f
commit
00d2670b10
23 changed files with 1139 additions and 182 deletions
|
@ -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/include/LiveSupport/Widgets/Button.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -44,6 +44,7 @@
|
|||
#include <gtkmm/label.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/ButtonImages.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
|
@ -63,7 +64,7 @@ using namespace LiveSupport::Core;
|
|||
* A button holding a text.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.3 $
|
||||
* @version $Revision: 1.4 $
|
||||
*/
|
||||
class Button : public Gtk::Button
|
||||
{
|
||||
|
@ -73,6 +74,11 @@ class Button : public Gtk::Button
|
|||
*/
|
||||
typedef enum { passiveState, rollState, selectedState } State;
|
||||
|
||||
/**
|
||||
* The font definition used in the button.
|
||||
*/
|
||||
static const std::string fontDefinition;
|
||||
|
||||
/**
|
||||
* The Gdk::Window object, used to draw inside this button.
|
||||
*/
|
||||
|
@ -84,9 +90,14 @@ class Button : public Gtk::Button
|
|||
Glib::RefPtr<Gdk::GC> gc;
|
||||
|
||||
/**
|
||||
* The text displayed inside the button.
|
||||
* The widget inside the button.
|
||||
*/
|
||||
Gtk::Label * label;
|
||||
Gtk::Widget * child;
|
||||
|
||||
/**
|
||||
* The text label for the button.
|
||||
*/
|
||||
Glib::ustring label;
|
||||
|
||||
/**
|
||||
* The state of the button.
|
||||
|
@ -94,34 +105,15 @@ class Button : public Gtk::Button
|
|||
State state;
|
||||
|
||||
/**
|
||||
* The left image for the passive state of the button.
|
||||
* The non-interactive state of the button
|
||||
* (not rollover, either passive or selected)
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageLeft;
|
||||
State stationaryState;
|
||||
|
||||
/**
|
||||
* The center image for the passive state of the button.
|
||||
* The button images.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageCenter;
|
||||
|
||||
/**
|
||||
* The right image for the passive state of the button.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageRight;
|
||||
|
||||
/**
|
||||
* The left image of the button, when the mouse hovers above it.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageLeft;
|
||||
|
||||
/**
|
||||
* The center image of the button, when the mouse hovers above it.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageCenter;
|
||||
|
||||
/**
|
||||
* The right image of the button, when the mouse hovers above it.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageRight;
|
||||
Ptr<ButtonImages>::Ref buttonImages;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -240,34 +232,19 @@ class Button : public Gtk::Button
|
|||
* Constructor, with only one state.
|
||||
*
|
||||
* @param label the text to display in the button
|
||||
* @param leftImage the left image for the button
|
||||
* @param centerImage the center image for the button
|
||||
* @param rightImage the right image for the button
|
||||
* @param buttonImages the images of the button
|
||||
*/
|
||||
Button(const Glib::ustring & label,
|
||||
Glib::RefPtr<Gdk::Pixbuf> leftImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> centerImage,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rightImage) throw ();
|
||||
Ptr<ButtonImages>::Ref buttonImages) throw ();
|
||||
|
||||
/**
|
||||
* Constructor, with a rollover state.
|
||||
* Passive and rollover images are expected to be of the same size.
|
||||
* Constructor, with only one state.
|
||||
*
|
||||
* @param label the text to display in the button
|
||||
* @param passiveImageLeft the left image for the button, passive
|
||||
* @param passiveImageCenter the center image for the button, passive
|
||||
* @param passiveImageRight the right image for the button, passive
|
||||
* @param rollImageLeft the left image for the button, onmouseover
|
||||
* @param rollImageCenter the center image for the button, onmouseover
|
||||
* @param rollImageRight the right image for the button, onmouseover
|
||||
* @param child the widget that should be displayed inside the button.
|
||||
* @param buttonImages the images of the button
|
||||
*/
|
||||
Button(const Glib::ustring & label,
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageLeft,
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageCenter,
|
||||
Glib::RefPtr<Gdk::Pixbuf> passiveImageRight,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageLeft,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageCenter,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rollImageRight) throw ();
|
||||
Button(Gtk::Widget * child,
|
||||
Ptr<ButtonImages>::Ref buttonImages) throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
|
@ -283,7 +260,13 @@ class Button : public Gtk::Button
|
|||
virtual void
|
||||
set_label(const Glib::ustring & label) throw ()
|
||||
{
|
||||
this->label->set_label(label);
|
||||
if (child && child->is_managed_()) {
|
||||
delete child;
|
||||
}
|
||||
this->label = label;
|
||||
child = Gtk::manage(new Gtk::Label(label));
|
||||
child->modify_font(Pango::FontDescription(fontDefinition));
|
||||
child->set_parent(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,7 +277,27 @@ class Button : public Gtk::Button
|
|||
Glib::ustring
|
||||
get_label(void) const throw ()
|
||||
{
|
||||
return this->label->get_label();
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the state of the button to selected.
|
||||
*/
|
||||
void
|
||||
select(void) throw ()
|
||||
{
|
||||
state = selectedState;
|
||||
stationaryState = selectedState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the state of the button to passive.
|
||||
*/
|
||||
void
|
||||
unselect(void) throw ()
|
||||
{
|
||||
state = passiveState;
|
||||
stationaryState = passiveState;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue