GuiLite/workspace/core_include/theme.h

122 lines
1.8 KiB
C
Raw Normal View History

#pragma once
2018-10-04 14:30:29 +08:00
2020-01-22 11:03:29 +08:00
#include "../core_include/api.h"
#include "../core_include/resource.h"
//Rebuild gui library once you change this file
2021-03-26 11:32:11 +08:00
enum FONT_LIST
2018-10-04 14:30:29 +08:00
{
2018-11-01 10:35:37 +08:00
FONT_NULL,
FONT_DEFAULT,
FONT_CUSTOM1,
FONT_CUSTOM2,
FONT_CUSTOM3,
FONT_CUSTOM4,
FONT_CUSTOM5,
FONT_CUSTOM6,
2020-01-22 11:03:29 +08:00
2018-10-04 14:30:29 +08:00
FONT_MAX
};
2021-04-02 11:37:13 +08:00
enum IMAGE_LIST
2018-10-04 14:30:29 +08:00
{
2021-04-02 11:37:13 +08:00
IMAGE_CUSTOM1,
IMAGE_CUSTOM2,
IMAGE_CUSTOM3,
IMAGE_CUSTOM4,
IMAGE_CUSTOM5,
IMAGE_CUSTOM6,
2018-11-09 15:01:48 +08:00
2021-04-02 11:37:13 +08:00
IMAGE_MAX
2018-10-04 14:30:29 +08:00
};
2021-03-26 11:32:11 +08:00
enum COLOR_LIST
2018-10-04 14:30:29 +08:00
{
2018-12-28 15:56:36 +08:00
COLOR_WND_FONT,
COLOR_WND_NORMAL,
COLOR_WND_PUSHED,
COLOR_WND_FOCUS,
COLOR_WND_BORDER,
COLOR_CUSTOME1,
COLOR_CUSTOME2,
COLOR_CUSTOME3,
COLOR_CUSTOME4,
COLOR_CUSTOME5,
COLOR_CUSTOME6,
2018-10-04 14:30:29 +08:00
COLOR_MAX
};
class c_theme
2018-10-04 14:30:29 +08:00
{
public:
2021-03-26 11:32:11 +08:00
static int add_font(FONT_LIST index, const void* font)
2020-01-22 11:03:29 +08:00
{
if (index >= FONT_MAX)
{
ASSERT(false);
return -1;
}
2021-04-02 11:37:13 +08:00
s_font_map[index] = font;
2020-01-22 11:03:29 +08:00
return 0;
}
2021-04-02 11:37:13 +08:00
2021-03-26 11:32:11 +08:00
static const void* get_font(FONT_LIST index)
2020-01-22 11:03:29 +08:00
{
if (index >= FONT_MAX)
{
ASSERT(false);
return 0;
}
2021-04-02 11:37:13 +08:00
return s_font_map[index];
2020-01-22 11:03:29 +08:00
}
2021-04-02 11:37:13 +08:00
static int add_image(IMAGE_LIST index, const void* image_info)
2020-01-22 11:03:29 +08:00
{
2021-04-02 11:37:13 +08:00
if (index >= IMAGE_MAX)
2020-01-22 11:03:29 +08:00
{
ASSERT(false);
return -1;
}
2021-04-02 11:37:13 +08:00
s_image_map[index] = image_info;
2020-01-22 11:03:29 +08:00
return 0;
}
2021-04-02 11:37:13 +08:00
static const void* get_image(IMAGE_LIST index)
2020-01-22 11:03:29 +08:00
{
2021-04-02 11:37:13 +08:00
if (index >= IMAGE_MAX)
2020-01-22 11:03:29 +08:00
{
ASSERT(false);
return 0;
}
2021-04-02 11:37:13 +08:00
return s_image_map[index];
2020-01-22 11:03:29 +08:00
}
2021-04-02 11:37:13 +08:00
2021-03-26 11:32:11 +08:00
static int add_color(COLOR_LIST index, const unsigned int color)
2020-01-22 11:03:29 +08:00
{
if (index >= COLOR_MAX)
{
ASSERT(false);
return -1;
}
s_color_map[index] = color;
return 0;
}
2021-04-02 11:37:13 +08:00
2021-03-26 11:32:11 +08:00
static const unsigned int get_color(COLOR_LIST index)
2020-01-22 11:03:29 +08:00
{
if (index >= COLOR_MAX)
{
ASSERT(false);
return 0;
}
return s_color_map[index];
}
2021-04-02 11:37:13 +08:00
2020-01-22 11:03:29 +08:00
private:
2021-04-02 11:37:13 +08:00
static const void* s_font_map[FONT_MAX];
static const void* s_image_map[IMAGE_MAX];
2020-01-22 11:03:29 +08:00
static unsigned int s_color_map[COLOR_MAX];
2018-10-04 14:30:29 +08:00
};