Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb_inline_select.h
1 // ================================================================================
2 // == This file is a part of Turbo Badger. (C) 2011-2014, Emil SegerÃ¥s ==
3 // == See tb_core.h for more information. ==
4 // ================================================================================
5 
6 #ifndef TB_INLINE_SELECT_H
7 #define TB_INLINE_SELECT_H
8 
9 #include "tb_widgets_listener.h"
10 #include "tb_select_item.h"
11 #include "tb_editfield.h"
12 
13 namespace tb {
14 
22 class TBInlineSelect : public TBWidget
23 {
24 public:
25  // For safe typecasting
26  TBOBJECT_SUBCLASS(TBInlineSelect, TBWidget);
27 
29  ~TBInlineSelect();
30 
32  virtual void SetAxis(AXIS axis) { m_layout.SetAxis(axis); }
33  virtual AXIS GetAxis() const { return m_layout.GetAxis(); }
34 
35  void SetLimits(long min, long max);
36  long GetMinValue() const { return m_min; }
37  long GetMaxValue() const { return m_max; }
38 
39  virtual void SetValue(long value) { SetValueInternal(value, true); }
40  virtual long GetValue() const { return m_value; }
41 
42  virtual void OnInflate(const INFLATE_INFO &info);
43  virtual void OnSkinChanged();
44  virtual bool OnEvent(const TBWidgetEvent &ev);
45 protected:
46  TBButton m_buttons[2];
47  TBLayout m_layout;
48  TBEditField m_editfield;
49  long m_value;
50  long m_min, m_max;
51  void SetValueInternal(long value, bool update_text);
52 };
53 
54 } // namespace tb
55 
56 #endif // TB_INLINE_SELECT_H
AXIS
Definition: tb_widgets.h:251
The base TBWidget class.
Definition: tb_widgets.h:418
virtual long GetValue() const
See TBWidget::SetValue.
Definition: tb_inline_select.h:40
Definition: tb_widgets.h:112
TBEditField is a one line or multi line textfield that is editable or read-only.
Definition: tb_editfield.h:74
virtual void OnSkinChanged()
Called when the background skin changes by calling SetSkinBg(), or when the skin has changed indirect...
Definition: tb_inline_select.cpp:83
TBSelectList is a select widget with no popups.
Definition: tb_inline_select.h:22
virtual void SetValue(long value)
Set the value of this widget.
Definition: tb_inline_select.h:39
virtual void OnInflate(const INFLATE_INFO &info)
Called when this widget is inflated from resources, before any children have been inflated...
Definition: tb_widgets_reader.cpp:386
TBButton is a regular button widget with auto repeat, toggle and group capabilities.
Definition: tb_widgets_common.h:111
INFLATE_INFO contains info passed to TBWidget::OnInflate during resource loading. ...
Definition: tb_widgets_reader.h:21
virtual void SetAxis(AXIS axis)
Set along which axis the content should be layouted.
Definition: tb_layout.cpp:30
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_inline_select.h:33
virtual void SetAxis(AXIS axis)
Set along which axis the content should layouted.
Definition: tb_inline_select.h:32
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_layout.h:106
TBLayout layouts its children along the given axis.
Definition: tb_layout.h:96
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_inline_select.cpp:88