Skip to content

Theme

Global color scheme.

#include "GUI/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)
const Colors &getColors() const
Colors &getColorsRef()
const std::string &getName() const
Sizes &getSizesRef()
SizesVec &getSizesVecRef()
voidinitFonts()
voidreturnFloatColorToDefault()
voidset(EColor color, ImVec4 value)
voidsetColors(const Colors & colors)
ThemecreateDefaultClassic()
ThemecreateDefaultModern()
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()
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 getColors

cpp
inline const Colors & getColors() const
inline const Colors & getColors() const

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 returnFloatColorToDefault

cpp
void returnFloatColorToDefault()
void returnFloatColorToDefault()

function set

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

function setColors

cpp
inline void setColors(
    const Colors & colors
)
inline void setColors(
    const Colors & colors
)

function createDefaultClassic

cpp
static Theme createDefaultClassic()
static Theme createDefaultClassic()

function createDefaultModern

cpp
static Theme createDefaultModern()
static Theme createDefaultModern()

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 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.


Updated on 2024-03-16 at 19:15:00 +0000