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
This commit is contained in:
chaos.proton@gmail.com 2012-04-20 06:47:38 +00:00
parent b05e37893a
commit df8bebdc55
15 changed files with 45 additions and 35 deletions

View File

@ -31,7 +31,7 @@ struct rtgui_font;
typedef struct rtgui_win rtgui_win_t; typedef struct rtgui_win rtgui_win_t;
typedef struct rtgui_workbench rtgui_workbench_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 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 struct rtgui_point
{ {

View File

@ -77,5 +77,5 @@
//#define RTGUI_USING_DESKTOP_WINDOW //#define RTGUI_USING_DESKTOP_WINDOW
#define RTGUI_EVENT_DEBUG #define RTGUI_EVENT_DEBUG
#undef RTGUI_USING_SMALL_SIZE
#endif #endif

View File

@ -43,7 +43,7 @@ typedef struct rtgui_box rtgui_box_t;
struct rtgui_box* rtgui_box_create(int orientation, rtgui_rect_t* rect); struct rtgui_box* rtgui_box_create(int orientation, rtgui_rect_t* rect);
void rtgui_box_destroy(struct rtgui_box* box); 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_append(rtgui_box_t* box, rtgui_widget_t* widget);
void rtgui_box_layout(rtgui_box_t* box); void rtgui_box_layout(rtgui_box_t* box);

View File

@ -57,7 +57,7 @@ struct rtgui_button
rtgui_image_t *pressed_image, *unpressed_image; rtgui_image_t *pressed_image, *unpressed_image;
/* click button event handler */ /* 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; typedef struct rtgui_button rtgui_button_t;

View File

@ -26,7 +26,7 @@ struct rtgui_checkbox
rt_uint8_t status_down; rt_uint8_t status_down;
/* click button event handler */ /* 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; typedef struct rtgui_checkbox rtgui_checkbox_t;

View File

@ -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)) if ((btn->flag & RTGUI_BUTTON_FLAG_PRESS) && (btn->on_button != RT_NULL))
{ {
/* call on button handler */ /* 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) if (btn->on_button != RT_NULL)
{ {
/* call on button handler */ /* call on button handler */
btn->on_button(widget, event); btn->on_button(RTGUI_OBJECT(widget), event);
} }
#ifndef RTGUI_USING_SMALL_SIZE #ifndef RTGUI_USING_SMALL_SIZE
/* invokes call back */ /* invokes call back */
if (widget->on_mouseclick != RT_NULL && if (widget->on_mouseclick != RT_NULL &&
emouse->button & RTGUI_MOUSE_BUTTON_UP) emouse->button & RTGUI_MOUSE_BUTTON_UP)
return widget->on_mouseclick(widget, event); return widget->on_mouseclick(RTGUI_OBJECT(widget), event);
#endif #endif
} }
} }
@ -175,13 +175,13 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
/* invokes call back */ /* invokes call back */
if (widget->on_mouseclick != RT_NULL && if (widget->on_mouseclick != RT_NULL &&
emouse->button & RTGUI_MOUSE_BUTTON_UP) emouse->button & RTGUI_MOUSE_BUTTON_UP)
return widget->on_mouseclick(widget, event); return widget->on_mouseclick(RTGUI_OBJECT(widget), event);
#endif #endif
if (!(btn->flag & RTGUI_BUTTON_FLAG_PRESS) && (btn->on_button != RT_NULL)) if (!(btn->flag & RTGUI_BUTTON_FLAG_PRESS) && (btn->on_button != RT_NULL))
{ {
/* call on button handler */ /* call on button handler */
btn->on_button(widget, event); btn->on_button(RTGUI_OBJECT(widget), event);
} }
} }

View File

@ -46,7 +46,7 @@ rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui
#ifndef RTGUI_USING_SMALL_SIZE #ifndef RTGUI_USING_SMALL_SIZE
if (widget->on_draw != RT_NULL) if (widget->on_draw != RT_NULL)
{ {
return widget->on_draw(widget, event); return widget->on_draw(RTGUI_OBJECT(widget), event);
} }
else else
#endif #endif
@ -83,12 +83,12 @@ rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui
/* call user callback */ /* call user callback */
if (widget->on_mouseclick != RT_NULL) if (widget->on_mouseclick != RT_NULL)
{ {
return widget->on_mouseclick(widget, event); return widget->on_mouseclick(RTGUI_OBJECT(widget), event);
} }
#endif #endif
if (box->on_button != RT_NULL) if (box->on_button != RT_NULL)
{ {
box->on_button(widget, event); box->on_button(RTGUI_OBJECT(widget), event);
return RT_TRUE; return RT_TRUE;
} }
} }

View File

