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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user