mirror of
https://gitee.com/idea4good/GuiLite.git
synced 2026-01-02 12:27:22 +08:00
!27 Support header-only
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#ifndef GUILITE_CORE_INCLUDE_THEME_H
|
||||
#define GUILITE_CORE_INCLUDE_THEME_H
|
||||
|
||||
#include "../core_include/api.h"
|
||||
#include "../core_include/rect.h"
|
||||
#include "../core_include/resource.h"
|
||||
|
||||
typedef struct struct_font_info FONT_INFO;
|
||||
typedef struct struct_color_rect COLOR_RECT;
|
||||
typedef struct struct_bitmap_info BITMAP_INFO;
|
||||
@@ -16,6 +20,7 @@ enum FONT_TYPE
|
||||
FONT_CUSTOM4,
|
||||
FONT_CUSTOM5,
|
||||
FONT_CUSTOM6,
|
||||
|
||||
FONT_MAX
|
||||
};
|
||||
|
||||
@@ -52,14 +57,67 @@ enum COLOR_TYPE
|
||||
class c_theme
|
||||
{
|
||||
public:
|
||||
static int add_font(FONT_TYPE index, const FONT_INFO* font);
|
||||
static const FONT_INFO* get_font(FONT_TYPE index);
|
||||
|
||||
static int add_bitmap(BITMAP_TYPE index, const BITMAP_INFO* bmp);
|
||||
static const BITMAP_INFO* get_bmp(BITMAP_TYPE index);
|
||||
|
||||
static int add_color(COLOR_TYPE index, const unsigned int color);
|
||||
static const unsigned int get_color(COLOR_TYPE index);
|
||||
static int add_font(FONT_TYPE index, const FONT_INFO* font)
|
||||
{
|
||||
if (index >= FONT_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_font_map[index] = font;
|
||||
return 0;
|
||||
}
|
||||
static const FONT_INFO* get_font(FONT_TYPE index)
|
||||
{
|
||||
if (index >= FONT_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_font_map[index];
|
||||
}
|
||||
static int add_bitmap(BITMAP_TYPE index, const BITMAP_INFO* bmp)
|
||||
{
|
||||
if (index >= BITMAP_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_bmp_map[index] = bmp;
|
||||
return 0;
|
||||
}
|
||||
static const BITMAP_INFO* get_bmp(BITMAP_TYPE index)
|
||||
{
|
||||
if (index >= BITMAP_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_bmp_map[index];
|
||||
}
|
||||
static int add_color(COLOR_TYPE index, const unsigned int color)
|
||||
{
|
||||
if (index >= COLOR_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_color_map[index] = color;
|
||||
return 0;
|
||||
}
|
||||
static const unsigned int get_color(COLOR_TYPE index)
|
||||
{
|
||||
if (index >= COLOR_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_color_map[index];
|
||||
}
|
||||
private:
|
||||
static const FONT_INFO* s_font_map[FONT_MAX];
|
||||
static const BITMAP_INFO* s_bmp_map[BITMAP_MAX];
|
||||
static unsigned int s_color_map[COLOR_MAX];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user