@ -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) rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui_event* event)
{ {
struct rtgui_combobox *box; struct rtgui_combobox *box;
RTGUI_WIDGET_EVENT_HANDLER_PREPARE
RT_ASSERT(object != RT_NULL);
RT_ASSERT(event != RT_NULL);
box = RTGUI_COMBOBOX(object); 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: case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
rtgui_combobox_ondraw(box); rtgui_combobox_ondraw(box);

View File

@ -49,9 +49,7 @@ DEFINE_CLASS_TYPE(iconbox, "iconbox",
rt_bool_t rtgui_iconbox_event_handler(struct rtgui_object* object, struct rtgui_event* event) rt_bool_t rtgui_iconbox_event_handler(struct rtgui_object* object, struct rtgui_event* event)
{ {
struct rtgui_iconbox* iconbox; struct rtgui_iconbox* iconbox;
RTGUI_WIDGET_EVENT_HANDLER_PREPARE
RT_ASSERT(object != RT_NULL);
RT_ASSERT(event != RT_NULL);
iconbox = RTGUI_ICONBOX(object); 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: case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
{ {

View File

@ -86,7 +86,8 @@ rt_bool_t rtgui_radiobox_event_handler(struct rtgui_object* object, struct rtgui
{ {
case RTGUI_EVENT_PAINT: case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #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; if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(radiobox))) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
{ {
@ -140,7 +142,8 @@ rt_bool_t rtgui_radiobox_event_handler(struct rtgui_object* object, struct rtgui
case RTGUI_EVENT_MOUSE_BUTTON: case RTGUI_EVENT_MOUSE_BUTTON:
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
{ {

View File

@ -274,7 +274,8 @@ rt_bool_t rtgui_scrollbar_event_handler(struct rtgui_object *object,
{ {
case RTGUI_EVENT_PAINT: case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
{ {
@ -289,7 +290,7 @@ rt_bool_t rtgui_scrollbar_event_handler(struct rtgui_object *object,
#ifndef RTGUI_USING_SMALL_SIZE #ifndef RTGUI_USING_SMALL_SIZE
if (widget->on_mouseclick != RT_NULL) if (widget->on_mouseclick != RT_NULL)
{ {
widget->on_mouseclick(widget, event); widget->on_mouseclick(RTGUI_OBJECT(widget), event);
} }
else else
#endif #endif

View File

@ -153,7 +153,8 @@ rt_bool_t rtgui_slider_event_handler(struct rtgui_object *object, struct rtgui_e
{ {
case RTGUI_EVENT_PAINT: case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #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; if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #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; if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
{ {

View File

@ -30,7 +30,8 @@ rt_bool_t rtgui_staticline_event_handler(struct rtgui_object* object, struct rtg
{ {
case RTGUI_EVENT_PAINT: case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
rtgui_theme_draw_staticline(staticline); rtgui_theme_draw_staticline(staticline);

View File

@ -264,8 +264,9 @@ rt_bool_t rtgui_textbox_event_handler(struct rtgui_object* object, struct rtgui_
{ {
case RTGUI_EVENT_PAINT: case RTGUI_EVENT_PAINT:
#ifndef RTGUI_USING_SMALL_SIZE #ifndef RTGUI_USING_SMALL_SIZE
if (widget->on_draw != RT_NULL) widget->on_draw(widget, event); if (widget->on_draw != RT_NULL)
else widget->on_draw(RTGUI_OBJECT(widget), event);
else
#endif #endif
rtgui_theme_draw_textbox(box); rtgui_theme_draw_textbox(box);
break; 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; if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE #ifndef RTGUI_USING_SMALL_SIZE
if (widget->on_mouseclick != RT_NULL) widget->on_mouseclick(widget, event); if (widget->on_mouseclick != RT_NULL)
else widget->on_mouseclick(RTGUI_OBJECT(widget), event);
else
#endif #endif
rtgui_textbox_onmouse(box, (struct rtgui_event_mouse*)event); rtgui_textbox_onmouse(box, (struct rtgui_event_mouse*)event);
return RT_TRUE; 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; if (!RTGUI_WIDGET_IS_ENABLE(widget) || RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
#ifndef RTGUI_USING_SMALL_SIZE #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 else
#endif #endif
rtgui_textbox_onkey(box, (struct rtgui_event_kbd*)event); rtgui_textbox_onkey(box, (struct rtgui_event_kbd*)event);

View File

@ -130,6 +130,7 @@ void demo_view_get_logic_rect(rtgui_container_t* container, rtgui_rect_t *rect)
/* 当是标准版本时这个函数用于返回自动布局引擎box控件 */ /* 当是标准版本时这个函数用于返回自动布局引擎box控件 */
#ifndef RTGUI_USING_SMALL_SIZE #ifndef RTGUI_USING_SMALL_SIZE
#include <rtgui/widgets/box.h>
struct rtgui_box* demo_view_create_box(struct rtgui_container *container, int orient) struct rtgui_box* demo_view_create_box(struct rtgui_container *container, int orient)
{ {
rtgui_rect_t rect; rtgui_rect_t rect;