support modal/non-modal dialog
This commit is contained in:
parent
3a96d143c5
commit
8a77ba553d
|
@ -477,7 +477,7 @@ bool c_wnd::on_touch(int x, int y, TOUCH_ACTION action)
|
|||
if (GL_ATTR_VISIBLE == (child->m_style & GL_ATTR_VISIBLE))
|
||||
{
|
||||
child->get_wnd_rect(rect);
|
||||
if (TRUE == rect.PtInRect(x, y) || child->m_style & GL_ATTR_PRIORITY)
|
||||
if (TRUE == rect.PtInRect(x, y) || child->m_style & GL_ATTR_MODAL)
|
||||
{
|
||||
if (TRUE == child->is_focus_wnd())
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#define GL_ATTR_VISIBLE 0x80000000L
|
||||
#define GL_ATTR_DISABLED 0x40000000L
|
||||
#define GL_ATTR_FOCUS 0x20000000L
|
||||
#define GL_ATTR_PRIORITY 0x10000000L// Handle touch action at high priority
|
||||
#define GL_ATTR_MODAL 0x10000000L// Handle touch action at high priority
|
||||
|
||||
typedef struct struct_font_info FONT_INFO;
|
||||
typedef struct struct_color_rect COLOR_RECT;
|
||||
|
@ -52,7 +52,6 @@ class c_wnd : public c_cmd_target
|
|||
public:
|
||||
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, const char* str,
|
||||
short x, short y, short width, short height, WND_TREE* p_child_tree = NULL);
|
||||
virtual c_wnd* connect_clone(c_wnd *parent, unsigned short resource_id, const char* str,
|
||||
|
|
|
@ -41,7 +41,7 @@ c_dialog* c_dialog::get_the_dialog(c_surface* surface)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int c_dialog::open_dialog(c_dialog* p_dlg)
|
||||
int c_dialog::open_dialog(c_dialog* p_dlg, bool modal_mode)
|
||||
{
|
||||
if (NULL == p_dlg)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ int c_dialog::open_dialog(c_dialog* p_dlg)
|
|||
p_dlg->get_screen_rect(rc);
|
||||
p_dlg->get_surface()->set_frame_layer(rc, Z_ORDER_LEVEL_1);
|
||||
|
||||
p_dlg->set_style(GL_ATTR_VISIBLE | GL_ATTR_FOCUS | GL_ATTR_PRIORITY);
|
||||
p_dlg->set_style(modal_mode ? (GL_ATTR_VISIBLE | GL_ATTR_FOCUS | GL_ATTR_MODAL) : (GL_ATTR_VISIBLE | GL_ATTR_FOCUS));
|
||||
p_dlg->show_window();
|
||||
p_dlg->set_me_the_dialog();
|
||||
return 1;
|
||||
|
|
|
@ -124,7 +124,7 @@ void c_edit::on_paint()
|
|||
s_keyboard.disconnect();
|
||||
m_surface->set_frame_layer(empty_rect, s_keyboard.get_z_order());
|
||||
m_z_order = m_parent->get_z_order();
|
||||
m_style &= ~GL_ATTR_PRIORITY;
|
||||
m_style &= ~GL_ATTR_MODAL;
|
||||
}
|
||||
m_surface->fill_rect(rect, c_theme::get_color(COLOR_WND_NORMAL), m_z_order);
|
||||
break;
|
||||
|
@ -134,7 +134,7 @@ void c_edit::on_paint()
|
|||
s_keyboard.disconnect();
|
||||
m_surface->set_frame_layer(empty_rect, s_keyboard.get_z_order());
|
||||
m_z_order = m_parent->get_z_order();
|
||||
m_style &= ~GL_ATTR_PRIORITY;
|
||||
m_style &= ~GL_ATTR_MODAL;
|
||||
}
|
||||
m_surface->fill_rect(rect, c_theme::get_color(COLOR_WND_FOCUS), m_z_order);
|
||||
break;
|
||||
|
@ -142,7 +142,7 @@ void c_edit::on_paint()
|
|||
if (m_z_order == m_parent->get_z_order())
|
||||
{
|
||||
m_z_order++;
|
||||
m_style |= GL_ATTR_PRIORITY;
|
||||
m_style |= GL_ATTR_MODAL;
|
||||
show_keyboard();
|
||||
}
|
||||
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, c_theme::get_color(COLOR_WND_PUSHED), m_parent->get_z_order());
|
||||
|
|
|
@ -48,7 +48,7 @@ void c_list_box::on_paint()
|
|||
{
|
||||
m_surface->set_frame_layer(empty_rect, m_z_order);
|
||||
m_z_order = m_parent->get_z_order();
|
||||
m_style &= ~GL_ATTR_PRIORITY;
|
||||
m_style &= ~GL_ATTR_MODAL;
|
||||
}
|
||||
m_surface->fill_rect(rect, c_theme::get_color(COLOR_WND_NORMAL), m_z_order);
|
||||
break;
|
||||
|
@ -57,7 +57,7 @@ void c_list_box::on_paint()
|
|||
{
|
||||
m_surface->set_frame_layer(empty_rect, m_z_order);
|
||||
m_z_order = m_parent->get_z_order();
|
||||
m_style &= ~GL_ATTR_PRIORITY;
|
||||
m_style &= ~GL_ATTR_MODAL;
|
||||
}
|
||||
m_surface->fill_rect(rect, c_theme::get_color(COLOR_WND_FOCUS), m_z_order);
|
||||
break;
|
||||
|
@ -73,7 +73,7 @@ void c_list_box::on_paint()
|
|||
m_z_order++;
|
||||
}
|
||||
m_surface->set_frame_layer(m_list_screen_rect, m_z_order);
|
||||
m_style |= GL_ATTR_PRIORITY;
|
||||
m_style |= GL_ATTR_MODAL;
|
||||
show_list();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -103,14 +103,14 @@ void c_spin_box::show_arrow_button()
|
|||
m_bt_down.connect(this, ID_BT_ARROW_DOWN, "\xe2\x96\xbc"/*▼*/, m_bt_up_rect.Width(), m_wnd_rect.Height(), m_bt_down_rect.Width(),m_bt_down_rect.Height());
|
||||
m_bt_down.show_window();
|
||||
|
||||
m_style |= GL_ATTR_PRIORITY;
|
||||
m_style |= GL_ATTR_MODAL;
|
||||
}
|
||||
|
||||
void c_spin_box::hide_arrow_button()
|
||||
{
|
||||
m_bt_up.disconnect();
|
||||
m_bt_down.disconnect();
|
||||
m_style &= ~GL_ATTR_PRIORITY;
|
||||
m_style &= ~GL_ATTR_MODAL;
|
||||
}
|
||||
|
||||
void c_spin_box::on_paint()
|
||||
|
|
|
@ -9,7 +9,6 @@ typedef struct struct_bitmap_info BITMAP_INFO;
|
|||
class c_button : public c_wnd
|
||||
{
|
||||
public:
|
||||
virtual const char* get_class_name() const {return "c_button";}
|
||||
virtual c_wnd* clone(){return new c_button();}
|
||||
|
||||
void set_bitmap(const BITMAP_INFO *pBitmap) { m_bitmap_normal = pBitmap; }
|
||||
|
|
|
@ -13,7 +13,7 @@ typedef struct
|
|||
class c_dialog : public c_wnd
|
||||
{
|
||||
public:
|
||||
static int open_dialog(c_dialog* p_dlg);
|
||||
static int open_dialog(c_dialog* p_dlg, bool modal_mode = true);
|
||||
static int close_dialog(c_surface* surface);
|
||||
static c_dialog* get_the_dialog(c_surface* surface);
|
||||
protected:
|
||||
|
|
|
@ -10,7 +10,6 @@ class c_edit : public c_wnd
|
|||
friend class c_keyboard;
|
||||
public:
|
||||
virtual c_wnd* clone(){return new c_edit();}
|
||||
virtual const char* get_class_name() const {return "c_edit";}
|
||||
const char* get_text(){return m_str;}
|
||||
void set_text(const char* str);
|
||||
|
||||
|
|
Loading…
Reference in New Issue