summaryrefslogtreecommitdiff
path: root/components/rtgui
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-04-20 06:47:38 +0000
committer[email protected] <[email protected]>2012-04-20 06:47:38 +0000
commitdf8bebdc553975b4afc0be738755b62d8573a00f (patch)
tree07aeaaa78a2ed20939d1d24711b43651d3798816 /components/rtgui
parentb05e37893abe3d41be343d04ad5c9f9681c938e4 (diff)
fix compiling warnings and errors ifndef RTGUI_USING_SMALL_SIZE
Thank lgnq for pointing out it. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2096 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui')
-rw-r--r--components/rtgui/include/rtgui/rtgui.h2
-rw-r--r--components/rtgui/include/rtgui/rtgui_config.h2
-rw-r--r--components/rtgui/include/rtgui/widgets/box.h2
-rw-r--r--components/rtgui/include/rtgui/widgets/button.h2
-rw-r--r--components/rtgui/include/rtgui/widgets/checkbox.h2
-rw-r--r--components/rtgui/widgets/button.c10
-rw-r--r--components/rtgui/widgets/checkbox.c6
-rw-r--r--components/rtgui/widgets/combobox.c7
-rw-r--r--components/rtgui/widgets/iconbox.c7
-rw-r--r--components/rtgui/widgets/radiobox.c9
-rw-r--r--components/rtgui/widgets/scrollbar.c5
-rw-r--r--components/rtgui/widgets/slider.c9
-rw-r--r--components/rtgui/widgets/staticline.c3
-rw-r--r--components/rtgui/widgets/textbox.c13
14 files changed, 44 insertions, 35 deletions
diff --git a/components/rtgui/include/rtgui/rtgui.h b/components/rtgui/include/rtgui/rtgui.h
index b473b9d794..d35e17ec5e 100644
--- a/components/rtgui/include/rtgui/rtgui.h
+++ b/components/rtgui/include/rtgui/rtgui.h
@@ -31,7 +31,7 @@ struct rtgui_font;
typedef struct rtgui_win rtgui_win_t;
typedef struct rtgui_workbench rtgui_workbench_t;
typedef rt_bool_t (*rtgui_event_handler_ptr)(struct rtgui_object* widget, struct rtgui_event* event);
-typedef void (*rtgui_onbutton_func_t)(struct rtgui_widget* widget, struct rtgui_event* event);
+typedef void (*rtgui_onbutton_func_t)(struct rtgui_object* object, struct rtgui_event* event);
struct rtgui_point
{
diff --git a/components/rtgui/include/rtgui/rtgui_config.h b/components/rtgui/include/rtgui/rtgui_config.h
index f1dae17ca8..33ae2ee061 100644
--- a/components/rtgui/include/rtgui/rtgui_config.h
+++ b/components/rtgui/include/rtgui/rtgui_config.h
@@ -77,5 +77,5 @@
//#define RTGUI_USING_DESKTOP_WINDOW
#define RTGUI_EVENT_DEBUG
-
+#undef RTGUI_USING_SMALL_SIZE
#endif
diff --git a/components/rtgui/include/rtgui/widgets/box.h b/components/rtgui/include/rtgui/widgets/box.h
index 0e0b814e8b..370b9820d3 100644
--- a/components/rtgui/include/rtgui/widgets/box.h
+++ b/components/rtgui/include/rtgui/widgets/box.h
@@ -43,7 +43,7 @@ typedef struct rtgui_box rtgui_box_t;
struct rtgui_box* rtgui_box_create(int orientation, rtgui_rect_t* rect);
void rtgui_box_destroy(struct rtgui_box* box);
-rt_bool_t rtgui_box_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
+rt_bool_t rtgui_box_event_handler(struct rtgui_object* object, rtgui_event_t* event);
void rtgui_box_append(rtgui_box_t* box, rtgui_widget_t* widget);
void rtgui_box_layout(rtgui_box_t* box);
diff --git a/components/rtgui/include/rtgui/widgets/button.h b/components/rtgui/include/rtgui/widgets/button.h
index 0d7678d358..b149c5a2a2 100644
--- a/components/rtgui/include/rtgui/widgets/button.h
+++ b/components/rtgui/include/rtgui/widgets/button.h
@@ -57,7 +57,7 @@ struct rtgui_button
rtgui_image_t *pressed_image, *unpressed_image;
/* click button event handler */
- void (*on_button)(struct rtgui_widget* widget, rtgui_event_t *event);
+ rtgui_onbutton_func_t on_button;
};
typedef struct rtgui_button rtgui_button_t;
diff --git a/components/rtgui/include/rtgui/widgets/checkbox.h b/components/rtgui/include/rtgui/widgets/checkbox.h
index bf226e061e..c23b5d79a1 100644
--- a/components/rtgui/include/rtgui/widgets/checkbox.h
+++ b/components/rtgui/include/rtgui/widgets/checkbox.h
@@ -26,7 +26,7 @@ struct rtgui_checkbox
rt_uint8_t status_down;
/* click button event handler */
- void (*on_button)(struct rtgui_widget* widget, rtgui_event_t *event);
+ rtgui_onbutton_func_t on_button;
};
typedef struct rtgui_checkbox rtgui_checkbox_t;
diff --git a/components/rtgui/widgets/button.c b/components/rtgui/widgets/button.c
index a10d04ebbf..aab1333b56 100644
--- a/components/rtgui/widgets/button.c
+++ b/components/rtgui/widgets/button.c
@@ -95,7 +95,7 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
if ((btn->flag & RTGUI_BUTTON_FLAG_PRESS) && (btn->on_button != RT_NULL))
{
/* call on button handler */
- btn->on_button(widget, event);
+ btn->on_button(RTGUI_OBJECT(widget), event);
}
}
}
@@ -137,14 +137,14 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
if (btn->on_button != RT_NULL)
{
/* call on button handler */
- btn->on_button(widget, event);
+ btn->on_button(RTGUI_OBJECT(widget), event);
}
#ifndef RTGUI_USING_SMALL_SIZE
/* invokes call back */
if (widget->on_mouseclick != RT_NULL &&
emouse->button & RTGUI_MOUSE_BUTTON_UP)
- return widget->on_mouseclick(widget, event);
+ return widget->on_mouseclick(RTGUI_OBJECT(widget), event);
#endif
}
}
@@ -175,13 +175,13 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
/* invokes call back */
if (widget->on_mouseclick != RT_NULL &&
emouse->button & RTGUI_MOUSE_BUTTON_UP)
- return widget->on_mouseclick(widget, event);
+ return widget->on_mouseclick(RTGUI_OBJECT(widget), event);
#endif
if (!(btn->flag & RTGUI_BUTTON_FLAG_PRESS) && (btn->on_button != RT_NULL))
{
/* call on button handler */
- btn->on_button(widget, event);
+ btn->on_button(RTGUI_OBJECT(widget), event);
}
}
diff --git a/components/rtgui/widgets/checkbox.c b/components/rtgui/widgets/checkbox.c
index 78c3cd97c8..6a682903d0 100644
--- a/components/rtgui/widgets/checkbox.c
+++ b/components/rtgui/widgets/checkbox.c
@@ -46,7 +46,7 @@ rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui
#ifndef RTGUI_USING_SMALL_SIZE
if (widget->on_draw != RT_NULL)
{
- return widget->on_draw(widget, event);
+ return widget->on_draw(RTGUI_OBJECT(widget), event);
}
else
#endif
@@ -83,12 +83,12 @@ rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui
/* call user callback */
if (widget->on_mouseclick != RT_NULL)
{
- return widget->on_mouseclick(widget, event);
+ return widget->on_mouseclick(RTGUI_OBJECT(widget), event);
}
#endif
if (box->on_button != RT_NULL)
{
- box->on_button(widget, event);
+ box->on_button(RTGUI_OBJECT(widget), event);
return RT_TRUE;
}
}
diff --git a/components/rtgui/widgets/combobox.c b/components/rtgui/widgets/combobox.c
index 282a975f08..5b3010677c 100644
--- a/components/rtgui/widgets/combobox.c
+++ b/components/rtgui/widgets/combobox.c
@@ -194,9 +194,7 @@ static rt_bool_t rtgui_combobox_onmouse_button(struct rtgui_combobox* box, struc
rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui_event* event)
{
struct rtgui_combobox *box;
-
- RT_ASSERT(object != RT_NULL);
- RT_ASSERT(event != RT_NULL);
+ RTGUI_WIDGET_EVENT_HANDLER_PREPARE
box = RTGUI_COMBOBOX(object);
@@ -204,7 +202,8 @@ rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui
{
case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
+ if (widget->on_draw != RT_NULL)
+ widget->on_draw(RTGUI_OBJECT(widget), event);
else
#endif
rtgui_combobox_ondraw(box);
diff --git a/components/rtgui/widgets/iconbox.c b/components/rtgui/widgets/iconbox.c
index 1ba74e3ce2..03db07bd83 100644
--- a/components/rtgui/widgets/iconbox.c
+++ b/components/rtgui/widgets/iconbox.c
@@ -49,9 +49,7 @@ DEFINE_CLASS_TYPE(iconbox, "iconbox",
rt_bool_t rtgui_iconbox_event_handler(struct rtgui_object* object, struct rtgui_event* event)
{
struct rtgui_iconbox* iconbox;
-
- RT_ASSERT(object != RT_NULL);
- RT_ASSERT(event != RT_NULL);
+ RTGUI_WIDGET_EVENT_HANDLER_PREPARE
iconbox = RTGUI_ICONBOX(object);
@@ -59,7 +57,8 @@ rt_bool_t rtgui_iconbox_event_handler(struct rtgui_object* object, struct rtgui_
{
case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
+ if (widget->on_draw != RT_NULL)
+ widget->on_draw(RTGUI_OBJECT(widget), event);
else
#endif
{
diff --git a/components/rtgui/widgets/radiobox.c b/components/rtgui/widgets/radiobox.c
index b886c584c4..b1def7af01 100644
--- a/components/rtgui/widgets/radiobox.c
+++ b/components/rtgui/widgets/radiobox.c
@@ -86,7 +86,8 @@ rt_bool_t rtgui_radiobox_event_handler(struct rtgui_object* object, struct rtgui
{
case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
+ if (widget->on_draw != RT_NULL)
+ widget->on_draw(RTGUI_OBJECT(widget), event);
else
#endif
{
@@ -99,7 +100,8 @@ rt_bool_t rtgui_radiobox_event_handler(struct rtgui_object* object, struct rtgui
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(radiobox))) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_key != RT_NULL) widget->on_key(widget, event);
+ if (widget->on_key != RT_NULL)
+ widget->on_key(RTGUI_OBJECT(widget), event);
else
#endif
{
@@ -140,7 +142,8 @@ rt_bool_t rtgui_radiobox_event_handler(struct rtgui_object* object, struct rtgui
case RTGUI_EVENT_MOUSE_BUTTON:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_mouseclick != RT_NULL) widget->on_mouseclick(widget, event);
+ if (widget->on_mouseclick != RT_NULL)
+ widget->on_mouseclick(RTGUI_OBJECT(widget), event);
else
#endif
{
diff --git a/components/rtgui/widgets/scrollbar.c b/components/rtgui/widgets/scrollbar.c
index 58a3017b3c..257591a028 100644
--- a/components/rtgui/widgets/scrollbar.c
+++ b/components/rtgui/widgets/scrollbar.c
@@ -274,7 +274,8 @@ rt_bool_t rtgui_scrollbar_event_handler(struct rtgui_object *object,
{
case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
+ if (widget->on_draw != RT_NULL)
+ widget->on_draw(RTGUI_OBJECT(widget), event);
else
#endif
{
@@ -289,7 +290,7 @@ rt_bool_t rtgui_scrollbar_event_handler(struct rtgui_object *object,
#ifndef RTGUI_USING_SMALL_SIZE
if (widget->on_mouseclick != RT_NULL)
{
- widget->on_mouseclick(widget, event);
+ widget->on_mouseclick(RTGUI_OBJECT(widget), event);
}
else
#endif
diff --git a/components/rtgui/widgets/slider.c b/components/rtgui/widgets/slider.c
index 30d29d84f9..ca71fdfaad 100644
--- a/components/rtgui/widgets/slider.c
+++ b/components/rtgui/widgets/slider.c
@@ -153,7 +153,8 @@ rt_bool_t rtgui_slider_event_handler(struct rtgui_object *object, struct rtgui_e
{
case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
+ if (widget->on_draw != RT_NULL)
+ widget->on_draw(RTGUI_OBJECT(widget), event);
else
#endif
{
@@ -166,7 +167,8 @@ rt_bool_t rtgui_slider_event_handler(struct rtgui_object *object, struct rtgui_e
if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_key != RT_NULL) widget->on_key(widget, event);
+ if (widget->on_key != RT_NULL)
+ widget->on_key(RTGUI_OBJECT(widget), event);
else
#endif
{
@@ -178,7 +180,8 @@ rt_bool_t rtgui_slider_event_handler(struct rtgui_object *object, struct rtgui_e
if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_mouseclick != RT_NULL) widget->on_mouseclick(widget, event);
+ if (widget->on_mouseclick != RT_NULL)
+ widget->on_mouseclick(RTGUI_OBJECT(widget), event);
else
#endif
{
diff --git a/components/rtgui/widgets/staticline.c b/components/rtgui/widgets/staticline.c
index 19a1caed49..10bdd8bad8 100644
--- a/components/rtgui/widgets/staticline.c
+++ b/components/rtgui/widgets/staticline.c
@@ -30,7 +30,8 @@ rt_bool_t rtgui_staticline_event_handler(struct rtgui_object* object, struct rtg
{
case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
+ if (widget->on_draw != RT_NULL)
+ widget->on_draw(RTGUI_OBJECT(widget), event);
else
#endif
rtgui_theme_draw_staticline(staticline);
diff --git a/components/rtgui/widgets/textbox.c b/components/rtgui/widgets/textbox.c
index 15f2bd44ef..a28b3ec5f9 100644
--- a/components/rtgui/widgets/textbox.c
+++ b/components/rtgui/widgets/textbox.c
@@ -264,8 +264,9 @@ rt_bool_t rtgui_textbox_event_handler(struct rtgui_object* object, struct rtgui_
{
case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_draw != RT_NULL) widget->on_draw(widget, event);
- else
+ if (widget->on_draw != RT_NULL)
+ widget->on_draw(RTGUI_OBJECT(widget), event);
+ else
#endif
rtgui_theme_draw_textbox(box);
break;
@@ -274,8 +275,9 @@ rt_bool_t rtgui_textbox_event_handler(struct rtgui_object* object, struct rtgui_
if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_mouseclick != RT_NULL) widget->on_mouseclick(widget, event);
- else
+ if (widget->on_mouseclick != RT_NULL)
+ widget->on_mouseclick(RTGUI_OBJECT(widget), event);
+ else
#endif
rtgui_textbox_onmouse(box, (struct rtgui_event_mouse*)event);
return RT_TRUE;
@@ -284,7 +286,8 @@ rt_bool_t rtgui_textbox_event_handler(struct rtgui_object* object, struct rtgui_
if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_key != RT_NULL) widget->on_key(widget, event);
+ if (widget->on_key != RT_NULL)
+ widget->on_key(RTGUI_OBJECT(widget), event);
else
#endif
rtgui_textbox_onkey(box, (struct rtgui_event_kbd*)event);