bWidgets
Core widget toolkit designed for Blender
bWidgets Namespace Reference

Namespaces

namespace  bwScreenGraph
 

Classes

class  bwAbstractButton
 Base class for button like widgets. More...
 
class  bwAbstractButtonHandler
 
class  bwCheckbox
 
class  bwCheckboxHandler
 
class  bwColor
 
class  bwContainerWidget
 
struct  bwContext
 Important state information for the screen-graph. More...
 
class  bwEvent
 
class  bwEventDispatcher
 Mangages sending events to screen-graph nodes based on current state. More...
 
class  bwFunctorInterface
 Abstract function object class. More...
 
class  bwGradient
 Simple class for calculating colors for gradient fills. More...
 
class  bwIconInterface
 Interface to reference icons from within bWidgets. More...
 
class  bwLabel
 
class  bwLayoutInterface
 
class  bwMouseButtonDragEvent
 
class  bwMouseButtonEvent
 
class  bwMouseWheelEvent
 
class  bwNumberSlider
 
class  bwNumberSliderHandler
 
class  bwPaintEngine
 Main interface to implement any drawing of geometry or text. More...
 
class  bwPainter
 
class  bwPanel
 
class  bwPanelHandler
 
class  bwPoint
 
class  bwPolygon
 
class  bwPushButton
 
class  bwRadioButton
 A radio-button like widget retaining a pressed state once pressed. More...
 
class  bwRadioButtonHandler
 
class  bwRange
 
class  bwRectangle
 
class  bwScrollBar
 
class  bwScrollBarHandler
 
class  bwScrollView
 
class  bwScrollViewHandler
 
class  bwStyle
 
class  bwStyleClassic
 
class  bwStyleCSS
 Style-class for CSS driven Styles. More...
 
class  bwStyleFlat
 
class  bwStyleFlatDark
 
class  bwStyleFlatLight
 
class  bwStyleManager
 Singleton class for managing styles through type ID's. More...
 
class  bwStyleProperties
 Manage a list of properties (bwStyleProperty instances). More...
 
class  bwStyleProperty
 Simple class for managing properties that can be manipulated through stylesheets (CSS). More...
 
class  bwStylePropertyInternal
 
class  bwTextBox
 
class  bwTextBoxHandler
 
class  bwWidget
 Abstract base class that all widgets derive from. More...
 
class  bwWidgetBaseStyle
 Properties for typical widgets with roundbox corners. More...
 
class  PolygonRoundboxCreator
 
struct  PropType
 
struct  PropType< bool >
 
struct  PropType< bwColor >
 
struct  PropType< float >
 
struct  PropType< int >
 

Typedefs

template<typename... _Args>
using HandlerFunc = void(bwScreenGraph::EventHandler::*)(_Args &&...)
 
using bwDistance = bwPoint
 
using bwPointVec = std::vector< class bwPoint >
 
using bwRectanglePixel = bwRectangle< int >
 

Enumerations

enum  RoundboxCorner {
  NONE = 0 , BOTTOM_LEFT = (1 << 0) , BOTTOM_RIGHT = (1 << 1) , TOP_LEFT = (1 << 2) ,
  TOP_RIGHT = (1 << 3) , ALL = (BOTTOM_LEFT | BOTTOM_RIGHT | TOP_LEFT | TOP_RIGHT)
}
 
enum class  TextAlignment { LEFT , CENTER , RIGHT }
 
enum class  Direction { UP , DOWN , LEFT , RIGHT }
 

Functions

template<typename... _Args>
static void bubbleEvent (const bwEvent &event, const Node &from_node, HandlerFunc< _Args &&... > handler_func, _Args &&... __args)
 
static auto findHoveredNode (const bwEvent &event, Node &node) -> Node *
 
static auto painter_check_paint_engine () -> bool
 
static auto getRoundboxMinsize (const bwRectanglePixel &rect, unsigned int corners) -> unsigned int
 
auto operator* (const bwPoint &lhs, float factor) -> bwPoint
 
auto operator* (float factor, const bwPoint &rhs) -> bwPoint
 
