Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBWindow is a TBWidget that provides some window-like features. More...
#include <tb_window.h>
Public Types | |
enum | RESIZE_FIT { RESIZE_FIT_PREFERRED, RESIZE_FIT_MINIMAL, RESIZE_FIT_CURRENT_OR_NEEDED } |
RESIZE_FIT specifies how ResizeToFitContent should resize the window. More... | |
Public Types inherited from tb::TBWidget | |
enum | INVALIDATE_LAYOUT { INVALIDATE_LAYOUT_TARGET_ONLY, INVALIDATE_LAYOUT_RECURSIVE } |
Type used for InvalidateLayout. More... | |
Public Member Functions | |
TBOBJECT_SUBCLASS (TBWindow, TBWidget) | |
void | Close () |
Close this window. More... | |
bool | IsActive () const |
Return true if this window is active. More... | |
void | Activate () |
Activate this window if it's not already activated. More... | |
bool | EnsureFocus () |
Ensure that this window has focus by attempting to find a focusable child widget. More... | |
void | SetLastFocus (TBWidget *last_focus) |
Set the widget that should be focused when this window is activated next time. More... | |
void | SetSettings (WINDOW_SETTINGS settings) |
Set settings for how this window should look and behave. More... | |
WINDOW_SETTINGS | GetSettings () |
TBRect | GetResizeToFitContentRect (RESIZE_FIT fit=RESIZE_FIT_PREFERRED) |
Get a suitable rect for the window based on the contents and the given fit. More... | |
void | ResizeToFitContent (RESIZE_FIT fit=RESIZE_FIT_PREFERRED) |
Resize the window to fit the its content. More... | |
virtual bool | SetText (const TBStr &text) |
Set the window title. More... | |
virtual bool | GetText (TBStr &text) const |
Get the text of this widget. More... | |
int | GetTitleHeight () |
< Make all versions in base class available. More... | |
virtual TBRect | GetPaddingRect () |
Get the rectangle inside any padding, relative to this widget. More... | |
virtual PreferredSize | OnCalculatePreferredSize (const SizeConstraints &constraints) |
Calculate the preferred size for this widget. More... | |
virtual bool | OnEvent (const TBWidgetEvent &ev) |
Callback for handling events. More... | |
virtual void | OnAdded () |
Called when this widget has been added to a parent (after calling OnChildAdded on parent). More... | |
virtual void | OnRemove () |
Called when a this widget has been removed from its parent (after calling OnChildRemove on parent). More... | |
virtual void | OnChildAdded (TBWidget *child) |
Called when a child widget has been added to this widget (before calling OnAdded on child). More... | |
virtual void | OnResized (int old_w, int old_h) |
Called when this widget has been resized. More... | |
Public Member Functions inherited from tb::TBWidget | |
TBOBJECT_SUBCLASS (TBWidget, TBTypedObject) | |
For safe typecasting. | |
TBWidget (TBValue::TYPE sync_type=TBValue::TYPE_NULL) | |
virtual | ~TBWidget () |
virtual void | SetRect (const TBRect &rect) |
Set the rect for this widget in its parent. More... | |
const TBRect & | GetRect () const |
See TBWidget::SetRect. | |
void | SetPosition (const TBPoint &pos) |
Set position of this widget in its parent. More... | |
void | SetSize (int width, int height) |
Set size of this widget. More... | |
void | Invalidate () |
Invalidate should be called if the widget need to be repainted, to make sure the renderer repaints it and its children next frame. More... | |
void | InvalidateStates () |
Call if something changes that might need other widgets to update their state. More... | |
void | InvalidateSkinStates () |
Call if something changes that might cause any skin to change due to different state or conditions. More... | |
void | Die () |
Delete the widget with the possibility for some extended life during animations. More... | |
bool | GetIsDying () const |
Return true if this widget or any of its parents is dying. More... | |
void | SetID (const TBID &id) |
Set the id reference for this widgets. More... | |
TBID & | GetID () |
See TBWidget::SetID. | |
const TBID & | GetID () const |
See TBWidget::SetID. | |
void | SetGroupID (const TBID &id) |
Set the group id reference for this widgets. More... | |
TBID & | GetGroupID () |
See TBWidget::SetGroupID. | |
const TBID & | GetGroupID () const |
See TBWidget::SetGroupID. | |
TBWidget * | GetWidgetByID (const TBID &id) const |
Get this widget or any child widget with a matching id, or nullptr if none is found. More... | |
template<class T > | |
T * | GetWidgetByIDAndType (const TBID &id) const |
Get this widget or any child widget with a matching id and type, or nullptr if none is found. More... | |
void | SetState (WIDGET_STATE state, bool on) |
Enable or disable the given state(s). More... | |
bool | GetState (WIDGET_STATE state) const |
Get status of the given state(s). More... | |
void | SetStateRaw (WIDGET_STATE state) |
Set the widget state. More... | |
WIDGET_STATE | GetStateRaw () const |
Get the widget state. More... | |
WIDGET_STATE | GetAutoState () const |
Return the current combined state for this widget. More... | |
void | SetOpacity (float opacity) |
Set opacity for this widget and its children from 0.0 - 1.0. More... | |
float | GetOpacity () const |
See TBWidget::SetOpacity. | |
void | SetVisibility (WIDGET_VISIBILITY vis) |
Set visibility for this widget and its children. More... | |
WIDGET_VISIBILITY | GetVisibility () const |
See TBWidget::SetVisibility. | |
bool | GetVisibilityCombined () const |
Return true if this widget and all its ancestors are visible (has a opacity > 0 and visibility WIDGET_VISIBILITY_VISIBLE) | |
bool | GetDisabled () const |
Return true if this widget or any of its parents are disabled (has state WIDGET_STATE_DISABLED). More... | |
void | AddChild (TBWidget *child, WIDGET_Z z=WIDGET_Z_TOP, WIDGET_INVOKE_INFO info=WIDGET_INVOKE_INFO_NORMAL) |
Add the child to this widget. More... | |
void | AddChildRelative (TBWidget *child, WIDGET_Z_REL z, TBWidget *reference, WIDGET_INVOKE_INFO info=WIDGET_INVOKE_INFO_NORMAL) |
Add the child to this widget. More... | |
void | RemoveChild (TBWidget *child, WIDGET_INVOKE_INFO info=WIDGET_INVOKE_INFO_NORMAL) |
Remove child from this widget without deleting it. More... | |
void | RemoveFromParent () |
Remove this widget from parent if it has one. More... | |
void | DeleteAllChildren () |
Remove and delete all children in this widget. More... | |
void | SetZ (WIDGET_Z z) |
Sets the z-order of this widget related to its siblings. More... | |
void | SetZInflate (WIDGET_Z z) |
Set the z order in which children are added during resource loading. More... | |
WIDGET_Z | GetZInflate () const |
See TBWidget::SetZInflate. | |
void | SetGravity (WIDGET_GRAVITY g) |
Set the widget gravity (any combination of WIDGET_GRAVITY). More... | |
WIDGET_GRAVITY | GetGravity () const |
See TBWidget::SetGravity. | |
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. More... | |
TBID | GetSkinBg () const |
Return the current skin background, as set by SetSkinBg. More... | |
TBSkinElement * | GetSkinBgElement () |
Return the skin background element, or nullptr. More... | |
void | SetIsGroupRoot (bool group_root) |
Set if this widget is a group root. More... | |
bool | GetIsGroupRoot () const |
See TBWidget::SetIsGroupRoot. | |
void | SetIsFocusable (bool focusable) |
Set if this widget should be able to receive focus or not. More... | |
bool | GetIsFocusable () const |
See TBWidget::SetIsFocusable. | |
void | SetClickByKey (bool click_by_key) |
Set if this widget should emulate a click when it's focused and pressing enter or space. More... | |
bool | GetClickByKey () const |
See TBWidget::SetClickByKey. | |
void | SetWantLongClick (bool want_long_click) |
Set if this widget should generate long-click event (or context menu event if nothing handles the long click event). More... | |
bool | GetWantLongClick () const |
See TBWidget::SetWantLongClick. | |
void | SetIgnoreInput (bool ignore_input) |
Set if this widget should ignore input, as if it didn't exist. More... | |
bool | GetIgnoreInput () const |
See TBWidget::SetIgnoreInput. | |
bool | GetIsInteractable () const |
Get if this widget wants interaction depending on various states. More... | |
bool | SetFocus (WIDGET_FOCUS_REASON reason, WIDGET_INVOKE_INFO info=WIDGET_INVOKE_INFO_NORMAL) |
Set this widget to be the focused widget. More... | |
bool | GetIsFocused () const |
See TBWidget::SetFocus. | |
bool | SetFocusRecursive (WIDGET_FOCUS_REASON reason=WIDGET_FOCUS_REASON_UNKNOWN) |
Call SetFocus on all children and their children, until a widget is found that accepts it. More... | |
bool | MoveFocus (bool forward) |
Move focus from the currently focused widget to another focusable widget. More... | |
TBWidget * | GetWidgetAt (int x, int y, bool include_children) const |
Returns the child widget that contains the coordinate or nullptr if no one does. More... | |
TBWidget * | GetChildFromIndex (int index) const |
Get the child at the given index, or nullptr if there was no child at that index. More... | |
int | GetIndexFromChild (TBWidget *child) const |
Get the child index of the given widget (that must be a child of this widget). More... | |
TBStr | GetTextByID (const TBID &id) |
Get the text of a child widget with the given id, or an empty string if there was no widget with that id. More... | |
int | GetValueByID (const TBID &id) |
Get the value of a child widget with the given id, or 0 if there was no widget with that id. More... | |
TBWidget * | GetNextDeep (const TBWidget *bounding_ancestor=nullptr) const |
Get the next node in depth search of the widget tree. More... | |
TBWidget * | GetPrevDeep () const |
Get the prev node in depth search of the widget tree. More... | |
TBWidget * | GetLastLeaf () const |
Get the last leaf of a depth search of the widget tree. More... | |
TBWidget * | GetFirstChild () const |
Get the widget's first child. More... | |
TBWidget * | GetLastChild () const |
Get the widget's last child. More... | |
TBLinkListOf< TBWidget >::Iterator | GetIteratorForward () |
Create an iterator to iterate through the widget's children, forward. More... | |
TBLinkListOf< TBWidget >::Iterator | GetIteratorBackward () |
Create an iterator to iterate through the widget's children, backward. More... | |
bool | IsAncestorOf (TBWidget *other_widget) const |
Return true if this widget is the same or a ancestor of other_widget. More... | |
bool | IsEventDestinationFor (TBWidget *other_widget) const |
Return true if this widget is the same as other_widget or if other_widget events are going through this widget (See GetEventDestination()) | |
void | AddListener (TBWidgetListener *listener) |
Add a listener to this widget. More... | |
void | RemoveListener (TBWidgetListener *listener) |
See TBWidget::AddListener. | |
bool | HasListener (TBWidgetListener *listener) const |
See TBWidget::AddListener. | |
virtual void | OnProcess () |
Callback for doing anything that might be needed before paint. More... | |
virtual void | OnProcessAfterChildren () |
Callback for doing anything that might be needed before paint. More... | |
virtual void | OnProcessStates () |
Callback for doing state updates that depend on your application state. More... | |
virtual void | OnPaint (const PaintProps &) |
Callback for painting this widget. More... | |
virtual void | OnPaintChildren (const PaintProps &paint_props) |
Callback for painting child widgets. More... | |
virtual void | OnInvalid () |
Callback for when this widget or any of its children have called Invalidate() | |
virtual void | OnSkinChanged () |
Called when the background skin changes by calling SetSkinBg(), or when the skin has changed indirectly after a skin condition changes in a way that may affect layout. More... | |
virtual void | OnFontChanged () |
Called when the font has changed. More... | |
virtual void | OnFocusChanged (bool) |
Called when the focus has changed. More... | |
virtual void | OnVisibilityChanged () |
Called when the visibility has changed. More... | |
virtual void | OnCaptureChanged (bool) |
Called when the capture has changed. More... | |
virtual void | OnChildRemove (TBWidget *) |
Called when a child widget is about to be removed from this widget (before calling OnRemove on child). More... | |
virtual void | OnDie () |
Called when Die() is called on this widget. More... | |
virtual void | OnScroll (int, int) |
Called when this widget has been scrolled. More... | |
virtual void | OnInflateChild (TBWidget *child) |
Called just after a child has been inflated into this widget. More... | |
virtual void | OnInflate (const INFLATE_INFO &info) |
Called when this widget is inflated from resources, before any children have been inflated. More... | |
virtual void | OnDeflate (const INFLATE_INFO &info) |
Called when this widget is deflated to a node, before any children have been deflated. More... | |
virtual WIDGET_HIT_STATUS | GetHitStatus (int x, int y) |
Get hit status tests if this widget should be hit at the given coordinate. More... | |
virtual bool | GetCustomSkinCondition (const TBSkinCondition::CONDITION_INFO &) |
Get if skin condition applies to this widget. More... | |
virtual TBWidget * | GetContentRoot () |
Get this widget or a child widget that should be root for other children. More... | |
TBWidget * | GetParentRoot () |
Get this widget or a parent widget that is the absolute root parent. More... | |
TBWindow * | GetParentWindow () |
Get the closest parent widget that is a TBWindow or nullptr if there is none. More... | |
TBWidget * | GetParent () const |
Get the parent widget, or nullptr if this widget is not added. More... | |
virtual TBWidget * | GetEventDestination () |
Get the widget that should receive the events this widget invoke. More... | |
virtual void | GetChildTranslation (int &x, int &y) const |
Return translation the children should have. More... | |
virtual void | ScrollTo (int, int) |
If this is a widget that scroll children (see GetChildTranslation), it should scroll to the coordinates x, y. More... | |
void | ScrollToSmooth (int x, int y) |
Start the TBScroller for this widget and scroll it to the given position. More... | |
void | ScrollBy (int dx, int dy) |
If this is a widget that scroll children (see GetChildTranslation), it will scroll by delta dx, dy relative to its current position. More... | |
void | ScrollBySmooth (int dx, int dy) |
Start the TBScroller for this widget and scroll it by the given delta. More... | |
virtual ScrollInfo | GetScrollInfo () |
If this is a widget that scroll children (see GetChildTranslation), it should return the current scroll information. More... | |
virtual TBWidget * | GetScrollRoot () |
If this widget is implementing ScrollTo and GetScrollInfo but the corresponding GetChildTranslation is implemented on a child, you should return that child from this method. More... | |
void | ScrollByRecursive (int &dx, int &dy) |
Scroll this widget and/or any parent widgets by the given delta. More... | |
void | ScrollIntoViewRecursive () |
Make this widget visible by calling ScrollIntoView on all parent widgets. | |
void | ScrollIntoView (const TBRect &rect) |
If this is a widget that scroll children (see GetChildTranslation), it will scroll so that rect is visible. More... | |
TBScroller * | GetScroller () |
Return the TBScroller set up for this widget, or nullptr if creation failed. More... | |
virtual void | SetAxis (AXIS) |
Set along which axis the content should be layed out. More... | |
virtual AXIS | GetAxis () const |
See TBWidget::SetAxis. | |
virtual void | SetValue (long) |
Set the value of this widget. More... | |
virtual void | SetValue (const TBValue &value) |
See TBWidget::SetValue. | |
virtual long | GetValue () const |
See TBWidget::SetValue. | |
virtual void | SetValueDouble (double value) |
Set the value in double precision. More... | |
virtual double | GetValueDouble () const |
Return the value in double precision. More... | |
TBStr | GetText () const |
Get the text of this widget. More... | |
void | Connect (TBWidgetValue *value) |
Connect this widget to a widget value. More... | |
void | Unconnect () |
Unconnect, if this widget is connected to a TBWidgetValue. More... | |
const TBWidgetValueConnection & | GetConnection () const |
Get the widget TBWidgetValue. More... | |
virtual PreferredSize | OnCalculatePreferredContentSize (const SizeConstraints &constraints) |
Calculate the preferred content size for this widget. More... | |
PreferredSize | GetPreferredSize (const SizeConstraints &constraints) |
Get the PreferredSize for this widget. More... | |
PreferredSize | GetPreferredSize () |
See TBWidget::GetPreferredSize. | |
virtual void | InvalidateLayout (INVALIDATE_LAYOUT il) |
Invalidate layout for this widget so it will be scheduled for relayout. More... | |
void | SetLayoutParams (const LayoutParams &lp) |
Set layout params. More... | |
const LayoutParams * | GetLayoutParams () const |
Get layout params, or nullptr if not specified. More... | |
void | InvokeProcess () |
Invoke OnProcess and OnProcessAfterChildren on this widget and its children. More... | |
void | InvokeProcessStates (bool force_update=false) |
Invoke OnProcessStates on all child widgets, if state processing is needed (InvalidateStates() has been called) | |
void | InvokePaint (const PaintProps &parent_paint_props) |
Invoke paint on this widget and all its children. | |
void | InvokeFontChanged () |
Invoke OnFontChanged on this widget and recursively on any children that inherit the font. More... | |
bool | InvokeEvent (TBWidgetEvent &ev) |
Invoke a event on this widget. More... | |
bool | InvokePointerDown (int x, int y, int click_count, MODIFIER_KEYS modifierkeys, bool touch) |
See TBWidget::InvokeEvent. | |
bool | InvokePointerUp (int x, int y, int click_count, MODIFIER_KEYS modifierkeys, bool touch) |
See TBWidget::InvokeEvent. | |
void | InvokePointerMove (int x, int y, MODIFIER_KEYS modifierkeys, bool touch) |
See TBWidget::InvokeEvent. | |
bool | InvokeWheel (int x, int y, int delta_x, int delta_y, MODIFIER_KEYS modifierkeys) |
See TBWidget::InvokeEvent. | |
bool | InvokeMultiGesture (float dTheta, float dDist, int targetx, int targety, float x, float y, uint16_t numFingers) |
See TBWidget::InvokeEvent. | |
bool | InvokeFingerMotion (int x, int y, float cx, float cy, float dx, float dy, int finger) |
See TBWidget::InvokeEvent. | |
bool | InvokeFingerDown (int x, int y, float cx, float cy, float dx, float dy, int finger) |
See TBWidget::InvokeEvent. | |
bool | InvokeFingerUp (int x, int y, float cx, float cy, float dx, float dy, int finger) |
See TBWidget::InvokeEvent. | |
bool | InvokeKey (int key, SPECIAL_KEY special_key, MODIFIER_KEYS modifierkeys, bool down) |
Invoke the EVENT_TYPE_KEY_DOWN and EVENT_TYPE_KEY_UP events on the currently focused widget. More... | |
void | ReleaseCapture () |
A widget that receive a EVENT_TYPE_POINTER_DOWN event, will stay "captured" until EVENT_TYPE_POINTER_UP is received. More... | |
void | ConvertToRoot (int &x, int &y) const |
Make x and y (relative to this widget) relative to the upper left corner of the root widget. More... | |
void | ConvertFromRoot (int &x, int &y) const |
Make x and y (relative to the upper left corner of the root widget) relative to this widget. More... | |
bool | SetFontDescription (const TBFontDescription &font_desc) |
Set the font description for this widget and any children that inherit the font. More... | |
TBFontDescription | GetFontDescription () const |
Get the font description as set with SetFontDescription. More... | |
TBFontDescription | GetCalculatedFontDescription () const |
Calculate the font description for this widget. More... | |
TBFontFace * | GetFont () const |
Get the TBFontFace for this widget from the current font description (calculated by GetCalculatedFontDescription) | |
void | StopLongClickTimer () |
Public Member Functions inherited from tb::TBTypedObject | |
virtual bool | IsOfTypeId (const TB_TYPE_ID type_id) const |
Returns true if the class or the base class matches the type id. | |
template<class T > | |
T * | SafeCastTo () const |
Returns this object as the given type or nullptr if it's not that type. More... | |
template<class T > | |
bool | IsOfType () const |
Return true if this object can safely be casted to the given type. More... | |
virtual const char * | GetClassName () const |
Get the classname of the object. More... | |
Public Member Functions inherited from tb::TBLinkOf< TBWidget > | |
TBWidget * | GetPrev () const |
TBWidget * | GetNext () const |
Public Member Functions inherited from tb::TBLink | |
bool | IsInList () const |
Return true if the link is currently added to a list. More... | |
Protected Member Functions | |
TBWindow * | GetTopMostOtherWindow (bool only_activable_windows) |
void | SetWindowActiveState (bool active) |
void | DeActivate () |
Protected Attributes | |
TBMover | m_mover |
TBResizer | m_resizer |
TBTextField | m_textfield |
TBWidget | m_close_button |
WINDOW_SETTINGS | m_settings |
TBWidgetSafePointer | m_last_focus |
Additional Inherited Members | |
Static Public Member Functions inherited from tb::TBWidget | |
static void | SetAutoFocusState (bool on) |
Set if the state WIDGET_STATE_FOCUSED should be set automatically for the focused widget. More... | |
Static Public Member Functions inherited from tb::TBTypedObject | |
template<class T > | |
static TB_TYPE_ID | GetTypeId () |
A static template method that returns a unique id for each type. More... | |
Public Attributes inherited from tb::TBWidget | |
TBValue::TYPE | m_sync_type |
The data type that should be synchronized through TBWidgetValue. More... | |
TBValue | data |
This value is free to use for anything. More... | |
struct { | |
uint16_t is_group_root: 1 | |
uint16_t is_focusable: 1 | |
uint16_t click_by_key: 1 | |
uint16_t has_key_pressed_state: 1 | |
uint16_t ignore_input: 1 | |
uint16_t is_dying: 1 | |
uint16_t is_cached_ps_valid: 1 | |
uint16_t no_automatic_hover_state: 1 | |
uint16_t is_panning: 1 | |
uint16_t want_long_click: 1 | |
uint16_t visibility: 2 | |
uint16_t inflate_child_z: 1 | |
} | m_packed |
uint16_t | m_packed_init |
Public Attributes inherited from tb::TBLink | |
TBLink * | prev |
TBLink * | next |
TBLinkList * | linklist |
Static Public Attributes inherited from tb::TBWidget | |
static TBWidget * | hovered_widget = nullptr |
The currently hovered widget, or nullptr. | |
static TBWidget * | captured_widget = nullptr |
The currently captured widget, or nullptr. | |
static TBWidget * | focused_widget = nullptr |
The currently focused widget, or nullptr. | |
static int | pointer_down_widget_x = 0 |
Pointer x position on down event, relative to the captured widget. | |
static int | pointer_down_widget_y = 0 |
Pointer y position on down event, relative to the captured widget. | |
static int | pointer_move_widget_x = 0 |
Pointer x position on last pointer event, relative to the captured widget (if any) or hovered widget. | |
static int | pointer_move_widget_y = 0 |
Pointer y position on last pointer event, relative to the captured widget (if any) or hovered widget. | |
static bool | cancel_click = false |
true if the pointer up event should not generate a click event. | |
static bool | update_widget_states = true |
true if something has called InvalidateStates() and it still hasn't been updated. | |
static bool | update_skin_states = true |
true if something has called InvalidateSkinStates() and skin still hasn't been updated. | |
static bool | show_focus_state = false |
true if the focused state should be painted automatically. | |
TBWindow is a TBWidget that provides some window-like features.
It can have a titlebar, be movable, resizable etc.
It will activate and deactivate other windows on click (which will restore focus to the last focused child widget).
RESIZE_FIT specifies how ResizeToFitContent should resize the window.
void tb::TBWindow::Activate | ( | ) |
Activate this window if it's not already activated.
This will deactivate any currently activated window. This will automatically call EnsureFocus to restore/set focus to this window.
void tb::TBWindow::Close | ( | ) |
Close this window.
Warning: This window will be deleted after this call!
bool tb::TBWindow::EnsureFocus | ( | ) |
Ensure that this window has focus by attempting to find a focusable child widget.
It will first try to restore focus to the last focused widget in this window, or a widget that has received SetFocus while the window was inactive. If that doesn't succeed, it will go through all children and try to set focus. Returns false if no focusable child was found.
|
virtual |
Get the rectangle inside any padding, relative to this widget.
This is the rectangle in which the content should be rendered.
This may be overridden to f.ex deduct space allocated by visible scrollbars managed by this widget. Anything that removes space from the content area.
Reimplemented from tb::TBWidget.
TBRect tb::TBWindow::GetResizeToFitContentRect | ( | RESIZE_FIT | fit = RESIZE_FIT_PREFERRED | ) |
Get a suitable rect for the window based on the contents and the given fit.
|
inlinevirtual |
Get the text of this widget.
Implemented by most widgets (that has text). returns false if it failed.
Reimplemented from tb::TBWidget.
int tb::TBWindow::GetTitleHeight | ( | ) |
< Make all versions in base class available.
Get the height of the title bar (or 0 if the WINDOW_SETTINGS say this window shouldn't have any title bar)
bool tb::TBWindow::IsActive | ( | ) | const |
Return true if this window is active.
|
virtual |
Called when this widget has been added to a parent (after calling OnChildAdded on parent).
Reimplemented from tb::TBWidget.
|
virtual |
Calculate the preferred size for this widget.
This is the full size of the widget, content + padding + eventual other decoration (but not skin expansion). This is the size that should be used for layouting a widget. The returned PreferredSize also contains minimal size and maximum size.
Reimplemented from tb::TBWidget.
|
virtual |
Called when a child widget has been added to this widget (before calling OnAdded on child).
Reimplemented from tb::TBWidget.
|
virtual |
Callback for handling events.
Return true if the event is handled and should not continue to be handled by any parent widgets.
Reimplemented from tb::TBWidget.
Reimplemented in tb::TBPopupWindow, tb::TBMessageWindow, and tb::TBMenuWindow.
|
virtual |
Called when a this widget has been removed from its parent (after calling OnChildRemove on parent).
Reimplemented from tb::TBWidget.
|
virtual |
Called when this widget has been resized.
The default implementation move and resize all children according to their gravity.
Reimplemented from tb::TBWidget.
void tb::TBWindow::ResizeToFitContent | ( | RESIZE_FIT | fit = RESIZE_FIT_PREFERRED | ) |
Resize the window to fit the its content.
This is the same as doing SetRect(GetResizeToFitContentRect(fit)).
|
inline |
Set the widget that should be focused when this window is activated next time.
This should not be used to change focus. Call TBWidget::SetFocus to focus, which will call this method if the window is inactive!
void tb::TBWindow::SetSettings | ( | WINDOW_SETTINGS | settings | ) |
Set settings for how this window should look and behave.
|
inlinevirtual |
Set the window title.
Reimplemented from tb::TBWidget.