Skip to content

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)
voidapply()<br>Call this function whenever you change style settings.
const ImVec4 &get(EColor color)<br>Returns color variable value.
ImVec4get(EColor color, float alpha)<br>Returns a color whose alpha is set to the provided valuea.
ImFont *get(EFont font)
floatget(ESize size)<br>Returns size variable value, scaled by DPI factor.
ImVec2get(ESizeVec2 sizeVec)<br>Returns 2D size variable value, scaled by DPI factor.
floatgetBorderSize() const
Colors &getColorsRef()
floatgetDpiScale() 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()
voidinitFonts()
const boolisDark() const
voidset(EColor color, ImVec4 value)
voidsetDpiScale(float scale)
voidupdateDiwneStyleFromTheme() const
ThemecreateDefaultClassic()
std::map< EColor, std::string > &getColorNames()
std::map< ESize, std::string > &getSizeNames()
std::map< ESizeVec2, std::string > &getSizeVecNames()
const std::vector< ThemeGroup > &getVariables()
voidinitImGuiStyle()<br>Initializes ImGuiStyle with default values.
voidinitNames()<br>Function which initializes all style properties names.

Public Attributes

Name
DIWNE::StyleOverridem_nodeStyle
DIWNE::StyleOverridem_operatorStyle
DIWNE::StyleOverridem_transformationStyle

Detailed Description

cpp
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

cpp
using Theme::Colors =  std::unordered_map<EColor, ImVec4>;
using Theme::Colors =  std::unordered_map<EColor, ImVec4>;

using Sizes

cpp
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

cpp
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

cpp
Theme() =default
Theme() =default

function Theme

cpp
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

cpp
void apply()
void apply()

Call this function whenever you change style settings.

Applies Theme settings to the current ImGuiStyle.

function get

cpp
inline const ImVec4 & get(
    EColor color
)
inline const ImVec4 & get(
    EColor color
)

Returns color variable value.

function get

cpp
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

cpp
ImFont * get(
    EFont font
)
ImFont * get(
    EFont font
)

function get

cpp
inline float get(
    ESize size
)
inline float get(
    ESize size
)

Returns size variable value, scaled by DPI factor.

function get

cpp
inline ImVec2 get(
    ESizeVec2 sizeVec
)
inline ImVec2 get(
    ESizeVec2 sizeVec
)

Returns 2D size variable value, scaled by DPI factor.

function getBorderSize

cpp
inline float getBorderSize() const
inline float getBorderSize() const

function getColorsRef

cpp
inline Colors & getColorsRef()
inline Colors & getColorsRef()

function getDpiScale

cpp
inline float getDpiScale() const
inline float getDpiScale() const

function getName

cpp
inline const std::string & getName() const
inline const std::string & getName() const

function getPtr

cpp
inline ImVec4 * getPtr(
    EColor color
)
inline ImVec4 * getPtr(
    EColor color
)

Returns a pointer to a color variable.

function getPtr

cpp
inline float * getPtr(
    ESize size
)
inline float * getPtr(
    ESize size
)

Returns a pointer to a size variable. Not DPI scaled.

function getPtr

cpp
inline ImVec2 * getPtr(
    ESizeVec2 sizeVec
)
inline ImVec2 * getPtr(
    ESizeVec2 sizeVec
)

Returns a pointer to a 2D size variable. Not DPI scaled.

function getSizesRef

cpp
inline Sizes & getSizesRef()
inline Sizes & getSizesRef()

function getSizesVecRef

cpp
inline SizesVec & getSizesVecRef()
inline SizesVec & getSizesVecRef()

function initFonts

cpp
void initFonts()
void initFonts()

function isDark

cpp
inline const bool isDark() const
inline const bool isDark() const

function set

cpp
inline void set(
    EColor color,
    ImVec4 value
)
inline void set(
    EColor color,
    ImVec4 value
)

function setDpiScale

cpp
inline void setDpiScale(
    float scale
)
inline void setDpiScale(
    float scale
)

function updateDiwneStyleFromTheme

cpp
void updateDiwneStyleFromTheme() const
void updateDiwneStyleFromTheme() const

function createDefaultClassic

cpp
static Theme createDefaultClassic()
static Theme createDefaultClassic()

function getColorNames

cpp
static std::map< EColor, std::string > & getColorNames()
static std::map< EColor, std::string > & getColorNames()

function getSizeNames

cpp
static std::map< ESize, std::string > & getSizeNames()
static std::map< ESize, std::string > & getSizeNames()

function getSizeVecNames

cpp
static std::map< ESizeVec2, std::string > & getSizeVecNames()
static std::map< ESizeVec2, std::string > & getSizeVecNames()

function getVariables

cpp
static inline const std::vector< ThemeGroup > & getVariables()
static inline const std::vector< ThemeGroup > & getVariables()

function initImGuiStyle

cpp
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

cpp
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

cpp
static DIWNE::StyleOverride m_nodeStyle;
static DIWNE::StyleOverride m_nodeStyle;

variable m_operatorStyle

cpp
static DIWNE::StyleOverride m_operatorStyle;
static DIWNE::StyleOverride m_operatorStyle;

variable m_transformationStyle

cpp
static DIWNE::StyleOverride m_transformationStyle;
static DIWNE::StyleOverride m_transformationStyle;

Updated on 2025-05-31 at 12:55:30 +0000