DIWNE::StyleBase
Default base style. More...
#include "DIWNE/Core/Style/StyleBase.h"
Inherits from DIWNE::Style
Public Functions
Name | |
---|---|
StyleBase() | |
StyleBase(const StyleBase & other) | |
StyleBase(StyleBase && other) | |
virtual bool | boolean(Style::Var key) const override |
virtual const ImVec4 & | color(Style::Var key) const override |
virtual float | decimal(Style::Var key) const override |
template <typename T > <br>const T & | get(Style::Var key) const |
float | getDpiScale() const |
template <typename T > <br>T * | getPtr(Style::Var key) const |
virtual int | integer(Style::Var key) const override |
StyleBase & | operator=(const StyleBase & other) |
StyleBase & | operator=(StyleBase && other) |
template <typename T ,typename std::enable_if< std::is_pointer< T >::value, bool >::type =true> <br>void | set(Style::Var key, T ptr, bool dpiScaled =false)<br>Set style variable from a pointer, so that it can be modified dynamically. |
template <typename T ,typename std::enable_if<!std::is_pointer< T >::value, bool >::type =true> <br>void | set(Style::Var key, T value, bool dpiScaled =false)<br>Set style variable value. |
void | setDpiScale(float scale) |
virtual ImVec2 | size(Style::Var key) const override |
Public Attributes
Name | |
---|---|
float | dpiScale |
Friends
Name | |
---|---|
class | StyleOverride |
Additional inherited members
Public Types inherited from DIWNE::Style
Name | |
---|---|
enum short | Var { GRID_COLOR, GRID_DOTS_COLOR, NODE_BG, NODE_HEADER_BG, NODE_FG, NODE_HEADER_FG, NODE_ROUNDING, NODE_PADDING, MOUSE_DRAG_THRESHOLD, SELECTION_ROUNDING, SELECTED_BORDER_WIDTH, SELECTED_BORDER_COLOR, HOVER_BORDER_WIDTH, HOVER_BORDER_COLOR, LINK_COLOR, LINK_COLOR_SELECTED, LINK_UNPLUGGED_ALPHA, LINK_WIDTH, LINK_SELECTED_WIDTH, LINK_BORDER_WIDTH, LINK_BORDER_COLOR, PIN_SPACING, PIN_LABEL_SPACING, PIN_ENABLE_DRAG_LABEL, PIN_ENABLE_HOVER_BG, PIN_BG_SPACING, PIN_BG_COLOR, PIN_BG_ROUNDING, PIN_HOVER_COLOR_SHIFT, PIN_DRAG_ASSIST_RADIUS, PIN_SOCKET_OFFSET, PIN_SOCKET_BORDER_WIDTH, PIN_SOCKET_BORDER_COLOR, PIN_SOCKET_BORDER_ROUNDING, PIN_SOCKET_BG, PIN_SOCKET_THICKNESS, PIN_SOCKET_CONNECTED_GAP, PIN_SOCKET_ROUNDING, PIN_SOCKET_INNER_ROUNDING, PIN_SQUARE_OFFSET, PIN_SQUARE_BORDER_WIDTH, PIN_SQUARE_BORDER_COLOR, PIN_SQUARE_ROUNDING, PIN_SQUARE_HOVER_ENLARGE, PIN_CIRCLE_OFFSET, PIN_CIRCLE_BORDER_WIDTH, PIN_CIRCLE_BORDER_COLOR, PIN_DIM_ENABLED, PIN_DIM_ALPHA, SELECTION_RECT_FULL_COLOR, SELECTION_RECT_TOUCH_COLOR, SELECTION_RECT_ALPHA, DROP_ZONE_BG, DROP_INDICATOR_COLOR, DROP_ZONE_DROP_GAP, DROP_ZONE_MARGIN, STYLE_VAR_COUNT}<br>Style variables keys enum, they can be accessed by the get(key) method. |
Public Functions inherited from DIWNE::Style
Name | |
---|---|
virtual | ~Style() =default |
Detailed Description
class DIWNE::StyleBase;
class DIWNE::StyleBase;
Default base style.
Implementation of the Style interface.
Each NodeEditor contains a StyleBase member that contains the default style settings for objects inside that node editor. The base style can be modifed by setting a DiwneObject's StyleOverride.
Style variables are accessed using the StyleBase::get(key) method, key being one style variable enum values. Variables themselves are stored in a std::vector registry and accessed by the key (index based access). This is different from how, for example, ImGuiStyle works where each variable is just a plain variable in a struct.
The base style is DPI-aware. It has a dpiScale parameter to scale relevant style variables at runtime by the UI DPI scaling factor. Whether a particular theme variable will be scaled in that call depends on an internal dpiScaled flag that can be passed to the StyleBase::set() method during style initialization.
StyleBase::setDpiScale() should be called on DPI scale change.
Note that StyleBase variables are not automatically scaled by the DIWNENodeEditor zoom factor. This must be done manually on case by case basis inside DIWNE code.
Public Functions Documentation
function StyleBase
StyleBase()
StyleBase()
function StyleBase
inline StyleBase(
const StyleBase & other
)
inline StyleBase(
const StyleBase & other
)
function StyleBase
inline StyleBase(
StyleBase && other
)
inline StyleBase(
StyleBase && other
)
function boolean
virtual bool boolean(
Style::Var key
) const override
virtual bool boolean(
Style::Var key
) const override
Reimplements: DIWNE::Style::boolean
function color
virtual const ImVec4 & color(
Style::Var key
) const override
virtual const ImVec4 & color(
Style::Var key
) const override
Reimplements: DIWNE::Style::color
function decimal
virtual float decimal(
Style::Var key
) const override
virtual float decimal(
Style::Var key
) const override
Reimplements: DIWNE::Style::decimal
function get
template <typename T >
inline const T & get(
Style::Var key
) const
template <typename T >
inline const T & get(
Style::Var key
) const
function getDpiScale
inline float getDpiScale() const
inline float getDpiScale() const
function getPtr
template <typename T >
inline T * getPtr(
Style::Var key
) const
template <typename T >
inline T * getPtr(
Style::Var key
) const
function integer
virtual int integer(
Style::Var key
) const override
virtual int integer(
Style::Var key
) const override
Reimplements: DIWNE::Style::integer
function operator=
inline StyleBase & operator=(
const StyleBase & other
)
inline StyleBase & operator=(
const StyleBase & other
)
function operator=
inline StyleBase & operator=(
StyleBase && other
)
inline StyleBase & operator=(
StyleBase && other
)
function set
template <typename T ,
typename std::enable_if< std::is_pointer< T >::value, bool >::type =true>
inline void set(
Style::Var key,
T ptr,
bool dpiScaled =false
)
template <typename T ,
typename std::enable_if< std::is_pointer< T >::value, bool >::type =true>
inline void set(
Style::Var key,
T ptr,
bool dpiScaled =false
)
Set style variable from a pointer, so that it can be modified dynamically.
Parameters:
- key Style variable key to set
- ptr Pointer to the style value, ownership will NOT be transferred (memory is managed externally)
- dpiScaled Whether to scale the style variable with dpi scaling.
function set
template <typename T ,
typename std::enable_if<!std::is_pointer< T >::value, bool >::type =true>
inline void set(
Style::Var key,
T value,
bool dpiScaled =false
)
template <typename T ,
typename std::enable_if<!std::is_pointer< T >::value, bool >::type =true>
inline void set(
Style::Var key,
T value,
bool dpiScaled =false
)
Set style variable value.
Parameters:
- key Style variable key to set
- value Style value, passed as a copy. To pass a pointer see the pointer method overload.
- dpiScaled Whether to scale the style variable with dpi scaling.
function setDpiScale
inline void setDpiScale(
float scale
)
inline void setDpiScale(
float scale
)
function size
virtual ImVec2 size(
Style::Var key
) const override
virtual ImVec2 size(
Style::Var key
) const override
Reimplements: DIWNE::Style::size
Public Attributes Documentation
variable dpiScale
float dpiScale = 1.0f;
float dpiScale = 1.0f;
Friends
friend StyleOverride
friend class StyleOverride(
StyleOverride
);
friend class StyleOverride(
StyleOverride
);
Updated on 2025-05-31 at 12:55:31 +0000