fix some compiling warning, errors in the new object system.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1425 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
712aacd367
commit
a876302695
|
@ -34,7 +34,7 @@ DEFINE_CLASS_TYPE(type, "object",
|
||||||
_rtgui_object_destructor,
|
_rtgui_object_destructor,
|
||||||
sizeof(struct rtgui_object));
|
sizeof(struct rtgui_object));
|
||||||
|
|
||||||
void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object)
|
void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object)
|
||||||
{
|
{
|
||||||
/* first call parent's type */
|
/* first call parent's type */
|
||||||
if (type->parent != RT_NULL)
|
if (type->parent != RT_NULL)
|
||||||
|
@ -43,32 +43,38 @@ void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object)
|
||||||
if (type->constructor) type->constructor(object);
|
if (type->constructor) type->constructor(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtgui_type_destructors_call(rtgui_type_t *type, rtgui_object_t *object)
|
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object)
|
||||||
{
|
{
|
||||||
while (type)
|
const rtgui_type_t *t;
|
||||||
|
|
||||||
|
t = type;
|
||||||
|
while (t)
|
||||||
{
|
{
|
||||||
if (type->destructor) type->destructor(object);
|
if (t->destructor) t->destructor(object);
|
||||||
type = type->parent;
|
t = t->parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rt_bool_t rtgui_type_inherits_from(rtgui_type_t *type, rtgui_type_t *parent)
|
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent)
|
||||||
{
|
{
|
||||||
while (type)
|
const rtgui_type_t *t;
|
||||||
|
|
||||||
|
t = type;
|
||||||
|
while (t)
|
||||||
{
|
{
|
||||||
if (type == parent) return RT_TRUE;
|
if (t == parent) return RT_TRUE;
|
||||||
type = type->parent;
|
t = t->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtgui_type_t *rtgui_type_parent_type_get(rtgui_type_t *type)
|
const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type)
|
||||||
{
|
{
|
||||||
return type->parent;
|
return type->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *rtgui_type_name_get(rtgui_type_t *type)
|
const char *rtgui_type_name_get(const rtgui_type_t *type)
|
||||||
{
|
{
|
||||||
if (!type) return RT_NULL;
|
if (!type) return RT_NULL;
|
||||||
|
|
||||||
|
@ -165,7 +171,7 @@ rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *obj, rtgui_type_t *obj_t
|
||||||
* @param object an object
|
* @param object an object
|
||||||
* @return Returns the type of @a object (RT_NULL on failure)
|
* @return Returns the type of @a object (RT_NULL on failure)
|
||||||
*/
|
*/
|
||||||
rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object)
|
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object)
|
||||||
{
|
{
|
||||||
if (!object) return RT_NULL;
|
if (!object) return RT_NULL;
|
||||||
|
|
||||||
|
|
|
@ -60,16 +60,16 @@ typedef struct rtgui_type rtgui_type_t;
|
||||||
const struct rtgui_type _rtgui_##type = { \
|
const struct rtgui_type _rtgui_##type = { \
|
||||||
name, \
|
name, \
|
||||||
parent, \
|
parent, \
|
||||||
constructor, \
|
RTGUI_CONSTRUCTOR(constructor), \
|
||||||
destructor, \
|
RTGUI_DESTRUCTOR(destructor), \
|
||||||
size }
|
size }
|
||||||
|
|
||||||
void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object);
|
void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object);
|
||||||
void rtgui_type_destructors_call(rtgui_type_t *type, rtgui_object_t *object);
|
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object);
|
||||||
rt_bool_t rtgui_type_inherits_from(rtgui_type_t *type, rtgui_type_t *parent);
|
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent);
|
||||||
rtgui_type_t *rtgui_type_parent_type_get(rtgui_type_t *type);
|
const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type);
|
||||||
const char *rtgui_type_name_get(rtgui_type_t *type);
|
const char *rtgui_type_name_get(const rtgui_type_t *type);
|
||||||
rtgui_type_t *rtgui_type_get_from_name(const char *name);
|
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object);
|
||||||
|
|
||||||
#ifdef RTGUI_USING_CAST_CHECK
|
#ifdef RTGUI_USING_CAST_CHECK
|
||||||
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
|
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
|
||||||
|
|
|
@ -120,12 +120,10 @@ rt_bool_t rtgui_container_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
|
||||||
/* handle in child widget */
|
/* handle in child widget */
|
||||||
return rtgui_container_dispatch_mouse_event(container,
|
return rtgui_container_dispatch_mouse_event(container,
|
||||||
(struct rtgui_event_mouse*)event);
|
(struct rtgui_event_mouse*)event);
|
||||||
break;
|
|
||||||
|
|
||||||
case RTGUI_EVENT_MOUSE_MOTION:
|
case RTGUI_EVENT_MOUSE_MOTION:
|
||||||
return rtgui_container_dispatch_mouse_event(container,
|
return rtgui_container_dispatch_mouse_event(container,
|
||||||
(struct rtgui_event_mouse*)event);
|
(struct rtgui_event_mouse*)event);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* call parent widget event handler */
|
/* call parent widget event handler */
|
||||||
|
|
|
@ -137,10 +137,6 @@ static void _rtgui_menu_item_ondraw(struct rtgui_listctrl *list, struct rtgui_dc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _rtgui_menu_item_onmouse()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_CLASS_TYPE(menu, "menu",
|
DEFINE_CLASS_TYPE(menu, "menu",
|
||||||
RTGUI_WIDGET_TYPE,
|
RTGUI_WIDGET_TYPE,
|
||||||
_rtgui_menu_constructor,
|
_rtgui_menu_constructor,
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <rtgui/rtgui_system.h>
|
#include <rtgui/rtgui_system.h>
|
||||||
#include <rtgui/widgets/toplevel.h>
|
#include <rtgui/widgets/toplevel.h>
|
||||||
|
extern void rtgui_topwin_do_clip(rtgui_widget_t* widget);
|
||||||
|
|
||||||
static void _rtgui_toplevel_constructor(rtgui_toplevel_t *toplevel)
|
static void _rtgui_toplevel_constructor(rtgui_toplevel_t *toplevel)
|
||||||
{
|
{
|
||||||
|
@ -100,7 +101,6 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev
|
||||||
|
|
||||||
void rtgui_toplevel_update_clip(rtgui_toplevel_t* top)
|
void rtgui_toplevel_update_clip(rtgui_toplevel_t* top)
|
||||||
{
|
{
|
||||||
rt_uint32_t idx;
|
|
||||||
rtgui_container_t* container;
|
rtgui_container_t* container;
|
||||||
struct rtgui_list_node* node;
|
struct rtgui_list_node* node;
|
||||||
rtgui_rect_t screen_rect;
|
rtgui_rect_t screen_rect;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <rtgui/widgets/widget.h>
|
#include <rtgui/widgets/widget.h>
|
||||||
#include <rtgui/widgets/window.h>
|
#include <rtgui/widgets/window.h>
|
||||||
#include <rtgui/widgets/view.h>
|
#include <rtgui/widgets/view.h>
|
||||||
|
extern void rtgui_topwin_do_clip(rtgui_widget_t* widget);
|
||||||
|
|
||||||
static void _rtgui_widget_constructor(rtgui_widget_t *widget)
|
static void _rtgui_widget_constructor(rtgui_widget_t *widget)
|
||||||
{
|
{
|
||||||
|
@ -494,8 +495,6 @@ void rtgui_widget_show(rtgui_widget_t* widget)
|
||||||
|
|
||||||
void rtgui_widget_hide(rtgui_widget_t* widget)
|
void rtgui_widget_hide(rtgui_widget_t* widget)
|
||||||
{
|
{
|
||||||
rtgui_rect_t rect;
|
|
||||||
|
|
||||||
/* hide this widget */
|
/* hide this widget */
|
||||||
RTGUI_WIDGET_HIDE(widget);
|
RTGUI_WIDGET_HIDE(widget);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue