Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb Namespace Reference

This file contains a very simple unit testing framework. More...

Classes

class  TBAnimationListener
 TBAnimationListener - Listens to the progress of TBAnimationObject. More...
 
class  TBAnimationObject
 TBAnimationObject - Base class for all animated object. More...
 
class  TBAnimationManager
 TBAnimationManager - System class that manages all animated object. More...
 
class  TBAnimationBlocker
 TBAnimationBlocker blocks new animations during its lifetime. More...
 
class  TBAnimatedFloat
 
class  TBFloatAnimator
 
class  TBWidgetAnimationObject
 Base class for widget animations. More...
 
class  TBWidgetAnimationOpacity
 Animate the opacity of the target widget. More...
 
class  TBWidgetAnimationRect
 Animate the rectangle of the target widget. More...
 
class  TBWidgetsAnimationManager
 
class  TBParserTarget
 
class  TBParserStream
 
class  TBParser
 
class  TBImageLoader
 TBImageloader is a class used to load skin images. More...
 
class  TBSpaceAllocator
 Allocator of space out of a given available space. More...
 
class  TBFragmentSpaceAllocator
 Allocates space for TBBitmapFragment in a row (used in TBBitmapFragmentMap). More...
 
class  TBBitmapFragmentMap
 TBBitmapFragmentMap is used to pack multiple bitmaps into a single TBBitmap. More...
 
class  TBBitmapFragment
 TBBitmapFragment represents a sub part of a TBBitmap. More...
 
class  TBBitmapFragmentManager
 TBBitmapFragmentManager manages loading bitmaps of arbitrary size, pack as many of them into as few TBBitmap as possible. More...
 
class  TBColor
 TBColor contains a 32bit color. More...
 
class  TBColorManager
 TBColorManager contains a map of global color names. More...
 
class  TBDimensionConverter
 TBDimensionConverter converts device independant points to pixels, based on two DPI values. More...
 
class  TBTextFragmentContentWidget
 
class  TBEditFieldContentFactory
 The default content factory for embedded content in TBEditField with styling enabled. More...
 
class  TBEditFieldScrollRoot
 TBEditFieldScrollRoot - Internal for TBEditField. More...
 
class  TBEditField
 TBEditField is a one line or multi line textfield that is editable or read-only. More...
 
class  TBFontDescription
 TBFontDescription describes a font. More...
 
class  TBFontGlyphData
 TBFontGlyphData is rendering info used during glyph rendering by TBFontRenderer. More...
 
class  TBGlyphMetrics
 TBGlyphMetrics contains metrics for a font glyph. More...
 
class  TBFontMetrics
 TBFontMetrics contains metrics for a font face. More...
 
class  TBFontRenderer
 TBFontRenderer renders glyphs from a font file. More...
 
class  TBFontGlyph
 TBFontGlyph holds glyph metrics and bitmap fragment. More...
 
class  TBFontGlyphCache
 TBFontGlyphCache caches glyphs for font faces. More...
 
class  TBFontEffect
 TBFontEffect applies an effect on each glyph that is rendered in a TBFontFace. More...
 
class  TBFontFace
 TBFontFace represents a loaded font that can measure and render strings. More...
 
class  TBFontInfo
 TBFontInfo provides information about a font file associated with a font id. More...
 
class  TBFontManager
 TBFontManager creates and owns font faces (TBFontFace) which are looked up from TBFontDescription using GetFontFace. More...
 
class  TBPoint
 Simple point class. More...
 
class  TBRect
 Simple rectangle class. More...
 
class  TBRegion
 TBRegion does calculations on regions represented by a list of rectangles. More...
 
class  TBHashTable
 TBHashTable is a minimal hash table, for hashing anything using a uint32_t key. More...
 
class  TBHashTableIterator
 TBHashTableIterator is a iterator for stepping through all content stored in a TBHashTable. More...
 
class  TBHashTableIteratorOf
 TBHashTableIteratorOf is a TBHashTableIterator which auto cast to the class type. More...
 
class  TBHashTableOf
 TBHashTableOf is a TBHashTable with the given class type as content. More...
 
class  TBHashTableAutoDeleteOf
 TBHashTableOf is a TBHashTable with the given class type as content. More...
 
class  TBID
 TBID is a wrapper for a uint32_t to be used as ID. More...
 
class  TBInlineSelect
 TBSelectList is a select widget with no popups. More...
 
class  TBLanguage
 TBLanguage is a basic language string manager. More...
 
class  TBLayout
 TBLayout layouts its children along the given axis. More...
 
class  TBLinkListIterator
 TBLinkListIterator - The backend class for a safe iteration of a TBLinkList. More...
 
class  TBLink
 TBLink - The backend class to be inserted in TBLinkList. More...
 
class  TBLinkOf
 
class  TBLinkList
 TBLinkList - This is the backend for TBLinkListOf and TBLinkListAutoDeleteOf. More...
 
class  TBLinkListOf
 TBLinkListOf is a double linked linklist. More...
 
class  TBLinkListAutoDeleteOf
 TBLinkListAutoDeleteOf is a double linked linklist that deletes all links on destruction. More...
 
class  TBListBackend
 TBList is a list (array) of pointers to any kind of objects. More...
 
class  TBListOf
 TBListOf is a list (array) of pointers to the specified object type. More...
 
class  TBListAutoDeleteOf
 TBListAutoDeleteOf is a list (array) of pointers to the specified object type. More...
 
class  TBMenuWindow
 TBMenuWindow is a popup window that shows a list of items (TBSelectList). More...
 
class  TBMessageWindowSettings
 TBMessageWindowSettings contains additional settings for TBMessageWindow. More...
 
class  TBMessageWindow
 TBMessageWindow is a window for showing simple messages. More...
 
class  TBMessageData
 TBMessageData holds custom data to send with a posted message. More...
 
class  TBMessageLink
 TBMessageLink should never be created or subclassed anywhere except in TBMessage. More...
 
class  TBMessage
 TBMessage is a message created and owned by TBMessageHandler. More...
 
class  TBMessageHandler
 TBMessageHandler handles a list of pending messages posted to itself. More...
 
class  TBNodeRefTree
 TBNodeRefTree is a named TBNode. More...
 
class  TBNodeRefTreeListener
 TBNodeRefTreeListener receive OnDataChanged when the value of a node in a TBNodeRefTree is changed. More...
 
class  FileParser
 
class  DataParser
 
class  TBNodeTarget
 
class  TBNode
 TBNode is a tree node with a string name and a value (TBValue). More...
 
class  TBTypedObject
 
class  TBPopupAlignment
 TBPopupAlignment describes the preferred alignment of a popup relative to a target widget or a given point. More...
 
class  TBPopupWindow
 TBPopupWindow is a popup window that redirects any child widgets events through the given target. More...
 
class  TBRendererListener
 TBRendererListener is a listener for TBRenderer. More...
 
class  TBBitmap
 TBBitmap is a minimal interface for bitmap to be painted by TBRenderer. More...
 
class  TBRenderer
 TBRenderer is a minimal interface for painting strings and bitmaps. More...
 
class  TBScrollContainerRoot
 TBScrollContainerRoot - Internal for TBScrollContainer. More...
 
class  TBScrollBarVisibility
 TBScrollBarVisibility - Helper for TBScrollContainer or any other scrollable container that needs to solve scrollbar visibility according to SCROLL_MODE. More...
 
class  TBScrollContainer
 TBScrollContainer - A container with scrollbars that can scroll its children. More...
 
class  TBScrollerFunction
 TBScrollerFunction does the calculations of time, speed and distance that decides how the slow down of a scroll will happen. More...
 
class  TBScrollerSnapListener
 TBScrollerSnapListener may override the target scroll position of a TBScroller. More...
 
class  TBScroller
 TBScroller handles panning while the pointer is down and measure the pan speed over time. More...
 
class  TBSelectList
 TBSelectList shows a scrollable list of items provided by a TBSelectItemSource. More...
 
class  TBSelectDropdown
 TBSelectDropdown shows a button that opens a popup with a TBSelectList with items provided by a TBSelectItemSource. More...
 
class  TBSimpleLayoutItemWidget
 TBSimpleLayoutItemWidget is a item containing a layout with the following: -TBSkinImage showing the item image. More...
 
class  TBSelectItemViewer
 TBSelectItemViewer is the viewer for items provided by TBSelectItemSource. More...
 
class  TBSelectItemSource
 TBSelectItemSource is a item provider interface for list widgets (TBSelectList and TBSelectDropdown). More...
 
class  TBSelectItemSourceList
 TBSelectItemSourceList is a item provider for list widgets (TBSelectList and TBSelectDropdown). More...
 
class  TBGenericStringItem
 TBGenericStringItem item for TBGenericStringItemSource. More...
 
class  TBGenericSeparatorItem
 Item Separator. More...
 
class  TBGenericStringItemSource
 TBGenericStringItemSource is a item source list providing items of type TBGenericStringItem. More...
 
class  TBSkinCondition
 TBSkinCondition checks if a condition is true for a given TBSkinConditionContext. More...
 
class  TBSkinConditionContext
 TBSkinConditionContext checks if a condition is true. More...
 
class  TBSkinElementState
 TBSkinElementState has a skin element id that should be used if its state and condition matches that which is being painted. More...
 
class  TBSkinElementStateList
 List of state elements in a TBSkinElement. More...
 
class  TBSkinElement
 Skin element. More...
 
class  TBSkinListener
 
class  TBSkin
 TBSkin contains a list of TBSkinElement. More...
 
class  TBStrC
 Simple string class that doesn't own or change the string pointer. More...
 
class  TBStr
 TBStr is a simple string class. More...
 
class  TBStyleEditListener
 Listener for TBStyleEdit. More...
 
class  TBTextFragmentContentFactory
 Creates TBTextFragmentContent if the sequence of text matches known content. More...
 
class  TBTextOfs
 
class  TBSelection
 Handles the selected text in a TBStyleEdit. More...
 
class  TBCaret
 The caret in a TBStyleEdit. More...
 
class  TBTextProps
 TBTextProps is a stack of properties used during layout & paint of TBStyleEdit. More...
 
class  TBBlock
 A block of text (a line, that might be wrapped) More...
 
class  TBUndoEvent
 Event in the TBUndoRedoStack. More...
 
class  TBUndoRedoStack
 Keeps track of all TBUndoEvents used for undo and redo functionality. More...
 
class  TBTextFragment
 The textfragment baseclass for TBStyleEdit. More...
 
class  TBStyleEdit
 Edit and formats TBTextFragment's. More...
 
class  TBTextFragmentContent
 Content for a non-text TBTextFragment. More...
 
class  TBTextFragmentContentHR
 A horizontal line for TBStyleEdit. More...
 
class  TBTextFragmentContentUnderline
 Fragment content that enables underline in a TBStyleEdit. More...
 
class  TBTextFragmentContentTextColor
 Fragment content that changes color in a TBStyleEdit. More...
 
class  TBTextFragmentContentTextSize
 Fragment content that changes size in a TBStyleEdit. More...
 
class  TBTextFragmentContentSuperscript
 Fragment content that changes size in a TBStyleEdit. More...
 
class  TBTextFragmentContentSubscript
 Fragment content that changes size in a TBStyleEdit. More...
 
class  TBTextFragmentContentStylePop
 Fragment content that ends a change of style in a TBStyleEdit. More...
 
class  TBSystem
 TBSystem is porting interface for the underlaying OS. More...
 
class  TBClipboard
 TBClipboard is a portable interface for the clipboard. More...
 
class  TBFile
 TBFile is a portable interface for file access. More...
 
class  TBTabLayout
 TBTabLayout is a TBLayout used in TBTabContainer to apply some default properties on any TBButton added to it. More...
 
class  TBTabContainer
 TBTabContainer - A container with tabs for multiple pages. More...
 
class  TBTempBuffer
 TBTempBuffer manages a buffer that will be deleted on destruction. More...
 
class  TBToggleContainer
 TBToggleContainer is a widget that toggles a property when its value change between 0 and 1. More...
 
class  TBSectionHeader
 TBSectionHeader is just a thin wrapper for a TBButton that is in toggle mode with the skin TBSectionHeader by default. More...
 
class  TBSection
 TBSection is a widget with a header that when clicked toggles its children on and off (using a internal TBToggleContainer with TOGGLE_EXPANDED). More...
 
class  TBValueArray
 TBValueArray is an array of TBValue. More...
 
class  TBValue
 TBValue holds value of a specific type. More...
 
class  TBWidgetSkinConditionContext
 Check if a condition is true for a widget when painting a skin. More...
 
class  TBWidgetValueConnection
 TBWidgetValueConnection maintains a connection between TBWidget and TBWidgetValue. More...
 
class  TBWidgetValue
 TBWidgetValue stores a TBValue that will be synchronized with all widgets connected to it. More...
 
class  TBValueGroupListener
 Listener that will be notified when any of the values in a TBValueGroup is changed. More...
 
class  TBValueGroup
 TBValueGroup is a collection of widget values (TBWidgetValue) that can be fetched by name (using a TBID). More...
 
class  TBLongClickTimer
 One shot timer for long click event. More...
 
class  TBWidgetEvent
 
class  TBWidgetEventMultiGesture
 TBWidgetEventMultiGesture is a event of type EVENT_TYPE_MULTI_GESTURE It contains the corresponding values for MultiGesture events. More...
 
class  TBWidgetEventFinger
 TBWidgetEventFinger is a subclass of TBWidgetEvent It is triggered by finger event such as up down or move. More...
 
class  TBWidgetEventFileDrop
 TBWidgetEventFileDrop is a event of type EVENT_TYPE_FILE_DROP. More...
 
class  PreferredSize
 PreferredSize contains size preferences for a TBWidget. More...
 
class  LayoutParams
 LayoutParams defines size preferences for a TBWidget that are set on the widget to override size preferences from skin and widget. More...
 
class  SizeConstraints
 Specifies size constraints used during size calculations. More...
 
class  TBWidget
 The base TBWidget class. More...
 
class  TBWidgetString
 TBWidgetString holds a string that can be painted as one line with the set alignment. More...
 
class  TBTextField
 TBTextField is a one line text field that is not editable. More...
 
class  TBButton
 TBButton is a regular button widget with auto repeat, toggle and group capabilities. More...
 
class  TBClickLabel
 TBClickLabel has a text field in its internal layout by default. More...
 
class  TBSkinImage
 TBSkinImage is a widget showing a skin element, constrained in size to its skin. More...
 
class  TBSeparator
 TBSeparator is a widget only showing a skin. More...
 
class  TBProgressSpinner
 TBProgressSpinner is a animation that is running while its value is 1. More...
 
class  TBRadioCheckBox
 TBRadioCheckBox has shared functionality for TBCheckBox and TBRadioButton. More...
 
class  TBCheckBox
 TBCheckBox is a box toggling a check mark on click. More...
 
class  TBRadioButton
 TBRadioButton is a button which unselects other radiobuttons of the same group number when clicked. More...
 
class  TBScrollBar
 TBScrollBar is a scroll bar in the given axis. More...
 
class  TBSliderX
 TBSlider is a horizontal or vertical slider for a number within a range. More...
 
class  TBContainer
 TBContainer is just a TBWidget with border and padding (using skin "TBContainer") More...
 
class  TBMover
 TBMover is moving its parent widget when dragged. More...
 
class  TBResizer
 TBResizer is a lower right corner resize grip. More...
 
class  TBDimmer
 TBDimmer dim widgets in the background and block input. More...
 
class  TBWidgetListenerGlobalLink
 TBWidgetListenerGlobalLink should never be created or subclassed anywhere except in TBWidgetListener. More...
 
class  TBWidgetListener
 TBWidgetListener listens to some callbacks from TBWidget. More...
 
class  TBWidgetSafePointer
 TBWidgetSafePointer keeps a pointer to a widget that will be set to nullptr if the widget is removed. More...
 
struct  MTEnum
 
struct  INFLATE_INFO
 INFLATE_INFO contains info passed to TBWidget::OnInflate during resource loading. More...
 
class  TBWidgetFactory
 TBWidgetFactory creates a widget from a TBNode. More...
 
class  TBWidgetsReader
 TBWidgetsReader parse a resource file (or buffer) into a TBNode tree, and turns it into a hierarchy of widgets. More...
 
class  TBWindow
 TBWindow is a TBWidget that provides some window-like features. More...
 

Typedefs

typedef void * TB_TYPE_ID
 
typedef TBSliderX< double > TBSlider
 
typedef TBSliderX< int > TBSliderInt
 
typedef TBSliderX< long > TBSliderLong
 

Enumerations

enum  ANIMATION_CURVE {
  ANIMATION_CURVE_LINEAR, ANIMATION_CURVE_SLOW_DOWN, ANIMATION_CURVE_SPEED_UP, ANIMATION_CURVE_BEZIER,
  ANIMATION_CURVE_SMOOTH
}
 Defines how the animation progress value is interpolated. More...
 
enum  ANIMATION_TIME { ANIMATION_TIME_IMMEDIATELY, ANIMATION_TIME_FIRST_UPDATE }
 Defines what the animation duration time is relative to. More...
 
enum  TB_VALIDATE_TYPE { TB_VALIDATE_ALWAYS, TB_VALIDATE_FIRST_TIME }
 Specify when the bitmap should be validated when calling TBBitmapFragmentMap::GetBitmap. More...
 
enum  EDIT_TYPE {
  EDIT_TYPE_TEXT, EDIT_TYPE_SEARCH, EDIT_TYPE_PASSWORD, EDIT_TYPE_EMAIL,
  EDIT_TYPE_PHONE, EDIT_TYPE_URL, EDIT_TYPE_NUMBER
}
 EDIT_TYPE - These types does not restrict input (may change in the future). More...
 
enum  LAYOUT_SIZE { LAYOUT_SIZE_GRAVITY, LAYOUT_SIZE_PREFERRED, LAYOUT_SIZE_AVAILABLE }
 Specifies which height widgets in a AXIS_X layout should have, or which width widgets in a AXIS_Y layout should have. More...
 
enum  LAYOUT_POSITION { LAYOUT_POSITION_CENTER, LAYOUT_POSITION_LEFT_TOP, LAYOUT_POSITION_RIGHT_BOTTOM, LAYOUT_POSITION_GRAVITY }
 Specifies which y position widgets in a AXIS_X layout should have, or which x position widgets in a AXIS_Y layout should have. More...
 
enum  LAYOUT_DISTRIBUTION { LAYOUT_DISTRIBUTION_PREFERRED, LAYOUT_DISTRIBUTION_AVAILABLE, LAYOUT_DISTRIBUTION_GRAVITY }
 Specifies which width widgets in a AXIS_X layout should have, or which height widgets in a AXIS_Y layout should have. More...
 
enum  LAYOUT_DISTRIBUTION_POSITION { LAYOUT_DISTRIBUTION_POSITION_CENTER, LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP, LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM }
 Specifies how widgets should be moved horizontally in a AXIS_X layout (or vertically in a AXIS_Y layout) if there is extra space available. More...
 
enum  LAYOUT_ORDER { LAYOUT_ORDER_BOTTOM_TO_TOP, LAYOUT_ORDER_TOP_TO_BOTTOM }
 Layout order parameter for TBLayout::SetLayoutOrder. More...
 
enum  LAYOUT_OVERFLOW { LAYOUT_OVERFLOW_CLIP, LAYOUT_OVERFLOW_SCROLL }
 Specifies what happens when there is not enough room for the layout, even when all the children have been shrunk to their minimum size. More...
 
enum  TB_MSG { TB_MSG_OK, TB_MSG_OK_CANCEL, TB_MSG_YES_NO, TB_MSG_YES_NO_CANCEL }
 
enum  TB_NODE_READ_FLAGS { TB_NODE_READ_FLAGS_NONE = 0, TB_NODE_READ_FLAGS_APPEND = 1 }
 
enum  SCROLL_MODE {
  SCROLL_MODE_X_Y, SCROLL_MODE_Y, SCROLL_MODE_Y_AUTO, SCROLL_MODE_X_AUTO_Y_AUTO,
  SCROLL_MODE_OFF
}
 
enum  TB_SORT { TB_SORT_NONE, TB_SORT_ASCENDING, TB_SORT_DESCENDING }
 
enum  SKIN_STATE {
  SKIN_STATE_NONE = 0, SKIN_STATE_DISABLED = 1, SKIN_STATE_FOCUSED = 2, SKIN_STATE_PRESSED = 4,
  SKIN_STATE_SELECTED = 8, SKIN_STATE_HOVERED = 16, SKIN_STATE_ALL
}
 Skin state types (may be combined). More...
 
enum  SKIN_ELEMENT_TYPE {
  SKIN_ELEMENT_TYPE_STRETCH_BOX, SKIN_ELEMENT_TYPE_STRETCH_BORDER, SKIN_ELEMENT_TYPE_STRETCH_IMAGE, SKIN_ELEMENT_TYPE_TILE,
  SKIN_ELEMENT_TYPE_IMAGE
}
 Type of painting that should be done for a TBSkinElement. More...
 
enum  TB_CARET_POS { TB_CARET_POS_BEGINNING, TB_CARET_POS_END }
 
enum  TB_ALIGN { TB_ALIGN_LEFT, TB_ALIGN_TOP, TB_ALIGN_RIGHT, TB_ALIGN_BOTTOM }
 
enum  EVENT_TYPE {
  EVENT_TYPE_CLICK, EVENT_TYPE_LONG_CLICK, EVENT_TYPE_POINTER_DOWN, EVENT_TYPE_POINTER_UP,
  EVENT_TYPE_POINTER_MOVE, EVENT_TYPE_WHEEL, EVENT_TYPE_MULTI_GESTURE, EVENT_TYPE_FINGER_DOWN,
  EVENT_TYPE_FINGER_UP, EVENT_TYPE_FINGER_MOVE, EVENT_TYPE_CHANGED, EVENT_TYPE_KEY_DOWN,
  EVENT_TYPE_KEY_UP, EVENT_TYPE_SHORTCUT, EVENT_TYPE_CONTEXT_MENU, EVENT_TYPE_FILE_DROP,
  EVENT_TYPE_CUSTOM
}
 
enum  MODIFIER_KEYS {
  TB_MODIFIER_NONE = 0, TB_CTRL = 1, TB_SHIFT = 2, TB_ALT = 4,
  TB_SUPER = 8
}
 
enum  SPECIAL_KEY {
  TB_KEY_UNDEFINED = 0, TB_KEY_UP, TB_KEY_DOWN, TB_KEY_LEFT,
  TB_KEY_RIGHT, TB_KEY_PAGE_UP, TB_KEY_PAGE_DOWN, TB_KEY_HOME,
  TB_KEY_END, TB_KEY_TAB, TB_KEY_BACKSPACE, TB_KEY_INSERT,
  TB_KEY_DELETE, TB_KEY_ENTER, TB_KEY_ESC, TB_KEY_F1,
  TB_KEY_F2, TB_KEY_F3, TB_KEY_F4, TB_KEY_F5,
  TB_KEY_F6, TB_KEY_F7, TB_KEY_F8, TB_KEY_F9,
  TB_KEY_F10, TB_KEY_F11, TB_KEY_F12
}
 
enum  WIDGET_STATE {
  WIDGET_STATE_NONE = 0, WIDGET_STATE_DISABLED = 1, WIDGET_STATE_FOCUSED = 2, WIDGET_STATE_PRESSED = 4,
  WIDGET_STATE_SELECTED = 8, WIDGET_STATE_HOVERED = 16, WIDGET_STATE_ALL
}
 TBWidget state types (may be combined). More...
 
enum  WIDGET_GRAVITY {
  WIDGET_GRAVITY_NONE = 0, WIDGET_GRAVITY_LEFT = 1, WIDGET_GRAVITY_RIGHT = 2, WIDGET_GRAVITY_TOP = 4,
  WIDGET_GRAVITY_BOTTOM = 8, WIDGET_GRAVITY_LEFT_RIGHT = WIDGET_GRAVITY_LEFT | WIDGET_GRAVITY_RIGHT, WIDGET_GRAVITY_TOP_BOTTOM = WIDGET_GRAVITY_TOP | WIDGET_GRAVITY_BOTTOM, WIDGET_GRAVITY_ALL = WIDGET_GRAVITY_LEFT_RIGHT | WIDGET_GRAVITY_TOP_BOTTOM,
  WIDGET_GRAVITY_DEFAULT = WIDGET_GRAVITY_LEFT | WIDGET_GRAVITY_TOP
}
 TBWidget gravity (may be combined). More...
 
enum  AXIS { AXIS_X, AXIS_Y, AXIS_Z }
 
enum  SIZE_DEP { SIZE_DEP_NONE = 0, SIZE_DEP_WIDTH_DEPEND_ON_HEIGHT = 1, SIZE_DEP_HEIGHT_DEPEND_ON_WIDTH = 2, SIZE_DEP_BOTH }
 Defines how the size in one axis depend on the other axis when a widgets size is affected by constraints. More...
 
