rename enum
This commit is contained in:
parent
2ceb913448
commit
101040b623
440
GuiLite.cpp
440
GuiLite.cpp
|
@ -821,73 +821,73 @@ void c_surface_no_fb::draw_pixel_on_fb(int x, int y, unsigned int rgb)
|
||||||
((unsigned short*)m_fb)[y * m_width + x] = GL_RGB_32_to_16(rgb);
|
((unsigned short*)m_fb)[y * m_width + x] = GL_RGB_32_to_16(rgb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const FONT_INFO* s_font_map[FONT_MAX];
|
static const FONT_INFO* s_font_map[FONT_MAX];
|
||||||
static const BITMAP_INFO* s_bmp_map[BITMAP_MAX];
|
static const BITMAP_INFO* s_bmp_map[BITMAP_MAX];
|
||||||
static unsigned int s_color_map[COLOR_MAX];
|
static unsigned int s_color_map[COLOR_MAX];
|
||||||
|
|
||||||
int c_theme::add_font(FONT_TYPE index, const FONT_INFO* font)
|
int c_theme::add_font(FONT_TYPE index, const FONT_INFO* font)
|
||||||
{
|
{
|
||||||
if (index >= FONT_MAX)
|
if (index >= FONT_MAX)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
s_font_map[index] = font;
|
s_font_map[index] = font;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FONT_INFO* c_theme::get_font(FONT_TYPE index)
|
const FONT_INFO* c_theme::get_font(FONT_TYPE index)
|
||||||
{
|
{
|
||||||
if (index >= FONT_MAX)
|
if (index >= FONT_MAX)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return s_font_map[index];
|
return s_font_map[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
int c_theme::add_bitmap(BITMAP_TYPE index, const BITMAP_INFO* bmp)
|
int c_theme::add_bitmap(BITMAP_TYPE index, const BITMAP_INFO* bmp)
|
||||||
{
|
{
|
||||||
if (index >= BITMAP_MAX)
|
if (index >= BITMAP_MAX)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
s_bmp_map[index] = bmp;
|
s_bmp_map[index] = bmp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BITMAP_INFO* c_theme::get_bmp(BITMAP_TYPE index)
|
const BITMAP_INFO* c_theme::get_bmp(BITMAP_TYPE index)
|
||||||
{
|
{
|
||||||
if (index >= BITMAP_MAX)
|
if (index >= BITMAP_MAX)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return s_bmp_map[index];
|
return s_bmp_map[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
int c_theme::add_color(COLOR_TYPE index, const unsigned int color)
|
int c_theme::add_color(COLOR_TYPE index, const unsigned int color)
|
||||||
{
|
{
|
||||||
if (index >= COLOR_MAX)
|
if (index >= COLOR_MAX)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
s_color_map[index] = color;
|
s_color_map[index] = color;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned int c_theme::get_color(COLOR_TYPE index)
|
const unsigned int c_theme::get_color(COLOR_TYPE index)
|
||||||
{
|
{
|
||||||
if (index >= COLOR_MAX)
|
if (index >= COLOR_MAX)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return s_color_map[index];
|
return s_color_map[index];
|
||||||
}
|
}
|
||||||
c_wnd::c_wnd(): m_status(STATUS_NORMAL), m_attr(ATTR_VISIBLE), m_parent(0), m_top_child(0), m_prev_sibling(0), m_next_sibling(0),
|
c_wnd::c_wnd(): m_status(STATUS_NORMAL), m_attr(ATTR_VISIBLE), m_parent(0), m_top_child(0), m_prev_sibling(0), m_next_sibling(0),
|
||||||
m_str(0), m_font_color(0), m_bg_color(0), m_id(0), m_z_order(Z_ORDER_LEVEL_0), m_focus_child(0), m_surface(0)
|
m_str(0), m_font_color(0), m_bg_color(0), m_id(0), m_z_order(Z_ORDER_LEVEL_0), m_focus_child(0), m_surface(0)
|
||||||
{
|
{
|
||||||
|
@ -1170,7 +1170,7 @@ void c_wnd::on_touch(int x, int y, TOUCH_ACTION action)
|
||||||
c_wnd* tmp_child = m_top_child;
|
c_wnd* tmp_child = m_top_child;
|
||||||
while (tmp_child)
|
while (tmp_child)
|
||||||
{
|
{
|
||||||
if ((tmp_child->m_attr & ATTR_MODAL) && (tmp_child->m_attr & ATTR_VISIBLE))
|
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||||
{
|
{
|
||||||
model_wnd = tmp_child;
|
model_wnd = tmp_child;
|
||||||
break;
|
break;
|
||||||
|
@ -1204,7 +1204,7 @@ void c_wnd::on_key(KEY_TYPE key)
|
||||||
c_wnd* tmp_child = m_top_child;
|
c_wnd* tmp_child = m_top_child;
|
||||||
while (tmp_child)
|
while (tmp_child)
|
||||||
{
|
{
|
||||||
if ((tmp_child->m_attr & ATTR_MODAL) && (tmp_child->m_attr & ATTR_VISIBLE))
|
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||||
{
|
{
|
||||||
model_wnd = tmp_child;
|
model_wnd = tmp_child;
|
||||||
break;
|
break;
|
||||||
|
@ -1894,139 +1894,139 @@ int c_fifo::write(void* buf, int len)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if (!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__)
|
#if (!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static void(*do_assert)(const char* file, int line);
|
static void(*do_assert)(const char* file, int line);
|
||||||
static void(*do_log_out)(const char* log);
|
static void(*do_log_out)(const char* log);
|
||||||
void register_debug_function(void(*my_assert)(const char* file, int line), void(*my_log_out)(const char* log))
|
void register_debug_function(void(*my_assert)(const char* file, int line), void(*my_log_out)(const char* log))
|
||||||
{
|
{
|
||||||
do_assert = my_assert;
|
do_assert = my_assert;
|
||||||
do_log_out = my_log_out;
|
do_log_out = my_log_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _assert(const char* file, int line)
|
void _assert(const char* file, int line)
|
||||||
{
|
{
|
||||||
if(do_assert)
|
if(do_assert)
|
||||||
{
|
{
|
||||||
do_assert(file, line);
|
do_assert(file, line);
|
||||||
}
|
}
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_out(const char* log)
|
void log_out(const char* log)
|
||||||
{
|
{
|
||||||
if (do_log_out)
|
if (do_log_out)
|
||||||
{
|
{
|
||||||
do_log_out(log);
|
do_log_out(log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long get_time_in_second()
|
long get_time_in_second()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
T_TIME second_to_day(long second)
|
T_TIME second_to_day(long second)
|
||||||
{
|
{
|
||||||
T_TIME ret = {0};
|
T_TIME ret = {0};
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
T_TIME get_time()
|
T_TIME get_time()
|
||||||
{
|
{
|
||||||
T_TIME ret = {0};
|
T_TIME ret = {0};
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_real_timer(void (*func)(void* arg))
|
void start_real_timer(void (*func)(void* arg))
|
||||||
{
|
{
|
||||||
log_out("Not support now");
|
log_out("Not support now");
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_timer(int milli_second, void func(void* ptmr, void* parg))
|
void register_timer(int milli_second, void func(void* ptmr, void* parg))
|
||||||
{
|
{
|
||||||
log_out("Not support now");
|
log_out("Not support now");
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_cur_thread_id()
|
unsigned int get_cur_thread_id()
|
||||||
{
|
{
|
||||||
log_out("Not support now");
|
log_out("Not support now");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg)
|
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg)
|
||||||
{
|
{
|
||||||
log_out("Not support now");
|
log_out("Not support now");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void delay_ms(unsigned short nms);
|
extern "C" void delay_ms(unsigned short nms);
|
||||||
void thread_sleep(unsigned int milli_seconds)
|
void thread_sleep(unsigned int milli_seconds)
|
||||||
{//MCU alway implemnet driver code in APP.
|
{//MCU alway implemnet driver code in APP.
|
||||||
delay_ms(milli_seconds);
|
delay_ms(milli_seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data)
|
int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data)
|
||||||
{
|
{
|
||||||
log_out("Not support now");
|
log_out("Not support now");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c_fifo::c_fifo()
|
c_fifo::c_fifo()
|
||||||
{
|
{
|
||||||
m_head = m_tail = 0;
|
m_head = m_tail = 0;
|
||||||
m_read_sem = m_write_mutex = 0;
|
m_read_sem = m_write_mutex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int c_fifo::read(void* buf, int len)
|
int c_fifo::read(void* buf, int len)
|
||||||
{
|
{
|
||||||
unsigned char* pbuf = (unsigned char*)buf;
|
unsigned char* pbuf = (unsigned char*)buf;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(i < len)
|
while(i < len)
|
||||||
{
|
{
|
||||||
if (m_tail == m_head)
|
if (m_tail == m_head)
|
||||||
{//empty
|
{//empty
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*pbuf++ = m_buf[m_head];
|
*pbuf++ = m_buf[m_head];
|
||||||
m_head = (m_head + 1) % FIFO_BUFFER_LEN;
|
m_head = (m_head + 1) % FIFO_BUFFER_LEN;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if(i != len)
|
if(i != len)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int c_fifo::write(void* buf, int len)
|
int c_fifo::write(void* buf, int len)
|
||||||
{
|
{
|
||||||
unsigned char* pbuf = (unsigned char*)buf;
|
unsigned char* pbuf = (unsigned char*)buf;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int tail = m_tail;
|
int tail = m_tail;
|
||||||
|
|
||||||
while(i < len)
|
while(i < len)
|
||||||
{
|
{
|
||||||
if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head)
|
if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head)
|
||||||
{//full, clear data has been written;
|
{//full, clear data has been written;
|
||||||
m_tail = tail;
|
m_tail = tail;
|
||||||
log_out("Warning: fifo full\n");
|
log_out("Warning: fifo full\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
m_buf[m_tail] = *pbuf++;
|
m_buf[m_tail] = *pbuf++;
|
||||||
m_tail = (m_tail + 1) % FIFO_BUFFER_LEN;
|
m_tail = (m_tail + 1) % FIFO_BUFFER_LEN;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i != len)
|
if(i != len)
|
||||||
{
|
{
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if (defined _WIN32) || (defined WIN32) || (defined _WIN64) || (defined WIN64)
|
#if (defined _WIN32) || (defined WIN32) || (defined _WIN64) || (defined WIN64)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -2766,7 +2766,7 @@ int c_dialog::open_dialog(c_dialog* p_dlg, bool modal_mode)
|
||||||
c_rect rc;
|
c_rect rc;
|
||||||
p_dlg->get_screen_rect(rc);
|
p_dlg->get_screen_rect(rc);
|
||||||
p_dlg->get_surface()->set_frame_layer_visible_rect(rc, Z_ORDER_LEVEL_1);
|
p_dlg->get_surface()->set_frame_layer_visible_rect(rc, Z_ORDER_LEVEL_1);
|
||||||
p_dlg->set_attr(modal_mode ? (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_MODAL) : (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS));
|
p_dlg->set_attr(modal_mode ? (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_PRIORITY) : (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS));
|
||||||
p_dlg->show_window();
|
p_dlg->show_window();
|
||||||
p_dlg->set_me_the_dialog();
|
p_dlg->set_me_the_dialog();
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2948,7 +2948,7 @@ void c_edit::on_paint()
|
||||||
if (m_z_order == m_parent->get_z_order())
|
if (m_z_order == m_parent->get_z_order())
|
||||||
{
|
{
|
||||||
m_z_order++;
|
m_z_order++;
|
||||||
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_MODAL);
|
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_PRIORITY);
|
||||||
show_keyboard();
|
show_keyboard();
|
||||||
}
|
}
|
||||||
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, c_theme::get_color(COLOR_WND_PUSHED), m_parent->get_z_order());
|
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, c_theme::get_color(COLOR_WND_PUSHED), m_parent->get_z_order());
|
||||||
|
@ -3302,23 +3302,23 @@ void c_keyboard::pre_create_wnd()
|
||||||
}
|
}
|
||||||
void c_keyboard::on_key_clicked(int id, int param)
|
void c_keyboard::on_key_clicked(int id, int param)
|
||||||
{
|
{
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case 0x14:
|
case 0x14:
|
||||||
on_caps_clicked(id, param);
|
on_caps_clicked(id, param);
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
on_enter_clicked(id, param);
|
on_enter_clicked(id, param);
|
||||||
break;
|
break;
|
||||||
case 0x1B:
|
case 0x1B:
|
||||||
on_esc_clicked(id, param);
|
on_esc_clicked(id, param);
|
||||||
break;
|
break;
|
||||||
case 0x7F:
|
case 0x7F:
|
||||||
on_del_clicked(id, param);
|
on_del_clicked(id, param);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
on_char_clicked(id, param);
|
on_char_clicked(id, param);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void c_keyboard::on_caps_clicked(int id, int parm)
|
void c_keyboard::on_caps_clicked(int id, int parm)
|
||||||
|
@ -3510,7 +3510,7 @@ void c_list_box::on_paint()
|
||||||
m_z_order++;
|
m_z_order++;
|
||||||
}
|
}
|
||||||
m_surface->set_frame_layer_visible_rect(m_list_screen_rect, m_z_order);
|
m_surface->set_frame_layer_visible_rect(m_list_screen_rect, m_z_order);
|
||||||
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_MODAL);
|
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_PRIORITY);
|
||||||
show_list();
|
show_list();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
144
GuiLite.h
144
GuiLite.h
|
@ -1,74 +1,74 @@
|
||||||
#ifndef GUILITE_CORE_INCLUDE_API_H
|
#ifndef GUILITE_CORE_INCLUDE_API_H
|
||||||
#define GUILITE_CORE_INCLUDE_API_H
|
#define GUILITE_CORE_INCLUDE_API_H
|
||||||
|
|
||||||
#define REAL_TIME_TASK_CYCLE_MS 50
|
#define REAL_TIME_TASK_CYCLE_MS 50
|
||||||
|
|
||||||
#define GL_ARGB(a, r, g, b) ((((unsigned int)(a)) << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b)))
|
#define GL_ARGB(a, r, g, b) ((((unsigned int)(a)) << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b)))
|
||||||
#define GL_ARGB_A(rgb) ((((unsigned int)(rgb)) >> 24) & 0xFF)
|
#define GL_ARGB_A(rgb) ((((unsigned int)(rgb)) >> 24) & 0xFF)
|
||||||
|
|
||||||
#define GL_RGB(r, g, b) ((0xFF << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b)))
|
#define GL_RGB(r, g, b) ((0xFF << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b)))
|
||||||
#define GL_RGB_R(rgb) ((((unsigned int)(rgb)) >> 16) & 0xFF)
|
#define GL_RGB_R(rgb) ((((unsigned int)(rgb)) >> 16) & 0xFF)
|
||||||
#define GL_RGB_G(rgb) ((((unsigned int)(rgb)) >> 8) & 0xFF)
|
#define GL_RGB_G(rgb) ((((unsigned int)(rgb)) >> 8) & 0xFF)
|
||||||
#define GL_RGB_B(rgb) (((unsigned int)(rgb)) & 0xFF)
|
#define GL_RGB_B(rgb) (((unsigned int)(rgb)) & 0xFF)
|
||||||
#define GL_RGB_32_to_16(rgb) (((((unsigned int)(rgb)) & 0xFF) >> 3) | ((((unsigned int)(rgb)) & 0xFC00) >> 5) | ((((unsigned int)(rgb)) & 0xF80000) >> 8))
|
#define GL_RGB_32_to_16(rgb) (((((unsigned int)(rgb)) & 0xFF) >> 3) | ((((unsigned int)(rgb)) & 0xFC00) >> 5) | ((((unsigned int)(rgb)) & 0xF80000) >> 8))
|
||||||
#define GL_RGB_16_to_32(rgb) ((0xFF << 24) | ((((unsigned int)(rgb)) & 0x1F) << 3) | ((((unsigned int)(rgb)) & 0x7E0) << 5) | ((((unsigned int)(rgb)) & 0xF800) << 8))
|
#define GL_RGB_16_to_32(rgb) ((0xFF << 24) | ((((unsigned int)(rgb)) & 0x1F) << 3) | ((((unsigned int)(rgb)) & 0x7E0) << 5) | ((((unsigned int)(rgb)) & 0xF800) << 8))
|
||||||
|
|
||||||
#define ALIGN_HCENTER 0x00000000L
|
#define ALIGN_HCENTER 0x00000000L
|
||||||
#define ALIGN_LEFT 0x01000000L
|
#define ALIGN_LEFT 0x01000000L
|
||||||
#define ALIGN_RIGHT 0x02000000L
|
#define ALIGN_RIGHT 0x02000000L
|
||||||
#define ALIGN_HMASK 0x03000000L
|
#define ALIGN_HMASK 0x03000000L
|
||||||
|
|
||||||
#define ALIGN_VCENTER 0x00000000L
|
#define ALIGN_VCENTER 0x00000000L
|
||||||
#define ALIGN_TOP 0x00100000L
|
#define ALIGN_TOP 0x00100000L
|
||||||
#define ALIGN_BOTTOM 0x00200000L
|
#define ALIGN_BOTTOM 0x00200000L
|
||||||
#define ALIGN_VMASK 0x00300000L
|
#define ALIGN_VMASK 0x00300000L
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned short year;
|
unsigned short year;
|
||||||
unsigned short month;
|
unsigned short month;
|
||||||
unsigned short date;
|
unsigned short date;
|
||||||
unsigned short day;
|
unsigned short day;
|
||||||
unsigned short hour;
|
unsigned short hour;
|
||||||
unsigned short minute;
|
unsigned short minute;
|
||||||
unsigned short second;
|
unsigned short second;
|
||||||
}T_TIME;
|
}T_TIME;
|
||||||
|
|
||||||
void register_debug_function(void(*my_assert)(const char* file, int line), void(*my_log_out)(const char* log));
|
void register_debug_function(void(*my_assert)(const char* file, int line), void(*my_log_out)(const char* log));
|
||||||
void _assert(const char* file, int line);
|
void _assert(const char* file, int line);
|
||||||
#define ASSERT(condition) \
|
#define ASSERT(condition) \
|
||||||
do{ \
|
do{ \
|
||||||
if(!(condition))_assert(__FILE__, __LINE__);\
|
if(!(condition))_assert(__FILE__, __LINE__);\
|
||||||
}while(0)
|
}while(0)
|
||||||
void log_out(const char* log);
|
void log_out(const char* log);
|
||||||
|
|
||||||
long get_time_in_second();
|
long get_time_in_second();
|
||||||
T_TIME second_to_day(long second);
|
T_TIME second_to_day(long second);
|
||||||
T_TIME get_time();
|
T_TIME get_time();
|
||||||
|
|
||||||
void start_real_timer(void (*func)(void* arg));
|
void start_real_timer(void (*func)(void* arg));
|
||||||
void register_timer(int milli_second, void func(void* ptmr, void* parg));
|
void register_timer(int milli_second, void func(void* ptmr, void* parg));
|
||||||
|
|
||||||
unsigned int get_cur_thread_id();
|
unsigned int get_cur_thread_id();
|
||||||
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg);
|
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg);
|
||||||
void thread_sleep(unsigned int milli_seconds);
|
void thread_sleep(unsigned int milli_seconds);
|
||||||
int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data);
|
int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data);
|
||||||
|
|
||||||
#define FIFO_BUFFER_LEN 1024
|
#define FIFO_BUFFER_LEN 1024
|
||||||
class c_fifo
|
class c_fifo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
c_fifo();
|
c_fifo();
|
||||||
int read(void* buf, int len);
|
int read(void* buf, int len);
|
||||||
int write(void* buf, int len);
|
int write(void* buf, int len);
|
||||||
private:
|
private:
|
||||||
unsigned char m_buf[FIFO_BUFFER_LEN];
|
unsigned char m_buf[FIFO_BUFFER_LEN];
|
||||||
int m_head;
|
int m_head;
|
||||||
int m_tail;
|
int m_tail;
|
||||||
void* m_read_sem;
|
void* m_read_sem;
|
||||||
void* m_write_mutex;
|
void* m_write_mutex;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#ifndef GUILITE_CORE_INCLUDE_CMD_TARGET_H
|
#ifndef GUILITE_CORE_INCLUDE_CMD_TARGET_H
|
||||||
#define GUILITE_CORE_INCLUDE_CMD_TARGET_H
|
#define GUILITE_CORE_INCLUDE_CMD_TARGET_H
|
||||||
class c_cmd_target;
|
class c_cmd_target;
|
||||||
|
@ -358,7 +358,7 @@ typedef enum
|
||||||
{
|
{
|
||||||
ATTR_VISIBLE = 0x40000000L,
|
ATTR_VISIBLE = 0x40000000L,
|
||||||
ATTR_FOCUS = 0x20000000L,
|
ATTR_FOCUS = 0x20000000L,
|
||||||
ATTR_MODAL = 0x10000000L// Handle touch action at high priority
|
ATTR_PRIORITY = 0x10000000L// Handle touch action at high priority
|
||||||
}WND_ATTRIBUTION;
|
}WND_ATTRIBUTION;
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -335,7 +335,7 @@ void c_wnd::on_touch(int x, int y, TOUCH_ACTION action)
|
||||||
c_wnd* tmp_child = m_top_child;
|
c_wnd* tmp_child = m_top_child;
|
||||||
while (tmp_child)
|
while (tmp_child)
|
||||||
{
|
{
|
||||||
if ((tmp_child->m_attr & ATTR_MODAL) && (tmp_child->m_attr & ATTR_VISIBLE))
|
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||||
{
|
{
|
||||||
model_wnd = tmp_child;
|
model_wnd = tmp_child;
|
||||||
break;
|
break;
|
||||||
|
@ -371,7 +371,7 @@ void c_wnd::on_key(KEY_TYPE key)
|
||||||
c_wnd* tmp_child = m_top_child;
|
c_wnd* tmp_child = m_top_child;
|
||||||
while (tmp_child)
|
while (tmp_child)
|
||||||
{
|
{
|
||||||
if ((tmp_child->m_attr & ATTR_MODAL) && (tmp_child->m_attr & ATTR_VISIBLE))
|
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||||
{
|
{
|
||||||
model_wnd = tmp_child;
|
model_wnd = tmp_child;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,7 +11,7 @@ typedef enum
|
||||||
{
|
{
|
||||||
ATTR_VISIBLE = 0x40000000L,
|
ATTR_VISIBLE = 0x40000000L,
|
||||||
ATTR_FOCUS = 0x20000000L,
|
ATTR_FOCUS = 0x20000000L,
|
||||||
ATTR_MODAL = 0x10000000L// Handle touch action at high priority
|
ATTR_PRIORITY = 0x10000000L// Handle touch action at high priority
|
||||||
}WND_ATTRIBUTION;
|
}WND_ATTRIBUTION;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
|
@ -63,7 +63,7 @@ int c_dialog::open_dialog(c_dialog* p_dlg, bool modal_mode)
|
||||||
p_dlg->get_screen_rect(rc);
|
p_dlg->get_screen_rect(rc);
|
||||||
p_dlg->get_surface()->set_frame_layer_visible_rect(rc, Z_ORDER_LEVEL_1);
|
p_dlg->get_surface()->set_frame_layer_visible_rect(rc, Z_ORDER_LEVEL_1);
|
||||||
|
|
||||||
p_dlg->set_attr(modal_mode ? (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_MODAL) : (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS));
|
p_dlg->set_attr(modal_mode ? (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_PRIORITY) : (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS));
|
||||||
p_dlg->show_window();
|
p_dlg->show_window();
|
||||||
p_dlg->set_me_the_dialog();
|
p_dlg->set_me_the_dialog();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -156,7 +156,7 @@ void c_edit::on_paint()
|
||||||
if (m_z_order == m_parent->get_z_order())
|
if (m_z_order == m_parent->get_z_order())
|
||||||
{
|
{
|
||||||
m_z_order++;
|
m_z_order++;
|
||||||
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_MODAL);
|
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_PRIORITY);
|
||||||
show_keyboard();
|
show_keyboard();
|
||||||
}
|
}
|
||||||
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, c_theme::get_color(COLOR_WND_PUSHED), m_parent->get_z_order());
|
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, c_theme::get_color(COLOR_WND_PUSHED), m_parent->get_z_order());
|
||||||
|
|
|
@ -75,7 +75,7 @@ void c_list_box::on_paint()
|
||||||
m_z_order++;
|
m_z_order++;
|
||||||
}
|
}
|
||||||
m_surface->set_frame_layer_visible_rect(m_list_screen_rect, m_z_order);
|
m_surface->set_frame_layer_visible_rect(m_list_screen_rect, m_z_order);
|
||||||
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_MODAL);
|
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS | ATTR_PRIORITY);
|
||||||
show_list();
|
show_list();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue