summaryrefslogtreecommitdiff
path: root/components/rtgui/widgets
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-05-08 15:50:45 +0000
committerbernard.xiong <[email protected]>2010-05-08 15:50:45 +0000
commite7fb7e6c1480c8e38f8fa0affbd874edc307527c (patch)
tree21b2e4284de0516895fb4ad7f44f20f33814925b /components/rtgui/widgets
parentcfe7e91b95a7b59270e27c969018374513fde6be (diff)
update according 0.3.1 series and add XML parser.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@699 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/widgets')
-rw-r--r--components/rtgui/widgets/button.c6
-rw-r--r--components/rtgui/widgets/list_view.c2
-rw-r--r--components/rtgui/widgets/toplevel.c1
-rw-r--r--components/rtgui/widgets/widget.c7
4 files changed, 7 insertions, 9 deletions
diff --git a/components/rtgui/widgets/button.c b/components/rtgui/widgets/button.c
index 36e010f28a..ca89b5383b 100644
--- a/components/rtgui/widgets/button.c
+++ b/components/rtgui/widgets/button.c
@@ -22,7 +22,7 @@ static void _rtgui_button_constructor(rtgui_button_t *button)
rtgui_widget_set_event_handler(RTGUI_WIDGET(button), rtgui_button_event_handler);
/* un-press button */
- button->flag &= ~RTGUI_BUTTON_FLAG_PRESS;
+ button->flag = 0;
/* set flag and on_button event handler */
button->pressed_image = RT_NULL;
@@ -119,9 +119,13 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_widget* widget, struct rtgui_e
if (emouse->button & RTGUI_MOUSE_BUTTON_UP)
{
if (btn->flag & RTGUI_BUTTON_FLAG_PRESS)
+ {
btn->flag &= ~RTGUI_BUTTON_FLAG_PRESS;
+ }
else
+ {
btn->flag |= RTGUI_BUTTON_FLAG_PRESS;
+ }
/* draw button */
#ifndef RTGUI_USING_SMALL_SIZE
diff --git a/components/rtgui/widgets/list_view.c b/components/rtgui/widgets/list_view.c
index 857a9454a1..b638518d08 100644
--- a/components/rtgui/widgets/list_view.c
+++ b/components/rtgui/widgets/list_view.c
@@ -207,7 +207,7 @@ rt_bool_t rtgui_list_view_event_handler(struct rtgui_widget* widget, struct rtgu
old_item = view->current_item;
/* set selected item */
- view->current_item = view->current_item/view->page_items + index;
+ view->current_item = (view->current_item/view->page_items) * view->page_items + index;
rtgui_list_view_update_current(view, old_item);
}
}
diff --git a/components/rtgui/widgets/toplevel.c b/components/rtgui/widgets/toplevel.c
index d700038082..0f12c22f68 100644
--- a/components/rtgui/widgets/toplevel.c
+++ b/components/rtgui/widgets/toplevel.c
@@ -167,7 +167,6 @@ void rtgui_toplevel_update_clip(rtgui_toplevel_t* top)
/* reset toplevel widget clip to extent */
rtgui_region_reset(&(RTGUI_WIDGET(top)->clip), &(RTGUI_WIDGET(top)->extent));
- RTGUI_WIDGET(top)->clip_sync ++;
/* subtract the screen rect */
screen_rect.x1 = screen_rect.y1 = 0;
diff --git a/components/rtgui/widgets/widget.c b/components/rtgui/widgets/widget.c
index e1826c1489..f6edea7338 100644
--- a/components/rtgui/widgets/widget.c
+++ b/components/rtgui/widgets/widget.c
@@ -51,9 +51,8 @@ static void _rtgui_widget_constructor(rtgui_widget_t *widget)
/* set default event handler */
widget->event_handler = rtgui_widget_event_handler;
- /* does not set widget extent and only set clip_sync to zero */
+ /* init clip information */
rtgui_region_init(&(widget->clip));
- widget->clip_sync = 0;
}
/* Destroys the widget */
@@ -71,7 +70,6 @@ static void _rtgui_widget_destructor(rtgui_widget_t *widget)
/* fini clip region */
rtgui_region_fini(&(widget->clip));
- widget->clip_sync = 0;
}
rtgui_type_t *rtgui_widget_type_get(void)
@@ -411,9 +409,6 @@ void rtgui_widget_update_clip(rtgui_widget_t* widget)
/* if there is no parent, do not update clip (please use toplevel widget API) */
if (parent == RT_NULL) return;
- /* increase clip sync */
- widget->clip_sync ++;
-
/* reset clip to extent */
rtgui_region_reset(&(widget->clip), &(widget->extent));