mirror of
https://gitee.com/idea4good/GuiLite.git
synced 2025-01-15 17:02:52 +08:00
refactor wnd, display;rename macros
This commit is contained in:
parent
11e3b6e494
commit
e09fe24e14
34
README.md
34
README.md
@ -1,18 +1,14 @@
|
||||
# GuiLite - 简洁出奇迹
|
||||
- GuiLite(超轻量UI框架)是6千行代码的**全平台UI框架**,可以完美运行在iOS,Android,Windows(包含VR),Mac,单片机和**市面所有的 ARM Linux物联网终端设备**上。
|
||||
- GuiLite(超轻量UI框架)是5千行代码的**全平台UI框架**,可以完美运行在iOS,Android,Windows(包含VR),Mac,单片机和**市面所有的 ARM Linux物联网终端设备**上。
|
||||
- GuiLite可以嵌入在iOS、Android、MFC、QT等其他UI系统中,让你的界面集百家之长,又不失个性。
|
||||
- GuiLite鼓励混合编程,开发者可以用GuiLite接管UI部分,用Swift,Java,Go,C#,Python发开业务部分。
|
||||
|
||||
相比QT、MFC,GuiLite不预设开发者的使用场景,不在具体功能上,大包大揽;用框架的简洁,换取开发的自由;GuiLite在图形绘制上面,力图一步到位,运行效率感人。
|
||||
|
||||
## 新功能:万国语和墙纸
|
||||
墙纸:
|
||||
![unicode](doc/wallpaper.jpg)
|
||||
## 新功能:入门demo -- HelloGuiLite
|
||||
![HelloGuiLite](doc/HelloGuiLite.gif)
|
||||
|
||||
万国语(unicode):
|
||||
![unicode](doc/unicode.jpg)
|
||||
|
||||
[如何制作多种文字/位图资源?](https://github.com/idea4good/GuiLiteToolkit)
|
||||
**信不信由你,代码只有100+行!**[查阅代码](https://github.com/idea4good/GuiLiteSamples/blob/master/HelloGuiLite/UIcode/helloGL.cpp)
|
||||
|
||||
## 卓越的跨平台能力
|
||||
在Mac, iOS下的运行效果:
|
||||
@ -23,9 +19,18 @@
|
||||
|
||||
![Android](doc/Android.gif) ![Linux](doc/Linux.gif)
|
||||
|
||||
在Windows混合现实下的运行效果及开发者QQ群:
|
||||
在Windows混合现实下的运行效果:
|
||||
|
||||
![Win MR](doc/WinMR.gif) ![QQ group: 527251257](doc/qq.group.jpg)
|
||||
![Win MR](doc/WinMR.gif)
|
||||
|
||||
## 万国语和墙纸
|
||||
墙纸:
|
||||
![unicode](doc/wallpaper.jpg)
|
||||
|
||||
万国语(unicode):
|
||||
![unicode](doc/unicode.jpg)
|
||||
|
||||
[如何制作多种文字/位图资源?](https://github.com/idea4good/GuiLiteToolkit)
|
||||
|
||||
## “换肤”功能
|
||||
![multi-theme](doc/multi-theme.png)
|
||||
@ -65,9 +70,16 @@
|
||||
## 视频链接:
|
||||
[GuiLite简介](https://v.youku.com/v_show/id_XMzA5NTMzMTYyOA)
|
||||
|
||||
[GuiLite办公室](https://v.youku.com/v_show/id_XMzYxNTE3MTI0MA)
|
||||
[3D GuiLite](https://v.youku.com/v_show/id_XMzYxNTE3MTI0MA)
|
||||
|
||||
## 实例代码链接
|
||||
[GuiLiteSamples](https://gitee.com/idea4good/GuiLiteSamples)
|
||||
|
||||
## GitHub链接
|
||||
[GitHub链接](https://github.com/idea4good/GuiLite)
|
||||
|
||||
## 致谢
|
||||
### 感谢开发者群的所有同学,是你们塑造了今天的GuiLite!也欢迎新的大神/小白加入我们。
|
||||
![QQ group: 527251257](qq.group.jpg)
|
||||
### 感谢来自码云用户的捐赠,您的每一分钱都会用来帮助急需帮助的中国儿童或家庭。
|
||||
|
||||
|
@ -4,8 +4,6 @@ PROJECT(Core)
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/..)
|
||||
|
||||
ADD_DEFINITIONS(-fpermissive)
|
||||
|
||||
INCLUDE_DIRECTORIES(core_include)
|
||||
|
||||
FILE(GLOB MAIN src/*.cpp)
|
||||
|
@ -33,7 +33,7 @@ typedef union
|
||||
int (c_cmd_target::*func_ivv)();
|
||||
}MSGFUNCS;
|
||||
|
||||
struct GLT_MSG_ENTRY
|
||||
struct GL_MSG_ENTRY
|
||||
{
|
||||
unsigned int msgType;
|
||||
unsigned int msgId;
|
||||
@ -42,24 +42,24 @@ struct GLT_MSG_ENTRY
|
||||
MsgFuncVV func;
|
||||
};
|
||||
|
||||
#define ON_GLT_USER_MSG(msgId, func) \
|
||||
#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))},
|
||||
|
||||
#define GLT_DECLARE_MESSAGE_MAP() \
|
||||
#define GL_DECLARE_MESSAGE_MAP() \
|
||||
protected: \
|
||||
virtual const GLT_MSG_ENTRY* GetMSgEntries() const; \
|
||||
virtual const GL_MSG_ENTRY* GetMSgEntries() const; \
|
||||
private: \
|
||||
static const GLT_MSG_ENTRY mMsgEntries[];
|
||||
static const GL_MSG_ENTRY mMsgEntries[];
|
||||
|
||||
#define GLT_BEGIN_MESSAGE_MAP(theClass) \
|
||||
const GLT_MSG_ENTRY* theClass::GetMSgEntries() const \
|
||||
#define GL_BEGIN_MESSAGE_MAP(theClass) \
|
||||
const GL_MSG_ENTRY* theClass::GetMSgEntries() const \
|
||||
{ \
|
||||
return theClass::mMsgEntries; \
|
||||
} \
|
||||
const GLT_MSG_ENTRY theClass::mMsgEntries[] = \
|
||||
const GL_MSG_ENTRY theClass::mMsgEntries[] = \
|
||||
{
|
||||
|
||||
#define GLT_END_MESSAGE_MAP() \
|
||||
#define GL_END_MESSAGE_MAP() \
|
||||
{MSG_TYPE_INVALID, 0, (c_cmd_target*)0, MSG_CALLBACK_NULL, (MsgFuncVV)0}};
|
||||
|
||||
class c_cmd_target
|
||||
@ -70,12 +70,12 @@ public:
|
||||
static int handle_usr_msg(unsigned int msgId, unsigned int wParam, unsigned int lParam);
|
||||
protected:
|
||||
void load_cmd_msg();
|
||||
const GLT_MSG_ENTRY* FindMsgEntry(const GLT_MSG_ENTRY *pEntry,
|
||||
const GL_MSG_ENTRY* FindMsgEntry(const GL_MSG_ENTRY *pEntry,
|
||||
unsigned int msgType, unsigned short msgId, unsigned short ctrlId);
|
||||
private:
|
||||
static GLT_MSG_ENTRY ms_usr_map_entries[USR_MSG_MAX];
|
||||
static GL_MSG_ENTRY ms_usr_map_entries[USR_MSG_MAX];
|
||||
static unsigned short ms_user_map_size;
|
||||
GLT_DECLARE_MESSAGE_MAP()
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -11,8 +11,8 @@ class c_display {
|
||||
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 slides_cnt);
|
||||
c_surface* create_surface(void* usr, Z_ORDER_LEVEL max_zorder);
|
||||
unsigned int color_bytes, unsigned int surface_cnt);
|
||||
c_surface* alloc_surface(void* usr, Z_ORDER_LEVEL max_zorder);
|
||||
int merge_surface(c_surface* s1, c_surface* s2, int x0, int x1, int y0, int y2, int offset);
|
||||
c_hid_pipe* get_hid_pipe() { return m_hid_pipe; }
|
||||
unsigned int get_width() { return m_width; }
|
||||
|
@ -2,12 +2,9 @@
|
||||
#define _GUI_WND_H_
|
||||
|
||||
//Window attribution
|
||||
#define GLT_WIN_SHOW 0x00000001
|
||||
#define GLT_WIN_HIDE 0x00000002
|
||||
|
||||
#define GLT_ATTR_VISIBLE 0x80000000L
|
||||
#define GLT_ATTR_DISABLED 0x40000000L
|
||||
#define GLT_ATTR_FOCUS 0x20000000L
|
||||
#define GL_ATTR_VISIBLE 0x80000000L
|
||||
#define GL_ATTR_DISABLED 0x40000000L
|
||||
#define GL_ATTR_FOCUS 0x20000000L
|
||||
|
||||
typedef struct struct_font_info FONT_INFO;
|
||||
typedef struct struct_color_rect COLOR_RECT;
|
||||
@ -40,7 +37,7 @@ class c_wnd : public c_cmd_target
|
||||
friend class c_dialog;
|
||||
public:
|
||||
c_wnd();
|
||||
virtual ~c_wnd();
|
||||
virtual ~c_wnd() {};
|
||||
virtual const char* get_class_name() const { return "c_wnd"; }
|
||||
virtual int connect(c_wnd *parent, unsigned short resource_id, char* str,
|
||||
short x, short y, short width, short height, WND_TREE* p_child_tree = NULL);
|
||||
@ -50,7 +47,7 @@ public:
|
||||
virtual c_wnd* clone() = 0;
|
||||
virtual void on_init_children() {}
|
||||
virtual void on_paint() {}
|
||||
void show_window(int show_type = GLT_WIN_SHOW);
|
||||
virtual void show_window();
|
||||
|
||||
unsigned short get_id() const { return m_resource_id; }
|
||||
int get_z_order() { return m_z_order; }
|
||||
@ -59,15 +56,7 @@ public:
|
||||
virtual void modify_style(unsigned int add_style = 0, unsigned int remove_style = 0);
|
||||
|
||||
void set_str(char* str) { m_str = str; }
|
||||
|
||||
bool is_visible() const { return m_is_visible_now; }
|
||||
bool is_foreground();
|
||||
void set_visible(bool visible);
|
||||
virtual void enable_wnd(int enable = TRUE);
|
||||
int is_wnd_enable() const;
|
||||
void enable_focus(int enable = TRUE);
|
||||
int is_focus_wnd() const;
|
||||
const int is_active_wnd() const;
|
||||
|
||||
void set_font_color(unsigned int color) { m_font_color = color; }
|
||||
unsigned int get_font_color() { return m_font_color; }
|
||||
@ -103,8 +92,6 @@ public:
|
||||
void set_surface(c_surface* surface) { m_surface = surface; }
|
||||
protected:
|
||||
virtual void pre_create_wnd();
|
||||
virtual void display_window();
|
||||
void hide_widow();
|
||||
void add_child_2_head(c_wnd *child);
|
||||
void add_child_2_tail(c_wnd *child);
|
||||
|
||||
@ -144,7 +131,6 @@ protected:
|
||||
unsigned int m_font_color;
|
||||
unsigned int m_bg_color;
|
||||
|
||||
bool m_is_visible_now;
|
||||
unsigned short m_resource_id;
|
||||
|
||||
int m_z_order;
|
||||
|
@ -20,7 +20,20 @@ void register_debug_function(void(*my_assert)(const char* file, int line), void(
|
||||
|
||||
void _assert(const char* file, int line)
|
||||
{
|
||||
(do_assert) ? do_assert(file, line) : assert(false);
|
||||
static char s_buf[192];
|
||||
if (do_assert)
|
||||
{
|
||||
do_assert(file, line);
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(s_buf, 0, sizeof(s_buf));
|
||||
sprintf_s(s_buf, sizeof(s_buf), "vvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\nAssert@ file = %s, line = %d\n\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", file, line);
|
||||
OutputDebugStringA(s_buf);
|
||||
printf(s_buf);
|
||||
fflush(stdout);
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
void log_out(const char* log)
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "../core_include/api.h"
|
||||
#include "../core_include/cmd_target.h"
|
||||
|
||||
GLT_MSG_ENTRY c_cmd_target::ms_usr_map_entries[USR_MSG_MAX];
|
||||
GL_MSG_ENTRY c_cmd_target::ms_usr_map_entries[USR_MSG_MAX];
|
||||
unsigned short c_cmd_target::ms_user_map_size;
|
||||
|
||||
GLT_BEGIN_MESSAGE_MAP(c_cmd_target)
|
||||
GLT_END_MESSAGE_MAP()
|
||||
GL_BEGIN_MESSAGE_MAP(c_cmd_target)
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
c_cmd_target::c_cmd_target()
|
||||
{
|
||||
@ -34,7 +34,7 @@ int c_cmd_target::handle_usr_msg(unsigned int msgId, unsigned int wParam, unsign
|
||||
|
||||
void c_cmd_target::load_cmd_msg()
|
||||
{
|
||||
const GLT_MSG_ENTRY* p_entry = GetMSgEntries();
|
||||
const GL_MSG_ENTRY* p_entry = GetMSgEntries();
|
||||
if (0 == p_entry)
|
||||
{
|
||||
return;
|
||||
@ -85,7 +85,7 @@ void c_cmd_target::load_cmd_msg()
|
||||
}
|
||||
}
|
||||
|
||||
const GLT_MSG_ENTRY* c_cmd_target::FindMsgEntry(const GLT_MSG_ENTRY *pEntry,
|
||||
const GL_MSG_ENTRY* c_cmd_target::FindMsgEntry(const GL_MSG_ENTRY *pEntry,
|
||||
unsigned int msgType, unsigned short msgId, unsigned short ctrlId)
|
||||
{
|
||||
if ( MSG_TYPE_INVALID == msgType)
|
||||
|
@ -12,7 +12,7 @@ c_display* c_display::ms_displays[MAX_DISPLAY];
|
||||
|
||||
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 slides_cnt)
|
||||
unsigned int color_bytes, unsigned int surface_cnt)
|
||||
{
|
||||
if (color_bytes != 2 && color_bytes != 4)
|
||||
{
|
||||
@ -34,7 +34,7 @@ c_display::c_display(void* phy_fb, unsigned int display_width, unsigned int disp
|
||||
}
|
||||
}
|
||||
|
||||
m_surface_cnt = slides_cnt + 1;//slides + root
|
||||
m_surface_cnt = surface_cnt;
|
||||
if (m_surface_cnt > SURFACE_CNT_MAX)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
@ -47,7 +47,7 @@ c_display::c_display(void* phy_fb, unsigned int display_width, unsigned int disp
|
||||
}
|
||||
}
|
||||
|
||||
c_surface* c_display::create_surface(void* usr, Z_ORDER_LEVEL max_zorder)
|
||||
c_surface* c_display::alloc_surface(void* usr, Z_ORDER_LEVEL max_zorder)
|
||||
{
|
||||
int i = 0;
|
||||
if (max_zorder >= Z_ORDER_LEVEL_MAX)
|
||||
@ -76,6 +76,7 @@ c_surface* c_display::create_surface(void* usr, Z_ORDER_LEVEL max_zorder)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
//no surface for use
|
||||
ASSERT(FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -243,10 +243,6 @@ void c_wave_ctrl::on_paint()
|
||||
|
||||
void c_wave_ctrl::clear_wave(void)
|
||||
{
|
||||
if (!m_is_visible_now)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fill_rect(m_wave_left, m_wave_top, m_wave_right, m_wave_bottom, m_back_color);
|
||||
m_wave_cursor = m_wave_left;
|
||||
}
|
||||
|
167
core/src/wnd.cpp
167
core/src/wnd.cpp
@ -6,19 +6,15 @@
|
||||
#include "../core_include/surface.h"
|
||||
#include "../core_include/wnd.h"
|
||||
|
||||
c_wnd::c_wnd(): m_status(STATUS_NORMAL), m_style(GLT_ATTR_VISIBLE), m_parent(NULL), m_top_child(NULL), m_prev_sibling(NULL), m_next_sibling(NULL),
|
||||
m_str(0), m_font_color(0), m_bg_color(0), m_is_visible_now(false),m_resource_id(0), m_z_order(Z_ORDER_LEVEL_0), m_active_child(NULL), m_surface(NULL)
|
||||
c_wnd::c_wnd(): m_status(STATUS_NORMAL), m_style(GL_ATTR_VISIBLE), m_parent(NULL), m_top_child(NULL), m_prev_sibling(NULL), m_next_sibling(NULL),
|
||||
m_str(0), m_font_color(0), m_bg_color(0), m_resource_id(0), m_z_order(Z_ORDER_LEVEL_0), m_active_child(NULL), m_surface(NULL)
|
||||
{
|
||||
m_wnd_rect.Empty();
|
||||
}
|
||||
|
||||
c_wnd:: ~c_wnd()
|
||||
{
|
||||
}
|
||||
|
||||
void c_wnd::pre_create_wnd()
|
||||
{
|
||||
m_style = GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS;
|
||||
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS;
|
||||
}
|
||||
|
||||
int c_wnd::connect(c_wnd *parent, unsigned short resource_id, char* str,
|
||||
@ -197,7 +193,6 @@ void c_wnd::disconnect()
|
||||
m_parent->unlink_child(this);
|
||||
}
|
||||
m_active_child = 0;
|
||||
m_is_visible_now = false;
|
||||
m_resource_id = 0;
|
||||
}
|
||||
|
||||
@ -223,7 +218,7 @@ void c_wnd::modify_style(unsigned int add_style, unsigned int remove_style)
|
||||
m_style &= ~remove_style;
|
||||
m_style |= add_style;
|
||||
|
||||
if ( GLT_ATTR_DISABLED == (m_style & GLT_ATTR_DISABLED) )
|
||||
if ( GL_ATTR_DISABLED == (m_style & GL_ATTR_DISABLED) )
|
||||
{
|
||||
m_status = STATUS_DISABLED;
|
||||
}
|
||||
@ -236,92 +231,11 @@ void c_wnd::modify_style(unsigned int add_style, unsigned int remove_style)
|
||||
}
|
||||
}
|
||||
|
||||
bool c_wnd::is_foreground()
|
||||
{
|
||||
return (m_surface->is_active() && m_is_visible_now);
|
||||
}
|
||||
|
||||
void c_wnd::set_visible(bool visible)
|
||||
{
|
||||
m_is_visible_now = visible;
|
||||
|
||||
c_wnd *child = m_top_child;
|
||||
while (child)
|
||||
{
|
||||
child->set_visible(visible);
|
||||
child = child->m_next_sibling;
|
||||
}
|
||||
}
|
||||
|
||||
void c_wnd::enable_wnd(int enable)
|
||||
{
|
||||
int old_enable = is_wnd_enable();
|
||||
|
||||
if ( enable != old_enable )
|
||||
{
|
||||
if ( enable )
|
||||
{
|
||||
m_style &= ~GLT_ATTR_DISABLED;
|
||||
m_status = STATUS_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_style |= GLT_ATTR_DISABLED;
|
||||
m_status = STATUS_DISABLED;
|
||||
}
|
||||
|
||||
if ( 0 != m_top_child )
|
||||
{
|
||||
c_wnd *child = m_top_child;
|
||||
c_wnd *next_child = 0;
|
||||
|
||||
while ( child )
|
||||
{
|
||||
next_child = child->m_next_sibling;
|
||||
|
||||
child->enable_wnd(enable);
|
||||
child = next_child;
|
||||
}
|
||||
}
|
||||
|
||||
if ( true == m_is_visible_now )
|
||||
{
|
||||
on_paint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int c_wnd::is_wnd_enable() const
|
||||
{
|
||||
if ( GLT_ATTR_DISABLED == (m_style & GLT_ATTR_DISABLED) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void c_wnd::enable_focus(int enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
m_style |= GLT_ATTR_FOCUS;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_style &= ~GLT_ATTR_FOCUS;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int c_wnd::is_focus_wnd() const
|
||||
{
|
||||
if ( (m_style & GLT_ATTR_VISIBLE)
|
||||
&& !(m_style & GLT_ATTR_DISABLED)
|
||||
&& (m_style & GLT_ATTR_FOCUS)
|
||||
&& (true == m_is_visible_now))
|
||||
if ( (m_style & GL_ATTR_VISIBLE)
|
||||
&& !(m_style & GL_ATTR_DISABLED)
|
||||
&& (m_style & GL_ATTR_FOCUS))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -331,25 +245,6 @@ int c_wnd::is_focus_wnd() const
|
||||
}
|
||||
}
|
||||
|
||||
const int c_wnd::is_active_wnd() const
|
||||
{
|
||||
if(!m_parent)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( this == m_parent->get_active_child() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void c_wnd::set_wnd_pos(short x, short y, short width, short height)
|
||||
{
|
||||
m_wnd_rect.m_left = x;
|
||||
@ -477,7 +372,7 @@ c_wnd* c_wnd::set_focus(c_wnd * new_active_child)
|
||||
|
||||
int c_wnd::on_notify(unsigned short notify_code, unsigned short ctrl_id, long l_param)
|
||||
{
|
||||
const GLT_MSG_ENTRY *entry = FindMsgEntry(GetMSgEntries(), MSG_TYPE_WND, notify_code, ctrl_id);
|
||||
const GL_MSG_ENTRY *entry = FindMsgEntry(GetMSgEntries(), MSG_TYPE_WND, notify_code, ctrl_id);
|
||||
if ( NULL != entry )
|
||||
{
|
||||
MSGFUNCS msg_funcs;
|
||||
@ -630,59 +525,23 @@ int c_wnd::unlink_child(c_wnd *child)
|
||||
}
|
||||
}
|
||||
|
||||
void c_wnd::display_window()
|
||||
void c_wnd::show_window()
|
||||
{
|
||||
if (GLT_ATTR_VISIBLE == (m_style & GLT_ATTR_VISIBLE))
|
||||
if (GL_ATTR_VISIBLE == (m_style & GL_ATTR_VISIBLE))
|
||||
{
|
||||
m_is_visible_now = true;
|
||||
on_paint();
|
||||
|
||||
c_wnd *child = m_top_child;
|
||||
if ( NULL != child )
|
||||
{
|
||||
while ( child )
|
||||
{
|
||||
child->show_window(GLT_WIN_SHOW);
|
||||
child->show_window();
|
||||
child = child->m_next_sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void c_wnd::hide_widow()
|
||||
{
|
||||
c_wnd *child = m_top_child;
|
||||
|
||||
if ( true == m_is_visible_now )
|
||||
{
|
||||
if ( NULL != child )
|
||||
{
|
||||
while ( child )
|
||||
{
|
||||
child->show_window(GLT_WIN_HIDE);
|
||||
child = child->m_next_sibling;
|
||||
}
|
||||
}
|
||||
m_is_visible_now = false;
|
||||
if (m_parent && (m_parent->get_active_child() == this))
|
||||
{
|
||||
m_parent->on_kill_focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void c_wnd::show_window(int show_type)
|
||||
{
|
||||
if ( GLT_WIN_SHOW == show_type )
|
||||
{
|
||||
display_window();
|
||||
}
|
||||
else if (GLT_WIN_HIDE == show_type)
|
||||
{
|
||||
hide_widow();
|
||||
}
|
||||
}
|
||||
|
||||
void c_wnd::on_touch_down(int x, int y)
|
||||
{
|
||||
c_rect rect;
|
||||
@ -694,7 +553,7 @@ void c_wnd::on_touch_down(int x, int y)
|
||||
{
|
||||
while ( pChild )
|
||||
{
|
||||
if (pChild->is_visible())
|
||||
if (GL_ATTR_VISIBLE == (pChild->m_style & GL_ATTR_VISIBLE))
|
||||
{
|
||||
pChild->get_wnd_rect(rect);
|
||||
if ( TRUE == rect.PtInRect(x, y) )
|
||||
@ -721,7 +580,7 @@ void c_wnd::on_touch_up(int x, int y)
|
||||
{
|
||||
while ( pChild )
|
||||
{
|
||||
if (pChild->is_visible())
|
||||
if (GL_ATTR_VISIBLE == (pChild->m_style & GL_ATTR_VISIBLE))
|
||||
{
|
||||
pChild->get_wnd_rect(rect);
|
||||
if ( TRUE == rect.PtInRect(x, y) )
|
||||
|
@ -12,12 +12,12 @@ depdency: Windows 10, visul stdio 2015/2017
|
||||
|
||||
## How to build core&gui libary for ARM Linux?
|
||||
### Install cross compiler:
|
||||
For example: arm-linux-gnueabi-gcc
|
||||
|
||||
`sudo apt-get install g++-arm-linux-gnueabi gcc-arm-linux-gnueabi`
|
||||
|
||||
- For ARM32: `sudo apt-get install g++-arm-linux-gnueabi gcc-arm-linux-gnueabi`
|
||||
- For ARM64: `sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu`
|
||||
### Build
|
||||
- `cd GuiLite`
|
||||
- `cmake -D CMAKE_C_COMPILER="/usr/bin/arm-linux-gnueabi-gcc" -D CMAKE_CXX_COMPILER="/usr/bin/arm-linux-gnueabi-g++" .`
|
||||
- For ARM32: `cmake -D CMAKE_C_COMPILER="/usr/bin/arm-linux-gnueabi-gcc" -D CMAKE_CXX_COMPILER="/usr/bin/arm-linux-gnueabi-g++" .`
|
||||
- For ARM64: `cmake -D CMAKE_C_COMPILER="/usr/bin/aarch64-linux-gnu-gcc" -D CMAKE_CXX_COMPILER="/usr/bin/aarch64-linux-gnu-g++" .`
|
||||
- `make`
|
||||
- Output here: /GuiLite/libcore.a libgui.a
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef _BUTTON_H_
|
||||
#define _BUTTON_H_
|
||||
|
||||
#define GLT_BN_CLICKED 0x1111
|
||||
#define ON_GLT_BN_CLICKED(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GLT_BN_CLICKED, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
#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))},
|
||||
|
||||
typedef struct struct_bitmap_info BITMAP_INFO;
|
||||
class c_button : public c_wnd
|
||||
|
@ -10,15 +10,11 @@ typedef struct
|
||||
c_surface* surface;
|
||||
} DIALOG_ARRAY;
|
||||
|
||||
#define MAX_DIALOG 9
|
||||
|
||||
class c_dialog : public c_wnd
|
||||
{
|
||||
public:
|
||||
static c_dialog* get_the_dialog(c_surface* surface);
|
||||
static int open_dialog(c_dialog* p_dlg);
|
||||
c_dialog(){m_divider_lines = 0;}
|
||||
int close_dialog();
|
||||
static int close_dialog(c_surface* surface);
|
||||
void set_divider_lines(unsigned char lines){m_divider_lines = lines;}
|
||||
virtual void on_touch_down(int x, int y);
|
||||
virtual void on_touch_up(int x, int y);
|
||||
@ -26,8 +22,9 @@ protected:
|
||||
virtual const char* get_class_name(void) const {return "c_dialog";}
|
||||
virtual void pre_create_wnd();
|
||||
virtual void on_paint();
|
||||
static DIALOG_ARRAY ms_the_dialogs[MAX_DIALOG];
|
||||
static DIALOG_ARRAY ms_the_dialogs[SURFACE_CNT_MAX];
|
||||
private:
|
||||
static c_dialog* get_the_dialog(c_surface* surface);
|
||||
int set_me_the_dialog();
|
||||
unsigned char m_divider_lines;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ protected:
|
||||
virtual void on_touch_up(int x, int y);
|
||||
|
||||
void on_key_board_click(unsigned int ctrl_id, long param);
|
||||
GLT_DECLARE_MESSAGE_MAP()
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void show_keyboard();
|
||||
|
||||
|
@ -42,7 +42,7 @@ protected:
|
||||
void on_enter_clicked(unsigned int ctrl_id);
|
||||
void on_esc_clicked(unsigned int ctrl_id);
|
||||
|
||||
GLT_DECLARE_MESSAGE_MAP()
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
char m_str[32];
|
||||
int m_str_len;
|
||||
|
@ -3,18 +3,18 @@
|
||||
|
||||
#define MAX_ITEM_NUM 12
|
||||
|
||||
#define GLT_LIST_SELECT 0x1
|
||||
#define GLT_LIST_CONFIRM 0x2
|
||||
#define GLT_LIST_ROTATION 0x3
|
||||
#define GL_LIST_SELECT 0x1
|
||||
#define GL_LIST_CONFIRM 0x2
|
||||
#define GL_LIST_ROTATION 0x3
|
||||
|
||||
#define ON_LIST_SELECT(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GLT_LIST_SELECT, (c_cmd_target*)ctrlId, ctrlId, MSG_CALLBACK_VWV, reinterpret_cast<MsgFuncVV>(&func)},
|
||||
{MSG_TYPE_WND, GL_LIST_SELECT, (c_cmd_target*)ctrlId, ctrlId, MSG_CALLBACK_VWV, reinterpret_cast<MsgFuncVV>(&func)},
|
||||
|
||||
#define ON_LIST_CONFIRM(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GLT_LIST_CONFIRM, (c_cmd_target*)ctrlId, ctrlId, MSG_CALLBACK_VWV, reinterpret_cast<MsgFuncVV>(&func)},
|
||||
{MSG_TYPE_WND, GL_LIST_CONFIRM, (c_cmd_target*)ctrlId, ctrlId, MSG_CALLBACK_VWV, reinterpret_cast<MsgFuncVV>(&func)},
|
||||
|
||||
#define ON_LIST_ROTATION(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GLT_LIST_ROTATION, (c_cmd_target*)ctrlId, ctrlId, MSG_CALLBACK_VWL, reinterpret_cast<MsgFuncVV>(&func)},
|
||||
{MSG_TYPE_WND, GL_LIST_ROTATION, (c_cmd_target*)ctrlId, ctrlId, MSG_CALLBACK_VWL, reinterpret_cast<MsgFuncVV>(&func)},
|
||||
|
||||
class c_list_box : public c_wnd
|
||||
{
|
||||
|
@ -18,15 +18,9 @@ public:
|
||||
Z_ORDER_LEVEL max_zorder = Z_ORDER_LEVEL_0);
|
||||
void disabel_all_slide();
|
||||
protected:
|
||||
virtual void display_window();
|
||||
virtual c_wnd* clone(){return new c_slide_group();}
|
||||
c_wnd* m_slides[MAX_PAGES];
|
||||
int m_active_slide_index;
|
||||
};
|
||||
|
||||
class c_slide_root : public c_wnd
|
||||
{
|
||||
virtual c_wnd* clone() { return new c_slide_root(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,18 +1,18 @@
|
||||
#ifndef _SPIN_BOX_H_
|
||||
#define _SPIN_BOX_H_
|
||||
|
||||
#define GLT_SPIN_SELECT 0x2222
|
||||
#define GLT_SPIN_CONFIRM 0x3333
|
||||
#define GLT_SPIN_ROTATION 0x4444
|
||||
#define GL_SPIN_SELECT 0x2222
|
||||
#define GL_SPIN_CONFIRM 0x3333
|
||||
#define GL_SPIN_ROTATION 0x4444
|
||||
|
||||
#define ON_SPIN_SELECT(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GLT_SPIN_SELECT, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
{MSG_TYPE_WND, GL_SPIN_SELECT, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
|
||||
#define ON_SPIN_CONFIRM(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GLT_SPIN_CONFIRM, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
{MSG_TYPE_WND, GL_SPIN_CONFIRM, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
|
||||
#define ON_SPIN_ROTATION(ctrlId, func) \
|
||||
{MSG_TYPE_WND, GLT_SPIN_ROTATION, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
{MSG_TYPE_WND, GL_SPIN_ROTATION, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWL, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
|
||||
|
||||
class c_spin_box : public c_wnd
|
||||
{
|
||||
@ -44,7 +44,7 @@ protected:
|
||||
void on_arrow_up_bt_click(unsigned int ctr_id);
|
||||
void on_arrow_down_bt_click(unsigned int ctr_id);
|
||||
|
||||
GLT_DECLARE_MESSAGE_MAP()
|
||||
GL_DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
void show_arrow_button();
|
||||
|
@ -8,11 +8,10 @@
|
||||
#include "core_include/surface.h"
|
||||
#include "../gui_include/my_resource.h"
|
||||
#include "../gui_include/button.h"
|
||||
#include "../gui_include/dialog.h"
|
||||
|
||||
void c_button::pre_create_wnd()
|
||||
{
|
||||
m_style |= GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
|
||||
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
|
||||
m_font_type = c_my_resource::get_font(FONT_ENG_SMB);
|
||||
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);
|
||||
m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND);
|
||||
@ -44,7 +43,7 @@ void c_button::on_touch_up(int x, int y)
|
||||
modify_status(STATUS_FOCUSED);
|
||||
on_paint();
|
||||
|
||||
notify_parent(GLT_BN_CLICKED, get_id(), 0);
|
||||
notify_parent(GL_BN_CLICKED, get_id(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "core_include/wnd.h"
|
||||
#include "core_include/msg.h"
|
||||
#include "core_include/surface.h"
|
||||
#include "core_include/display.h"
|
||||
#include "core_include/resource.h"
|
||||
#include "core_include/bitmap.h"
|
||||
#include "core_include/word.h"
|
||||
@ -13,12 +14,13 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
DIALOG_ARRAY c_dialog::ms_the_dialogs[MAX_DIALOG];
|
||||
DIALOG_ARRAY c_dialog::ms_the_dialogs[SURFACE_CNT_MAX];
|
||||
void c_dialog::pre_create_wnd()
|
||||
{
|
||||
m_style |= GLT_ATTR_VISIBLE|GLT_ATTR_FOCUS;
|
||||
m_style = GL_ATTR_FOCUS;
|
||||
m_z_order = Z_ORDER_LEVEL_1;
|
||||
m_bg_color = GL_RGB(33,33,33);
|
||||
m_divider_lines = 0;
|
||||
}
|
||||
|
||||
void c_dialog::on_paint()
|
||||
@ -47,7 +49,7 @@ void c_dialog::on_paint()
|
||||
|
||||
c_dialog* c_dialog::get_the_dialog(c_surface* surface)
|
||||
{
|
||||
for(int i = 0; i < MAX_DIALOG; i++)
|
||||
for(int i = 0; i < SURFACE_CNT_MAX; i++)
|
||||
{
|
||||
if(ms_the_dialogs[i].surface == surface)
|
||||
{
|
||||
@ -72,36 +74,34 @@ int c_dialog::open_dialog(c_dialog* p_dlg)
|
||||
|
||||
if(cur_dlg)
|
||||
{
|
||||
cur_dlg->show_window(GLT_WIN_HIDE);
|
||||
cur_dlg->modify_style(0, GLT_ATTR_VISIBLE);
|
||||
cur_dlg->modify_style(0, GL_ATTR_VISIBLE);
|
||||
}
|
||||
|
||||
c_rect rc;
|
||||
p_dlg->get_screen_rect(rc);
|
||||
p_dlg->get_surface()->set_frame_layer(rc, Z_ORDER_LEVEL_1);
|
||||
|
||||
p_dlg->modify_style(GLT_ATTR_VISIBLE, 0);
|
||||
p_dlg->modify_style(GL_ATTR_VISIBLE, 0);
|
||||
p_dlg->show_window();
|
||||
p_dlg->set_me_the_dialog();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int c_dialog::close_dialog()
|
||||
int c_dialog::close_dialog(c_surface* surface)
|
||||
{
|
||||
c_dialog* dlg = get_the_dialog(get_surface());
|
||||
c_dialog* dlg = get_the_dialog(surface);
|
||||
|
||||
if (NULL == dlg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
c_rect rc;
|
||||
c_surface* surface = dlg->get_surface();
|
||||
dlg->show_window(GLT_WIN_HIDE);
|
||||
dlg->modify_style(0, GLT_ATTR_VISIBLE);
|
||||
|
||||
dlg->modify_style(0, GL_ATTR_VISIBLE);
|
||||
surface->set_frame_layer(rc, dlg->m_z_order);
|
||||
|
||||
//clear the dialog
|
||||
for(int i = 0; i < MAX_DIALOG; i++)
|
||||
for(int i = 0; i < SURFACE_CNT_MAX; i++)
|
||||
{
|
||||
if(ms_the_dialogs[i].surface == surface)
|
||||
{
|
||||
@ -160,7 +160,7 @@ void c_dialog::on_touch_up(int x, int y)
|
||||
int c_dialog::set_me_the_dialog()
|
||||
{
|
||||
c_surface* surface = get_surface();
|
||||
for(int i = 0; i < MAX_DIALOG; i++)
|
||||
for(int i = 0; i < SURFACE_CNT_MAX; i++)
|
||||
{
|
||||
if(ms_the_dialogs[i].surface == surface)
|
||||
{
|
||||
@ -169,7 +169,7 @@ int c_dialog::set_me_the_dialog()
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < MAX_DIALOG; i++)
|
||||
for(int i = 0; i < SURFACE_CNT_MAX; i++)
|
||||
{
|
||||
if(ms_the_dialogs[i].surface == NULL)
|
||||
{
|
||||
|
@ -9,23 +9,22 @@
|
||||
#include "../gui_include/label.h"
|
||||
#include "../gui_include/edit.h"
|
||||
#include "../gui_include/my_resource.h"
|
||||
#include "../gui_include/dialog.h"
|
||||
#include "../gui_include/keyboard.h"
|
||||
#include <string.h>
|
||||
|
||||
#define IDD_ALL_KEY_BOARD 0x5012
|
||||
#define IDD_NUM_KEY_BOARD 0x5013
|
||||
|
||||
GLT_BEGIN_MESSAGE_MAP(c_edit)
|
||||
GL_BEGIN_MESSAGE_MAP(c_edit)
|
||||
ON_KEYBORAD_UPDATE(IDD_ALL_KEY_BOARD, c_edit::on_key_board_click)
|
||||
ON_KEYBORAD_UPDATE(IDD_NUM_KEY_BOARD, c_edit::on_key_board_click)
|
||||
GLT_END_MESSAGE_MAP()
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
static c_keyboard s_keyboard;
|
||||
|
||||
void c_edit::pre_create_wnd()
|
||||
{
|
||||
m_style |= GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER | KEY_BOARD_STYLE;
|
||||
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER | KEY_BOARD_STYLE;
|
||||
m_font_type = c_my_resource::get_font(FONT_ENG_SMB);
|
||||
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);
|
||||
m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND);
|
||||
|
@ -99,51 +99,51 @@ WND_TREE g_number_board_children[] =
|
||||
{NULL,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
GLT_BEGIN_MESSAGE_MAP(c_keyboard)
|
||||
ON_GLT_BN_CLICKED('A', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('B', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('C', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('D', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('E', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('F', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('G', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('H', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('I', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('J', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('K', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('L', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('M', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('N', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('O', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('P', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('Q', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('R', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('S', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('T', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('U', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('V', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('W', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('X', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('Y', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('Z', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('0', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('1', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('2', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('3', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('4', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('5', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('6', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('7', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('8', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('9', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED(' ', c_keyboard::on_char_clicked)
|
||||
ON_GLT_BN_CLICKED('.', c_keyboard::on_char_clicked)
|
||||
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_GLT_BN_CLICKED(0x7F, c_keyboard::on_del_clicked)
|
||||
ON_GLT_BN_CLICKED(0x14, c_keyboard::on_caps_clicked)
|
||||
ON_GLT_BN_CLICKED('\n', c_keyboard::on_enter_clicked)
|
||||
ON_GLT_BN_CLICKED(0x1B, c_keyboard::on_esc_clicked)
|
||||
GLT_END_MESSAGE_MAP()
|
||||
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)
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
int c_keyboard::create(c_wnd *parent, unsigned short resource_id, char* str,
|
||||
short x, short y, short width, short height, WND_TREE* p_child_tree)
|
||||
@ -164,7 +164,7 @@ int c_keyboard::create(c_wnd *parent, unsigned short resource_id, char* str,
|
||||
|
||||
void c_keyboard::pre_create_wnd()
|
||||
{
|
||||
m_style = GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS;
|
||||
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS;
|
||||
m_cap_status = STATUS_UPPERCASE;
|
||||
m_bg_color = GL_RGB(39,39,39);
|
||||
memset(m_str, 0, sizeof(m_str));
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
void c_label::pre_create_wnd()
|
||||
{
|
||||
m_style = GLT_ATTR_VISIBLE | ALIGN_LEFT | ALIGN_VCENTER;
|
||||
m_style = GL_ATTR_VISIBLE | ALIGN_LEFT | ALIGN_VCENTER;
|
||||
m_font_color = GL_RGB(255,255,255);
|
||||
|
||||
m_font_type = c_my_resource::get_font(FONT_ENG_SMB);
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "../gui_include/button.h"
|
||||
#include "../gui_include/my_resource.h"
|
||||
#include "../gui_include/dialog.h"
|
||||
#include "../gui_include/list_box.h"
|
||||
#include <string.h>
|
||||
|
||||
@ -17,7 +16,7 @@
|
||||
|
||||
void c_list_box::pre_create_wnd()
|
||||
{
|
||||
m_style |= GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
|
||||
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
|
||||
memset(m_item_array, 0, sizeof(m_item_array));
|
||||
m_item_total = 0;
|
||||
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);
|
||||
@ -114,7 +113,7 @@ void c_list_box::on_touch_down(int x, int y)
|
||||
{
|
||||
modify_status(STATUS_FOCUSED);
|
||||
on_paint();
|
||||
notify_parent(GLT_LIST_CONFIRM, get_id(), 0);
|
||||
notify_parent(GL_LIST_CONFIRM, get_id(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,7 +124,7 @@ void c_list_box::on_touch_up(int x, int y)
|
||||
{
|
||||
modify_status(STATUS_PUSHED);
|
||||
on_paint();
|
||||
notify_parent(GLT_LIST_SELECT, get_id(), 0);
|
||||
notify_parent(GL_LIST_SELECT, get_id(), 0);
|
||||
}
|
||||
else if (STATUS_PUSHED == m_status)
|
||||
{
|
||||
@ -139,7 +138,7 @@ void c_list_box::on_touch_up(int x, int y)
|
||||
modify_status(STATUS_FOCUSED);
|
||||
select_item((y - m_list_wnd_rect.m_top) / ITEM_HEIGHT);
|
||||
on_paint();
|
||||
notify_parent(GLT_LIST_CONFIRM, get_id(), 0);
|
||||
notify_parent(GL_LIST_CONFIRM, get_id(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -54,14 +54,6 @@ int c_slide_group::set_active_slide(int index, bool is_redraw)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void c_slide_group::display_window()
|
||||
{
|
||||
if (GLT_ATTR_VISIBLE == (m_style & GLT_ATTR_VISIBLE))
|
||||
{
|
||||
m_is_visible_now = true;
|
||||
}
|
||||
}
|
||||
|
||||
int c_slide_group::add_slide(c_wnd* slide, unsigned short resource_id, short x, short y,
|
||||
short width, short height, WND_TREE* p_child_tree, Z_ORDER_LEVEL max_zorder)
|
||||
{
|
||||
@ -71,7 +63,7 @@ int c_slide_group::add_slide(c_wnd* slide, unsigned short resource_id, short x,
|
||||
}
|
||||
|
||||
c_surface* old_surface = get_surface();
|
||||
c_surface* new_surface = old_surface->get_display()->create_surface(slide,max_zorder);
|
||||
c_surface* new_surface = old_surface->get_display()->alloc_surface(slide,max_zorder);
|
||||
new_surface->set_active(false);
|
||||
set_surface(new_surface);
|
||||
slide->connect(this, resource_id ,0 , x, y, width, height, p_child_tree);
|
||||
@ -125,7 +117,7 @@ int c_slide_group::add_clone_silde(c_wnd* slide, unsigned short resource_id, sho
|
||||
}
|
||||
|
||||
c_surface* old_surface = get_surface();
|
||||
c_surface* new_surface = old_surface->get_display()->create_surface(slide,max_zorder);
|
||||
c_surface* new_surface = old_surface->get_display()->alloc_surface(slide,max_zorder);
|
||||
new_surface->set_active(false);
|
||||
set_surface(new_surface);
|
||||
c_wnd* page_tmp = slide->connect_clone(this,resource_id,0,x,y,width,height,p_child_tree);
|
||||
|
@ -13,14 +13,14 @@
|
||||
#define ID_BT_ARROW_UP 1
|
||||
#define ID_BT_ARROW_DOWN 2
|
||||
|
||||
GLT_BEGIN_MESSAGE_MAP(c_spin_box)
|
||||
ON_GLT_BN_CLICKED(ID_BT_ARROW_UP, c_spin_box::on_arrow_up_bt_click)
|
||||
ON_GLT_BN_CLICKED(ID_BT_ARROW_DOWN, c_spin_box::on_arrow_down_bt_click)
|
||||
GLT_END_MESSAGE_MAP()
|
||||
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)
|
||||
GL_END_MESSAGE_MAP()
|
||||
|
||||
void c_spin_box::pre_create_wnd()
|
||||
{
|
||||
m_style = GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
|
||||
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
|
||||
m_font_type = c_my_resource::get_font(FONT_ENG_SMB);
|
||||
m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND);
|
||||
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);
|
||||
@ -72,7 +72,7 @@ void c_spin_box::on_touch_down(int x, int y)
|
||||
}
|
||||
modify_status(STATUS_FOCUSED);
|
||||
on_paint();
|
||||
notify_parent(GLT_SPIN_CONFIRM, get_id(), 0);
|
||||
notify_parent(GL_SPIN_CONFIRM, get_id(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ void c_spin_box::on_touch_up(int x, int y)
|
||||
{
|
||||
modify_status(STATUS_PUSHED);
|
||||
on_paint();
|
||||
notify_parent(GLT_SPIN_SELECT, get_id(), 0);
|
||||
notify_parent(GL_SPIN_SELECT, get_id(), 0);
|
||||
}
|
||||
else if (STATUS_PUSHED == m_status)
|
||||
{
|
||||
@ -95,7 +95,7 @@ void c_spin_box::on_touch_up(int x, int y)
|
||||
}
|
||||
modify_status(STATUS_FOCUSED);
|
||||
on_paint();
|
||||
notify_parent(GLT_SPIN_CONFIRM, get_id(), 0);
|
||||
notify_parent(GL_SPIN_CONFIRM, get_id(), 0);
|
||||
}
|
||||
else
|
||||
{//click arrow button.
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
void c_table::pre_create_wnd()
|
||||
{
|
||||
m_style = GLT_ATTR_VISIBLE | (~GLT_ATTR_FOCUS);
|
||||
m_style = GL_ATTR_VISIBLE;
|
||||
}
|
||||
|
||||
int c_table::set_item(int row, int col, char* str, unsigned int with_bg_color)
|
||||
|
Loading…
x
Reference in New Issue
Block a user