Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb_widgets_common.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_WIDGETS_COMMON_H
7 #define TB_WIDGETS_COMMON_H
8 
9 #include "tb_widgets.h"
10 #include "tb_layout.h"
11 #include "tb_msg.h"
12 
13 namespace tb {
14 
26 };
27 
34 {
35 public:
37 
38  void Paint(TBWidget *widget, const TBRect &rect, const TBColor &color);
39 
40  int GetWidth(TBWidget *widget);
41  int GetHeight(TBWidget *widget);
42 
43  bool SetText(const TBStr & text) { return m_text.Set(text); }
44  bool GetText(TBStr &text) const { return text.Set(m_text); }
45 
46  bool IsEmpty() const { return m_text.IsEmpty(); }
47 
50  void SetTextAlign(TB_TEXT_ALIGN align) { m_text_align = align; }
51  TB_TEXT_ALIGN GetTextAlign() const { return m_text_align; }
52 public:
53  TBStr m_text;
54  TB_TEXT_ALIGN m_text_align;
55 };
56 
59 class TBTextField : public TBWidget
60 {
61 public:
62  // For safe typecasting
63  TBOBJECT_SUBCLASS(TBTextField, TBWidget);
64 
65  TBTextField();
66 
68  virtual bool SetText(const TBStr & text);
69  virtual bool GetText(TBStr &text) const { return m_text.GetText(text); }
70  using TBWidget::GetText;
71 
73  virtual void SetValueDouble(double value);
74 
76  virtual double GetValueDouble() const { return GetText().atof(); }
77 
79  bool IsEmpty() const { return m_text.IsEmpty(); }
80 
83  void SetTextAlign(TB_TEXT_ALIGN align) { m_text.SetTextAlign(align); }
84  TB_TEXT_ALIGN GetTextAlign() const { return m_text.GetTextAlign(); }
85 
88  void SetSqueezable(bool squeezable);
89  bool GetSqueezable() const { return m_squeezable; }
90 
92  void SetFormat(TBStr format);
93  const TBStr & GetFormat() const { return m_format; }
94 
95  virtual void OnInflate(const INFLATE_INFO &info);
96  virtual void OnDeflate(const INFLATE_INFO &info);
97  virtual PreferredSize OnCalculatePreferredContentSize(const SizeConstraints &constraints);
98  virtual void OnFontChanged();
99  virtual void OnPaint(const PaintProps &paint_props);
100 protected:
101  TBWidgetString m_text;
102  TBStr m_format;
104  bool m_squeezable;
105 };
106 
111 class TBButton : public TBWidget, protected TBMessageHandler
112 {
113 public:
114  // For safe typecasting
115  TBOBJECT_SUBCLASS(TBButton, TBWidget);
116 
117  TBButton();
118  ~TBButton();
119 
122  virtual void SetAxis(AXIS axis) { m_layout.SetAxis(axis); }
123  virtual AXIS GetAxis() const { return m_layout.GetAxis(); }
124 
127  void SetSqueezable(bool squeezable) { m_textfield.SetSqueezable(squeezable); }
128  bool GetSqueezable() { return m_textfield.GetSqueezable(); }
129 
131  void SetAutoRepeat(bool auto_repeat_click) { m_auto_repeat_click = auto_repeat_click; }
132  bool GetAutoRepeat() { return m_auto_repeat_click; }
133 
136  void SetToggleMode(bool toggle_mode_on) { m_toggle_mode = toggle_mode_on; }
137  bool GetToggleMode() const { return m_toggle_mode; }
138 
140  virtual bool SetText(const TBStr & text);
141  virtual bool GetText(TBStr &text) const { return m_textfield.GetText(text); }
142  using TBWidget::GetText;
143 
144  virtual void SetValue(long value);
145  virtual long GetValue() const;
146 
147  virtual void OnInflate(const INFLATE_INFO &info);
148  virtual void OnDeflate(const INFLATE_INFO &info);
149  virtual void OnCaptureChanged(bool captured);
150  virtual void OnSkinChanged();
151  virtual bool OnEvent(const TBWidgetEvent &ev);
152  virtual WIDGET_HIT_STATUS GetHitStatus(int x, int y);
154  {
155  return m_layout.GetPreferredSize();
156  }
157 
158  virtual TBWidget *GetContentRoot() { return &m_layout; }
159 
160  // == TBMessageHandler ==============================================================
161  virtual void OnMessageReceived(TBMessage *msg);
162 protected:
163  void UpdateTextFieldVisibility();
164  bool CanToggle() { return m_toggle_mode || GetGroupID(); }
165  class ButtonLayout : public TBLayout
166  {
167  virtual void OnChildAdded(TBWidget *child);
168  virtual void OnChildRemove(TBWidget *child);
169  };
170  ButtonLayout m_layout;
171  TBTextField m_textfield;
172  bool m_auto_repeat_click;
173  bool m_toggle_mode;
174 };
175 
181 class TBClickLabel : public TBWidget
182 {
183 public:
184  // For safe typecasting
185  TBOBJECT_SUBCLASS(TBClickLabel, TBWidget);
186 
187  TBClickLabel();
188  ~TBClickLabel();
189 
192  virtual void SetAxis(AXIS axis) { m_layout.SetAxis(axis); }
193  virtual AXIS GetAxis() const { return m_layout.GetAxis(); }
194 
196  virtual bool SetText(const TBStr & text) { return m_textfield.SetText(text); }
197  virtual bool GetText(TBStr &text) const { return m_textfield.GetText(text); }
198  using TBWidget::GetText;
199 
201  return m_layout.GetPreferredSize();
202  }
203 
204  virtual TBWidget *GetContentRoot() { return &m_layout; }
205 
206  virtual bool OnEvent(const TBWidgetEvent &ev);
207 protected:
208  TBLayout m_layout;
209  TBTextField m_textfield;
210 };
211 
217 class TBSkinImage : public TBWidget
218 {
219 public:
220  // For safe typecasting
221  TBOBJECT_SUBCLASS(TBSkinImage, TBWidget);
222 
223  TBSkinImage() {}
224  TBSkinImage(const TBID &skin_bg) { SetSkinBg(skin_bg); }
225 
226  virtual PreferredSize OnCalculatePreferredSize(const SizeConstraints &constraints);
227 };
228 
231 class TBSeparator : public TBWidget
232 {
233 public:
234  // For safe typecasting
235  TBOBJECT_SUBCLASS(TBSeparator, TBWidget);
236 
237  TBSeparator();
238 };
239 
242 class TBProgressSpinner : public TBWidget, protected TBMessageHandler
243 {
244 public:
245  // For safe typecasting
246  TBOBJECT_SUBCLASS(TBProgressSpinner, TBWidget);
247 
249 
251  bool IsRunning() const { return m_value > 0; }
252 
256  void Begin() { SetValue(GetValue() + 1); }
257  void End() { SetValue(GetValue() - 1); }
258 
261  virtual void SetValue(long value);
262  virtual long GetValue() const { return m_value; }
263 
264  virtual void OnPaint(const PaintProps &paint_props);
265 
266  // == TBMessageHandler ==============================================================
267  virtual void OnMessageReceived(TBMessage *msg);
268 protected:
269  int m_value;
270  int m_frame;
271  TBID m_skin_fg;
272 };
273 
275 class TBRadioCheckBox : public TBWidget
276 {
277 public:
278  // For safe typecasting
279  TBOBJECT_SUBCLASS(TBRadioCheckBox, TBWidget);
280 
281  TBRadioCheckBox();
282 
283  virtual void SetValue(long value);
284  virtual long GetValue() const { return m_value; }
285 
286  virtual PreferredSize OnCalculatePreferredSize(const SizeConstraints &constraints);
287  virtual bool OnEvent(const TBWidgetEvent &ev);
288 
290  static void UpdateGroupWidgets(TBWidget *new_leader);
291 protected:
292  int m_value;
293 };
294 
298 {
299 public:
300  // For safe typecasting
301  TBOBJECT_SUBCLASS(TBCheckBox, TBRadioCheckBox);
302 
303  TBCheckBox() { SetSkinBg(TBIDC("TBCheckBox"), WIDGET_INVOKE_INFO_NO_CALLBACKS); }
304 };
305 
310 {
311 public:
312  // For safe typecasting
313  TBOBJECT_SUBCLASS(TBRadioButton, TBRadioCheckBox);
314 
315  TBRadioButton() { SetSkinBg(TBIDC("TBRadioButton"), WIDGET_INVOKE_INFO_NO_CALLBACKS); }
316 };
317 
320 class TBScrollBar : public TBWidget
321 {
322 public:
323  // For safe typecasting
324  TBOBJECT_SUBCLASS(TBScrollBar, TBWidget);
325 
326  TBScrollBar();
327  ~TBScrollBar();
328 
330  virtual void SetAxis(AXIS axis);
331  virtual AXIS GetAxis() const { return m_axis; }
332 
337  void SetLimits(double min, double max, double visible);
338 
340  bool CanScroll() const { return m_visible > 0; }
341 
343  bool CanScrollPositive() const { return m_value < m_max; }
344 
346  bool CanScrollNegative() const { return m_value > m_min; }
347 
348  double GetMinValue() const { return m_min; }
349  double GetMaxValue() const { return m_max; }
350  double GetVisible() const { return m_visible; }
351 
353  virtual void SetValueDouble(double value);
354  virtual double GetValueDouble() const { return m_value; }
355 
356  virtual void SetValue(long value) { SetValueDouble(value); }
357  virtual long GetValue() const { return GetValueDouble(); }
358 
359  virtual void OnInflate(const INFLATE_INFO &info);
360  virtual bool OnEvent(const TBWidgetEvent &ev);
361  virtual void OnResized(int old_w, int old_h);
362 protected:
363  TBWidget m_handle;
364  AXIS m_axis;
365  double m_value;
366  double m_min, m_max, m_visible;
367  double m_to_pixel_factor;
368  void UpdateHandle();
369 };
370 
373 // FIX: Add a "track value" showing as a line within the track (to be used for buffering etc).
374 // FIX: Also add a auto track that keeps it up to date with value (default).
375 template <typename VAL_T>
376 class TBSliderX : public TBWidget
377 {
378 public:
379  // For safe typecasting
380  TBOBJECT_SUBCLASS(TBSliderX<VAL_T>, TBWidget);
381 
383  ~TBSliderX<VAL_T>();
384 
386  virtual void SetAxis(AXIS axis);
387  virtual AXIS GetAxis() const { return m_axis; }
388 
390  void SetLimits(VAL_T min, VAL_T max, int nstep = 100);
391 
392  VAL_T GetMinValue() const { return m_min; }
393  VAL_T GetMaxValue() const { return m_max; }
394 
396  VAL_T GetSmallStep() const { return m_step; }
397  void SetSmallStep(VAL_T step) { m_step = step; }
398 
400  virtual void SetValueVal(VAL_T value);
401  virtual VAL_T GetValueVal() const { return m_value; }
402 
404  virtual void SetValue(long value) { SetValueVal(value); }
406  virtual long GetValue() const { return m_value; }
408  virtual void SetValueDouble(double value) { SetValueVal(value); }
410  virtual double GetValueDouble() const { return GetValueVal(); }
411 
412  virtual void OnInflate(const INFLATE_INFO &info);
413  virtual void OnDeflate(const INFLATE_INFO &info);
414  virtual bool OnEvent(const TBWidgetEvent &ev);
415  virtual void OnResized(int old_w, int old_h);
416 protected:
417  TBWidget m_handle;
418  AXIS m_axis;
419  VAL_T m_value;
420  VAL_T m_min, m_max, m_step;
421  double m_to_pixel_factor;
422  void UpdateHandle();
423 };
424 typedef TBSliderX<double> TBSlider;
425 typedef TBSliderX<int> TBSliderInt;
426 typedef TBSliderX<long> TBSliderLong;
427 
429 class TBContainer : public TBWidget
430 {
431 public:
432  // For safe typecasting
433  TBOBJECT_SUBCLASS(TBContainer, TBWidget);
434 
435  TBContainer();
436 };
437 
439 class TBMover : public TBWidget
440 {
441 public:
442  // For safe typecasting
443  TBOBJECT_SUBCLASS(TBMover, TBWidget);
444 
445  TBMover();
446 
447  virtual bool OnEvent(const TBWidgetEvent &ev);
448 };
449 
451 class TBResizer : public TBWidget
452 {
453 public:
454  // For safe typecasting
455  TBOBJECT_SUBCLASS(TBResizer, TBWidget);
456 
457  TBResizer();
458  virtual WIDGET_HIT_STATUS GetHitStatus(int x, int y);
459  virtual bool OnEvent(const TBWidgetEvent &ev);
460 };
461 
463 class TBDimmer : public TBWidget
464 {
465 public:
466  // For safe typecasting
467  TBOBJECT_SUBCLASS(TBDimmer, TBWidget);
468 
469  TBDimmer();
470 
471  virtual void OnAdded();
472 };
473 
476 } // namespace tb
477 
478 #endif // TB_WIDGETS_COMMON_H
AXIS
Definition: tb_widgets.h:251
virtual bool GetText(TBStr &text) const
Get the text of this widget.
Definition: tb_widgets_common.h:141
TBTextField is a one line text field that is not editable.
Definition: tb_widgets_common.h:59
virtual void OnResized(int old_w, int old_h)
Called when this widget has been resized.
Definition: tb_widgets_common.cpp:618
virtual PreferredSize OnCalculatePreferredContentSize(const SizeConstraints &)
&lt; Make all versions in base class available.
Definition: tb_widgets_common.h:200
bool CanScrollPositive() const
Return true if the scrollbar can scroll in the positive direction with its current limits...
Definition: tb_widgets_common.h:343
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_widgets_common.h:387
virtual void OnPaint(const PaintProps &paint_props)
Callback for painting this widget.
Definition: tb_widgets_common.cpp:139
virtual void SetValue(long value)
Give SetValue corrent precision.
Definition: tb_widgets_common.h:404
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:368
virtual PreferredSize OnCalculatePreferredSize(const SizeConstraints &constraints)
Calculate the preferred size for this widget.
Definition: tb_widgets_common.cpp:455
void SetTextAlign(TB_TEXT_ALIGN align)
Set which alignment the text should have if the space given when painting is larger than the text...
Definition: tb_widgets_common.h:83
TBRadioCheckBox has shared functionality for TBCheckBox and TBRadioButton.
Definition: tb_widgets_common.h:275
The base TBWidget class.
Definition: tb_widgets.h:418
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_widgets_common.cpp:229
virtual void SetAxis(AXIS axis)
Set along which axis the content should be layed out (If the label has more content than the text) ...
Definition: tb_widgets_common.h:192
virtual bool GetText(TBStr &text) const
Get the text of this widget.
Definition: tb_widgets_common.h:69
virtual long GetValue() const
See TBWidget::SetValue.
Definition: tb_widgets_common.h:284
Definition: tb_widgets.h:112
virtual void OnFontChanged()
Called when the font has changed.
Definition: tb_widgets_common.cpp:133
TB_TEXT_ALIGN
TB_TEXT_ALIGN specifies horizontal text alignment.
Definition: tb_widgets_common.h:22
virtual void OnDeflate(const INFLATE_INFO &info)
Called when this widget is deflated to a node, before any children have been deflated.
Definition: tb_widgets_reader.cpp:644
bool IsRunning() const
Return true if the animation is running.
Definition: tb_widgets_common.h:251
virtual bool SetText(const TBStr &text)
Set the text of the button.
Definition: tb_widgets_common.cpp:175
virtual void SetAxis(AXIS axis)
Set along which axis the content should be layed out (If the button has more content than the text) ...
Definition: tb_widgets_common.h:122
virtual void SetAxis(AXIS axis)
Set along which axis the scrollbar should scroll.
Definition: tb_widgets_common.cpp:650
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_widgets_common.h:123
virtual bool SetText(const TBStr &text)
Set the text of the text field.
Definition: tb_widgets_common.cpp:84
virtual void SetValueVal(VAL_T value)
Same as SetValue, but with double precision.
Definition: tb_widgets_common.cpp:682
virtual void OnMessageReceived(TBMessage *msg)
Called when a message is delivered.
Definition: tb_widgets_common.cpp:407
TBProgressSpinner is a animation that is running while its value is 1.
Definition: tb_widgets_common.h:242
virtual void OnCaptureChanged(bool captured)
Called when the capture has changed.
Definition: tb_widgets_common.cpp:213
TBScrollBar is a scroll bar in the given axis.
Definition: tb_widgets_common.h:320
TBClickLabel has a text field in its internal layout by default.
Definition: tb_widgets_common.h:181
Aligned left.
Definition: tb_widgets_common.h:23
TBSeparator is a widget only showing a skin.
Definition: tb_widgets_common.h:231
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_widgets_common.cpp:463
double atof() const
Call atof() on the string.
Definition: tb_str.h:96
void Begin()
Begin/End are used to start or stop the animation in a incremental way.
Definition: tb_widgets_common.h:256
virtual WIDGET_HIT_STATUS GetHitStatus(int x, int y)
Get hit status tests if this widget should be hit at the given coordinate.
Definition: tb_widgets_common.cpp:262
TBDimmer dim widgets in the background and block input.
Definition: tb_widgets_common.h:463
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:711
TBSkinImage is a widget showing a skin element, constrained in size to its skin.
Definition: tb_widgets_common.h:217
void SetSqueezable(bool squeezable)
Set if the text field should be allowed to squeeze below its preferred size.
Definition: tb_widgets_common.h:127
Specifies size constraints used during size calculations.
Definition: tb_widgets.h:321
TBContainer is just a TBWidget with border and padding (using skin &quot;TBContainer&quot;) ...
Definition: tb_widgets_common.h:429
virtual PreferredSize OnCalculatePreferredSize(const SizeConstraints &constraints)
Calculate the preferred size for this widget.
Definition: tb_widgets_common.cpp:336
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:630
void SetTextAlign(TB_TEXT_ALIGN align)
Set which alignment the text should have if the space given when painting is larger than the text...
Definition: tb_widgets_common.h:50
virtual long GetValue() const
See TBWidget::SetValue.
Definition: tb_widgets_common.h:262
virtual TBWidget * GetContentRoot()
Get this widget or a child widget that should be root for other children.
Definition: tb_widgets_common.h:158
TBCheckBox is a box toggling a check mark on click.
Definition: tb_widgets_common.h:297
TBRadioButton is a button which unselects other radiobuttons of the same group number when clicked...
Definition: tb_widgets_common.h:309
virtual void SetValue(long value)
Setting the value to 1 will start the spinner.
Definition: tb_widgets_common.cpp:368
virtual double GetValueDouble() const
Return the value in double precision.
Definition: tb_widgets_common.h:354
virtual PreferredSize OnCalculatePreferredContentSize(const SizeConstraints &constraints)
Calculate the preferred content size for this widget.
Definition: tb_widgets_common.cpp:117
void SetFormat(TBStr format)
The printf formatting string, used for formatting Set*Value().
Definition: tb_widgets_common.cpp:110
virtual void SetValue(long value)
Set the value of this widget.
Definition: tb_widgets_common.cpp:440
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_widgets_common.h:193
bool CanScrollNegative() const
Return true if the scrollbar can scroll in the negative direction with its current limits...
Definition: tb_widgets_common.h:346
TBWidgetString holds a string that can be painted as one line with the set alignment.
Definition: tb_widgets_common.h:33
virtual PreferredSize OnCalculatePreferredContentSize(const SizeConstraints &)
Calculate the preferred content size for this widget.
Definition: tb_widgets_common.h:153
TBID is a wrapper for a uint32_t to be used as ID.
Definition: tb_id.h:18
virtual double GetValueDouble() const
Return the value in double precision.
Definition: tb_widgets_common.h:76
Aligned center.
Definition: tb_widgets_common.h:25
void SetSkinBg(const TBID &skin_bg, WIDGET_INVOKE_INFO info=WIDGET_INVOKE_INFO_NORMAL)
Set the skin background for this widget and call OnSkinChanged if it changed.
Definition: tb_widgets.cpp:397
virtual void OnSkinChanged()
Called when the background skin changes by calling SetSkinBg(), or when the skin has changed indirect...
Definition: tb_widgets_common.cpp:224
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_widgets_common.cpp:830
TBButton is a regular button widget with auto repeat, toggle and group capabilities.
Definition: tb_widgets_common.h:111
virtual double GetValueDouble() const
Same as GetValue, but with double precision.
Definition: tb_widgets_common.h:410
virtual void SetAxis(AXIS axis)
Set along which axis the scrollbar should scroll.
Definition: tb_widgets_common.cpp:496
virtual void OnDeflate(const INFLATE_INFO &info)
Called when this widget is deflated to a node, before any children have been deflated.
Definition: tb_widgets_reader.cpp:723
virtual void SetValueDouble(double value)
&lt; Make all versions in base class available.
Definition: tb_widgets_common.cpp:94
virtual void SetValue(long value)
Set the value of this widget.
Definition: tb_widgets_common.h:356
TBID & GetGroupID()
See TBWidget::SetGroupID.
Definition: tb_widgets.h:487
virtual WIDGET_HIT_STATUS GetHitStatus(int x, int y)
Get hit status tests if this widget should be hit at the given coordinate.
Definition: tb_widgets_common.cpp:821
Aligned right.
Definition: tb_widgets_common.h:24
WIDGET_HIT_STATUS
Hit status return value for TBWidget::GetHitStatus.
Definition: tb_widgets.h:398
virtual void OnPaint(const PaintProps &paint_props)
Callback for painting this widget.
Definition: tb_widgets_common.cpp:392
virtual void OnAdded()
Called when this widget has been added to a parent (after calling OnChildAdded on parent)...
Definition: tb_widgets_common.cpp:861
virtual void OnResized(int old_w, int old_h)
Called when this widget has been resized.
Definition: tb_widgets_common.cpp:766
INFLATE_INFO contains info passed to TBWidget::OnInflate during resource loading. ...
Definition: tb_widgets_reader.h:21
TBMessageHandler handles a list of pending messages posted to itself.
Definition: tb_msg.h:72
virtual bool GetText(TBStr &text) const
Get the text of this widget.
Definition: tb_widgets_common.h:197
void SetLimits(VAL_T min, VAL_T max, int nstep=100)
Set the min, max limits for the slider.
Definition: tb_widgets_common.cpp:669
void SetLimits(double min, double max, double visible)
Set the min, max limits for the scrollbar.
Definition: tb_widgets_common.cpp:514
TBStr is a simple string class.
Definition: tb_str.h:62
void SetAutoRepeat(bool auto_repeat_click)
Set to true if the button should fire repeatedly while pressed.
Definition: tb_widgets_common.h:131
Simple rectangle class.
Definition: tb_geometry.h:25
Definition: tb_widgets_common.h:165
bool CanScroll() const
Return true if the scrollbar has anywhere to go with the current limits.
Definition: tb_widgets_common.h:340
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:621
virtual void OnDeflate(const INFLATE_INFO &info)
Called when this widget is deflated to a node, before any children have been deflated.
Definition: tb_widgets_reader.cpp:376
virtual bool SetText(const TBStr &text)
Set the text of the label.
Definition: tb_widgets_common.h:196
virtual void SetAxis(AXIS axis)
Set along which axis the content should be layouted.
Definition: tb_layout.cpp:30
TBMessage is a message created and owned by TBMessageHandler.
Definition: tb_msg.h:47
virtual long GetValue() const
See TBWidget::SetValue.
Definition: tb_widgets_common.h:357
TBResizer is a lower right corner resize grip.
Definition: tb_widgets_common.h:451
virtual TBWidget * GetContentRoot()
Get this widget or a child widget that should be root for other children.
Definition: tb_widgets_common.h:204
TBColor contains a 32bit color.
Definition: tb_color.h:21
void SetSqueezable(bool squeezable)
Set if this text field should be allowed to squeeze below its preferred size.
Definition: tb_widgets_common.cpp:101
virtual void SetValueDouble(double value)
Same as SetValue, but with double precision.
Definition: tb_widgets_common.h:408
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_layout.h:106
void SetToggleMode(bool toggle_mode_on)
Set to true if the button should toggle on and off, instead of just fire click events.
Definition: tb_widgets_common.h:136
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_widgets_common.cpp:549
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_widgets_common.cpp:789
virtual void OnMessageReceived(TBMessage *msg)
Called when a message is delivered.
Definition: tb_widgets_common.cpp:247
virtual long GetValue() const
Give GetValue corrent precision.
Definition: tb_widgets_common.h:406
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_widgets_common.h:331
virtual void SetValue(long value)
&lt; Make all versions in base class available.
Definition: tb_widgets_common.cpp:182
virtual void SetValueDouble(double value)
Same as SetValue, but with double precision.
Definition: tb_widgets_common.cpp:537
PreferredSize contains size preferences for a TBWidget.
Definition: tb_widgets.h:277
TBSlider is a horizontal or vertical slider for a number within a range.
Definition: tb_widgets_common.h:376
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_widgets_common.cpp:305
static void UpdateGroupWidgets(TBWidget *new_leader)
Make sure all widgets sharing the same group as new_leader are set to value 0.
Definition: tb_widgets_common.cpp:426
VAL_T GetSmallStep() const
Get a small value (depending on the min and max limits) for stepping by f.ex.
Definition: tb_widgets_common.h:396
TBLayout layouts its children along the given axis.
Definition: tb_layout.h:96
PreferredSize GetPreferredSize(const SizeConstraints &constraints)
Get the PreferredSize for this widget.
Definition: tb_widgets.cpp:1022
TBMover is moving its parent widget when dragged.
Definition: tb_widgets_common.h:439
int m_cached_text_width
Cached width of m_text.
Definition: tb_widgets_common.h:103
virtual long GetValue() const
See TBWidget::SetValue.
Definition: tb_widgets_common.cpp:208
TBStr GetText() const
Get the text of this widget.
Definition: tb_widgets.h:942
bool IsEmpty() const
Is the text empty?
Definition: tb_widgets_common.h:79
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_widgets_common.cpp:695