From e40f70a3af1142e6c0c89c6ea2ee47b996495661 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 20 Sep 2010 16:30:45 +0000 Subject: corrected trading inconsistencies, improved trade window, initial slider widget --- src/ui/widget.h | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/ui/widget.h') diff --git a/src/ui/widget.h b/src/ui/widget.h index 3ae75d2..8b61bc1 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -28,7 +28,7 @@ class Widget public: /// types of custom events a widget can emit - enum Event {EventNone = 0, EventButtonClicked, EventListItemClicked}; + enum Event {EventNone = 0, EventButtonClicked, EventListItemClicked, EventListViewChanged, EventSliderChanged}; /// create a new widget Widget(Widget *parent = 0); @@ -128,6 +128,16 @@ public: return !widget_visible; } + /// true if the widget is enabled + inline bool enabled() const { + return widget_enabled; + } + + /// true if the widget is disabled + inline bool disabled() const { + return !widget_enabled; + } + /// the palette used to draw this widget const Palette *palette() const; @@ -156,9 +166,18 @@ public: /// hide the widget virtual void hide(); - + /// set visibility - void set_visible(bool visible = true); + void set_visible(const bool visible = true); + + /// disable the widget + virtual void disable(); + + /// enable the widget + virtual void enable(); + + ///set enabled or disabled state + void set_enabled(const bool enabled = true); /// set input focus void set_focus(); @@ -194,16 +213,16 @@ public: void set_font(const Font *font); /// set the widgets label - void set_label(std::string const &label); + void set_label(const std::string &label); /// set the widgets label void set_label(const char *label); /// enable or disable widget border - void set_border(bool border = true); + void set_border(const bool border = true); /// enable or disable widget background - void set_background(bool background = true); + void set_background(const bool background = true); /* -- event distributors --------------------------------------- */ @@ -354,6 +373,7 @@ private: bool widget_background; bool widget_border; bool widget_focus; + bool widget_enabled; math::Vector2f widget_location; math::Vector2f widget_size; -- cgit v1.2.3