auto operator+ (const bwPoint &lhs, const bwPoint &rhs) -> bwPoint
 
auto operator- (const bwPoint &lhs, const bwPoint &rhs) -> bwPoint
 
auto distance (bwPoint a, bwPoint b) -> float
 
static auto property_value_is_copyable (const bwStyleProperty &destination, const bwStyleProperty &source) -> bool
 
template<typename _Type >
static void property_copy_value (bwStyleProperty &destination_property_base, const bwStyleProperty &source_property_base)
 
static void widget_base_style_checkbox_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_number_slider_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_push_button_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_radio_button_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_scroll_bar_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_text_box_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_panel_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_scrollview_set (bwWidget &, bwWidgetBaseStyle &r_base_style)
 
static void widget_style_properties_set_to_default (bwWidget &widget)
 
static void widget_base_style_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_checkbox_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_number_slider_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_push_button_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_radio_button_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_scroll_bar_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_text_box_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_panel_set (bwWidget &, bwWidgetBaseStyle &r_base_style)
 
static void widget_base_style_scrollview_set (bwWidget &, bwWidgetBaseStyle &r_base_style)
 
static void widget_style_properties_set_to_default (bwWidget &widget)
 
static void widget_base_style_set (bwWidget &widget, bwWidgetBaseStyle &r_base_style)
 
static void panel_draw_drag_dots (bwPainter &painter, const bwRectanglePixel &rectangle, const bwWidgetBaseStyle &base_style)
 
static auto getInnerRect (bwScrollBar &scrollbar) -> bwRectanglePixel
 
template<typename... _Args>
static void forwardEventToNode (bwScreenGraph::Node &to_node, HandlerFunc< _Args &&... > handler_func, _Args &&... __args)
 
template<typename... _Args>
static auto forwardEventToScrollbarIfInside (const bwScrollViewHandler &scrollview_handler, bwScreenGraph::Node &scrollbar_node, const class bwEvent &event, HandlerFunc< _Args &&... > handler_func, _Args &&... __args) -> bool
 
template<class T , class _RawT = typename std::remove_pointer<T>::type>
auto widget_cast (bwWidget &widget) -> _RawT *
 
template<class T , class _RawT = typename std::remove_pointer<typename std::remove_const<T>::type>::type>
auto widget_cast (const bwWidget &widget) -> const _RawT *
 
template<class T , class _RawT = typename std::remove_pointer<T>::type>
auto widget_cast (bwWidget *widget) -> _RawT *
 
template<class T , class _RawT = typename std::remove_pointer<typename std::remove_const<T>::type>::type>
auto widget_cast (const bwWidget *widget) -> const _RawT *
 
Property registration
template<typename _Type >
static auto properties_add_property (bwStyleProperties::PropertyList &properties, const std::string_view &name, _Type &reference) -> bwStyleProperty &
 
template<typename _Type >
static auto properties_add_property (bwStyleProperties::PropertyList &properties, const std::string_view &name) -> bwStyleProperty &
 

Variables

static const std::vector< bwPointcheck_mark_verts
 

Typedef Documentation

◆ bwDistance

using bWidgets::bwDistance = typedef bwPoint

◆ bwPointVec

using bWidgets::bwPointVec = typedef std::vector<class bwPoint>

◆ bwRectanglePixel

◆ HandlerFunc

template<typename... _Args>
using bWidgets::HandlerFunc = typedef void (bwScreenGraph::EventHandler::*)(_Args&&...)

Enumeration Type Documentation

◆ Direction

enum class bWidgets::Direction
strong
Enumerator
UP 
DOWN 
LEFT 
RIGHT 

◆ RoundboxCorner

Enumerator
NONE 
BOTTOM_LEFT 
BOTTOM_RIGHT 
TOP_LEFT 
TOP_RIGHT 
ALL 

◆ TextAlignment

enum class bWidgets::TextAlignment
strong
Enumerator
LEFT 
CENTER 
RIGHT 

Function Documentation

◆ bubbleEvent()

template<typename... _Args>
static void bWidgets::bubbleEvent ( const bwEvent event,
const Node from_node,
HandlerFunc< _Args &&... >  handler_func,
_Args &&...  __args 
)
static

◆ distance()

auto bWidgets::distance ( bwPoint  a,
bwPoint  b 
) -> float

◆ findHoveredNode()

static auto bWidgets::findHoveredNode ( const bwEvent event,
Node node 
) -> Node*
static

◆ forwardEventToNode()

template<typename... _Args>
static void bWidgets::forwardEventToNode ( bwScreenGraph::Node to_node,
HandlerFunc< _Args &&... >  handler_func,
_Args &&...  __args 
)
static

◆ forwardEventToScrollbarIfInside()

template<typename... _Args>
static auto bWidgets::forwardEventToScrollbarIfInside ( const bwScrollViewHandler scrollview_handler,
bwScreenGraph::Node scrollbar_node,
const class bwEvent event,
HandlerFunc< _Args &&... >  handler_func,
_Args &&...  __args 
) -> bool
static

◆ getInnerRect()

static auto bWidgets::getInnerRect ( bwScrollBar scrollbar) -> bwRectanglePixel
static

◆ getRoundboxMinsize()

static auto bWidgets::getRoundboxMinsize ( const bwRectanglePixel rect,
unsigned int  corners 
) -> unsigned int
static

◆ operator*() [1/2]

auto bWidgets::operator* ( const bwPoint lhs,
float  factor 
) -> bwPoint

◆ operator*() [2/2]

auto bWidgets::operator* ( float  factor,
const bwPoint rhs 
) -> bwPoint

◆ operator+()

auto bWidgets::operator+ ( const bwPoint lhs,
const bwPoint rhs 
) -> bwPoint

◆ operator-()

auto bWidgets::operator- ( const bwPoint lhs,
const bwPoint rhs 
) -> bwPoint

◆ painter_check_paint_engine()

static auto bWidgets::painter_check_paint_engine ( ) -> bool
static

◆ panel_draw_drag_dots()

static void bWidgets::panel_draw_drag_dots ( bwPainter painter,
const bwRectanglePixel rectangle,
const bwWidgetBaseStyle base_style 
)
static

◆ properties_add_property() [1/2]

template<typename _Type >
static auto bWidgets::properties_add_property ( bwStyleProperties::PropertyList properties,
const std::string_view &  name 
) -> bwStyleProperty&
static

◆ properties_add_property() [2/2]

template<typename _Type >
static auto bWidgets::properties_add_property ( bwStyleProperties::PropertyList properties,
const std::string_view &  name,
_Type &  reference 
) -> bwStyleProperty&
static

◆ property_copy_value()

template<typename _Type >
static void bWidgets::property_copy_value ( bwStyleProperty destination_property_base,
const bwStyleProperty source_property_base 
)
static

◆ property_value_is_copyable()

static auto bWidgets::property_value_is_copyable ( const bwStyleProperty destination,
const bwStyleProperty source 
) -> bool
static

◆ widget_base_style_checkbox_set() [1/2]

static void bWidgets::widget_base_style_checkbox_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_checkbox_set() [2/2]

static void bWidgets::widget_base_style_checkbox_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_number_slider_set() [1/2]

static void bWidgets::widget_base_style_number_slider_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_number_slider_set() [2/2]

static void bWidgets::widget_base_style_number_slider_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_panel_set() [1/2]

