fix touch issue, update spinbox appearance
This commit is contained in:
parent
865365f2c5
commit
add08fdd8c
28
GuiLite.h
28
GuiLite.h
|
@ -1681,23 +1681,23 @@ public:
|
|||
}
|
||||
virtual void on_touch(int x, int y, TOUCH_ACTION action)
|
||||
{
|
||||
c_wnd* model_wnd = 0;
|
||||
x -= m_wnd_rect.m_left;
|
||||
y -= m_wnd_rect.m_top;
|
||||
c_wnd* priority_wnd = 0;
|
||||
c_wnd* tmp_child = m_top_child;
|
||||
while (tmp_child)
|
||||
{
|
||||
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||
{
|
||||
model_wnd = tmp_child;
|
||||
priority_wnd = tmp_child;
|
||||
break;
|
||||
}
|
||||
tmp_child = tmp_child->m_next_sibling;
|
||||
}
|
||||
if (model_wnd)
|
||||
if (priority_wnd)
|
||||
{
|
||||
return model_wnd->on_touch(x, y, action);
|
||||
return priority_wnd->on_touch(x, y, action);
|
||||
}
|
||||
x -= m_wnd_rect.m_left;
|
||||
y -= m_wnd_rect.m_top;
|
||||
c_wnd* child = m_top_child;
|
||||
while (child)
|
||||
{
|
||||
|
@ -1715,20 +1715,20 @@ public:
|
|||
}
|
||||
virtual void on_key(KEY_TYPE key)
|
||||
{
|
||||
c_wnd* model_wnd = 0;
|
||||
c_wnd* priority_wnd = 0;
|
||||
c_wnd* tmp_child = m_top_child;
|
||||
while (tmp_child)
|
||||
{
|
||||
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||
{
|
||||
model_wnd = tmp_child;
|
||||
priority_wnd = tmp_child;
|
||||
break;
|
||||
}
|
||||
tmp_child = tmp_child->m_next_sibling;
|
||||
}
|
||||
if (model_wnd)
|
||||
if (priority_wnd)
|
||||
{
|
||||
return model_wnd->on_key(key);
|
||||
return priority_wnd->on_key(key);
|
||||
}
|
||||
if (!is_focus_wnd())
|
||||
{
|
||||
|
@ -3092,7 +3092,6 @@ inline void c_slide_group::on_touch(int x, int y, TOUCH_ACTION action)
|
|||
#endif
|
||||
#ifndef GUILITE_WIDGETS_INCLUDE_SPINBOX_H
|
||||
#define GUILITE_WIDGETS_INCLUDE_SPINBOX_H
|
||||
#define ARROW_BT_WIDTH 55
|
||||
#define ID_BT_ARROW_UP 0x1111
|
||||
#define ID_BT_ARROW_DOWN 0x2222
|
||||
#define GL_SPIN_CHANGE 0x3333
|
||||
|
@ -3123,6 +3122,7 @@ protected:
|
|||
{
|
||||
c_rect rect;
|
||||
get_screen_rect(rect);
|
||||
rect.m_right = rect.m_left + (rect.Width() * 2 / 3);
|
||||
m_surface->fill_rect(rect, c_theme::get_color(COLOR_WND_NORMAL), m_z_order);
|
||||
c_word::draw_value_in_rect(m_surface, m_parent->get_z_order(), m_cur_value, m_digit, rect, m_font_type, m_font_color, c_theme::get_color(COLOR_WND_NORMAL), ALIGN_HCENTER | ALIGN_VCENTER);
|
||||
}
|
||||
|
@ -3137,10 +3137,10 @@ protected:
|
|||
m_step = 1;
|
||||
//link arrow button position.
|
||||
c_rect rect;
|
||||
get_screen_rect(rect);
|
||||
get_wnd_rect(rect);
|
||||
m_bt_down.m_spin_box = m_bt_up.m_spin_box = this;
|
||||
m_bt_down.connect(m_parent, ID_BT_ARROW_DOWN, "-", rect.m_left - ARROW_BT_WIDTH, rect.m_top, ARROW_BT_WIDTH, rect.Height());
|
||||
m_bt_up.connect(m_parent, ID_BT_ARROW_UP, "+", rect.m_right, rect.m_top, ARROW_BT_WIDTH, rect.Height());
|
||||
m_bt_up.connect(m_parent, ID_BT_ARROW_UP, "+", (rect.m_left + rect.Width() * 2 / 3), rect.m_top, (rect.Width() / 3), (rect.Height() / 2));
|
||||
m_bt_down.connect(m_parent, ID_BT_ARROW_DOWN, "-", (rect.m_left + rect.Width() * 2 / 3), (rect.m_top + rect.Height() / 2), (rect.Width() / 3), (rect.Height() / 2));
|
||||
}
|
||||
void on_arrow_up_bt_click()
|
||||
{
|
||||
|
|
|
@ -319,24 +319,25 @@ public:
|
|||
|
||||
virtual void on_touch(int x, int y, TOUCH_ACTION action)
|
||||
{
|
||||
c_wnd* model_wnd = 0;
|
||||
x -= m_wnd_rect.m_left;
|
||||
y -= m_wnd_rect.m_top;
|
||||
|
||||
c_wnd* priority_wnd = 0;
|
||||
c_wnd* tmp_child = m_top_child;
|
||||
while (tmp_child)
|
||||
{
|
||||
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||
{
|
||||
model_wnd = tmp_child;
|
||||
priority_wnd = tmp_child;
|
||||
break;
|
||||
}
|
||||
tmp_child = tmp_child->m_next_sibling;
|
||||
}
|
||||
if (model_wnd)
|
||||
if (priority_wnd)
|
||||
{
|
||||
return model_wnd->on_touch(x, y, action);
|
||||
return priority_wnd->on_touch(x, y, action);
|
||||
}
|
||||
|
||||
x -= m_wnd_rect.m_left;
|
||||
y -= m_wnd_rect.m_top;
|
||||
c_wnd* child = m_top_child;
|
||||
while (child)
|
||||
{
|
||||
|
@ -354,20 +355,20 @@ public:
|
|||
}
|
||||
virtual void on_key(KEY_TYPE key)
|
||||
{
|
||||
c_wnd* model_wnd = 0;
|
||||
c_wnd* priority_wnd = 0;
|
||||
c_wnd* tmp_child = m_top_child;
|
||||
while (tmp_child)
|
||||
{
|
||||
if ((tmp_child->m_attr & ATTR_PRIORITY) && (tmp_child->m_attr & ATTR_VISIBLE))
|
||||
{
|
||||
model_wnd = tmp_child;
|
||||
priority_wnd = tmp_child;
|
||||
break;
|
||||
}
|
||||
tmp_child = tmp_child->m_next_sibling;
|
||||
}
|
||||
if (model_wnd)
|
||||
if (priority_wnd)
|
||||
{
|
||||
return model_wnd->on_key(key);
|
||||
return priority_wnd->on_key(key);
|
||||
}
|
||||
|
||||
if (!is_focus_wnd())
|
||||
|
@ -468,6 +469,7 @@ protected:
|
|||
parent = parent->m_parent;
|
||||
}
|
||||
}
|
||||
|
||||
void wnd2screen(c_rect &rect) const
|
||||
{
|
||||
int l = rect.m_left;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "../core_include/theme.h"
|
||||
#include "../widgets_include/button.h"
|
||||
|
||||
#define ARROW_BT_WIDTH 55
|
||||
#define ID_BT_ARROW_UP 0x1111
|
||||
#define ID_BT_ARROW_DOWN 0x2222
|
||||
#define GL_SPIN_CHANGE 0x3333
|
||||
|
@ -46,6 +45,7 @@ protected:
|
|||
{
|
||||
c_rect rect;
|
||||
get_screen_rect(rect);
|
||||
rect.m_right = rect.m_left + (rect.Width() * 2 / 3);
|
||||
|
||||
m_surface->fill_rect(rect, c_theme::get_color(COLOR_WND_NORMAL), m_z_order);
|
||||
c_word::draw_value_in_rect(m_surface, m_parent->get_z_order(), m_cur_value, m_digit, rect, m_font_type, m_font_color, c_theme::get_color(COLOR_WND_NORMAL), ALIGN_HCENTER | ALIGN_VCENTER);
|
||||
|
@ -62,10 +62,10 @@ protected:
|
|||
|
||||
//link arrow button position.
|
||||
c_rect rect;
|
||||
get_screen_rect(rect);
|
||||
get_wnd_rect(rect);
|
||||
m_bt_down.m_spin_box = m_bt_up.m_spin_box = this;
|
||||
m_bt_down.connect(m_parent, ID_BT_ARROW_DOWN, "-", rect.m_left - ARROW_BT_WIDTH, rect.m_top, ARROW_BT_WIDTH, rect.Height());
|
||||
m_bt_up.connect(m_parent, ID_BT_ARROW_UP, "+", rect.m_right, rect.m_top, ARROW_BT_WIDTH, rect.Height());
|
||||
m_bt_up.connect(m_parent, ID_BT_ARROW_UP, "+", (rect.m_left + rect.Width() * 2 / 3), rect.m_top, (rect.Width() / 3), (rect.Height() / 2));
|
||||
m_bt_down.connect(m_parent, ID_BT_ARROW_DOWN, "-", (rect.m_left + rect.Width() * 2 / 3), (rect.m_top + rect.Height() / 2), (rect.Width() / 3), (rect.Height() / 2));
|
||||
}
|
||||
void on_arrow_up_bt_click()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue