diff options
| author | bernard.xiong <[email protected]> | 2011-05-13 10:53:51 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2011-05-13 10:53:51 +0000 |
| commit | 8457439dc1271e9d9d7551eff3efd32a9a55942b (patch) | |
| tree | 1d843d279ad397e9036927519c453648c3a152bf /components/rtgui/include | |
| parent | 169c31fc4f22c12f1b74b17aec9d44ed65a752b9 (diff) | |
use new object type implementation.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1402 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/include')
29 files changed, 79 insertions, 78 deletions
diff --git a/components/rtgui/include/rtgui/event.h b/components/rtgui/include/rtgui/event.h index 1b0a6d1022..09bc80a6bb 100644 --- a/components/rtgui/include/rtgui/event.h +++ b/components/rtgui/include/rtgui/event.h @@ -275,6 +275,7 @@ struct rtgui_event_paint struct rtgui_event parent;
rtgui_win_t* wid; /* destination window */
+ rtgui_rect_t rect; /* rect to be updated */
};
struct rtgui_timer;
diff --git a/components/rtgui/include/rtgui/rtgui_object.h b/components/rtgui/include/rtgui/rtgui_object.h index 05104f8dd9..2010d9b403 100644 --- a/components/rtgui/include/rtgui/rtgui_object.h +++ b/components/rtgui/include/rtgui/rtgui_object.h @@ -42,9 +42,8 @@ struct rtgui_type /* type name */
char* name;
- /* hierarchy and depth */
- struct rtgui_type **hierarchy;
- int hierarchy_depth;
+ /* parent type link */
+ struct rtgui_type *parent;
/* constructor and destructor */
rtgui_constructor_t constructor;
@@ -54,11 +53,16 @@ struct rtgui_type int size;
};
typedef struct rtgui_type rtgui_type_t;
+#define RTGUI_TYPE(type) (struct rtgui_type*)&(_rtgui_##type)
-rtgui_type_t *rtgui_type_create(const char *type_name, rtgui_type_t *parent_type,
- int type_size, rtgui_constructor_t constructor,
- rtgui_destructor_t destructor);
-void rtgui_type_destroy(rtgui_type_t *type);
+#define DECLARE_CLASS_TYPE(type) extern const struct rtgui_type _rtgui_##type
+#define DEFINE_CLASS_TYPE(type, name, parent, constructor, destructor, size) \
+ const struct rtgui_type _rtgui_##type = { \
+ name, \
+ parent, \
+ constructor, \
+ destructor, \
+ size }
void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object);
void rtgui_type_destructors_call(rtgui_type_t *type, rtgui_object_t *object);
@@ -68,17 +72,18 @@ const char *rtgui_type_name_get(rtgui_type_t *type); rtgui_type_t *rtgui_type_get_from_name(const char *name);
#ifdef RTGUI_USING_CAST_CHECK
- #define RTGUI_OBJECT_CAST(obj, rtgui_type_t, c_type) \
- ((c_type *)rtgui_object_check_cast((rtgui_object_t *)(obj), (rtgui_type_t)))
+ #define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
+ ((c_type *)rtgui_object_check_cast((rtgui_object_t *)(obj), (obj_type)))
#else
- #define RTGUI_OBJECT_CAST(obj, rtgui_type_t, c_type) ((c_type *)(obj))
+ #define RTGUI_OBJECT_CAST(obj, obj_type, c_type) ((c_type *)(obj))
#endif
#define RTGUI_OBJECT_CHECK_TYPE(_obj, _type) \
(rtgui_type_inherits_from(((rtgui_object_t *)(_obj))->type, (_type)))
+DECLARE_CLASS_TYPE(type);
/** Gets the type of an object */
-#define RTGUI_OBJECT_TYPE (rtgui_object_type_get())
+#define RTGUI_OBJECT_TYPE RTGUI_TYPE(type)
/** Casts the object to an rtgui_object_t */
#define RTGUI_OBJECT(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_OBJECT_TYPE, rtgui_object_t))
/** Checks if the object is an rtgui_Object */
@@ -88,7 +93,7 @@ rtgui_type_t *rtgui_type_get_from_name(const char *name); struct rtgui_object
{
/* object type */
- rtgui_type_t* type;
+ const rtgui_type_t* type;
rt_bool_t is_static;
};
diff --git a/components/rtgui/include/rtgui/rtgui_server.h b/components/rtgui/include/rtgui/rtgui_server.h index ebb4807194..f5c798fbee 100644 --- a/components/rtgui/include/rtgui/rtgui_server.h +++ b/components/rtgui/include/rtgui/rtgui_server.h @@ -63,7 +63,6 @@ typedef struct rtgui_topwin rtgui_topwin_t; /* top win manager init */
void rtgui_topwin_init(void);
-void rtgui_panel_init (void);
void rtgui_server_init(void);
/* post an event to server */
diff --git a/components/rtgui/include/rtgui/widgets/about_view.h b/components/rtgui/include/rtgui/widgets/about_view.h index 52f6ca23a0..9058d84bb7 100644 --- a/components/rtgui/include/rtgui/widgets/about_view.h +++ b/components/rtgui/include/rtgui/widgets/about_view.h @@ -20,8 +20,9 @@ #include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h>
+DECLARE_CLASS_TYPE(aboutview);
/** Gets the type of a about view */
-#define RTGUI_ABOUT_VIEW_TYPE (rtgui_about_view_type_get())
+#define RTGUI_ABOUT_VIEW_TYPE (RTGUI_TYPE(aboutview))
/** Casts the object to a about view */
#define RTGUI_ABOUT_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_ABOUT_VIEW_TYPE, rtgui_about_view_t))
/** Checks if the object is a about view */
diff --git a/components/rtgui/include/rtgui/widgets/box.h b/components/rtgui/include/rtgui/widgets/box.h index 8c963b26f0..a58f07568e 100644 --- a/components/rtgui/include/rtgui/widgets/box.h +++ b/components/rtgui/include/rtgui/widgets/box.h @@ -22,8 +22,10 @@ extern "C" {
#endif
+DECLARE_CLASS_TYPE(box);
+
/** Gets the type of a box */
-#define RTGUI_BOX_TYPE (rtgui_box_type_get())
+#define RTGUI_BOX_TYPE (RTGUI_TYPE(box))
/** Casts the object to an rtgui_box */
#define RTGUI_BOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_BOX_TYPE, rtgui_box_t))
/** Checks if the object is an rtgui_box */
@@ -38,8 +40,6 @@ struct rtgui_box };
typedef struct rtgui_box rtgui_box_t;
-rtgui_type_t *rtgui_box_type_get(void);
-
struct rtgui_box* rtgui_box_create(int orientation, rtgui_rect_t* rect);
void rtgui_box_destroy(struct rtgui_box* box);
diff --git a/components/rtgui/include/rtgui/widgets/button.h b/components/rtgui/include/rtgui/widgets/button.h index 989f753643..cab0fcaf01 100644 --- a/components/rtgui/include/rtgui/widgets/button.h +++ b/components/rtgui/include/rtgui/widgets/button.h @@ -27,8 +27,10 @@ extern "C" { * @{
*/
+DECLARE_CLASS_TYPE(button);
+
/** Gets the type of a button */
-#define RTGUI_BUTTON_TYPE (rtgui_button_type_get())
+#define RTGUI_BUTTON_TYPE (RTGUI_TYPE(button))
/** Casts the object to an rtgui_button */
#define RTGUI_BUTTON(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_BUTTON_TYPE, rtgui_button_t))
/** Checks if the object is an rtgui_button */
@@ -59,8 +61,6 @@ struct rtgui_button };
typedef struct rtgui_button rtgui_button_t;
-rtgui_type_t *rtgui_button_type_get(void);
-
rtgui_button_t* rtgui_button_create(const char* text);
rtgui_button_t* rtgui_pushbutton_create(const char* text);
void rtgui_button_destroy(rtgui_button_t* btn);
diff --git a/components/rtgui/include/rtgui/widgets/checkbox.h b/components/rtgui/include/rtgui/widgets/checkbox.h index 0cbe7c9e34..554a00d9f9 100644 --- a/components/rtgui/include/rtgui/widgets/checkbox.h +++ b/components/rtgui/include/rtgui/widgets/checkbox.h @@ -5,8 +5,10 @@ #include <rtgui/widgets/widget.h>
#include <rtgui/widgets/label.h>
-/** Gets the type of a button */
-#define RTGUI_CHECKBOX_TYPE (rtgui_checkbox_type_get())
+DECLARE_CLASS_TYPE(checkbox);
+
+/** Gets the type of a checkbox */
+#define RTGUI_CHECKBOX_TYPE (RTGUI_TYPE(checkbox))
/** Casts the object to an rtgui_button */
#define RTGUI_CHECKBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_CHECKBOX_TYPE, rtgui_checkbox))
/** Checks if the object is an rtgui_button */
@@ -28,8 +30,6 @@ struct rtgui_checkbox };
typedef struct rtgui_checkbox rtgui_checkbox_t;
-rtgui_type_t *rtgui_checkbox_type_get(void);
-
rtgui_checkbox_t* rtgui_checkbox_create(const char* text, rt_bool_t checked);
void rtgui_checkbox_destroy(rtgui_checkbox_t* checkbox);
diff --git a/components/rtgui/include/rtgui/widgets/combobox.h b/components/rtgui/include/rtgui/widgets/combobox.h index 36895dc1a7..2409d7fb5c 100644 --- a/components/rtgui/include/rtgui/widgets/combobox.h +++ b/components/rtgui/include/rtgui/widgets/combobox.h @@ -6,8 +6,9 @@ #include <rtgui/widgets/window.h>
#include <rtgui/widgets/listbox.h>
+DECLARE_CLASS_TYPE(combobox);
/** Gets the type of a combobox */
-#define RTGUI_COMBOBOX_TYPE (rtgui_combobox_type_get())
+#define RTGUI_COMBOBOX_TYPE (RTGUI_TYPE(combobox))
/** Casts the object to a rtgui_combobox */
#define RTGUI_COMBOBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_COMBOBOX_TYPE, rtgui_combobox_t))
/** Checks if the object is a rtgui_combobox */
@@ -37,7 +38,6 @@ struct rtgui_combobox };
typedef struct rtgui_combobox rtgui_combobox_t;
-rtgui_type_t *rtgui_combobox_type_get(void);
rtgui_combobox_t *rtgui_combobox_create(struct rtgui_listbox_item* items, rt_uint16_t counter, struct rtgui_rect* rect);
void rtgui_combobox_destroy(rtgui_combobox_t* box);
diff --git a/components/rtgui/include/rtgui/widgets/container.h b/components/rtgui/include/rtgui/widgets/container.h index 4cd1bb0a30..09a79d71d6 100644 --- a/components/rtgui/include/rtgui/widgets/container.h +++ b/components/rtgui/include/rtgui/widgets/container.h @@ -16,8 +16,9 @@ #include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(container);
/** Gets the type of a container */
-#define RTGUI_CONTAINER_TYPE (rtgui_container_type_get())
+#define RTGUI_CONTAINER_TYPE (RTGUI_TYPE(container))
/** Casts the object to a rtgui_container */
#define RTGUI_CONTAINER(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_CONTAINER_TYPE, rtgui_container_t))
/** Checks if the object is a rtgui_container */
@@ -33,8 +34,6 @@ struct rtgui_container };
typedef struct rtgui_container rtgui_container_t;
-rtgui_type_t *rtgui_container_type_get(void);
-
void rtgui_container_add_child(rtgui_container_t *container, rtgui_widget_t* child);
void rtgui_container_remove_child(rtgui_container_t *container, rtgui_widget_t* child);
void rtgui_container_destroy_children(rtgui_container_t *container);
diff --git a/components/rtgui/include/rtgui/widgets/filelist_view.h b/components/rtgui/include/rtgui/widgets/filelist_view.h index 0249f31c3e..6be873efc9 100644 --- a/components/rtgui/include/rtgui/widgets/filelist_view.h +++ b/components/rtgui/include/rtgui/widgets/filelist_view.h @@ -14,8 +14,9 @@ struct rtgui_file_item rt_uint32_t size;
};
+DECLARE_CLASS_TYPE(filelist);
/** Gets the type of a filelist view */
-#define RTGUI_FILELIST_VIEW_TYPE (rtgui_filelist_view_type_get())
+#define RTGUI_FILELIST_VIEW_TYPE (RTGUI_TYPE(filelist))
/** Casts the object to a filelist */
#define RTGUI_FILELIST_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_FILELIST_VIEW_TYPE, rtgui_filelist_view_t))
/** Checks if the object is a filelist view */
@@ -43,8 +44,6 @@ struct rtgui_filelist_view };
typedef struct rtgui_filelist_view rtgui_filelist_view_t;
-rtgui_type_t *rtgui_filelist_view_type_get(void);
-
rtgui_filelist_view_t* rtgui_filelist_view_create(rtgui_workbench_t* workbench,
const char* directory, const char* pattern, const rtgui_rect_t* rect);
void rtgui_filelist_view_destroy(rtgui_filelist_view_t* view);
diff --git a/components/rtgui/include/rtgui/widgets/iconbox.h b/components/rtgui/include/rtgui/widgets/iconbox.h index c6807e2a9b..9ce5fee57c 100644 --- a/components/rtgui/include/rtgui/widgets/iconbox.h +++ b/components/rtgui/include/rtgui/widgets/iconbox.h @@ -18,8 +18,9 @@ #include <rtgui/image.h>
#include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(iconbox);
/** Gets the type of a iconbox */
-#define RTGUI_ICONBOX_TYPE (rtgui_iconbox_type_get())
+#define RTGUI_ICONBOX_TYPE (RTGUI_TYPE(iconbox))
/** Casts the object to a rtgui_iconbox */
#define RTGUI_ICONBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_ICONBOX_TYPE, rtgui_iconbox_t))
/** Checks if the object is a rtgui_iconbox */
@@ -44,8 +45,6 @@ struct rtgui_iconbox };
typedef struct rtgui_iconbox rtgui_iconbox_t;
-rtgui_type_t *rtgui_iconbox_type_get(void);
-
struct rtgui_iconbox* rtgui_iconbox_create(struct rtgui_image* image, const char* text, int position);
void rtgui_iconbox_destroy(struct rtgui_iconbox* iconbox);
diff --git a/components/rtgui/include/rtgui/widgets/label.h b/components/rtgui/include/rtgui/widgets/label.h index cced499f86..e19c15984d 100644 --- a/components/rtgui/include/rtgui/widgets/label.h +++ b/components/rtgui/include/rtgui/widgets/label.h @@ -17,8 +17,10 @@ #include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(label);
+
/** Gets the type of a button */
-#define RTGUI_LABEL_TYPE (rtgui_label_type_get())
+#define RTGUI_LABEL_TYPE (RTGUI_TYPE(label))
/** Casts the object to an rtgui_button */
#define RTGUI_LABEL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_LABEL_TYPE, rtgui_label_t))
/** Checks if the object is an rtgui_button */
@@ -36,8 +38,6 @@ struct rtgui_label };
typedef struct rtgui_label rtgui_label_t;
-rtgui_type_t *rtgui_label_type_get(void);
-
rtgui_label_t* rtgui_label_create(const char* text);
void rtgui_label_destroy(rtgui_label_t* label);
diff --git a/components/rtgui/include/rtgui/widgets/list_view.h b/components/rtgui/include/rtgui/widgets/list_view.h index 1a55043ac8..09f6520b71 100644 --- a/components/rtgui/include/rtgui/widgets/list_view.h +++ b/components/rtgui/include/rtgui/widgets/list_view.h @@ -31,8 +31,9 @@ struct rtgui_list_item void *parameter;
};
+DECLARE_CLASS_TYPE(listview);
/** Gets the type of a list view */
-#define RTGUI_LIST_VIEW_TYPE (rtgui_list_view_type_get())
+#define RTGUI_LIST_VIEW_TYPE (RTGUI_TYPE(listview))
/** Casts the object to a filelist */
#define RTGUI_LIST_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_LIST_VIEW_TYPE, rtgui_list_view_t))
/** Checks if the object is a filelist view */
diff --git a/components/rtgui/include/rtgui/widgets/listbox.h b/components/rtgui/include/rtgui/widgets/listbox.h index dd1e6af154..d53ed84540 100644 --- a/components/rtgui/include/rtgui/widgets/listbox.h +++ b/components/rtgui/include/rtgui/widgets/listbox.h @@ -26,8 +26,9 @@ struct rtgui_listbox_item rtgui_image_t *image;
};
+DECLARE_CLASS_TYPE(listbox);
/** Gets the type of a list box */
-#define RTGUI_LISTBOX_TYPE (rtgui_listbox_type_get())
+#define RTGUI_LISTBOX_TYPE (RTGUI_TYPE(listbox))
/** Casts the object to a filelist */
#define RTGUI_LISTBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_LISTBOX_TYPE, rtgui_listbox_t))
/** Checks if the object is a filelist box */
@@ -54,8 +55,6 @@ struct rtgui_listbox typedef struct rtgui_listbox rtgui_listbox_t;
typedef void (*rtgui_onitem_func_t)(struct rtgui_widget* widget, rtgui_event_t *event);
-rtgui_type_t *rtgui_listbox_type_get(void);
-
rtgui_listbox_t* rtgui_listbox_create(const struct rtgui_listbox_item* items, rt_uint16_t count,
rtgui_rect_t *rect);
void rtgui_listbox_destroy(rtgui_listbox_t* box);
diff --git a/components/rtgui/include/rtgui/widgets/listctrl.h b/components/rtgui/include/rtgui/widgets/listctrl.h index c2ce9871d0..ad3bb924cb 100644 --- a/components/rtgui/include/rtgui/widgets/listctrl.h +++ b/components/rtgui/include/rtgui/widgets/listctrl.h @@ -20,8 +20,9 @@ #include <rtgui/rtgui_system.h>
#include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(listctrl);
/** Gets the type of a listctrl */
-#define RTGUI_LISTCTRL_TYPE (rtgui_listctrl_type_get())
+#define RTGUI_LISTCTRL_TYPE (RTGUI_TYPE(listctrl))
/** Casts the object to a listctrl */
#define RTGUI_LISTCTRL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_LISTCTRL_TYPE, rtgui_listctrl_t))
/** Checks if the object is a listctrl */
diff --git a/components/rtgui/include/rtgui/widgets/menu.h b/components/rtgui/include/rtgui/widgets/menu.h index f6c422bb19..629fb84e46 100644 --- a/components/rtgui/include/rtgui/widgets/menu.h +++ b/components/rtgui/include/rtgui/widgets/menu.h @@ -33,8 +33,9 @@ struct rtgui_menu_item };
typedef struct rtgui_menu_item rtgui_menu_item_t;
+DECLARE_CLASS_TYPE(menu);
/** Gets the type of a menu */
-#define RTGUI_MENU_TYPE (rtgui_menu_type_get())
+#define RTGUI_MENU_TYPE (RTGUI_TYPE(menu))
/** Casts the object to an rtgui_menu */
#define RTGUI_MENU(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_MENU_TYPE, rtgui_menu_t))
/** Checks if the object is an rtgui_menu */
diff --git a/components/rtgui/include/rtgui/widgets/notebook.h b/components/rtgui/include/rtgui/widgets/notebook.h index ea203599a9..e14c895647 100644 --- a/components/rtgui/include/rtgui/widgets/notebook.h +++ b/components/rtgui/include/rtgui/widgets/notebook.h @@ -4,8 +4,9 @@ #include <rtgui/rtgui.h>
#include <rtgui/widgets/container.h>
+DECLARE_CLASS_TYPE(notebook);
/** Gets the type of a notebook */
-#define RTGUI_NOTEBOOK_TYPE (rtgui_notebook_type_get())
+#define RTGUI_NOTEBOOK_TYPE (RTGUI_TYPE(notebook))
/** Casts the object to a notebook control */
#define RTGUI_NOTEBOOK(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_NOTEBOOK_TYPE, rtgui_notebook_t))
/** Checks if the object is a notebook control */
diff --git a/components/rtgui/include/rtgui/widgets/progressbar.h b/components/rtgui/include/rtgui/widgets/progressbar.h index c56d72dcf4..ef2ccc9db5 100644 --- a/components/rtgui/include/rtgui/widgets/progressbar.h +++ b/components/rtgui/include/rtgui/widgets/progressbar.h @@ -4,8 +4,9 @@ #include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(progressbar);
/** Gets the type of a progressbar */
-#define RTGUI_PROGRESSBAR_TYPE (rtgui_progressbar_type_get())
+#define RTGUI_PROGRESSBAR_TYPE (RTGUI_TYPE(progressbar))
/** Casts the object to a rtgui_progressbar */
#define RTGUI_PROGRESSBAR(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_PROGRESSBAR_TYPE, rtgui_progressbar_t))
/** Checks if the object is a rtgui_progressbar */
@@ -25,8 +26,6 @@ struct rtgui_progressbar };
typedef struct rtgui_progressbar rtgui_progressbar_t;
-rtgui_type_t *rtgui_progressbar_type_get(void);
-
struct rtgui_progressbar* rtgui_progressbar_create(int orientation, int range, rtgui_rect_t* r);
void rtgui_progressbar_destroy(struct rtgui_progressbar* p_bar);
diff --git a/components/rtgui/include/rtgui/widgets/radiobox.h b/components/rtgui/include/rtgui/widgets/radiobox.h index a0ffd095a3..e0f68bfca0 100644 --- a/components/rtgui/include/rtgui/widgets/radiobox.h +++ b/components/rtgui/include/rtgui/widgets/radiobox.h @@ -4,8 +4,9 @@ #include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(radiobox);
/** Gets the type of a radiobox */
-#define RTGUI_RADIOBOX_TYPE (rtgui_radiobox_type_get())
+#define RTGUI_RADIOBOX_TYPE (RTGUI_TYPE(radiobox))
/** Casts the object to an rtgui_radiobox */
#define RTGUI_RADIOBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_RADIOBOX_TYPE, rtgui_radiobox_t))
/** Checks if the object is an rtgui_radiobox */
@@ -30,8 +31,6 @@ struct rtgui_radiobox };
typedef struct rtgui_radiobox rtgui_radiobox_t;
-rtgui_type_t *rtgui_radiobox_type_get(void);
-
struct rtgui_radiobox* rtgui_radiobox_create(const char* label, int orient, char** radio_items, int number);
void rtgui_radiobox_destroy(struct rtgui_radiobox* radiobox);
diff --git a/components/rtgui/include/rtgui/widgets/scrollbar.h b/components/rtgui/include/rtgui/widgets/scrollbar.h index d360822b58..8ae56aa8b1 100644 --- a/components/rtgui/include/rtgui/widgets/scrollbar.h +++ b/components/rtgui/include/rtgui/widgets/scrollbar.h @@ -21,8 +21,9 @@ extern "C" {
#endif
+DECLARE_CLASS_TYPE(scrollbar);
/** Gets the type of a scrollbar */
-#define RTGUI_SCROLLBAR_TYPE (rtgui_scrollbar_type_get())
+#define RTGUI_SCROLLBAR_TYPE (RTGUI_TYPE(scrollbar))
/** Casts the object to an rtgui_scrollbar */
#define RTGUI_SCROLLBAR(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_SCROLLBAR_TYPE, rtgui_scrollbar_t))
/** Checks if the object is an rtgui_scrollbar */
@@ -65,8 +66,6 @@ struct rtgui_scrollbar };
typedef struct rtgui_scrollbar rtgui_scrollbar_t;
-rtgui_type_t *rtgui_scrollbar_type_get(void);
-
struct rtgui_scrollbar* rtgui_scrollbar_create(int orient, rtgui_rect_t* r);
void rtgui_scrollbar_destroy(struct rtgui_scrollbar* bar);
diff --git a/components/rtgui/include/rtgui/widgets/slider.h b/components/rtgui/include/rtgui/widgets/slider.h index 062c617f2a..6b3bee28e2 100644 --- a/components/rtgui/include/rtgui/widgets/slider.h +++ b/components/rtgui/include/rtgui/widgets/slider.h @@ -17,8 +17,9 @@ #include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(slider);
/** Gets the type of a slider */
-#define RTGUI_SLIDER_TYPE (rtgui_slider_type_get())
+#define RTGUI_SLIDER_TYPE (RTGUI_TYPE(slider))
/** Casts the object to an rtgui_slider */
#define RTGUI_SLIDER(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_SLIDER_TYPE, rtgui_slider_t))
/** Checks if the object is an rtgui_slider */
@@ -38,8 +39,6 @@ struct rtgui_slider };
typedef struct rtgui_slider rtgui_slider_t;
-rtgui_type_t *rtgui_slider_type_get(void);
-
struct rtgui_slider* rtgui_slider_create(rt_size_t min, rt_size_t max, int orient);
void rtgui_slider_destroy(struct rtgui_slider* slider);
diff --git a/components/rtgui/include/rtgui/widgets/staticline.h b/components/rtgui/include/rtgui/widgets/staticline.h index 7b3c25a798..481c8da306 100644 --- a/components/rtgui/include/rtgui/widgets/staticline.h +++ b/components/rtgui/include/rtgui/widgets/staticline.h @@ -8,8 +8,9 @@ * the static line widget
*/
+DECLARE_CLASS_TYPE(staticline);
/** Gets the type of a staticline */
-#define RTGUI_STATICLINE_TYPE (rtgui_staticline_type_get())
+#define RTGUI_STATICLINE_TYPE (RTGUI_TYPE(staticline))
/** Casts the object to an rtgui_staticline */
#define RTGUI_STATICLINE(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_STATICLINE_TYPE, rtgui_staticline_t))
/** Checks if the object is an rtgui_staticline */
diff --git a/components/rtgui/include/rtgui/widgets/textbox.h b/components/rtgui/include/rtgui/widgets/textbox.h index 65d6b253c5..912da4ca84 100644 --- a/components/rtgui/include/rtgui/widgets/textbox.h +++ b/components/rtgui/include/rtgui/widgets/textbox.h @@ -17,8 +17,9 @@ #include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
+DECLARE_CLASS_TYPE(textbox);
/** Gets the type of a textbox */
-#define RTGUI_TEXTBOX_TYPE (rtgui_textbox_type_get())
+#define RTGUI_TEXTBOX_TYPE (RTGUI_TYPE(textbox))
/** Casts the object to a rtgui_textbox */
#define RTGUI_TEXTBOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_TEXTBOX_TYPE, rtgui_textbox_t))
/** Checks if the object is a rtgui_textbox */
@@ -61,8 +62,6 @@ struct rtgui_textbox };
typedef struct rtgui_textbox rtgui_textbox_t;
-rtgui_type_t *rtgui_textbox_type_get(void);
-
struct rtgui_textbox* rtgui_textbox_create(const char* text, rt_uint8_t flag);
void rtgui_textbox_destroy(struct rtgui_textbox* box);
diff --git a/components/rtgui/include/rtgui/widgets/title.h b/components/rtgui/include/rtgui/widgets/title.h index 97f4463407..ee6ac2c824 100644 --- a/components/rtgui/include/rtgui/widgets/title.h +++ b/components/rtgui/include/rtgui/widgets/title.h @@ -16,8 +16,9 @@ #include <rtgui/widgets/toplevel.h>
-/** Gets the type of a top win */
-#define RTGUI_WINTITLE_TYPE (rtgui_wintitle_type_get())
+DECLARE_CLASS_TYPE(wintitle);
+/** Gets the type of a title */
+#define RTGUI_WINTITLE_TYPE (RTGUI_TYPE(wintitle))
/** Casts the object to an rtgui_wintitle */
#define RTGUI_WINTITLE(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WINTITLE_TYPE, rtgui_wintitle_t))
/** Checks if the object is an rtgui_wintitle */
@@ -32,8 +33,6 @@ struct rtgui_wintitle };
typedef struct rtgui_wintitle rtgui_wintitle_t;
-rtgui_type_t* rtgui_wintitle_type_get(void);
-
rtgui_wintitle_t* rtgui_wintitle_create(const char* title);
void rtgui_wintitle_destroy(rtgui_wintitle_t* wintitle);
diff --git a/components/rtgui/include/rtgui/widgets/toplevel.h b/components/rtgui/include/rtgui/widgets/toplevel.h index 1ef443351f..1382626805 100644 --- a/components/rtgui/include/rtgui/widgets/toplevel.h +++ b/components/rtgui/include/rtgui/widgets/toplevel.h @@ -16,8 +16,9 @@ #include <rtgui/widgets/container.h>
+DECLARE_CLASS_TYPE(toplevel);
/** Gets the type of a toplevel */
-#define RTGUI_TOPLEVEL_TYPE (rtgui_toplevel_type_get())
+#define RTGUI_TOPLEVEL_TYPE (RTGUI_TYPE(toplevel))
/** Casts the object to an rtgui_toplevel */
#define RTGUI_TOPLEVEL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_TOPLEVEL_TYPE, rtgui_toplevel_t))
/** Checks if the object is an rtgui_toplevel */
@@ -40,10 +41,7 @@ struct rtgui_toplevel };
typedef struct rtgui_toplevel rtgui_toplevel_t;
-rtgui_type_t *rtgui_toplevel_type_get(void);
-
rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
-
void rtgui_toplevel_update_clip(rtgui_toplevel_t* top);
#endif
diff --git a/components/rtgui/include/rtgui/widgets/view.h b/components/rtgui/include/rtgui/widgets/view.h index 7e28a4ea93..a35095cf30 100644 --- a/components/rtgui/include/rtgui/widgets/view.h +++ b/components/rtgui/include/rtgui/widgets/view.h @@ -21,8 +21,9 @@ extern "C" {
#endif
+DECLARE_CLASS_TYPE(view);
/** Gets the type of a view */
-#define RTGUI_VIEW_TYPE (rtgui_view_type_get())
+#define RTGUI_VIEW_TYPE (RTGUI_TYPE(view))
/** Casts the object to an rtgui_view */
#define RTGUI_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_VIEW_TYPE, rtgui_view_t))
/** Checks if the object is an rtgui_view */
@@ -42,8 +43,6 @@ struct rtgui_view };
typedef struct rtgui_view rtgui_view_t;
-rtgui_type_t *rtgui_view_type_get(void);
-
rtgui_view_t* rtgui_view_create(const char* title);
void rtgui_view_destroy(rtgui_view_t* view);
diff --git a/components/rtgui/include/rtgui/widgets/widget.h b/components/rtgui/include/rtgui/widgets/widget.h index 93bc333237..9dfd40f0ae 100644 --- a/components/rtgui/include/rtgui/widgets/widget.h +++ b/components/rtgui/include/rtgui/widgets/widget.h @@ -59,8 +59,10 @@ extern "C" { #define RTGUI_WIDGET_FONT(w) ((w)->gc.font) #define RTGUI_WIDGET_FLAG(w) ((w)->flag) +DECLARE_CLASS_TYPE(widget); + /** Gets the type of a widget */ -#define RTGUI_WIDGET_TYPE (rtgui_widget_type_get()) +#define RTGUI_WIDGET_TYPE (RTGUI_TYPE(widget)) /** Casts the object to a rtgui_widget */ #define RTGUI_WIDGET(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WIDGET_TYPE, rtgui_widget_t)) /** Check if the object is a rtgui_widget */ diff --git a/components/rtgui/include/rtgui/widgets/window.h b/components/rtgui/include/rtgui/widgets/window.h index e8c8b2f0e3..4807407b00 100644 --- a/components/rtgui/include/rtgui/widgets/window.h +++ b/components/rtgui/include/rtgui/widgets/window.h @@ -21,8 +21,9 @@ #include <rtgui/widgets/toplevel.h>
#include <rtgui/widgets/box.h>
+DECLARE_CLASS_TYPE(win);
/** Gets the type of a win */
-#define RTGUI_WIN_TYPE (rtgui_win_type_get())
+#define RTGUI_WIN_TYPE (RTGUI_TYPE(win))
/** Casts the object to an rtgui_win */
#define RTGUI_WIN(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WIN_TYPE, rtgui_win_t))
/** Checks if the object is an rtgui_win */
@@ -72,8 +73,6 @@ struct rtgui_win rt_uint32_t user_data;
};
-rtgui_type_t *rtgui_win_type_get(void);
-
rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* title,
rtgui_rect_t *rect, rt_uint8_t flag);
void rtgui_win_destroy(rtgui_win_t* win);
diff --git a/components/rtgui/include/rtgui/widgets/workbench.h b/components/rtgui/include/rtgui/widgets/workbench.h index 7ada3553ca..3ec089f345 100644 --- a/components/rtgui/include/rtgui/widgets/workbench.h +++ b/components/rtgui/include/rtgui/widgets/workbench.h @@ -35,8 +35,10 @@ #define RTGUI_WORKBENCH_IS_MODAL_MODE(w) ((w)->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
+DECLARE_CLASS_TYPE(workbench);
+
/** Gets the type of a workbench */
-#define RTGUI_WORKBENCH_TYPE (rtgui_workbench_type_get())
+#define RTGUI_WORKBENCH_TYPE (RTGUI_TYPE(workbench))
/** Casts the object to an rtgui_workbench */
#define RTGUI_WORKBENCH(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WORKBENCH_TYPE, rtgui_workbench_t))
/** Checks if the object is an rtgui_workbench */
@@ -64,7 +66,7 @@ rtgui_type_t* rtgui_workbench_type_get(void); rtgui_workbench_t *rtgui_workbench_create(const char* panel_name, const unsigned char* title);
void rtgui_workbench_destroy(rtgui_workbench_t* workbench);
-void rtgui_workbench_close(rtgui_workbench_t* workbench); +void rtgui_workbench_close(rtgui_workbench_t* workbench);
rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
|