static void bWidgets::widget_base_style_panel_set ( bwWidget ,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_panel_set() [2/2]

static void bWidgets::widget_base_style_panel_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_push_button_set() [1/2]

static void bWidgets::widget_base_style_push_button_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_push_button_set() [2/2]

static void bWidgets::widget_base_style_push_button_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_radio_button_set() [1/2]

static void bWidgets::widget_base_style_radio_button_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_radio_button_set() [2/2]

static void bWidgets::widget_base_style_radio_button_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_scroll_bar_set() [1/2]

static void bWidgets::widget_base_style_scroll_bar_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_scroll_bar_set() [2/2]

static void bWidgets::widget_base_style_scroll_bar_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_scrollview_set() [1/2]

static void bWidgets::widget_base_style_scrollview_set ( bwWidget ,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_scrollview_set() [2/2]

static void bWidgets::widget_base_style_scrollview_set ( bwWidget ,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_set() [1/2]

static void bWidgets::widget_base_style_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_set() [2/2]

static void bWidgets::widget_base_style_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_text_box_set() [1/2]

static void bWidgets::widget_base_style_text_box_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_base_style_text_box_set() [2/2]

static void bWidgets::widget_base_style_text_box_set ( bwWidget widget,
bwWidgetBaseStyle r_base_style 
)
static

◆ widget_cast() [1/4]

template<class T , class _RawT = typename std::remove_pointer<T>::type>
auto bWidgets::widget_cast ( bwWidget widget) -> _RawT*
inline

Try to dynamically cast a widget from one widget type to another. Use-case is not just to perform the cast itself, but to also to check if a widget is of a specific type.

There are a couple of reasons why types are checked this way:

  • Using bwWidget::identifier for this would imply string comparisons - which scale badly.
  • The most practical alternative would probably be a type enum. To add a widget, the central enum definition would have to be extended. This makes it impossible to define a widget in a single file.
  • Enums can't be modified from external code to define custom widget types (types not definied within bWidgets). So for these a "custom" enum item would be needed. If this is set, an alternative type check mechanism would be needed, likely the slower string comparison.
  • Using enums leads to more verbose and less safe checks. If an enum value says the widget is of a certain type, the code will assume it was also constructed for this type. It typically performs a static cast, which may work fine in most cases, but is technically unsafe still. Using dynamic_cast<>(), the compiler ensures a type-safe operation.

Retains const-correctness and always returns a pointer. E.g. widget_cast<bwFoo>(const_object) returns a const bwFoo* type.

Note
By design, bWidgets should not need much type casting or type checking like this. Widget types, composed together with other custom objects (like widget specific event handlers) through the screen-graph node, should be able to define comprehensive custom behavior. Sometimes it's still necessary to customize behavior through type checks from outside the widget type definition though. At least for now.
Returns
The derived widget class of type T* or nullptr if cast is not valid (whereby T is the "raw" type requested, without pointer).

◆ widget_cast() [2/4]

template<class T , class _RawT = typename std::remove_pointer<T>::type>
auto bWidgets::widget_cast ( bwWidget widget) -> _RawT*
inline

See widget_cast(bwWidget& widget)

Returns
The derived widget class of type T* or nullptr if cast is not valid (whereby T is the "raw" type requested, without pointer).

◆ widget_cast() [3/4]

template<class T , class _RawT = typename std::remove_pointer<typename std::remove_const<T>::type>::type>
auto bWidgets::widget_cast ( const bwWidget widget) -> const _RawT*
inline

See widget_cast(bwWidget& widget)

Returns
The derived widget class of type const T* or nullptr if cast is not valid (whereby T is the "raw" type requested, without const qualifier or pointer).

◆ widget_cast() [4/4]

template<class T , class _RawT = typename std::remove_pointer<typename std::remove_const<T>::type>::type>
auto bWidgets::widget_cast ( const bwWidget widget) -> const _RawT*
inline

See widget_cast(bwWidget& widget)

Returns
The derived widget class of type const T* or nullptr if cast is not valid (whereby T is the "raw" type requested, without const qualifier or pointer).

◆ widget_style_properties_set_to_default() [1/2]

static void bWidgets::widget_style_properties_set_to_default ( bwWidget widget)
static

◆ widget_style_properties_set_to_default() [2/2]

static void bWidgets::widget_style_properties_set_to_default ( bwWidget widget)
static

Variable Documentation

◆ check_mark_verts

const std::vector<bwPoint> bWidgets::check_mark_verts
static
Initial value:
= {{-0.578579f, 0.253369f},
{-0.392773f, 0.412794f},
{-0.004241f, -0.328551f},
{-0.003001f, 0.034320f},
{1.055313f, 0.864744f},
{0.866408f, 1.026895f}}