enum  WIDGET_Z { WIDGET_Z_TOP, WIDGET_Z_BOTTOM }
 Defines widget z level, used with TBWidget::SetZ, TBWidget::AddChild. More...
 
enum  WIDGET_Z_REL { WIDGET_Z_REL_BEFORE, WIDGET_Z_REL_AFTER }
 Defines widget z level relative to another widget, used with TBWidget::AddChildRelative. More...
 
enum  WIDGET_VISIBILITY { WIDGET_VISIBILITY_VISIBLE, WIDGET_VISIBILITY_INVISIBLE, WIDGET_VISIBILITY_GONE }
 Defines widget visibility, used with TBWidget::SetVisibility. More...
 
enum  WIDGET_INVOKE_INFO { WIDGET_INVOKE_INFO_NORMAL, WIDGET_INVOKE_INFO_NO_CALLBACKS }
 
enum  WIDGET_FOCUS_REASON { WIDGET_FOCUS_REASON_NAVIGATION, WIDGET_FOCUS_REASON_POINTER, WIDGET_FOCUS_REASON_UNKNOWN }
 
enum  WIDGET_HIT_STATUS { WIDGET_HIT_STATUS_NO_HIT = 0, WIDGET_HIT_STATUS_HIT, WIDGET_HIT_STATUS_HIT_NO_CHILDREN }
 Hit status return value for TBWidget::GetHitStatus. More...
 
enum  TB_TEXT_ALIGN { TB_TEXT_ALIGN_LEFT, TB_TEXT_ALIGN_RIGHT, TB_TEXT_ALIGN_CENTER }
 TB_TEXT_ALIGN specifies horizontal text alignment. More...
 
enum  WINDOW_SETTINGS {
  WINDOW_SETTINGS_NONE = 0, WINDOW_SETTINGS_TITLEBAR = 1, WINDOW_SETTINGS_RESIZABLE = 2, WINDOW_SETTINGS_CLOSE_BUTTON = 4,
  WINDOW_SETTINGS_CAN_ACTIVATE = 8, WINDOW_SETTINGS_DEFAULT
}
 

Functions

void UnescapeString (char *str)
 Unescape backslash codes. More...
 
bool is_white_space (const char *str)
 
bool is_start_of_color (const char *str)
 Return true if the given string starts with a color. More...
 
bool is_start_of_reference (const char *str)
 Return true if the given string may be a node reference, such as language strings or TBNodeRefTree references. More...
 
bool is_space_or_comment (char *&line)
 Check if the line is a comment or empty space. More...
 
bool is_pending_multiline (const char *str)
 
bool IsEndQuote (const char *buf_start, const char *buf, const char quote_type)
 Check if buf is pointing at an end quote. More...
 
int TBGetNearestPowerOfTwo (int val)
 Return the nearest power of two from val. More...
 
bool tb_core_init (TBRenderer *renderer)
 Initialize turbo badger. More...
 
void tb_core_shutdown ()
 Shutdown turbo badger. More...
 
bool tb_core_is_initialized ()
 Returns true if turbo badger is initialized. More...
 
int GetSelectionScrollSpeed (int pointerpos, int min, int max)
 Get the delta that should be scrolled if dragging the pointer outside the range min-max.
 
constexpr uint32_t TBGetHash_one (char c, const char *remain, uint32_t value)
 
constexpr uint32_t TBGetHash (const char *str)
 
PreferredSize RotPreferredSize (const PreferredSize &ps, AXIS axis)
 
SizeConstraints RotSizeConstraints (const SizeConstraints &sc, AXIS axis)
 
TBRect RotRect (const TBRect &rect, AXIS axis)
 
WIDGET_GRAVITY RotGravity (WIDGET_GRAVITY gravity, AXIS axis)
 
 MAKE_ENUM_FLAG_COMBO (TB_NODE_READ_FLAGS)
 
template<class T >
T * TBSafeCast (TBTypedObject *obj)
 Returns the given object as the given type, or nullptr if it's not that type or if the object is nullptr. More...
 
template<class T >
const T * TBSafeCast (const TBTypedObject *obj)
 Returns the given object as the given type, or nullptr if it's not that type or if the object is nullptr. More...
 
int select_list_sort_cb (TBSelectItemSource *source, const int *a, const int *b)
 
const char * TypeToString (SKIN_ELEMENT_TYPE type)
 
TBSkinCondition::TARGET StringToTarget (const TBStr &target_str)
 
TBSkinCondition::PROPERTY StringToProperty (const TBStr &prop_str)
 
 MAKE_ENUM_FLAG_COMBO (SKIN_STATE)
 
void DrawEdgeFadeout (const TBRect &dst_rect, TBID skin_x, TBID skin_y, int left, int top, int right, int bottom)
 Draw fade out skin elements at the edges of dst_rect if needed. More...
 
void safe_delete (char *&str)
 
const char * stristr (const char *arg1, const char *arg2)
 Some useful C-like functions that's missing in the standard. More...
 
template<class T >
Max (const T &left, const T &right)
 
template<class T >
Min (const T &left, const T &right)
 
template<class T >
Abs (const T &value)
 
template<class T >
Clamp (const T &value, const T &min, const T &max)
 
template<class T >
ClampClipMax (const T &value, const T &min, const T &max)
 Returns value clamped to min and max. More...
 
char * next_token (char *&str, const char *delim)
 
bool is_start_of_number (const char *str)
 Return true if the given string starts with a number. More...
 
bool contains_non_trailing_space (const char *str)
 Returns true if the given string contains space that is not at the end of the string. More...
 
bool is_number_only (const char *str)
 Return true if the string can be represented as a number. More...
 
bool is_number_float (const char *str)
 Return true if the given number string is a float number. More...
 
 MAKE_ENUM_FLAG_COMBO (MODIFIER_KEYS)
 
 MAKE_ENUM_FLAG_COMBO (WIDGET_STATE)
 
 MAKE_ENUM_FLAG_COMBO (WIDGET_GRAVITY)
 
 MAKE_ENUM_FLAG_COMBO (SIZE_DEP)
 
template<class T >
TBValue::TYPE SliderType (T x)
 
template<>
TBValue::TYPE SliderType< double > (double x)
 
template<>
TBValue::TYPE SliderType< long > (long x)
 
template<>
TBValue::TYPE SliderType< int > (int x)
 
 TB_WIDGET_FACTORY (TBWidget, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBWindow, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBButton, TBValue::TYPE_INT, WIDGET_Z_BOTTOM)
 
 TB_WIDGET_FACTORY (TBInlineSelect, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBClickLabel, TBValue::TYPE_STRING, WIDGET_Z_BOTTOM)
 
 TB_WIDGET_FACTORY (TBEditField, TBValue::TYPE_STRING, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBLayout, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBScrollContainer, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBTabContainer, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBScrollBar, TBValue::TYPE_FLOAT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSlider, TBValue::TYPE_FLOAT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSliderInt, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSliderLong, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
void ReadItems (TBNode *node, TBGenericStringItemSource *target_source)
 
 TB_WIDGET_FACTORY (TBSelectList, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSelectDropdown, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBCheckBox, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBRadioButton, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBTextField, TBValue::TYPE_STRING, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSkinImage, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSeparator, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBProgressSpinner, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBContainer, TBValue::TYPE_NULL, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSectionHeader, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBSection, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 TB_WIDGET_FACTORY (TBToggleContainer, TBValue::TYPE_INT, WIDGET_Z_TOP)
 
 MAKE_ENUM_FLAG_COMBO (WINDOW_SETTINGS)
 
int TBRunTests (uint32_t settings=TB_TEST_VERBOSE)
 

Variables

TBLinkListOf
< TBWidgetAnimationObject
widget_animations
 
TBWidgetsAnimationManager widgets_animation_manager
 
TBRendererg_renderer
 
TBSking_tb_skin
 
TBWidgetsReaderg_widgets_reader
 
TBLanguageg_tb_lng
 
TBFontManagerg_font_manager
 
TBColorManagerg_color_manager
 
const int CARET_BLINK_TIME = 500
 
const int SELECTION_SCROLL_DELAY = 1000/30
 
TBLinkListOf< TBMessageLinkg_all_delayed_messages
 List of all delayed messages.
 
TBLinkListOf< TBMessageLinkg_all_normal_messages
 List of all nondelayed messages. More...
 
const int TAB_SPACE = 4
 
const char * special_char_newln = "¶"
 
const char * special_char_space = "·"
 
const char * special_char_tab = "»"
 
const char * special_char_password = "•"
 
TBValueGroup g_value_group
 The global value group. More...
 
const int auto_click_first_delay = 500
 
const int auto_click_repeat_delay = 100
 
const int spin_speed = 1000/30
 How fast should the spinner animation animate.
 
TBLinkListOf
< TBWidgetListenerGlobalLink
g_listeners
 
TBWidgetFactoryg_registered_factories = nullptr
 

Detailed Description

This file contains a very simple unit testing framework.

There are more capable unit testing frameworks available (that
might be more suitable if you need extensive testing of your target
application.

I've chosen to not use any other framework for internal testing of
Turbo Badger to minimize dependences.

Test groups and tests:
---------------------

Tests are specified in named groups, that can contain multiple named tests
that are run in the order specified, except for special tests.

Special tests are test with the names Init, Shutdown, Setup, Cleanup.
They can be left out if they are not needed.

Init and Shutdown - Called once per group. If Init fail, the tests in the
                    group and Shutdown will be skipped.
Setup and Cleanup - Called once per test. If Setup fail, the current test
                    and Cleanup will be skipped.

How to define a single test:
---------------------------

TB_TEST_GROUP(groupname)
{
    TB_TEST(testname)
    {

Here goes test code and calls to TB_VERIFY, TB_PASS, TB_FAIL etc. TB_VERIFY(1); } }

How to define multiple tests, with data, setup and cleanup:

TB_TEST_GROUP(groupname) { Here goes the data for this group TBStr str;

Here goes methods with access to data bool is_str_empty() { return str.IsEmpty(); }

A test with name Setup will be called before each test. If it fail, no other tests will be called (not even Cleanup). TB_TEST(Setup) { Setup }

The actual test code. Will be called if Setup passed. TB_TEST(test_something_1) { Test 1 }

Another test code. Will be called if Setup passed. TB_TEST(test_something_2) { Test 2 }

A test with name Cleanup will be called after each test. Will be called even if the test failed. TB_TEST(Cleanup) { Cleanup } }

Enumeration Type Documentation

Defines how the animation progress value is interpolated.

Enumerator
ANIMATION_CURVE_LINEAR 

Linear.

ANIMATION_CURVE_SLOW_DOWN 

Fast start, slow end.

ANIMATION_CURVE_SPEED_UP 

Slow start, fast end.

ANIMATION_CURVE_BEZIER 

Slow start, slow end. Almost linear.

ANIMATION_CURVE_SMOOTH 

Slow start, slow end. Stronger than ANIMATION_CURVE_BEZIER.

Defines what the animation duration time is relative to.

Enumerator
ANIMATION_TIME_IMMEDIATELY 

The start time begins when the animation start in TBAnimationManager::StartAnimation.

ANIMATION_TIME_FIRST_UPDATE 

The animation start in StartAnimation just as with ANIMATION_TIME_IMMEDIATELY, but the start time is adjusted to when the animations Update is about to be called the first time since it was started.

Using this is most often preferable since starting a animation is often accompanied with some extra work that might eat up a considerable time of the total duration (and chop of the beginning of it).

F.ex: Creating a window and starting its appearance animation. During initialization of the window, you might initiate loading of additional resources. When that is done and you finally end up updating animations, most of the animation time might already have passed. If the animation start time is adjusted to the first update, the whole animation will run from 0.0 - 1.0 smoothly when the initialization is done.

enum tb::AXIS
Enumerator
AXIS_X 

Horizontal layout.

AXIS_Y 

Vertical layout.

AXIS_Z 

Depth.

EDIT_TYPE - These types does not restrict input (may change in the future).

They are just hints for virtual keyboard, so it can show special keys.

Enumerator
EVENT_TYPE_CLICK 

Click event is what should be used to trig actions in almost all cases.

It is invoked on a widget after POINTER_UP if the pointer is still inside its hit area. It can also be invoked by keyboard on some clickable widgets (see TBWidget::SetClickByKey).

If panning of scrollable widgets start while the pointer is down, CLICK won't be invoked when releasing the pointer (since that should stop panning).

EVENT_TYPE_LONG_CLICK 

Long click event is sent when the pointer has been down for some time without moving much.

It is invoked on a widget that has enabled it (TBWidget::SetWantLongClick If this event isn't handled, the widget will invoke a CONTEXT_MENU event. If any of those are handled, the CLICK event that would normally be invoked after the pending POINTER_UP will be suppressed.

EVENT_TYPE_CHANGED 

Invoked after changing text in a TBTextField, changing selected item in a TBSelectList etc.

Invoking this event trigs synchronization with connected TBWidgetValue and other widgets connected to it.

EVENT_TYPE_SHORTCUT 

Invoked by the platform when a standard keyboard shortcut is pressed.

It's called before InvokeKeyDown (EVENT_TYPE_KEY_DOWN) and if the event is handled (returns true), the KeyDown is canceled. The ref_id will be set to one of the following: "cut", "copy", "paste", "selectall", "undo", "redo", "new", "open", "save".

EVENT_TYPE_CONTEXT_MENU 

Invoked when a context menu should be opened at the event x and y coordinates.

It may be invoked automatically for a widget on long click, if nothing handles the long click event.

EVENT_TYPE_FILE_DROP 

Invoked by the platform when one or multiple files has been dropped on the widget.

The event is guaranteed to be a TBWidgetEventFileDrop.

EVENT_TYPE_CUSTOM 

Custom event.

Not used internally. ref_id may be used for additional type info.

Specifies which width widgets in a AXIS_X layout should have, or which height widgets in a AXIS_Y layout should have.

Attribute: 'distribution'.

TBLayout TBLayout::SetLayoutDistribution

Enumerator
LAYOUT_DISTRIBUTION_PREFERRED 

Size will be the preferred so each widget may be sized differently. [default].

LAYOUT_DISTRIBUTION_AVAILABLE 

Size should grow to all available space.

LAYOUT_DISTRIBUTION_GRAVITY 

Sizes depend on the gravity for each widget.

(If the widget pulls towards both directions, it should grow to all available space)

Specifies how widgets should be moved horizontally in a AXIS_X layout (or vertically in a AXIS_Y layout) if there is extra space available.

Attribute: 'distribution-position'.

TBLayout TBLayout::SetLayoutDistributionPosition

Enumerator
LAYOUT_DISTRIBUTION_POSITION_CENTER 

Position centered. [default].

LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP 

Position to the upper left.

LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM 

Position to the lower right.

Layout order parameter for TBLayout::SetLayoutOrder.

Enumerator
LAYOUT_ORDER_BOTTOM_TO_TOP 

From bottom to top widget (default creation order).

LAYOUT_ORDER_TOP_TO_BOTTOM 

From top to bottom widget.

Specifies what happens when there is not enough room for the layout, even when all the children have been shrunk to their minimum size.

Enumerator
LAYOUT_OVERFLOW_CLIP 

Clip the chilren widgtes. [default].

LAYOUT_OVERFLOW_SCROLL 

Create a scroller.

Specifies which y position widgets in a AXIS_X layout should have, or which x position widgets in a AXIS_Y layout should have.

Attribute: 'position'.

TBLayout TBLayout::SetLayoutPosition

Enumerator
LAYOUT_POSITION_CENTER 

Position is centered. [default].

LAYOUT_POSITION_LEFT_TOP 

Position is to the left for AXIS_Y layout and top for AXIS_X layout.

LAYOUT_POSITION_RIGHT_BOTTOM 

Position is to the right for AXIS_Y layout and bottom for AXIS_X layout.

LAYOUT_POSITION_GRAVITY 

Position depend on the gravity for each widget.

(If the widget pulls towards both directions, it will be centered)

Specifies which height widgets in a AXIS_X layout should have, or which width widgets in a AXIS_Y layout should have.

No matter what, it will still prioritize minimum and maximum for each widget.

TBLayout TBLayout::SetLayoutSize

Enumerator
LAYOUT_SIZE_GRAVITY 

Sizes depend on the gravity for each widget.

(If the widget pulls towards both directions, it should grow to all available space)

LAYOUT_SIZE_PREFERRED 

Size will be the preferred so each widget may be sized differently. [default].

LAYOUT_SIZE_AVAILABLE 

Size should grow to all available space.

Enumerator
SCROLL_MODE_X_Y 

X and Y always scroll-mode: xy.

SCROLL_MODE_Y 

Y always (X never) scroll-mode: y.

SCROLL_MODE_Y_AUTO 

Y auto (X never) scroll-mode: y-auto.

SCROLL_MODE_X_AUTO_Y_AUTO 

X auto, Y auto scroll-mode: auto.

SCROLL_MODE_OFF 

X any Y never scroll-mode: off.

Defines how the size in one axis depend on the other axis when a widgets size is affected by constraints.

Enumerator
SIZE_DEP_NONE 

No dependency (Faster layout).

SIZE_DEP_WIDTH_DEPEND_ON_HEIGHT 

The width is dependant on the height.

Additional layout pass may be required.

SIZE_DEP_HEIGHT_DEPEND_ON_WIDTH 

The height is dependant on the width.

Additional layout pass may be required.

SIZE_DEP_BOTH 

Both width and height are dependant on each other.

Additional layout pass may be required.

Type of painting that should be done for a TBSkinElement.

Enumerator
SKIN_ELEMENT_TYPE_STRETCH_BOX 

Default element type, cut bitmap into 9 pieces "cut" wide.

SKIN_ELEMENT_TYPE_STRETCH_BORDER 

Same as above, but dont fill the center.

SKIN_ELEMENT_TYPE_STRETCH_IMAGE 

Scale the bitmap to the dest rect.

SKIN_ELEMENT_TYPE_TILE 

Tile the bitmap to the dest rect.

Skin state types (may be combined).

NOTE: This should exactly match WIDGET_STATE in tb_widgets.h!

Enumerator
TB_ALIGN_LEFT 

Align to the left side.

TB_ALIGN_TOP 

Align to the top (above)

TB_ALIGN_RIGHT 

Align to the right side.

TB_ALIGN_BOTTOM 

Align to the bottom (below)

Enumerator
TB_NODE_READ_FLAGS_APPEND 

Read nodes without clearing first.

Can be used to append data from multiple sources, or inject dependencies.

Enumerator
TB_SORT_NONE 

No sorting. Items appear in list order.

TB_SORT_ASCENDING 

Ascending sort.

TB_SORT_DESCENDING 

Descending sort.

TB_TEXT_ALIGN specifies horizontal text alignment.

See Also
TBWidgetString::SetTextAlign
TBWidgetString::GetTextAlign
TBTextField::SetTextAlign
TBTextField::SetTextAlign
Enumerator
TB_TEXT_ALIGN_LEFT 

Aligned left.

TB_TEXT_ALIGN_RIGHT 

Aligned right.

TB_TEXT_ALIGN_CENTER 

Aligned center.

Specify when the bitmap should be validated when calling TBBitmapFragmentMap::GetBitmap.

Enumerator
TB_VALIDATE_ALWAYS 

Always validate the bitmap (The bitmap is updated if needed)

TB_VALIDATE_FIRST_TIME 

Only validate if the bitmap does not yet exist (Make sure there is a valid bitmap pointer, but the data is not necessarily updated)

Enumerator
WIDGET_FOCUS_REASON_NAVIGATION 

Set focus by navigation (i.e.

keyboard tab). This will scroll to the widget if needed.

WIDGET_FOCUS_REASON_POINTER 

Set focus by pointer (i.e. clicking)

WIDGET_FOCUS_REASON_UNKNOWN 

Set focus by anything else.

TBWidget gravity (may be combined).

Gravity gives hints about positioning and sizing preferences.

Hit status return value for TBWidget::GetHitStatus.

Enumerator
WIDGET_HIT_STATUS_NO_HIT 

The widget was not hit.

WIDGET_HIT_STATUS_HIT 

The widget was hit, any child may be hit too.

WIDGET_HIT_STATUS_HIT_NO_CHILDREN 

The widget was hit, no children should be hit.

TBWidget state types (may be combined).

NOTE: This should exactly match SKIN_STATE in tb_skin.h!

Defines widget visibility, used with TBWidget::SetVisibility.

Enumerator
WIDGET_VISIBILITY_VISIBLE 

Visible (default)

WIDGET_VISIBILITY_INVISIBLE 

Invisible, but layouted. Interaction disabled.

WIDGET_VISIBILITY_GONE 

Invisible and no layout. Interaction disabled.

Defines widget z level, used with TBWidget::SetZ, TBWidget::AddChild.

Enumerator
WIDGET_Z_TOP 

The toplevel (Visually drawn on top of everything else).

WIDGET_Z_BOTTOM 

The bottomlevel (Visually drawn behind everything else).

Defines widget z level relative to another widget, used with TBWidget::AddChildRelative.

Enumerator
WIDGET_Z_REL_BEFORE 

Before the reference widget (visually behind reference).

WIDGET_Z_REL_AFTER 

After the reference widget (visually above reference).

Enumerator
WINDOW_SETTINGS_NONE 

Chrome less window without any other settings.

WINDOW_SETTINGS_TITLEBAR 

Show a title bar that can also move the window.

WINDOW_SETTINGS_RESIZABLE 

Show a widget for resizing the window.

WINDOW_SETTINGS_CLOSE_BUTTON 

Show a widget for closing the window.

WINDOW_SETTINGS_CAN_ACTIVATE 

Can be activated and deactivate other windows.

Function Documentation

template<class T >
T tb::ClampClipMax ( const T &  value,
const T &  min,
const T &  max 
)

Returns value clamped to min and max.

If max is greater than min, max will be clipped to min.

bool tb::contains_non_trailing_space ( const char *  str)

Returns true if the given string contains space that is not at the end of the string.

void tb::DrawEdgeFadeout ( const TBRect &  dst_rect,
TBID  skin_x,
TBID  skin_y,
int  left,
int  top,
int  right,
int  bottom 
)

Draw fade out skin elements at the edges of dst_rect if needed.

It indicates to the user that there is hidden content. left, top, right, bottom specifies the (positive) distance scrolled from the limit.

bool tb::is_number_float ( const char *  str)

Return true if the given number string is a float number.

Should only be called when you've verified it's a number with is_number().

bool tb::is_number_only ( const char *  str)

Return true if the string can be represented as a number.

It ignores trailing white space. Ex: 100, -.2 will return true. Ex: 1.0E-8, 5px will return false.

bool tb::is_space_or_comment ( char *&  line)

Check if the line is a comment or empty space.

If it is, consume the leading whitespace from line.

bool tb::is_start_of_color ( const char *  str)

Return true if the given string starts with a color.

Ex: #ffdd00, #fd0

bool tb::is_start_of_number ( const char *  str)

Return true if the given string starts with a number.

Ex: 100, -.2, 1.0E-8, 5px will all return true.

bool tb::is_start_of_reference ( const char *  str)

Return true if the given string may be a node reference, such as language strings or TBNodeRefTree references.

bool tb::IsEndQuote ( const char *  buf_start,
const char *  buf,
const char  quote_type 
)

Check if buf is pointing at an end quote.

It may need to iterate buf backwards toward buf_start to check if any preceding backslashes make it a escaped quote (which should not be the end quote)

const char * tb::stristr ( const char *  arg1,
const char *  arg2 
)

Some useful C-like functions that's missing in the standard.

bool tb::tb_core_init ( TBRenderer *  renderer)

Initialize turbo badger.

Call this before using any turbo badger API.

bool tb::tb_core_is_initialized ( )

Returns true if turbo badger is initialized.

void tb::tb_core_shutdown ( )

Shutdown turbo badger.

Call this after deleting the last widget, to free turbo badger internals.

int tb::TBGetNearestPowerOfTwo ( int  val)

Return the nearest power of two from val.

F.ex 110 -> 128, 256->256, 257->512 etc.

template<class T >
T* tb::TBSafeCast ( TBTypedObject *  obj)

Returns the given object as the given type, or nullptr if it's not that type or if the object is nullptr.

template<class T >
const T* tb::TBSafeCast ( const TBTypedObject *  obj)

Returns the given object as the given type, or nullptr if it's not that type or if the object is nullptr.

void tb::UnescapeString ( char *  str)

Unescape backslash codes.

This is done in place using the string both as source and destination.

Variable Documentation

TBLinkListOf<TBMessageLink> tb::g_all_normal_messages

List of all nondelayed messages.

TBValueGroup tb::g_value_group

The global value group.