mirror of
https://gitee.com/idea4good/GuiLite.git
synced 2026-01-02 04:17:19 +08:00
fix warnings, simplify cmd_target
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user