fix warnings, simplify cmd_target
This commit is contained in:
parent
46ba6afa70
commit
30e55c5267
631
GuiLite.cpp
631
GuiLite.cpp
|
@ -72,31 +72,23 @@ GL_MSG_ENTRY c_cmd_target::ms_usr_map_entries[USR_MSG_MAX];
|
|||
unsigned short c_cmd_target::ms_user_map_size;
|
||||
GL_BEGIN_MESSAGE_MAP(c_cmd_target)
|
||||
GL_END_MESSAGE_MAP()
|
||||
c_cmd_target::c_cmd_target()
|
||||
{
|
||||
}
|
||||
c_cmd_target::~c_cmd_target()
|
||||
{
|
||||
}
|
||||
int c_cmd_target::handle_usr_msg(unsigned int msgId, unsigned int wParam, unsigned int lParam)
|
||||
int c_cmd_target::handle_usr_msg(int msgId, int resource_id, int param)
|
||||
{
|
||||
int i;
|
||||
c_cmd_target* p_wnd = 0;
|
||||
MSGFUNCS msg_funcs;
|
||||
for (i = 0; i < ms_user_map_size; i++)
|
||||
{
|
||||
if (msgId == ms_usr_map_entries[i].msgId)
|
||||
{
|
||||
p_wnd = (c_cmd_target*)ms_usr_map_entries[i].pObject;
|
||||
msg_funcs.func = ms_usr_map_entries[i].func;
|
||||
(p_wnd->*msg_funcs.func_vwl)(wParam , lParam);
|
||||
p_wnd = (c_cmd_target*)ms_usr_map_entries[i].object;
|
||||
(p_wnd->*ms_usr_map_entries[i].callBack)(resource_id, param);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
void c_cmd_target::load_cmd_msg()
|
||||
{
|
||||
const GL_MSG_ENTRY* p_entry = GetMSgEntries();
|
||||
const GL_MSG_ENTRY* p_entry = get_msg_entries();
|
||||
if (0 == p_entry)
|
||||
{
|
||||
return;
|
||||
|
@ -114,7 +106,7 @@ void c_cmd_target::load_cmd_msg()
|
|||
{
|
||||
//repeat register, return.
|
||||
if (p_entry->msgId == ms_usr_map_entries[i].msgId
|
||||
&& ms_usr_map_entries[i].pObject == this)
|
||||
&& ms_usr_map_entries[i].object == this)
|
||||
{
|
||||
bExist = true;
|
||||
break;
|
||||
|
@ -128,7 +120,7 @@ void c_cmd_target::load_cmd_msg()
|
|||
if (MSG_TYPE_USR == p_entry->msgType)
|
||||
{
|
||||
ms_usr_map_entries[ms_user_map_size] = *p_entry;
|
||||
ms_usr_map_entries[ms_user_map_size].pObject = this;
|
||||
ms_usr_map_entries[ms_user_map_size].object = this;
|
||||
ms_user_map_size++;
|
||||
if (USR_MSG_MAX == ms_user_map_size)
|
||||
{
|
||||
|
@ -143,16 +135,15 @@ void c_cmd_target::load_cmd_msg()
|
|||
p_entry++;
|
||||
}
|
||||
}
|
||||
const GL_MSG_ENTRY* c_cmd_target::FindMsgEntry(const GL_MSG_ENTRY *pEntry,
|
||||
unsigned int msgType, unsigned short msgId, unsigned short ctrlId)
|
||||
const GL_MSG_ENTRY* c_cmd_target::find_msg_entry(const GL_MSG_ENTRY *pEntry, int msgType, int msgId)
|
||||
{
|
||||
if ( MSG_TYPE_INVALID == msgType)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while (MSG_CALLBACK_NULL != pEntry->callbackType)
|
||||
while (MSG_TYPE_INVALID != pEntry->msgType)
|
||||
{
|
||||
if ( (msgType == pEntry->msgType) && (msgId == pEntry->msgId) && (void*)(unsigned long)ctrlId == pEntry->pObject)
|
||||
if ( (msgType == pEntry->msgType) && (msgId == pEntry->msgId))
|
||||
{
|
||||
return pEntry;
|
||||
}
|
||||
|
@ -162,9 +153,7 @@ const GL_MSG_ENTRY* c_cmd_target::FindMsgEntry(const GL_MSG_ENTRY *pEntry,
|
|||
}
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
c_display::c_display(void* phy_fb, unsigned int display_width, unsigned int display_height,
|
||||
unsigned int surface_width, unsigned int surface_height,
|
||||
unsigned int color_bytes, unsigned int surface_cnt, EXTERNAL_GFX_OP* gfx_op)
|
||||
c_display::c_display(void* phy_fb, int display_width, int display_height, int surface_width, int surface_height, unsigned int color_bytes, int surface_cnt, EXTERNAL_GFX_OP* gfx_op)
|
||||
{
|
||||
if (color_bytes != 2 && color_bytes != 4)
|
||||
{
|
||||
|
@ -293,8 +282,8 @@ int c_display::snap_shot(const char* file_name)
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
unsigned int width = get_width();
|
||||
unsigned int height = get_height();
|
||||
int width = get_width();
|
||||
int height = get_height();
|
||||
//16 bits framebuffer
|
||||
if (m_color_bytes == 2)
|
||||
{
|
||||
|
@ -356,7 +345,7 @@ int c_rect::IsEmpty() const
|
|||
{
|
||||
return m_top == m_bottom || m_left == m_right;
|
||||
}
|
||||
int c_rect::PtInRect(int x, int y) const
|
||||
bool c_rect::PtInRect(int x, int y) const
|
||||
{
|
||||
return x >= m_left && x <= m_right && y >= m_top && y <= m_bottom;
|
||||
}
|
||||
|
@ -401,7 +390,7 @@ void c_surface::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order)
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (z_order > m_max_zorder)
|
||||
if (z_order > (unsigned int)m_max_zorder)
|
||||
{
|
||||
ASSERT(false);
|
||||
return;
|
||||
|
@ -411,7 +400,7 @@ void c_surface::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order)
|
|||
{
|
||||
return draw_pixel_on_fb(x, y, rgb);
|
||||
}
|
||||
if (z_order > m_top_zorder)
|
||||
if (z_order > (unsigned int)m_top_zorder)
|
||||
{
|
||||
m_top_zorder = (Z_ORDER_LEVEL)z_order;
|
||||
}
|
||||
|
@ -426,7 +415,7 @@ void c_surface::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order)
|
|||
return draw_pixel_on_fb(x, y, rgb);
|
||||
}
|
||||
bool is_covered = false;
|
||||
for (int tmp_z_order = Z_ORDER_LEVEL_MAX - 1; tmp_z_order > z_order; tmp_z_order--)
|
||||
for (unsigned int tmp_z_order = Z_ORDER_LEVEL_MAX - 1; tmp_z_order > z_order; tmp_z_order--)
|
||||
{
|
||||
if (true == m_frame_layers[tmp_z_order].visible_rect.PtInRect(x, y))
|
||||
{
|
||||
|
@ -702,7 +691,7 @@ int c_surface::set_frame_layer_visible_rect(c_rect& rect, unsigned int z_order)
|
|||
ASSERT(false);
|
||||
return -2;
|
||||
}
|
||||
if (z_order < m_top_zorder)
|
||||
if (z_order < (unsigned int)m_top_zorder)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -3;
|
||||
|
@ -712,8 +701,6 @@ int c_surface::set_frame_layer_visible_rect(c_rect& rect, unsigned int z_order)
|
|||
c_rect old_rect = m_frame_layers[z_order].visible_rect;
|
||||
//Recover the lower layer
|
||||
int src_zorder = (Z_ORDER_LEVEL)(z_order - 1);
|
||||
int display_width = m_display->get_width();
|
||||
int display_height = m_display->get_height();
|
||||
for (int y = old_rect.m_top; y <= old_rect.m_bottom; y++)
|
||||
{
|
||||
for (int x = old_rect.m_left; x <= old_rect.m_right; x++)
|
||||
|
@ -834,75 +821,75 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
int c_theme::add_font(FONT_TYPE index, const FONT_INFO* font)
|
||||
{
|
||||
if (index >= FONT_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_font_map[index] = font;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const FONT_INFO* c_theme::get_font(FONT_TYPE index)
|
||||
{
|
||||
if (index >= FONT_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_font_map[index];
|
||||
}
|
||||
|
||||
int c_theme::add_bitmap(BITMAP_TYPE index, const BITMAP_INFO* bmp)
|
||||
{
|
||||
if (index >= BITMAP_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_bmp_map[index] = bmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const BITMAP_INFO* c_theme::get_bmp(BITMAP_TYPE index)
|
||||
{
|
||||
if (index >= BITMAP_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_bmp_map[index];
|
||||
}
|
||||
|
||||
int c_theme::add_color(COLOR_TYPE index, const unsigned int color)
|
||||
{
|
||||
if (index >= COLOR_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_color_map[index] = color;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const unsigned int c_theme::get_color(COLOR_TYPE index)
|
||||
{
|
||||
if (index >= COLOR_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_color_map[index];
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
int c_theme::add_font(FONT_TYPE index, const FONT_INFO* font)
|
||||
{
|
||||
if (index >= FONT_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_font_map[index] = font;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const FONT_INFO* c_theme::get_font(FONT_TYPE index)
|
||||
{
|
||||
if (index >= FONT_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_font_map[index];
|
||||
}
|
||||
|
||||
int c_theme::add_bitmap(BITMAP_TYPE index, const BITMAP_INFO* bmp)
|
||||
{
|
||||
if (index >= BITMAP_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_bmp_map[index] = bmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const BITMAP_INFO* c_theme::get_bmp(BITMAP_TYPE index)
|
||||
{
|
||||
if (index >= BITMAP_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
return s_bmp_map[index];
|
||||
}
|
||||
|
||||
int c_theme::add_color(COLOR_TYPE index, const unsigned int color)
|
||||
{
|
||||
if (index >= COLOR_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
s_color_map[index] = color;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const unsigned int c_theme::get_color(COLOR_TYPE index)
|
||||
{
|
||||
if (index >= COLOR_MAX)
|
||||
{
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
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),
|
||||
m_str(0), m_font_color(0), m_bg_color(0), m_resource_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)
|
||||
{
|
||||
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS);
|
||||
}
|
||||
|
@ -914,7 +901,7 @@ int c_wnd::connect(c_wnd *parent, unsigned short resource_id, const char* str,
|
|||
ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
m_resource_id = resource_id;
|
||||
m_id = resource_id;
|
||||
set_str(str);
|
||||
m_parent = parent;
|
||||
m_status = STATUS_NORMAL;
|
||||
|
@ -958,7 +945,7 @@ int c_wnd::load_child_wnd(WND_TREE *p_child_tree)
|
|||
WND_TREE* p_cur = p_child_tree;
|
||||
while(p_cur->p_wnd)
|
||||
{
|
||||
if (0 != p_cur->p_wnd->m_resource_id)
|
||||
if (0 != p_cur->p_wnd->m_id)
|
||||
{//This wnd has been used! Do not share!
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
|
@ -982,7 +969,7 @@ c_wnd* c_wnd::connect_clone(c_wnd *parent, unsigned short resource_id, const cha
|
|||
return 0;
|
||||
}
|
||||
c_wnd* wnd = clone();
|
||||
wnd->m_resource_id = resource_id;
|
||||
wnd->m_id = resource_id;
|
||||
wnd->set_str(str);
|
||||
wnd->m_parent = parent;
|
||||
wnd->m_status = STATUS_NORMAL;
|
||||
|
@ -1040,7 +1027,7 @@ int c_wnd::load_clone_child_wnd(WND_TREE *p_child_tree)
|
|||
}
|
||||
void c_wnd::disconnect()
|
||||
{
|
||||
if (0 == m_resource_id)
|
||||
if (0 == m_id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1060,7 +1047,7 @@ void c_wnd::disconnect()
|
|||
m_parent->unlink_child(this);
|
||||
}
|
||||
m_focus_child = 0;
|
||||
m_resource_id = 0;
|
||||
m_id = 0;
|
||||
}
|
||||
c_wnd* c_wnd::get_wnd_ptr(unsigned short id) const
|
||||
{
|
||||
|
@ -1090,7 +1077,7 @@ void c_wnd::set_attr(WND_ATTRIBUTION attr)
|
|||
}
|
||||
}
|
||||
}
|
||||
int c_wnd::is_focus_wnd() const
|
||||
bool c_wnd::is_focus_wnd() const
|
||||
{
|
||||
if ( (m_attr & ATTR_VISIBLE)
|
||||
&& !(m_attr & ATTR_DISABLED)
|
||||
|
@ -1168,7 +1155,7 @@ c_wnd* c_wnd::set_child_focus(c_wnd * focus_child)
|
|||
void c_wnd::add_child_2_tail(c_wnd *child)
|
||||
{
|
||||
if( 0 == child )return;
|
||||
if(child == get_wnd_ptr(child->m_resource_id))return;
|
||||
if(child == get_wnd_ptr(child->m_id))return;
|
||||
if ( 0 == m_top_child )
|
||||
{
|
||||
m_top_child = child;
|
||||
|
@ -1211,7 +1198,7 @@ int c_wnd::unlink_child(c_wnd *child)
|
|||
{
|
||||
return -2;
|
||||
}
|
||||
int find = false;
|
||||
bool find = false;
|
||||
c_wnd *tmp_child = m_top_child;
|
||||
if (tmp_child == child)
|
||||
{
|
||||
|
@ -1361,37 +1348,18 @@ bool c_wnd::on_key(KEY_TYPE key)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
void c_wnd::notify_parent(unsigned int msg_id, int param)
|
||||
void c_wnd::notify_parent(int msg_id, int param)
|
||||
{
|
||||
if (!m_parent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const GL_MSG_ENTRY* entry = m_parent->FindMsgEntry(m_parent->GetMSgEntries(), MSG_TYPE_WND, msg_id, m_resource_id);
|
||||
const GL_MSG_ENTRY* entry = m_parent->find_msg_entry(m_parent->get_msg_entries(), MSG_TYPE_WND, msg_id);
|
||||
if (0 == entry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MSGFUNCS msg_funcs;
|
||||
msg_funcs.func = entry->func;
|
||||
switch (entry->callbackType)
|
||||
{
|
||||
case MSG_CALLBACK_VV:
|
||||
(m_parent->*msg_funcs.func)();
|
||||
break;
|
||||
case MSG_CALLBACK_VVL:
|
||||
(m_parent->*msg_funcs.func_vvl)(param);
|
||||
break;
|
||||
case MSG_CALLBACK_VWV:
|
||||
(m_parent->*msg_funcs.func_vwv)(m_resource_id);
|
||||
break;
|
||||
case MSG_CALLBACK_VWL:
|
||||
(m_parent->*msg_funcs.func_vwl)(m_resource_id, param);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
}
|
||||
(m_parent->*(entry->callBack))(m_id, param);
|
||||
}
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -2008,139 +1976,139 @@ int c_fifo::write(void* buf, int len)
|
|||
return i;
|
||||
}
|
||||
#endif
|
||||
#if (!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static void(*do_assert)(const char* file, int line);
|
||||
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))
|
||||
{
|
||||
do_assert = my_assert;
|
||||
do_log_out = my_log_out;
|
||||
}
|
||||
|
||||
void _assert(const char* file, int line)
|
||||
{
|
||||
if(do_assert)
|
||||
{
|
||||
do_assert(file, line);
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
void log_out(const char* log)
|
||||
{
|
||||
if (do_log_out)
|
||||
{
|
||||
do_log_out(log);
|
||||
}
|
||||
}
|
||||
|
||||
long get_time_in_second()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
T_TIME second_to_day(long second)
|
||||
{
|
||||
T_TIME ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
T_TIME get_time()
|
||||
{
|
||||
T_TIME ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
void start_real_timer(void (*func)(void* arg))
|
||||
{
|
||||
log_out("Not support now");
|
||||
}
|
||||
|
||||
void register_timer(int milli_second, void func(void* ptmr, void* parg))
|
||||
{
|
||||
log_out("Not support now");
|
||||
}
|
||||
|
||||
unsigned int get_cur_thread_id()
|
||||
{
|
||||
log_out("Not support now");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg)
|
||||
{
|
||||
log_out("Not support now");
|
||||
}
|
||||
|
||||
extern "C" void delay_ms(unsigned short nms);
|
||||
void thread_sleep(unsigned int milli_seconds)
|
||||
{//MCU alway implemnet driver code in APP.
|
||||
delay_ms(milli_seconds);
|
||||
}
|
||||
|
||||
int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data)
|
||||
{
|
||||
log_out("Not support now");
|
||||
return 0;
|
||||
}
|
||||
|
||||
c_fifo::c_fifo()
|
||||
{
|
||||
m_head = m_tail = 0;
|
||||
m_read_sem = m_write_mutex = 0;
|
||||
}
|
||||
|
||||
int c_fifo::read(void* buf, int len)
|
||||
{
|
||||
unsigned char* pbuf = (unsigned char*)buf;
|
||||
int i = 0;
|
||||
while(i < len)
|
||||
{
|
||||
if (m_tail == m_head)
|
||||
{//empty
|
||||
continue;
|
||||
}
|
||||
*pbuf++ = m_buf[m_head];
|
||||
m_head = (m_head + 1) % FIFO_BUFFER_LEN;
|
||||
i++;
|
||||
}
|
||||
if(i != len)
|
||||
{
|
||||
ASSERT(false);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
int c_fifo::write(void* buf, int len)
|
||||
{
|
||||
unsigned char* pbuf = (unsigned char*)buf;
|
||||
int i = 0;
|
||||
int tail = m_tail;
|
||||
|
||||
while(i < len)
|
||||
{
|
||||
if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head)
|
||||
{//full, clear data has been written;
|
||||
m_tail = tail;
|
||||
log_out("Warning: fifo full\n");
|
||||
return 0;
|
||||
}
|
||||
m_buf[m_tail] = *pbuf++;
|
||||
m_tail = (m_tail + 1) % FIFO_BUFFER_LEN;
|
||||
i++;
|
||||
}
|
||||
|
||||
if(i != len)
|
||||
{
|
||||
ASSERT(false);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if (!defined _WIN32) && (!defined WIN32) && (!defined _WIN64) && (!defined WIN64) && (!defined __linux__) && (!defined __APPLE__)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static void(*do_assert)(const char* file, int line);
|
||||
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))
|
||||
{
|
||||
do_assert = my_assert;
|
||||
do_log_out = my_log_out;
|
||||
}
|
||||
|
||||
void _assert(const char* file, int line)
|
||||
{
|
||||
if(do_assert)
|
||||
{
|
||||
do_assert(file, line);
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
void log_out(const char* log)
|
||||
{
|
||||
if (do_log_out)
|
||||
{
|
||||
do_log_out(log);
|
||||
}
|
||||
}
|
||||
|
||||
long get_time_in_second()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
T_TIME second_to_day(long second)
|
||||
{
|
||||
T_TIME ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
T_TIME get_time()
|
||||
{
|
||||
T_TIME ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
void start_real_timer(void (*func)(void* arg))
|
||||
{
|
||||
log_out("Not support now");
|
||||
}
|
||||
|
||||
void register_timer(int milli_second, void func(void* ptmr, void* parg))
|
||||
{
|
||||
log_out("Not support now");
|
||||
}
|
||||
|
||||
unsigned int get_cur_thread_id()
|
||||
{
|
||||
log_out("Not support now");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg)
|
||||
{
|
||||
log_out("Not support now");
|
||||
}
|
||||
|
||||
extern "C" void delay_ms(unsigned short nms);
|
||||
void thread_sleep(unsigned int milli_seconds)
|
||||
{//MCU alway implemnet driver code in APP.
|
||||
delay_ms(milli_seconds);
|
||||
}
|
||||
|
||||
int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data)
|
||||
{
|
||||
log_out("Not support now");
|
||||
return 0;
|
||||
}
|
||||
|
||||
c_fifo::c_fifo()
|
||||
{
|
||||
m_head = m_tail = 0;
|
||||
m_read_sem = m_write_mutex = 0;
|
||||
}
|
||||
|
||||
int c_fifo::read(void* buf, int len)
|
||||
{
|
||||
unsigned char* pbuf = (unsigned char*)buf;
|
||||
int i = 0;
|
||||
while(i < len)
|
||||
{
|
||||
if (m_tail == m_head)
|
||||
{//empty
|
||||
continue;
|
||||
}
|
||||
*pbuf++ = m_buf[m_head];
|
||||
m_head = (m_head + 1) % FIFO_BUFFER_LEN;
|
||||
i++;
|
||||
}
|
||||
if(i != len)
|
||||
{
|
||||
ASSERT(false);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
int c_fifo::write(void* buf, int len)
|
||||
{
|
||||
unsigned char* pbuf = (unsigned char*)buf;
|
||||
int i = 0;
|
||||
int tail = m_tail;
|
||||
|
||||
while(i < len)
|
||||
{
|
||||
if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head)
|
||||
{//full, clear data has been written;
|
||||
m_tail = tail;
|
||||
log_out("Warning: fifo full\n");
|
||||
return 0;
|
||||
}
|
||||
m_buf[m_tail] = *pbuf++;
|
||||
m_tail = (m_tail + 1) % FIFO_BUFFER_LEN;
|
||||
i++;
|
||||
}
|
||||
|
||||
if(i != len)
|
||||
{
|
||||
ASSERT(false);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if (defined _WIN32) || (defined WIN32) || (defined _WIN64) || (defined WIN64)
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -2324,7 +2292,7 @@ void register_timer(int milli_second,void func(void* ptmr, void* parg))
|
|||
}
|
||||
long get_time_in_second()
|
||||
{
|
||||
return time(0);
|
||||
return (long)time(0);
|
||||
}
|
||||
T_TIME get_time()
|
||||
{
|
||||
|
@ -2920,10 +2888,7 @@ int c_dialog::set_me_the_dialog()
|
|||
if(ms_the_dialogs[i].surface == 0)
|
||||
{
|
||||
ms_the_dialogs[i].dialog = this;
|
||||
if(this)
|
||||
{
|
||||
ms_the_dialogs[i].surface = surface;
|
||||
}
|
||||
ms_the_dialogs[i].surface = surface;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -2933,7 +2898,7 @@ int c_dialog::set_me_the_dialog()
|
|||
#include <string.h>
|
||||
#define IDD_KEY_BOARD 0x1
|
||||
GL_BEGIN_MESSAGE_MAP(c_edit)
|
||||
ON_KEYBORAD_UPDATE(IDD_KEY_BOARD, c_edit::on_key_board_click)
|
||||
ON_KEYBORAD_UPDATE(c_edit::on_key_board_click)
|
||||
GL_END_MESSAGE_MAP()
|
||||
static c_keyboard s_keyboard;
|
||||
void c_edit::pre_create_wnd()
|
||||
|
@ -3070,7 +3035,7 @@ void c_edit::show_keyboard()
|
|||
m_surface->set_frame_layer_visible_rect(kb_rect, s_keyboard.get_z_order());
|
||||
s_keyboard.show_window();
|
||||
}
|
||||
void c_edit::on_key_board_click(unsigned int ctrl_id, long param)
|
||||
void c_edit::on_key_board_click(int id, int param)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
|
@ -3373,48 +3338,7 @@ WND_TREE g_number_board_children[] =
|
|||
{0,0,0,0,0,0,0}
|
||||
};
|
||||
GL_BEGIN_MESSAGE_MAP(c_keyboard)
|
||||
ON_GL_BN_CLICKED('A', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('B', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('C', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('D', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('E', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('F', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('G', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('H', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('I', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('J', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('K', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('L', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('M', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('N', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('O', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('P', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('Q', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('R', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('S', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('T', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('U', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('V', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('W', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('X', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('Y', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('Z', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('0', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('1', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('2', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('3', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('4', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('5', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('6', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('7', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('8', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('9', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED(' ', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('.', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED(0x7F, c_keyboard::on_del_clicked)
|
||||
ON_GL_BN_CLICKED(0x14, c_keyboard::on_caps_clicked)
|
||||
ON_GL_BN_CLICKED('\n', c_keyboard::on_enter_clicked)
|
||||
ON_GL_BN_CLICKED(0x1B, c_keyboard::on_esc_clicked)
|
||||
ON_GL_BN_CLICKED(c_keyboard::on_key_clicked)
|
||||
GL_END_MESSAGE_MAP()
|
||||
int c_keyboard::connect(c_wnd *user, unsigned short resource_id, KEYBOARD_STYLE style)
|
||||
{
|
||||
|
@ -3443,22 +3367,43 @@ void c_keyboard::pre_create_wnd()
|
|||
memset(m_str, 0, sizeof(m_str));
|
||||
m_str_len = 0;
|
||||
}
|
||||
void c_keyboard::on_caps_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_key_clicked(int id, int param)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0x14:
|
||||
on_caps_clicked(id, param);
|
||||
break;
|
||||
case '\n':
|
||||
on_enter_clicked(id, param);
|
||||
break;
|
||||
case 0x1B:
|
||||
on_esc_clicked(id, param);
|
||||
break;
|
||||
case 0x7F:
|
||||
on_del_clicked(id, param);
|
||||
break;
|
||||
default:
|
||||
on_char_clicked(id, param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void c_keyboard::on_caps_clicked(int id, int parm)
|
||||
{
|
||||
m_cap_status = (m_cap_status == STATUS_LOWERCASE) ? STATUS_UPPERCASE : STATUS_LOWERCASE;
|
||||
show_window();
|
||||
}
|
||||
void c_keyboard::on_enter_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_enter_clicked(int id, int param)
|
||||
{
|
||||
memset(m_str, 0, sizeof(m_str));
|
||||
notify_parent(KEYBORAD_CLICK, CLICK_ENTER);
|
||||
return notify_parent(KEYBORAD_CLICK, CLICK_ENTER);
|
||||
}
|
||||
void c_keyboard::on_esc_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_esc_clicked(int id, int param)
|
||||
{
|
||||
memset(m_str, 0, sizeof(m_str));
|
||||
notify_parent(KEYBORAD_CLICK, CLICK_ESC);
|
||||
}
|
||||
void c_keyboard::on_del_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_del_clicked(int id, int param)
|
||||
{
|
||||
if (m_str_len <= 0)
|
||||
{
|
||||
|
@ -3467,27 +3412,27 @@ void c_keyboard::on_del_clicked(unsigned int ctrl_id)
|
|||
m_str[--m_str_len] = 0;
|
||||
notify_parent(KEYBORAD_CLICK, CLICK_CHAR);
|
||||
}
|
||||
void c_keyboard::on_char_clicked(unsigned int ctrl_id)
|
||||
{//ctrl_id = char ascii code.
|
||||
void c_keyboard::on_char_clicked(int id, int param)
|
||||
{//id = char ascii code.
|
||||
if (m_str_len >= sizeof(m_str))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((ctrl_id >= '0' && ctrl_id <= '9') || ctrl_id == ' ' || ctrl_id == '.')
|
||||
if ((id >= '0' && id <= '9') || id == ' ' || id == '.')
|
||||
{
|
||||
goto InputChar;
|
||||
}
|
||||
if (ctrl_id >= 'A' && ctrl_id <= 'Z')
|
||||
if (id >= 'A' && id <= 'Z')
|
||||
{
|
||||
if (STATUS_LOWERCASE == m_cap_status)
|
||||
{
|
||||
ctrl_id += 0x20;
|
||||
id += 0x20;
|
||||
}
|
||||
goto InputChar;
|
||||
}
|
||||
ASSERT(false);
|
||||
InputChar:
|
||||
m_str[m_str_len++] = ctrl_id;
|
||||
m_str[m_str_len++] = id;
|
||||
notify_parent(KEYBORAD_CLICK, CLICK_CHAR);
|
||||
}
|
||||
void c_keyboard::on_paint()
|
||||
|
@ -3517,43 +3462,43 @@ void c_keyboard_button::on_paint()
|
|||
break;
|
||||
}
|
||||
|
||||
if (m_resource_id == 0x14)
|
||||
if (m_id == 0x14)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Caps", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == 0x1B)
|
||||
else if (m_id == 0x1B)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Esc", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == ' ')
|
||||
else if (m_id == ' ')
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Space", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == '\n')
|
||||
else if (m_id == '\n')
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Enter", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == '.')
|
||||
else if (m_id == '.')
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, ".", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == 0x7F)
|
||||
else if (m_id == 0x7F)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Back", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == 0x90)
|
||||
else if (m_id == 0x90)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "?123", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
|
||||
char letter[] = { 0, 0 };
|
||||
if (m_resource_id >= 'A' && m_resource_id <= 'Z')
|
||||
if (m_id >= 'A' && m_id <= 'Z')
|
||||
{
|
||||
letter[0] = (((c_keyboard*)m_parent)->get_cap_status() == STATUS_UPPERCASE) ? m_resource_id : (m_resource_id + 0x20);
|
||||
letter[0] = (((c_keyboard*)m_parent)->get_cap_status() == STATUS_UPPERCASE) ? m_id : (m_id + 0x20);
|
||||
}
|
||||
else if (m_resource_id >= '0' && m_resource_id <= '9')
|
||||
else if (m_id >= '0' && m_id <= '9')
|
||||
{
|
||||
letter[0] = m_resource_id;
|
||||
letter[0] = (char)m_id;
|
||||
}
|
||||
c_word::draw_string_in_rect(m_surface, m_z_order, letter, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
|
@ -3908,8 +3853,7 @@ bool c_slide_group::on_key(KEY_TYPE key)
|
|||
#define ID_BT_ARROW_UP 1
|
||||
#define ID_BT_ARROW_DOWN 2
|
||||
GL_BEGIN_MESSAGE_MAP(c_spin_box)
|
||||
ON_GL_BN_CLICKED(ID_BT_ARROW_UP, c_spin_box::on_arrow_up_bt_click)
|
||||
ON_GL_BN_CLICKED(ID_BT_ARROW_DOWN, c_spin_box::on_arrow_down_bt_click)
|
||||
ON_GL_BN_CLICKED(c_spin_box::on_arrow_bt_click)
|
||||
GL_END_MESSAGE_MAP()
|
||||
void c_spin_box::pre_create_wnd()
|
||||
{
|
||||
|
@ -4037,7 +3981,22 @@ void c_spin_box::on_paint()
|
|||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
void c_spin_box::on_arrow_up_bt_click(unsigned int ctr_id)
|
||||
void c_spin_box::on_arrow_bt_click(int ctr_id, int param)
|
||||
{
|
||||
switch (ctr_id)
|
||||
{
|
||||
case ID_BT_ARROW_UP:
|
||||
on_arrow_up_bt_click(ctr_id, param);
|
||||
break;
|
||||
case ID_BT_ARROW_DOWN:
|
||||
on_arrow_down_bt_click(ctr_id, param);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void c_spin_box::on_arrow_up_bt_click(int ctr_id, int param)
|
||||
{
|
||||
if (m_cur_value + m_step > m_max)
|
||||
{
|
||||
|
@ -4047,7 +4006,7 @@ void c_spin_box::on_arrow_up_bt_click(unsigned int ctr_id)
|
|||
notify_parent(GL_SPIN_CHANGE, m_cur_value);
|
||||
on_paint();
|
||||
}
|
||||
void c_spin_box::on_arrow_down_bt_click(unsigned int ctr_id)
|
||||
void c_spin_box::on_arrow_down_bt_click(int ctr_id, int param)
|
||||
{
|
||||
if (m_cur_value - m_step < m_min)
|
||||
{
|
||||
|
|
137
GuiLite.h
137
GuiLite.h
|
@ -76,62 +76,37 @@ class c_cmd_target;
|
|||
#define MSG_TYPE_WND 0x0001
|
||||
#define MSG_TYPE_USR 0x0002
|
||||
#define USR_MSG_MAX 32
|
||||
typedef void (c_cmd_target::*MsgFuncVV)();
|
||||
enum MSG_CALLBACK_TYPE
|
||||
{
|
||||
MSG_CALLBACK_NULL = 0,
|
||||
MSG_CALLBACK_VV,
|
||||
MSG_CALLBACK_IWL,
|
||||
MSG_CALLBACK_IWV,
|
||||
MSG_CALLBACK_VWV,
|
||||
MSG_CALLBACK_VVL,
|
||||
MSG_CALLBACK_VWL,
|
||||
MSG_CALLBACK_IVV
|
||||
};
|
||||
typedef union
|
||||
{
|
||||
void (c_cmd_target::*func)();
|
||||
void (c_cmd_target::*func_vwv)(unsigned int w_param);
|
||||
int (c_cmd_target::*func_iwl)(unsigned int w_param, long l_param);
|
||||
int (c_cmd_target::*func_iwv)(unsigned int w_param);
|
||||
void (c_cmd_target::*func_vvl)(long l_param);
|
||||
void (c_cmd_target::*func_vwl)(unsigned int w_param, long l_param);
|
||||
int (c_cmd_target::*func_ivv)();
|
||||
}MSGFUNCS;
|
||||
typedef void (c_cmd_target::*msgCallback)(int, int);
|
||||
struct GL_MSG_ENTRY
|
||||
{
|
||||
unsigned int msgType;
|
||||
unsigned int msgId;
|
||||
c_cmd_target* pObject;
|
||||
MSG_CALLBACK_TYPE callbackType;
|
||||
MsgFuncVV func;
|
||||
c_cmd_target* object;
|
||||
msgCallback callBack;
|
||||
};
|
||||
#define ON_GL_USER_MSG(msgId, func) \
|
||||
{MSG_TYPE_USR, msgId, 0, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, unsigned int)>(&func))},
|
||||
{MSG_TYPE_USR, msgId, 0, msgCallback(&func)},
|
||||
#define GL_DECLARE_MESSAGE_MAP() \
|
||||
protected: \
|
||||
virtual const GL_MSG_ENTRY* GetMSgEntries() const; \
|
||||
virtual const GL_MSG_ENTRY* get_msg_entries() const;\
|
||||
private: \
|
||||
static const GL_MSG_ENTRY mMsgEntries[];
|
||||
static const GL_MSG_ENTRY m_msg_entries[];
|
||||
#define GL_BEGIN_MESSAGE_MAP(theClass) \
|
||||
const GL_MSG_ENTRY* theClass::GetMSgEntries() const \
|
||||
const GL_MSG_ENTRY* theClass::get_msg_entries() const \
|
||||
{ \
|
||||
return theClass::mMsgEntries; \
|
||||
return theClass::m_msg_entries; \
|
||||
} \
|
||||
const GL_MSG_ENTRY theClass::mMsgEntries[] = \
|
||||
const GL_MSG_ENTRY theClass::m_msg_entries[] = \
|
||||
{
|
||||
#define GL_END_MESSAGE_MAP() \
|
||||
{MSG_TYPE_INVALID, 0, (c_cmd_target*)0, MSG_CALLBACK_NULL, (MsgFuncVV)0}};
|
||||
{MSG_TYPE_INVALID, 0, 0, 0}};
|
||||
class c_cmd_target
|
||||
{
|
||||
public:
|
||||
c_cmd_target();
|
||||
virtual ~c_cmd_target();
|
||||
static int handle_usr_msg(unsigned int msgId, unsigned int wParam, unsigned int lParam);
|
||||
static int handle_usr_msg(int msg_id, int resource_id, int param);
|
||||
protected:
|
||||
void load_cmd_msg();
|
||||
const GL_MSG_ENTRY* FindMsgEntry(const GL_MSG_ENTRY *pEntry,
|
||||
unsigned int msgType, unsigned short msgId, unsigned short ctrlId);
|
||||
const GL_MSG_ENTRY* find_msg_entry(const GL_MSG_ENTRY *pEntry, int msgType, int msgId);
|
||||
private:
|
||||
static GL_MSG_ENTRY ms_usr_map_entries[USR_MSG_MAX];
|
||||
static unsigned short ms_user_map_size;
|
||||
|
@ -151,7 +126,7 @@ public:
|
|||
void Empty();
|
||||
void Offset(int x, int y);
|
||||
int IsEmpty() const ;
|
||||
int PtInRect(int x, int y) const ;
|
||||
bool PtInRect(int x, int y) const ;
|
||||
int operator==(const c_rect& ) const;
|
||||
c_rect operator&(const c_rect& aRect) const;
|
||||
int Width() const {return m_right - m_left + 1;}
|
||||
|
@ -293,17 +268,17 @@ protected:
|
|||
virtual void draw_pixel_on_fb(int x, int y, unsigned int rgb);
|
||||
void set_surface(Z_ORDER_LEVEL max_z_order);
|
||||
c_surface(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes);
|
||||
int m_width; //in pixels
|
||||
int m_height; //in pixels
|
||||
int m_color_bytes; //16 bits, 32 bits only
|
||||
void* m_fb; //Top frame buffer you could see
|
||||
c_frame_layer m_frame_layers[Z_ORDER_LEVEL_MAX];//Top layber fb always be 0
|
||||
bool m_is_active;
|
||||
Z_ORDER_LEVEL m_max_zorder;
|
||||
Z_ORDER_LEVEL m_top_zorder;
|
||||
void* m_phy_fb;
|
||||
int* m_phy_write_index;
|
||||
c_display* m_display;
|
||||
int m_width; //in pixels
|
||||
int m_height; //in pixels
|
||||
int m_color_bytes; //16 bits, 32 bits only
|
||||
void* m_fb; //Top frame buffer you could see
|
||||
c_frame_layer m_frame_layers[Z_ORDER_LEVEL_MAX];//Top layber fb always be 0
|
||||
bool m_is_active;
|
||||
Z_ORDER_LEVEL m_max_zorder;
|
||||
Z_ORDER_LEVEL m_top_zorder;
|
||||
void* m_phy_fb;
|
||||
int* m_phy_write_index;
|
||||
c_display* m_display;
|
||||
};
|
||||
class c_surface_no_fb : public c_surface {//No physical framebuffer, memory fb is 32 bits
|
||||
friend class c_display;
|
||||
|
@ -323,25 +298,23 @@ class c_surface;
|
|||
class c_display {
|
||||
friend class c_surface;
|
||||
public:
|
||||
c_display(void* phy_fb, unsigned int display_width, unsigned int display_height,
|
||||
unsigned int surface_width, unsigned int surface_height,
|
||||
unsigned int color_bytes, unsigned int surface_cnt, EXTERNAL_GFX_OP* gfx_op = 0);
|
||||
c_display(void* phy_fb, int display_width, int display_height, int surface_width, int surface_height, unsigned int color_bytes, int surface_cnt, EXTERNAL_GFX_OP* gfx_op = 0);
|
||||
c_surface* alloc_surface(Z_ORDER_LEVEL max_zorder);
|
||||
int swipe_surface(c_surface* s0, c_surface* s1, int x0, int x1, int y0, int y2, int offset);
|
||||
unsigned int get_width() { return m_width; }
|
||||
unsigned int get_height() { return m_height; }
|
||||
int get_width() { return m_width; }
|
||||
int get_height() { return m_height; }
|
||||
void* get_updated_fb(int* width, int* height, bool force_update = false);
|
||||
int snap_shot(const char* file_name);
|
||||
private:
|
||||
unsigned int m_width; //in pixels
|
||||
unsigned int m_height; //in pixels
|
||||
unsigned int m_color_bytes; //16 bits, 32 bits only
|
||||
int m_width; //in pixels
|
||||
int m_height; //in pixels
|
||||
int m_color_bytes; //16 bits, 32 bits only
|
||||
void* m_phy_fb;
|
||||
int m_phy_read_index;
|
||||
int m_phy_write_index;
|
||||
c_surface* m_surface_group[SURFACE_CNT_MAX];
|
||||
unsigned int m_surface_cnt;
|
||||
unsigned int m_surface_index;
|
||||
int m_surface_cnt;
|
||||
int m_surface_index;
|
||||
};
|
||||
#endif
|
||||
#ifndef GUILITE_CORE_INCLUDE_WORD_H
|
||||
|
@ -432,13 +405,13 @@ public:
|
|||
virtual void on_init_children() {}
|
||||
virtual void on_paint() {}
|
||||
virtual void show_window();
|
||||
unsigned short get_id() const { return m_resource_id; }
|
||||
unsigned short get_id() const { return m_id; }
|
||||
int get_z_order() { return m_z_order; }
|
||||
c_wnd* get_wnd_ptr(unsigned short id) const;
|
||||
unsigned int get_attr() const { return m_attr; }
|
||||
void set_attr(WND_ATTRIBUTION attr);
|
||||
void set_str(const char* str) { m_str = str; }
|
||||
int is_focus_wnd() const;
|
||||
bool is_focus_wnd() const;
|
||||
void set_font_color(unsigned int color) { m_font_color = color; }
|
||||
unsigned int get_font_color() { return m_font_color; }
|
||||
void set_bg_color(unsigned int color) { m_bg_color = color; }
|
||||
|
@ -454,7 +427,7 @@ public:
|
|||
int unlink_child(c_wnd *child);
|
||||
c_wnd* get_prev_sibling() const { return m_prev_sibling; }
|
||||
c_wnd* get_next_sibling() const { return m_next_sibling; }
|
||||
void notify_parent(unsigned int msg_id, int param);
|
||||
void notify_parent(int msg_id, int param);
|
||||
virtual bool on_touch(int x, int y, TOUCH_ACTION action);// return true: handled; false: not be handled.
|
||||
virtual bool on_key(KEY_TYPE key);// return false: skip handling by parent;
|
||||
c_surface* get_surface() { return m_surface; }
|
||||
|
@ -481,7 +454,7 @@ protected:
|
|||
const FONT_INFO* m_font_type;
|
||||
unsigned int m_font_color;
|
||||
unsigned int m_bg_color;
|
||||
unsigned short m_resource_id;
|
||||
unsigned short m_id;
|
||||
int m_z_order;
|
||||
c_wnd* m_focus_child;//current focused wnd
|
||||
c_surface* m_surface;
|
||||
|
@ -509,8 +482,8 @@ private:
|
|||
#ifndef GUILITE_WIDGETS_INCLUDE_BUTTON_H
|
||||
#define GUILITE_WIDGETS_INCLUDE_BUTTON_H
|
||||
#define GL_BN_CLICKED 0x1111
|
||||
#define ON_GL_BN_CLICKED(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_BN_CLICKED, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
#define ON_GL_BN_CLICKED(func) \
|
||||
{MSG_TYPE_WND, GL_BN_CLICKED, 0, msgCallback(&func)},
|
||||
typedef struct struct_bitmap_info BITMAP_INFO;
|
||||
class c_button : public c_wnd
|
||||
{
|
||||
|
@ -552,8 +525,8 @@ private:
|
|||
#ifndef GUILITE_WIDGETS_INCLUDE_KEYBOARD_H
|
||||
#define GUILITE_WIDGETS_INCLUDE_KEYBOARD_H
|
||||
#define KEYBORAD_CLICK 0x5014
|
||||
#define ON_KEYBORAD_UPDATE(ctrlId, func) \
|
||||
{MSG_TYPE_WND, KEYBORAD_CLICK, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, long)>(&func))},
|
||||
#define ON_KEYBORAD_UPDATE(func) \
|
||||
{MSG_TYPE_WND, KEYBORAD_CLICK, 0, msgCallback(&func)},
|
||||
typedef enum
|
||||
{
|
||||
STATUS_UPPERCASE,
|
||||
|
@ -580,11 +553,12 @@ protected:
|
|||
virtual void pre_create_wnd();
|
||||
virtual c_wnd* clone(){return new c_keyboard();}
|
||||
virtual void on_paint();
|
||||
void on_char_clicked(unsigned int ctrl_id);
|
||||
void on_del_clicked(unsigned int ctrl_id);
|
||||
void on_caps_clicked(unsigned int ctrl_id);
|
||||
void on_enter_clicked(unsigned int ctrl_id);
|
||||
void on_esc_clicked(unsigned int ctrl_id);
|
||||
void on_key_clicked(int id, int param);
|
||||
void on_char_clicked(int id, int param);
|
||||
void on_del_clicked(int id, int param);
|
||||
void on_caps_clicked(int id, int param);
|
||||
void on_enter_clicked(int id, int param);
|
||||
void on_esc_clicked(int id, int param);
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
char m_str[32];
|
||||
|
@ -617,7 +591,7 @@ protected:
|
|||
virtual void on_kill_focus();
|
||||
virtual bool on_touch(int x, int y, TOUCH_ACTION action);
|
||||
|
||||
void on_key_board_click(unsigned int ctrl_id, long param);
|
||||
void on_key_board_click(int id, int param);
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void show_keyboard();
|
||||
|
@ -670,8 +644,8 @@ private:
|
|||
#define GUILITE_WIDGETS_INCLUDE_LIST_BOX_H
|
||||
#define MAX_ITEM_NUM 4
|
||||
#define GL_LIST_CONFIRM 0x1
|
||||
#define ON_LIST_CONFIRM(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_LIST_CONFIRM, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, int)>(&func))},
|
||||
#define ON_LIST_CONFIRM(func) \
|
||||
{MSG_TYPE_WND, GL_LIST_CONFIRM, 0, msgCallback(&func)},
|
||||
class c_list_box : public c_wnd
|
||||
{
|
||||
public:
|
||||
|
@ -731,10 +705,10 @@ protected:
|
|||
#define GUILITE_WIDGETS_INCLUDE_SPINBOX_H
|
||||
#define GL_SPIN_CONFIRM 0x2222
|
||||
#define GL_SPIN_CHANGE 0x3333
|
||||
#define ON_SPIN_CONFIRM(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CONFIRM, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, int)>(&func))},
|
||||
#define ON_SPIN_CHANGE(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CHANGE, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, int)>(&func))},
|
||||
#define ON_SPIN_CONFIRM(func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CONFIRM, 0, msgCallback(&func)},
|
||||
#define ON_SPIN_CHANGE(func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CHANGE, 0, msgCallback(&func)},
|
||||
class c_spin_box : public c_wnd
|
||||
{
|
||||
public:
|
||||
|
@ -755,8 +729,9 @@ protected:
|
|||
virtual void on_kill_focus();
|
||||
virtual void pre_create_wnd();
|
||||
virtual bool on_touch(int x, int y, TOUCH_ACTION action);
|
||||
void on_arrow_up_bt_click(unsigned int ctr_id);
|
||||
void on_arrow_down_bt_click(unsigned int ctr_id);
|
||||
void on_arrow_bt_click(int ctr_id, int param);
|
||||
void on_arrow_up_bt_click(int ctr_id, int param);
|
||||
void on_arrow_down_bt_click(int ctr_id, int param);
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void show_arrow_button();
|
||||
|
|
|
@ -205,7 +205,7 @@ void register_timer(int milli_second,void func(void* ptmr, void* parg))
|
|||
|
||||
long get_time_in_second()
|
||||
{
|
||||
return time(0);
|
||||
return (long)time(0);
|
||||
}
|
||||
|
||||
T_TIME get_time()
|
||||
|
|
|
@ -7,26 +7,16 @@ unsigned short c_cmd_target::ms_user_map_size;
|
|||
GL_BEGIN_MESSAGE_MAP(c_cmd_target)
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
c_cmd_target::c_cmd_target()
|
||||
{
|
||||
}
|
||||
|
||||
c_cmd_target::~c_cmd_target()
|
||||
{
|
||||
}
|
||||
|
||||
int c_cmd_target::handle_usr_msg(unsigned int msgId, unsigned int wParam, unsigned int lParam)
|
||||
int c_cmd_target::handle_usr_msg(int msgId, int resource_id, int param)
|
||||
{
|
||||
int i;
|
||||
c_cmd_target* p_wnd = 0;
|
||||
MSGFUNCS msg_funcs;
|
||||
for (i = 0; i < ms_user_map_size; i++)
|
||||
{
|
||||
if (msgId == ms_usr_map_entries[i].msgId)
|
||||
{
|
||||
p_wnd = (c_cmd_target*)ms_usr_map_entries[i].pObject;
|
||||
msg_funcs.func = ms_usr_map_entries[i].func;
|
||||
(p_wnd->*msg_funcs.func_vwl)(wParam , lParam);
|
||||
p_wnd = (c_cmd_target*)ms_usr_map_entries[i].object;
|
||||
(p_wnd->*ms_usr_map_entries[i].callBack)(resource_id, param);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -34,7 +24,7 @@ int c_cmd_target::handle_usr_msg(unsigned int msgId, unsigned int wParam, unsign
|
|||
|
||||
void c_cmd_target::load_cmd_msg()
|
||||
{
|
||||
const GL_MSG_ENTRY* p_entry = GetMSgEntries();
|
||||
const GL_MSG_ENTRY* p_entry = get_msg_entries();
|
||||
if (0 == p_entry)
|
||||
{
|
||||
return;
|
||||
|
@ -54,7 +44,7 @@ void c_cmd_target::load_cmd_msg()
|
|||
{
|
||||
//repeat register, return.
|
||||
if (p_entry->msgId == ms_usr_map_entries[i].msgId
|
||||
&& ms_usr_map_entries[i].pObject == this)
|
||||
&& ms_usr_map_entries[i].object == this)
|
||||
{
|
||||
bExist = true;
|
||||
break;
|
||||
|
@ -69,7 +59,7 @@ void c_cmd_target::load_cmd_msg()
|
|||
if (MSG_TYPE_USR == p_entry->msgType)
|
||||
{
|
||||
ms_usr_map_entries[ms_user_map_size] = *p_entry;
|
||||
ms_usr_map_entries[ms_user_map_size].pObject = this;
|
||||
ms_usr_map_entries[ms_user_map_size].object = this;
|
||||
ms_user_map_size++;
|
||||
if (USR_MSG_MAX == ms_user_map_size)
|
||||
{
|
||||
|
@ -85,17 +75,16 @@ void c_cmd_target::load_cmd_msg()
|
|||
}
|
||||
}
|
||||
|
||||
const GL_MSG_ENTRY* c_cmd_target::FindMsgEntry(const GL_MSG_ENTRY *pEntry,
|
||||
unsigned int msgType, unsigned short msgId, unsigned short ctrlId)
|
||||
const GL_MSG_ENTRY* c_cmd_target::find_msg_entry(const GL_MSG_ENTRY *pEntry, int msgType, int msgId)
|
||||
{
|
||||
if ( MSG_TYPE_INVALID == msgType)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (MSG_CALLBACK_NULL != pEntry->callbackType)
|
||||
while (MSG_TYPE_INVALID != pEntry->msgType)
|
||||
{
|
||||
if ( (msgType == pEntry->msgType) && (msgId == pEntry->msgId) && (void*)(unsigned long)ctrlId == pEntry->pObject)
|
||||
if ( (msgType == pEntry->msgType) && (msgId == pEntry->msgId))
|
||||
{
|
||||
return pEntry;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
c_display::c_display(void* phy_fb, unsigned int display_width, unsigned int display_height,
|
||||
unsigned int surface_width, unsigned int surface_height,
|
||||
unsigned int color_bytes, unsigned int surface_cnt, EXTERNAL_GFX_OP* gfx_op)
|
||||
c_display::c_display(void* phy_fb, int display_width, int display_height, int surface_width, int surface_height, unsigned int color_bytes, int surface_cnt, EXTERNAL_GFX_OP* gfx_op)
|
||||
{
|
||||
if (color_bytes != 2 && color_bytes != 4)
|
||||
{
|
||||
|
@ -148,8 +146,8 @@ int c_display::snap_shot(const char* file_name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
unsigned int width = get_width();
|
||||
unsigned int height = get_height();
|
||||
int width = get_width();
|
||||
int height = get_height();
|
||||
|
||||
//16 bits framebuffer
|
||||
if (m_color_bytes == 2)
|
||||
|
|
|
@ -53,7 +53,7 @@ int c_rect::IsEmpty() const
|
|||
return m_top == m_bottom || m_left == m_right;
|
||||
}
|
||||
|
||||
int c_rect::PtInRect(int x, int y) const
|
||||
bool c_rect::PtInRect(int x, int y) const
|
||||
{
|
||||
return x >= m_left && x <= m_right && y >= m_top && y <= m_bottom;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ void c_surface::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order)
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (z_order > m_max_zorder)
|
||||
if (z_order > (unsigned int)m_max_zorder)
|
||||
{
|
||||
ASSERT(false);
|
||||
return;
|
||||
|
@ -57,7 +57,7 @@ void c_surface::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order)
|
|||
return draw_pixel_on_fb(x, y, rgb);
|
||||
}
|
||||
|
||||
if (z_order > m_top_zorder)
|
||||
if (z_order > (unsigned int)m_top_zorder)
|
||||
{
|
||||
m_top_zorder = (Z_ORDER_LEVEL)z_order;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void c_surface::draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order)
|
|||
}
|
||||
|
||||
bool is_covered = false;
|
||||
for (int tmp_z_order = Z_ORDER_LEVEL_MAX - 1; tmp_z_order > z_order; tmp_z_order--)
|
||||
for (unsigned int tmp_z_order = Z_ORDER_LEVEL_MAX - 1; tmp_z_order > z_order; tmp_z_order--)
|
||||
{
|
||||
if (true == m_frame_layers[tmp_z_order].visible_rect.PtInRect(x, y))
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ int c_surface::set_frame_layer_visible_rect(c_rect& rect, unsigned int z_order)
|
|||
ASSERT(false);
|
||||
return -2;
|
||||
}
|
||||
if (z_order < m_top_zorder)
|
||||
if (z_order < (unsigned int)m_top_zorder)
|
||||
{
|
||||
ASSERT(false);
|
||||
return -3;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "../core_include/wnd.h"
|
||||
|
||||
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_resource_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)
|
||||
{
|
||||
m_attr = (WND_ATTRIBUTION)(ATTR_VISIBLE | ATTR_FOCUS);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ int c_wnd::connect(c_wnd *parent, unsigned short resource_id, const char* str,
|
|||
return -1;
|
||||
}
|
||||
|
||||
m_resource_id = resource_id;
|
||||
m_id = resource_id;
|
||||
set_str(str);
|
||||
m_parent = parent;
|
||||
m_status = STATUS_NORMAL;
|
||||
|
@ -73,7 +73,7 @@ int c_wnd::load_child_wnd(WND_TREE *p_child_tree)
|
|||
WND_TREE* p_cur = p_child_tree;
|
||||
while(p_cur->p_wnd)
|
||||
{
|
||||
if (0 != p_cur->p_wnd->m_resource_id)
|
||||
if (0 != p_cur->p_wnd->m_id)
|
||||
{//This wnd has been used! Do not share!
|
||||
ASSERT(false);
|
||||
return -1;
|
||||
|
@ -99,7 +99,7 @@ c_wnd* c_wnd::connect_clone(c_wnd *parent, unsigned short resource_id, const cha
|
|||
}
|
||||
|
||||
c_wnd* wnd = clone();
|
||||
wnd->m_resource_id = resource_id;
|
||||
wnd->m_id = resource_id;
|
||||
wnd->set_str(str);
|
||||
wnd->m_parent = parent;
|
||||
wnd->m_status = STATUS_NORMAL;
|
||||
|
@ -165,7 +165,7 @@ int c_wnd::load_clone_child_wnd(WND_TREE *p_child_tree)
|
|||
|
||||
void c_wnd::disconnect()
|
||||
{
|
||||
if (0 == m_resource_id)
|
||||
if (0 == m_id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void c_wnd::disconnect()
|
|||
m_parent->unlink_child(this);
|
||||
}
|
||||
m_focus_child = 0;
|
||||
m_resource_id = 0;
|
||||
m_id = 0;
|
||||
}
|
||||
|
||||
c_wnd* c_wnd::get_wnd_ptr(unsigned short id) const
|
||||
|
@ -225,7 +225,7 @@ void c_wnd::set_attr(WND_ATTRIBUTION attr)
|
|||
}
|
||||
}
|
||||
|
||||
int c_wnd::is_focus_wnd() const
|
||||
bool c_wnd::is_focus_wnd() const
|
||||
{
|
||||
if ( (m_attr & ATTR_VISIBLE)
|
||||
&& !(m_attr & ATTR_DISABLED)
|
||||
|
@ -316,7 +316,7 @@ c_wnd* c_wnd::set_child_focus(c_wnd * focus_child)
|
|||
void c_wnd::add_child_2_tail(c_wnd *child)
|
||||
{
|
||||
if( 0 == child )return;
|
||||
if(child == get_wnd_ptr(child->m_resource_id))return;
|
||||
if(child == get_wnd_ptr(child->m_id))return;
|
||||
|
||||
if ( 0 == m_top_child )
|
||||
{
|
||||
|
@ -367,7 +367,7 @@ int c_wnd::unlink_child(c_wnd *child)
|
|||
return -2;
|
||||
}
|
||||
|
||||
int find = false;
|
||||
bool find = false;
|
||||
|
||||
c_wnd *tmp_child = m_top_child;
|
||||
if (tmp_child == child)
|
||||
|
@ -533,37 +533,16 @@ bool c_wnd::on_key(KEY_TYPE key)
|
|||
return true;
|
||||
}
|
||||
|
||||
void c_wnd::notify_parent(unsigned int msg_id, int param)
|
||||
void c_wnd::notify_parent(int msg_id, int param)
|
||||
{
|
||||
if (!m_parent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const GL_MSG_ENTRY* entry = m_parent->FindMsgEntry(m_parent->GetMSgEntries(), MSG_TYPE_WND, msg_id, m_resource_id);
|
||||
const GL_MSG_ENTRY* entry = m_parent->find_msg_entry(m_parent->get_msg_entries(), MSG_TYPE_WND, msg_id);
|
||||
if (0 == entry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MSGFUNCS msg_funcs;
|
||||
msg_funcs.func = entry->func;
|
||||
|
||||
switch (entry->callbackType)
|
||||
{
|
||||
case MSG_CALLBACK_VV:
|
||||
(m_parent->*msg_funcs.func)();
|
||||
break;
|
||||
case MSG_CALLBACK_VVL:
|
||||
(m_parent->*msg_funcs.func_vvl)(param);
|
||||
break;
|
||||
case MSG_CALLBACK_VWV:
|
||||
(m_parent->*msg_funcs.func_vwv)(m_resource_id);
|
||||
break;
|
||||
case MSG_CALLBACK_VWL:
|
||||
(m_parent->*msg_funcs.func_vwl)(m_resource_id, param);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
}
|
||||
(m_parent->*(entry->callBack))(m_id, param);
|
||||
}
|
||||
|
|
|
@ -8,70 +8,43 @@ class c_cmd_target;
|
|||
#define MSG_TYPE_USR 0x0002
|
||||
#define USR_MSG_MAX 32
|
||||
|
||||
typedef void (c_cmd_target::*MsgFuncVV)();
|
||||
|
||||
enum MSG_CALLBACK_TYPE
|
||||
{
|
||||
MSG_CALLBACK_NULL = 0,
|
||||
MSG_CALLBACK_VV,
|
||||
MSG_CALLBACK_IWL,
|
||||
MSG_CALLBACK_IWV,
|
||||
MSG_CALLBACK_VWV,
|
||||
MSG_CALLBACK_VVL,
|
||||
MSG_CALLBACK_VWL,
|
||||
MSG_CALLBACK_IVV
|
||||
};
|
||||
|
||||
typedef union
|
||||
{
|
||||
void (c_cmd_target::*func)();
|
||||
void (c_cmd_target::*func_vwv)(unsigned int w_param);
|
||||
int (c_cmd_target::*func_iwl)(unsigned int w_param, long l_param);
|
||||
int (c_cmd_target::*func_iwv)(unsigned int w_param);
|
||||
void (c_cmd_target::*func_vvl)(long l_param);
|
||||
void (c_cmd_target::*func_vwl)(unsigned int w_param, long l_param);
|
||||
int (c_cmd_target::*func_ivv)();
|
||||
}MSGFUNCS;
|
||||
typedef void (c_cmd_target::*msgCallback)(int, int);
|
||||
|
||||
struct GL_MSG_ENTRY
|
||||
{
|
||||
unsigned int msgType;
|
||||
unsigned int msgId;
|
||||
c_cmd_target* pObject;
|
||||
MSG_CALLBACK_TYPE callbackType;
|
||||
MsgFuncVV func;
|
||||
c_cmd_target* object;
|
||||
msgCallback callBack;
|
||||
};
|
||||
|
||||
#define ON_GL_USER_MSG(msgId, func) \
|
||||
{MSG_TYPE_USR, msgId, 0, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, unsigned int)>(&func))},
|
||||
{MSG_TYPE_USR, msgId, 0, msgCallback(&func)},
|
||||
|
||||
#define GL_DECLARE_MESSAGE_MAP() \
|
||||
protected: \
|
||||
virtual const GL_MSG_ENTRY* GetMSgEntries() const; \
|
||||
virtual const GL_MSG_ENTRY* get_msg_entries() const;\
|
||||
private: \
|
||||
static const GL_MSG_ENTRY mMsgEntries[];
|
||||
static const GL_MSG_ENTRY m_msg_entries[];
|
||||
|
||||
#define GL_BEGIN_MESSAGE_MAP(theClass) \
|
||||
const GL_MSG_ENTRY* theClass::GetMSgEntries() const \
|
||||
const GL_MSG_ENTRY* theClass::get_msg_entries() const \
|
||||
{ \
|
||||
return theClass::mMsgEntries; \
|
||||
return theClass::m_msg_entries; \
|
||||
} \
|
||||
const GL_MSG_ENTRY theClass::mMsgEntries[] = \
|
||||
const GL_MSG_ENTRY theClass::m_msg_entries[] = \
|
||||
{
|
||||
|
||||
#define GL_END_MESSAGE_MAP() \
|
||||
{MSG_TYPE_INVALID, 0, (c_cmd_target*)0, MSG_CALLBACK_NULL, (MsgFuncVV)0}};
|
||||
{MSG_TYPE_INVALID, 0, 0, 0}};
|
||||
|
||||
class c_cmd_target
|
||||
{
|
||||
public:
|
||||
c_cmd_target();
|
||||
virtual ~c_cmd_target();
|
||||
static int handle_usr_msg(unsigned int msgId, unsigned int wParam, unsigned int lParam);
|
||||
static int handle_usr_msg(int msg_id, int resource_id, int param);
|
||||
protected:
|
||||
void load_cmd_msg();
|
||||
const GL_MSG_ENTRY* FindMsgEntry(const GL_MSG_ENTRY *pEntry,
|
||||
unsigned int msgType, unsigned short msgId, unsigned short ctrlId);
|
||||
const GL_MSG_ENTRY* find_msg_entry(const GL_MSG_ENTRY *pEntry, int msgType, int msgId);
|
||||
private:
|
||||
static GL_MSG_ENTRY ms_usr_map_entries[USR_MSG_MAX];
|
||||
static unsigned short ms_user_map_size;
|
||||
|
|
|
@ -9,25 +9,23 @@ class c_surface;
|
|||
class c_display {
|
||||
friend class c_surface;
|
||||
public:
|
||||
c_display(void* phy_fb, unsigned int display_width, unsigned int display_height,
|
||||
unsigned int surface_width, unsigned int surface_height,
|
||||
unsigned int color_bytes, unsigned int surface_cnt, EXTERNAL_GFX_OP* gfx_op = 0);
|
||||
c_display(void* phy_fb, int display_width, int display_height, int surface_width, int surface_height, unsigned int color_bytes, int surface_cnt, EXTERNAL_GFX_OP* gfx_op = 0);
|
||||
c_surface* alloc_surface(Z_ORDER_LEVEL max_zorder);
|
||||
int swipe_surface(c_surface* s0, c_surface* s1, int x0, int x1, int y0, int y2, int offset);
|
||||
unsigned int get_width() { return m_width; }
|
||||
unsigned int get_height() { return m_height; }
|
||||
int get_width() { return m_width; }
|
||||
int get_height() { return m_height; }
|
||||
|
||||
void* get_updated_fb(int* width, int* height, bool force_update = false);
|
||||
int snap_shot(const char* file_name);
|
||||
private:
|
||||
unsigned int m_width; //in pixels
|
||||
unsigned int m_height; //in pixels
|
||||
unsigned int m_color_bytes; //16 bits, 32 bits only
|
||||
int m_width; //in pixels
|
||||
int m_height; //in pixels
|
||||
int m_color_bytes; //16 bits, 32 bits only
|
||||
void* m_phy_fb;
|
||||
int m_phy_read_index;
|
||||
int m_phy_write_index;
|
||||
c_surface* m_surface_group[SURFACE_CNT_MAX];
|
||||
unsigned int m_surface_cnt;
|
||||
unsigned int m_surface_index;
|
||||
int m_surface_cnt;
|
||||
int m_surface_index;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
void Empty();
|
||||
void Offset(int x, int y);
|
||||
int IsEmpty() const ;
|
||||
int PtInRect(int x, int y) const ;
|
||||
bool PtInRect(int x, int y) const ;
|
||||
int operator==(const c_rect& ) const;
|
||||
c_rect operator&(const c_rect& aRect) const;
|
||||
int Width() const {return m_right - m_left + 1;}
|
||||
|
|
|
@ -59,17 +59,17 @@ protected:
|
|||
virtual void draw_pixel_on_fb(int x, int y, unsigned int rgb);
|
||||
void set_surface(Z_ORDER_LEVEL max_z_order);
|
||||
c_surface(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes);
|
||||
int m_width; //in pixels
|
||||
int m_height; //in pixels
|
||||
int m_color_bytes; //16 bits, 32 bits only
|
||||
void* m_fb; //Top frame buffer you could see
|
||||
c_frame_layer m_frame_layers[Z_ORDER_LEVEL_MAX];//Top layber fb always be 0
|
||||
bool m_is_active;
|
||||
Z_ORDER_LEVEL m_max_zorder;
|
||||
Z_ORDER_LEVEL m_top_zorder;
|
||||
void* m_phy_fb;
|
||||
int* m_phy_write_index;
|
||||
c_display* m_display;
|
||||
int m_width; //in pixels
|
||||
int m_height; //in pixels
|
||||
int m_color_bytes; //16 bits, 32 bits only
|
||||
void* m_fb; //Top frame buffer you could see
|
||||
c_frame_layer m_frame_layers[Z_ORDER_LEVEL_MAX];//Top layber fb always be 0
|
||||
bool m_is_active;
|
||||
Z_ORDER_LEVEL m_max_zorder;
|
||||
Z_ORDER_LEVEL m_top_zorder;
|
||||
void* m_phy_fb;
|
||||
int* m_phy_write_index;
|
||||
c_display* m_display;
|
||||
};
|
||||
|
||||
class c_surface_no_fb : public c_surface {//No physical framebuffer, memory fb is 32 bits
|
||||
|
|
|
@ -64,14 +64,14 @@ public:
|
|||
virtual void on_paint() {}
|
||||
virtual void show_window();
|
||||
|
||||
unsigned short get_id() const { return m_resource_id; }
|
||||
unsigned short get_id() const { return m_id; }
|
||||
int get_z_order() { return m_z_order; }
|
||||
c_wnd* get_wnd_ptr(unsigned short id) const;
|
||||
unsigned int get_attr() const { return m_attr; }
|
||||
void set_attr(WND_ATTRIBUTION attr);
|
||||
|
||||
void set_str(const char* str) { m_str = str; }
|
||||
int is_focus_wnd() const;
|
||||
bool is_focus_wnd() const;
|
||||
|
||||
void set_font_color(unsigned int color) { m_font_color = color; }
|
||||
unsigned int get_font_color() { return m_font_color; }
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
c_wnd* get_prev_sibling() const { return m_prev_sibling; }
|
||||
c_wnd* get_next_sibling() const { return m_next_sibling; }
|
||||
|
||||
void notify_parent(unsigned int msg_id, int param);
|
||||
void notify_parent(int msg_id, int param);
|
||||
|
||||
virtual bool on_touch(int x, int y, TOUCH_ACTION action);// return true: handled; false: not be handled.
|
||||
virtual bool on_key(KEY_TYPE key);// return false: skip handling by parent;
|
||||
|
@ -126,7 +126,7 @@ protected:
|
|||
unsigned int m_font_color;
|
||||
unsigned int m_bg_color;
|
||||
|
||||
unsigned short m_resource_id;
|
||||
unsigned short m_id;
|
||||
|
||||
int m_z_order;
|
||||
c_wnd* m_focus_child;//current focused wnd
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#define IDD_KEY_BOARD 0x1
|
||||
|
||||
GL_BEGIN_MESSAGE_MAP(c_edit)
|
||||
ON_KEYBORAD_UPDATE(IDD_KEY_BOARD, c_edit::on_key_board_click)
|
||||
ON_KEYBORAD_UPDATE(c_edit::on_key_board_click)
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
static c_keyboard s_keyboard;
|
||||
|
@ -167,7 +167,7 @@ void c_edit::show_keyboard()
|
|||
s_keyboard.show_window();
|
||||
}
|
||||
|
||||
void c_edit::on_key_board_click(unsigned int ctrl_id, long param)
|
||||
void c_edit::on_key_board_click(int id, int param)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
|
|
|
@ -101,49 +101,7 @@ WND_TREE g_number_board_children[] =
|
|||
};
|
||||
|
||||
GL_BEGIN_MESSAGE_MAP(c_keyboard)
|
||||
ON_GL_BN_CLICKED('A', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('B', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('C', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('D', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('E', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('F', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('G', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('H', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('I', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('J', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('K', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('L', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('M', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('N', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('O', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('P', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('Q', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('R', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('S', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('T', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('U', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('V', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('W', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('X', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('Y', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('Z', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('0', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('1', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('2', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('3', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('4', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('5', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('6', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('7', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('8', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('9', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED(' ', c_keyboard::on_char_clicked)
|
||||
ON_GL_BN_CLICKED('.', c_keyboard::on_char_clicked)
|
||||
|
||||
ON_GL_BN_CLICKED(0x7F, c_keyboard::on_del_clicked)
|
||||
ON_GL_BN_CLICKED(0x14, c_keyboard::on_caps_clicked)
|
||||
ON_GL_BN_CLICKED('\n', c_keyboard::on_enter_clicked)
|
||||
ON_GL_BN_CLICKED(0x1B, c_keyboard::on_esc_clicked)
|
||||
ON_GL_BN_CLICKED(c_keyboard::on_key_clicked)
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
int c_keyboard::connect(c_wnd *user, unsigned short resource_id, KEYBOARD_STYLE style)
|
||||
|
@ -175,25 +133,47 @@ void c_keyboard::pre_create_wnd()
|
|||
m_str_len = 0;
|
||||
}
|
||||
|
||||
void c_keyboard::on_caps_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_key_clicked(int id, int param)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0x14:
|
||||
on_caps_clicked(id, param);
|
||||
break;
|
||||
case '\n':
|
||||
on_enter_clicked(id, param);
|
||||
break;
|
||||
case 0x1B:
|
||||
on_esc_clicked(id, param);
|
||||
break;
|
||||
case 0x7F:
|
||||
on_del_clicked(id, param);
|
||||
break;
|
||||
default:
|
||||
on_char_clicked(id, param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void c_keyboard::on_caps_clicked(int id, int parm)
|
||||
{
|
||||
m_cap_status = (m_cap_status == STATUS_LOWERCASE) ? STATUS_UPPERCASE : STATUS_LOWERCASE;
|
||||
show_window();
|
||||
}
|
||||
|
||||
void c_keyboard::on_enter_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_enter_clicked(int id, int param)
|
||||
{
|
||||
memset(m_str, 0, sizeof(m_str));
|
||||
notify_parent(KEYBORAD_CLICK, CLICK_ENTER);
|
||||
return notify_parent(KEYBORAD_CLICK, CLICK_ENTER);
|
||||
}
|
||||
|
||||
void c_keyboard::on_esc_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_esc_clicked(int id, int param)
|
||||
{
|
||||
memset(m_str, 0, sizeof(m_str));
|
||||
notify_parent(KEYBORAD_CLICK, CLICK_ESC);
|
||||
}
|
||||
|
||||
void c_keyboard::on_del_clicked(unsigned int ctrl_id)
|
||||
void c_keyboard::on_del_clicked(int id, int param)
|
||||
{
|
||||
if (m_str_len <= 0)
|
||||
{
|
||||
|
@ -203,28 +183,28 @@ void c_keyboard::on_del_clicked(unsigned int ctrl_id)
|
|||
notify_parent(KEYBORAD_CLICK, CLICK_CHAR);
|
||||
}
|
||||
|
||||
void c_keyboard::on_char_clicked(unsigned int ctrl_id)
|
||||
{//ctrl_id = char ascii code.
|
||||
void c_keyboard::on_char_clicked(int id, int param)
|
||||
{//id = char ascii code.
|
||||
if (m_str_len >= sizeof(m_str))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((ctrl_id >= '0' && ctrl_id <= '9') || ctrl_id == ' ' || ctrl_id == '.')
|
||||
if ((id >= '0' && id <= '9') || id == ' ' || id == '.')
|
||||
{
|
||||
goto InputChar;
|
||||
}
|
||||
|
||||
if (ctrl_id >= 'A' && ctrl_id <= 'Z')
|
||||
if (id >= 'A' && id <= 'Z')
|
||||
{
|
||||
if (STATUS_LOWERCASE == m_cap_status)
|
||||
{
|
||||
ctrl_id += 0x20;
|
||||
id += 0x20;
|
||||
}
|
||||
goto InputChar;
|
||||
}
|
||||
ASSERT(false);
|
||||
InputChar:
|
||||
m_str[m_str_len++] = ctrl_id;
|
||||
m_str[m_str_len++] = id;
|
||||
notify_parent(KEYBORAD_CLICK, CLICK_CHAR);
|
||||
}
|
||||
|
||||
|
@ -256,43 +236,43 @@ void c_keyboard_button::on_paint()
|
|||
break;
|
||||
}
|
||||
|
||||
if (m_resource_id == 0x14)
|
||||
if (m_id == 0x14)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Caps", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == 0x1B)
|
||||
else if (m_id == 0x1B)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Esc", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == ' ')
|
||||
else if (m_id == ' ')
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Space", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == '\n')
|
||||
else if (m_id == '\n')
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Enter", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == '.')
|
||||
else if (m_id == '.')
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, ".", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == 0x7F)
|
||||
else if (m_id == 0x7F)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "Back", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
else if (m_resource_id == 0x90)
|
||||
else if (m_id == 0x90)
|
||||
{
|
||||
return c_word::draw_string_in_rect(m_surface, m_z_order, "?123", rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
|
||||
char letter[] = { 0, 0 };
|
||||
if (m_resource_id >= 'A' && m_resource_id <= 'Z')
|
||||
if (m_id >= 'A' && m_id <= 'Z')
|
||||
{
|
||||
letter[0] = (((c_keyboard*)m_parent)->get_cap_status() == STATUS_UPPERCASE) ? m_resource_id : (m_resource_id + 0x20);
|
||||
letter[0] = (((c_keyboard*)m_parent)->get_cap_status() == STATUS_UPPERCASE) ? m_id : (m_id + 0x20);
|
||||
}
|
||||
else if (m_resource_id >= '0' && m_resource_id <= '9')
|
||||
else if (m_id >= '0' && m_id <= '9')
|
||||
{
|
||||
letter[0] = m_resource_id;
|
||||
letter[0] = (char)m_id;
|
||||
}
|
||||
c_word::draw_string_in_rect(m_surface, m_z_order, letter, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_attr);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
#define ID_BT_ARROW_DOWN 2
|
||||
|
||||
GL_BEGIN_MESSAGE_MAP(c_spin_box)
|
||||
ON_GL_BN_CLICKED(ID_BT_ARROW_UP, c_spin_box::on_arrow_up_bt_click)
|
||||
ON_GL_BN_CLICKED(ID_BT_ARROW_DOWN, c_spin_box::on_arrow_down_bt_click)
|
||||
ON_GL_BN_CLICKED(c_spin_box::on_arrow_bt_click)
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
void c_spin_box::pre_create_wnd()
|
||||
|
@ -161,7 +160,23 @@ void c_spin_box::on_paint()
|
|||
}
|
||||
}
|
||||
|
||||
void c_spin_box::on_arrow_up_bt_click(unsigned int ctr_id)
|
||||
void c_spin_box::on_arrow_bt_click(int ctr_id, int param)
|
||||
{
|
||||
switch (ctr_id)
|
||||
{
|
||||
case ID_BT_ARROW_UP:
|
||||
on_arrow_up_bt_click(ctr_id, param);
|
||||
break;
|
||||
case ID_BT_ARROW_DOWN:
|
||||
on_arrow_down_bt_click(ctr_id, param);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void c_spin_box::on_arrow_up_bt_click(int ctr_id, int param)
|
||||
{
|
||||
if (m_cur_value + m_step > m_max)
|
||||
{
|
||||
|
@ -172,7 +187,7 @@ void c_spin_box::on_arrow_up_bt_click(unsigned int ctr_id)
|
|||
on_paint();
|
||||
}
|
||||
|
||||
void c_spin_box::on_arrow_down_bt_click(unsigned int ctr_id)
|
||||
void c_spin_box::on_arrow_down_bt_click(int ctr_id, int param)
|
||||
{
|
||||
if (m_cur_value - m_step < m_min)
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define GUILITE_WIDGETS_INCLUDE_BUTTON_H
|
||||
|
||||
#define GL_BN_CLICKED 0x1111
|
||||
#define ON_GL_BN_CLICKED(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_BN_CLICKED, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
#define ON_GL_BN_CLICKED(func) \
|
||||
{MSG_TYPE_WND, GL_BN_CLICKED, 0, msgCallback(&func)},
|
||||
|
||||
typedef struct struct_bitmap_info BITMAP_INFO;
|
||||
class c_button : public c_wnd
|
||||
|
|
|
@ -19,7 +19,7 @@ protected:
|
|||
virtual void on_kill_focus();
|
||||
virtual bool on_touch(int x, int y, TOUCH_ACTION action);
|
||||
|
||||
void on_key_board_click(unsigned int ctrl_id, long param);
|
||||
void on_key_board_click(int id, int param);
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void show_keyboard();
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define GUILITE_WIDGETS_INCLUDE_KEYBOARD_H
|
||||
|
||||
#define KEYBORAD_CLICK 0x5014
|
||||
#define ON_KEYBORAD_UPDATE(ctrlId, func) \
|
||||
{MSG_TYPE_WND, KEYBORAD_CLICK, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, long)>(&func))},
|
||||
#define ON_KEYBORAD_UPDATE(func) \
|
||||
{MSG_TYPE_WND, KEYBORAD_CLICK, 0, msgCallback(&func)},
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -35,11 +35,12 @@ protected:
|
|||
virtual c_wnd* clone(){return new c_keyboard();}
|
||||
virtual void on_paint();
|
||||
|
||||
void on_char_clicked(unsigned int ctrl_id);
|
||||
void on_del_clicked(unsigned int ctrl_id);
|
||||
void on_caps_clicked(unsigned int ctrl_id);
|
||||
void on_enter_clicked(unsigned int ctrl_id);
|
||||
void on_esc_clicked(unsigned int ctrl_id);
|
||||
void on_key_clicked(int id, int param);
|
||||
void on_char_clicked(int id, int param);
|
||||
void on_del_clicked(int id, int param);
|
||||
void on_caps_clicked(int id, int param);
|
||||
void on_enter_clicked(int id, int param);
|
||||
void on_esc_clicked(int id, int param);
|
||||
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#define MAX_ITEM_NUM 4
|
||||
#define GL_LIST_CONFIRM 0x1
|
||||
|
||||
#define ON_LIST_CONFIRM(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_LIST_CONFIRM, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, int)>(&func))},
|
||||
#define ON_LIST_CONFIRM(func) \
|
||||
{MSG_TYPE_WND, GL_LIST_CONFIRM, 0, msgCallback(&func)},
|
||||
|
||||
class c_list_box : public c_wnd
|
||||
{
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#define GL_SPIN_CONFIRM 0x2222
|
||||
#define GL_SPIN_CHANGE 0x3333
|
||||
|
||||
#define ON_SPIN_CONFIRM(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CONFIRM, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, int)>(&func))},
|
||||
#define ON_SPIN_CONFIRM(func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CONFIRM, 0, msgCallback(&func)},
|
||||
|
||||
#define ON_SPIN_CHANGE(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CHANGE, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int, int)>(&func))},
|
||||
#define ON_SPIN_CHANGE(func) \
|
||||
{MSG_TYPE_WND, GL_SPIN_CHANGE, 0, msgCallback(&func)},
|
||||
|
||||
class c_spin_box : public c_wnd
|
||||
{
|
||||
|
@ -34,8 +34,9 @@ protected:
|
|||
virtual void pre_create_wnd();
|
||||
virtual bool on_touch(int x, int y, TOUCH_ACTION action);
|
||||
|
||||
void on_arrow_up_bt_click(unsigned int ctr_id);
|
||||
void on_arrow_down_bt_click(unsigned int ctr_id);
|
||||
void on_arrow_bt_click(int ctr_id, int param);
|
||||
void on_arrow_up_bt_click(int ctr_id, int param);
|
||||
void on_arrow_down_bt_click(int ctr_id, int param);
|
||||
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
|
Loading…
Reference in New Issue