Theme
ApplicationTheme holding custom style variables that override the current ImGui style and/or are used separately by various parts of the I3T code. More...
#include "GUI/Theme/Theme.h"
Public Types
Name | |
---|---|
using std::unordered_map< EColor, ImVec4 > | Colors |
using std::unordered_map< ESize, std::pair< float, bool > > | Sizes <br>Map of ESizeVec2 and a pair of float and bool, bool specifies whether the float is dpi scaled. |
using std::unordered_map< ESizeVec2, std::pair< ImVec2, bool > > | SizesVec <br>Map of ESizeVec2 and a pair of ImVec2 and bool, bool specifies whether the ImVec2 is dpi scaled. |
Public Functions
Name | |
---|---|
Theme() =default | |
Theme(std::string name, bool isDark, const Colors & colors, const Sizes & sizes, const SizesVec & sizesVec) | |
void | apply()<br>Call this function whenever you change style settings. |
const ImVec4 & | get(EColor color)<br>Returns color variable value. |
ImVec4 | get(EColor color, float alpha)<br>Returns a color whose alpha is set to the provided valuea. |
ImFont * | get(EFont font) |
float | get(ESize size)<br>Returns size variable value, scaled by DPI factor. |
ImVec2 | get(ESizeVec2 sizeVec)<br>Returns 2D size variable value, scaled by DPI factor. |
float | getBorderSize() const |
Colors & | getColorsRef() |
float | getDpiScale() const |
const std::string & | getName() const |
ImVec4 * | getPtr(EColor color)<br>Returns a pointer to a color variable. |
float * | getPtr(ESize size)<br>Returns a pointer to a size variable. Not DPI scaled. |
ImVec2 * | getPtr(ESizeVec2 sizeVec)<br>Returns a pointer to a 2D size variable. Not DPI scaled. |
Sizes & | getSizesRef() |
SizesVec & | getSizesVecRef() |
void | initFonts() |
const bool | isDark() const |
void | set(EColor color, ImVec4 value) |
void | setDpiScale(float scale) |
void | updateDiwneStyleFromTheme() const |
Theme | createDefaultClassic() |
std::map< EColor, std::string > & | getColorNames() |
std::map< ESize, std::string > & | getSizeNames() |
std::map< ESizeVec2, std::string > & | getSizeVecNames() |
const std::vector< ThemeGroup > & | getVariables() |
void | initImGuiStyle()<br>Initializes ImGuiStyle with default values. |
void | initNames()<br>Function which initializes all style properties names. |
Public Attributes
Name | |
---|---|
DIWNE::StyleOverride | m_nodeStyle |
DIWNE::StyleOverride | m_operatorStyle |
DIWNE::StyleOverride | m_transformationStyle |
Detailed Description
class Theme;
class Theme;
ApplicationTheme holding custom style variables that override the current ImGui style and/or are used separately by various parts of the I3T code.
The Theme holds color information as well as general sizing information.
Themes do have a UI/DPI scaling factor using which relevant sizing variables are scaled when fetched. Changes of the scaling factor are however handled elsewhere (in UIModule).
Themes do hold an association between font keys and actual font names. But fonts are loaded and managed externally (by the FontManager). Currently the Theme cannot load new fonts, but it can change which fonts are used where. // Proposal: (Issue #432) Themes could tell FontManager which fonts to load
Public Types Documentation
using Colors
using Theme::Colors = std::unordered_map<EColor, ImVec4>;
using Theme::Colors = std::unordered_map<EColor, ImVec4>;
using Sizes
using Theme::Sizes = std::unordered_map<ESize, std::pair<float, bool> >;
using Theme::Sizes = std::unordered_map<ESize, std::pair<float, bool> >;
Map of ESizeVec2 and a pair of float and bool, bool specifies whether the float is dpi scaled.
using SizesVec
using Theme::SizesVec = std::unordered_map<ESizeVec2, std::pair<ImVec2, bool> >;
using Theme::SizesVec = std::unordered_map<ESizeVec2, std::pair<ImVec2, bool> >;
Map of ESizeVec2 and a pair of ImVec2 and bool, bool specifies whether the ImVec2 is dpi scaled.
Public Functions Documentation
function Theme
Theme() =default
Theme() =default
function Theme
Theme(
std::string name,
bool isDark,
const Colors & colors,
const Sizes & sizes,
const SizesVec & sizesVec
)
Theme(
std::string name,
bool isDark,
const Colors & colors,
const Sizes & sizes,
const SizesVec & sizesVec
)
function apply
void apply()
void apply()
Call this function whenever you change style settings.
Applies Theme settings to the current ImGuiStyle.
function get
inline const ImVec4 & get(
EColor color
)
inline const ImVec4 & get(
EColor color
)
Returns color variable value.
function get
inline ImVec4 get(
EColor color,
float alpha
)
inline ImVec4 get(
EColor color,
float alpha
)
Returns a color whose alpha is set to the provided valuea.
function get
ImFont * get(
EFont font
)
ImFont * get(
EFont font
)
function get
inline float get(
ESize size
)
inline float get(
ESize size
)
Returns size variable value, scaled by DPI factor.
function get
inline ImVec2 get(
ESizeVec2 sizeVec
)
inline ImVec2 get(
ESizeVec2 sizeVec
)
Returns 2D size variable value, scaled by DPI factor.
function getBorderSize
inline float getBorderSize() const
inline float getBorderSize() const
function getColorsRef
inline Colors & getColorsRef()
inline Colors & getColorsRef()
function getDpiScale
inline float getDpiScale() const
inline float getDpiScale() const
function getName
inline const std::string & getName() const
inline const std::string & getName() const
function getPtr
inline ImVec4 * getPtr(
EColor color
)
inline ImVec4 * getPtr(
EColor color
)
Returns a pointer to a color variable.
function getPtr
inline float * getPtr(
ESize size
)
inline float * getPtr(
ESize size
)
Returns a pointer to a size variable. Not DPI scaled.
function getPtr
inline ImVec2 * getPtr(
ESizeVec2 sizeVec
)
inline ImVec2 * getPtr(
ESizeVec2 sizeVec
)
Returns a pointer to a 2D size variable. Not DPI scaled.
function getSizesRef
inline Sizes & getSizesRef()
inline Sizes & getSizesRef()
function getSizesVecRef
inline SizesVec & getSizesVecRef()
inline SizesVec & getSizesVecRef()
function initFonts
void initFonts()
void initFonts()
function isDark
inline const bool isDark() const
inline const bool isDark() const
function set
inline void set(
EColor color,
ImVec4 value
)
inline void set(
EColor color,
ImVec4 value
)
function setDpiScale
inline void setDpiScale(
float scale
)
inline void setDpiScale(
float scale
)
function updateDiwneStyleFromTheme
void updateDiwneStyleFromTheme() const
void updateDiwneStyleFromTheme() const
function createDefaultClassic
static Theme createDefaultClassic()
static Theme createDefaultClassic()
function getColorNames
static std::map< EColor, std::string > & getColorNames()
static std::map< EColor, std::string > & getColorNames()
function getSizeNames
static std::map< ESize, std::string > & getSizeNames()
static std::map< ESize, std::string > & getSizeNames()
function getSizeVecNames
static std::map< ESizeVec2, std::string > & getSizeVecNames()
static std::map< ESizeVec2, std::string > & getSizeVecNames()
function getVariables
static inline const std::vector< ThemeGroup > & getVariables()
static inline const std::vector< ThemeGroup > & getVariables()
function initImGuiStyle
static void initImGuiStyle()
static void initImGuiStyle()
Initializes ImGuiStyle with default values.
Rewrites all ImGuiStyle values. The theme still needs to be applied after this call.
function initNames
static void initNames()
static void initNames()
Function which initializes all style properties names.
Warning: All values are kept in a table (key, value). If you want to edit or add new name, keep in mind, that name (value) must be unique.
Public Attributes Documentation
variable m_nodeStyle
static DIWNE::StyleOverride m_nodeStyle;
static DIWNE::StyleOverride m_nodeStyle;
variable m_operatorStyle
static DIWNE::StyleOverride m_operatorStyle;
static DIWNE::StyleOverride m_operatorStyle;
variable m_transformationStyle
static DIWNE::StyleOverride m_transformationStyle;
static DIWNE::StyleOverride m_transformationStyle;
Updated on 2025-05-31 at 12:55:30 +0000