Skip to content

Theme

Global color scheme.

#include "GUI/Theme/Theme.h"

Public Types

Name
using std::map< std::string, const char * >CategoryNames
using std::unordered_map< EColor, ImVec4 >Colors
using std::unordered_map< ESize, float >Sizes
using std::unordered_map< ESizeVec2, ImVec2 >SizesVec

Public Functions

Name
Theme() =default
Theme(std::string name, const Colors & colors, const Sizes & sizes, const SizesVec & sizesVec)
voidapply()<br>Call this function whenever you change style settings.
const ImVec4 &get(EColor color)
ImFont *get(EFont font)
floatget(ESize size)
const ImVec2 &get(ESizeVec2 sizeVec)
Colors &getColorsRef()
const std::string &getName() const
Sizes &getSizesRef()
SizesVec &getSizesVecRef()
voidinitFonts()
voidset(EColor color, ImVec4 value)
ThemecreateDefaultClassic()
const char *getCategoryName(const std::string & key)
CategoryNames &getCategoryNames()
std::map< EColor, const char * > &getColorNames()
std::map< ESize, const char * > &getSizeNames()
std::map< ESizeVec2, const char * > &getSizeVecNames()
const std::vector< ThemeGroup > &getVariables()
voidinitNames()<br>Function which initializes all style properties names.

Public Types Documentation

using CategoryNames

cpp
using Theme::CategoryNames =  std::map<std::string, const char*>;
using Theme::CategoryNames =  std::map<std::string, const char*>;

Todo: MH - P0919R2 Heterogeneous lookup for unordered containers, C++2a (std::unordered_map cannot be used).

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, float>;
using Theme::Sizes =  std::unordered_map<ESize, float>;

using SizesVec

cpp
using Theme::SizesVec =  std::unordered_map<ESizeVec2, ImVec2>;
using Theme::SizesVec =  std::unordered_map<ESizeVec2, ImVec2>;

Public Functions Documentation

function Theme

cpp
Theme() =default
Theme() =default

function Theme

cpp
Theme(
    std::string name,
    const Colors & colors,
    const Sizes & sizes,
    const SizesVec & sizesVec
)
Theme(
    std::string name,
    const Colors & colors,
    const Sizes & sizes,
    const SizesVec & sizesVec
)

function apply

cpp
void apply()
void apply()

Call this function whenever you change style settings.

function get

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

function get

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

function get

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

function get

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

function getColorsRef

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

function getName

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

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 set

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

function createDefaultClassic

cpp
static Theme createDefaultClassic()
static Theme createDefaultClassic()

function getCategoryName

cpp
static const char * getCategoryName(
    const std::string & key
)
static const char * getCategoryName(
    const std::string & key
)

function getCategoryNames

cpp
static CategoryNames & getCategoryNames()
static CategoryNames & getCategoryNames()

function getColorNames

cpp
static std::map< EColor, const char * > & getColorNames()
static std::map< EColor, const char * > & getColorNames()

function getSizeNames

cpp
static std::map< ESize, const char * > & getSizeNames()
static std::map< ESize, const char * > & getSizeNames()

function getSizeVecNames

cpp
static std::map< ESizeVec2, const char * > & getSizeVecNames()
static std::map< ESizeVec2, const char * > & getSizeVecNames()

function getVariables

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

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.

TodoThis will be removed.

TodoThis will be removed.

TodoThis will be removed.

TodoThis will be removed.

TodoThis will be removed.

TodoThis will be removed.

TodoThis will be removed.


Updated on 2024-11-06 at 20:16:53 +0000