diff options
| author | [email protected] <[email protected]> | 2012-09-07 01:50:13 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-09-07 01:50:13 +0000 |
| commit | 9707b6ce0beb142d5444b8256510cb2d96912091 (patch) | |
| tree | 9e89357cc7916280877d21054bad94d4b86f318d /components/rtgui/include | |
| parent | fd425e792d517e69dcceab3fc009bf4fdfec5217 (diff) | |
sync RTGUI with github(https://github.com/RT-Thread/RTGUI)
a8dac7ed473f381b7042cf9d14028488192624c5
As always, full log is in GitHub.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2276 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/include')
| -rw-r--r-- | components/rtgui/include/rtgui/filerw.h | 2 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/image.h | 10 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/image_container.h | 3 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/widgets/plot.h | 65 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/widgets/plot_curve.h | 45 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/widgets/title.h | 6 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/widgets/toplevel.h | 44 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/widgets/widget.h | 12 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/widgets/window.h | 9 |
9 files changed, 133 insertions, 63 deletions
diff --git a/components/rtgui/include/rtgui/filerw.h b/components/rtgui/include/rtgui/filerw.h index 03e030d539..eb1f5d3885 100644 --- a/components/rtgui/include/rtgui/filerw.h +++ b/components/rtgui/include/rtgui/filerw.h @@ -14,6 +14,7 @@ #ifndef __RTGUI_FILERW_H__ #define __RTGUI_FILERW_H__ +#ifdef RTGUI_USING_DFS_FILERW #ifdef _WIN32 #pragma warning(disable: 4996) #include <fcntl.h> @@ -23,6 +24,7 @@ #else #include <dfs_posix.h> #endif +#endif #include <rtgui/rtgui.h> diff --git a/components/rtgui/include/rtgui/image.h b/components/rtgui/include/rtgui/image.h index 6fe92e0a22..3c1383656e 100644 --- a/components/rtgui/include/rtgui/image.h +++ b/components/rtgui/include/rtgui/image.h @@ -18,6 +18,12 @@ #include <rtgui/filerw.h> #include <rtgui/region.h> +enum rtgui_img_zoom +{ + RTGUI_IMG_ZOOM_NEAREST, + RTGUI_IMG_ZOOM_BILINEAR +}; + struct rtgui_image; struct rtgui_image_engine { @@ -31,6 +37,8 @@ struct rtgui_image_engine void (*image_unload)(struct rtgui_image* image); void (*image_blit)(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect); + struct rtgui_image* (*image_zoom)(struct rtgui_image* image, float scalew, float scaleh, rt_uint32_t mode); + struct rtgui_image* (*image_rotate)(struct rtgui_image* image, float angle); }; struct rtgui_image_palette @@ -76,6 +84,8 @@ void rtgui_image_register_engine(struct rtgui_image_engine* engine); /* blit an image on DC */ void rtgui_image_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect); struct rtgui_image_palette* rtgui_image_palette_create(rt_uint32_t ncolors); +rtgui_image_t* rtgui_image_zoom(rtgui_image_t* image, float scalew, float scaleh, rt_uint32_t mode); +rtgui_image_t* rtgui_image_rotate(rtgui_image_t* image, float angle); #endif diff --git a/components/rtgui/include/rtgui/image_container.h b/components/rtgui/include/rtgui/image_container.h index b48058372c..fe7367abb7 100644 --- a/components/rtgui/include/rtgui/image_container.h +++ b/components/rtgui/include/rtgui/image_container.h @@ -16,8 +16,9 @@ struct rtgui_image_item typedef struct rtgui_image_item rtgui_image_item_t; void rtgui_system_image_container_init(rt_bool_t load); - +#ifdef RTGUI_USING_DFS_FILERW rtgui_image_item_t* rtgui_image_container_get(const char* filename); +#endif rtgui_image_item_t* rtgui_image_container_get_from_mem(const rt_uint8_t* mem, const char* type, rt_uint32_t len); void rtgui_image_container_put(rtgui_image_item_t* item); diff --git a/components/rtgui/include/rtgui/widgets/plot.h b/components/rtgui/include/rtgui/widgets/plot.h new file mode 100644 index 0000000000..28a1c84791 --- /dev/null +++ b/components/rtgui/include/rtgui/widgets/plot.h @@ -0,0 +1,65 @@ +/* + * File : plot.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2012, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2012-09-03 Grissiom first version + */ +#ifndef __RTGUI_PLOT_H__ +#define __RTGUI_PLOT_H__ + +#include <rtgui/rtgui.h> +#include <rtgui/widgets/widget.h> +#include <rtgui/widgets/plot_curve.h> + +DECLARE_CLASS_TYPE(plot); + +/** Gets the type of a plot */ +#define RTGUI_PLOT_TYPE (RTGUI_TYPE(plot)) +/** Casts the object to an rtgui_plot */ +#define RTGUI_PLOT(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_PLOT_TYPE, struct rtgui_plot)) +/** Checks if the object is an rtgui_plot */ +#define RTGUI_IS_PLOT(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_PLOT_TYPE)) + +struct rtgui_plot_curve_container +{ + struct rtgui_plot_curve *curve; + struct rtgui_plot_curve_container *next; +}; + +enum rtgui_plot_flag +{ + RTGUI_PLOT_INCREMENTAL, + RTGUI_PLOT_MOVING_WINDOW, + RTGUI_PLOT_SCAN, +}; + +/* + * the plot widget + */ +struct rtgui_plot +{ + struct rtgui_widget parent; + + enum rtgui_plot_flag pflag; + + struct rtgui_point base_point; + struct rtgui_plot_curve_container curve_container; +}; + +struct rtgui_plot *rtgui_plot_create(struct rtgui_plot_curve*); +void rtgui_plot_destroy(struct rtgui_plot *plot); + +void rtgui_plot_set_base_point(struct rtgui_plot *plot, rt_uint16_t x, rt_uint16_t y); +void rtgui_plot_append_curve(struct rtgui_plot *plot, struct rtgui_plot_curve *curve); +void rtgui_plot_remove_curve(struct rtgui_plot *plot, struct rtgui_plot_curve *curve); + +rt_bool_t rtgui_plot_event_handler(struct rtgui_object *object, struct rtgui_event *event); + +#endif diff --git a/components/rtgui/include/rtgui/widgets/plot_curve.h b/components/rtgui/include/rtgui/widgets/plot_curve.h new file mode 100644 index 0000000000..a868e6ebe5 --- /dev/null +++ b/components/rtgui/include/rtgui/widgets/plot_curve.h @@ -0,0 +1,45 @@ +/* + * File : plot_curve.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2012, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2012-09-03 Grissiom first version + */ +#ifndef __RTGUI_PLOT_CURVE_H__ +#define __RTGUI_PLOT_CURVE_H__ + +#include <rtgui/rtgui.h> + +DECLARE_CLASS_TYPE(plot_curve); + +/** Gets the type of a plot_curve */ +#define RTGUI_PLOT_CURVE_TYPE (RTGUI_TYPE(plot_curve)) +/** Casts the object to an rtgui_plot */ +#define RTGUI_PLOT_CURVE(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_PLOT_CURVE_TYPE, struct rtgui_plot_curve)) +/** Checks if the object is an rtgui_plot */ +#define RTGUI_IS_PLOT_CURVE(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_PLOT_CURVE_TYPE)) + +/* change this if you want to use other type of data. + * For example, rt_uint8_t or rt_uint32_t. */ +#define rtgui_plot_curve_dtype rt_int16_t + +struct rtgui_plot_curve +{ + struct rtgui_object parent; + + rtgui_color_t color; + + rt_size_t length; + rtgui_plot_curve_dtype *x_data; + rtgui_plot_curve_dtype *y_data; +}; + +struct rtgui_plot_curve *rtgui_plot_curve_create(void); +void rtgui_plot_curve_destroy(struct rtgui_plot_curve *curve); +#endif diff --git a/components/rtgui/include/rtgui/widgets/title.h b/components/rtgui/include/rtgui/widgets/title.h index 09a67ea2ba..974a90711b 100644 --- a/components/rtgui/include/rtgui/widgets/title.h +++ b/components/rtgui/include/rtgui/widgets/title.h @@ -14,7 +14,7 @@ #ifndef __RTGUI_TITLE__ #define __RTGUI_TITLE__ -#include <rtgui/widgets/toplevel.h> +#include <rtgui/widgets/widget.h> DECLARE_CLASS_TYPE(wintitle); /** Gets the type of a title */ @@ -26,14 +26,14 @@ DECLARE_CLASS_TYPE(wintitle); struct rtgui_wintitle { - struct rtgui_toplevel parent; + struct rtgui_widget parent; /* title */ char* title; }; typedef struct rtgui_wintitle rtgui_wintitle_t; -rtgui_wintitle_t* rtgui_wintitle_create(const char* title); +rtgui_wintitle_t* rtgui_wintitle_create(struct rtgui_win *window, const char* title); void rtgui_wintitle_destroy(rtgui_wintitle_t* wintitle); rt_bool_t rtgui_wintile_event_handler(rtgui_widget_t* widget, rtgui_event_t* event); diff --git a/components/rtgui/include/rtgui/widgets/toplevel.h b/components/rtgui/include/rtgui/widgets/toplevel.h deleted file mode 100644 index 9b4b5573d2..0000000000 --- a/components/rtgui/include/rtgui/widgets/toplevel.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * File : toplevel.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2009-10-16 Bernard first version - */ -#ifndef __RTGUI_TOPLEVEL_H__ -#define __RTGUI_TOPLEVEL_H__ - -#include <rtgui/widgets/container.h> - -DECLARE_CLASS_TYPE(toplevel); -/** Gets the type of a toplevel */ -#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 */ -#define RTGUI_IS_TOPLEVEL(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_TOPLEVEL_TYPE)) - -struct rtgui_toplevel -{ - /* inherit from view */ - rtgui_container_t parent; - - /* drawing count */ - rt_base_t drawing; - - /* external clip info */ - rtgui_rect_t* external_clip_rect; - rt_uint32_t external_clip_size; -}; -typedef struct rtgui_toplevel rtgui_toplevel_t; - -rt_bool_t rtgui_toplevel_event_handler(struct rtgui_object* widget, struct rtgui_event* event); -void rtgui_toplevel_update_clip(rtgui_toplevel_t* top); - -#endif diff --git a/components/rtgui/include/rtgui/widgets/widget.h b/components/rtgui/include/rtgui/widgets/widget.h index 3deef998e4..6e4926a312 100644 --- a/components/rtgui/include/rtgui/widgets/widget.h +++ b/components/rtgui/include/rtgui/widgets/widget.h @@ -111,16 +111,6 @@ struct rtgui_widget /* call back */ rt_bool_t (*on_focus_in) (struct rtgui_object* widget, struct rtgui_event* event); rt_bool_t (*on_focus_out) (struct rtgui_object* widget, struct rtgui_event* event); - /* will be called just before the widget is shown. You can setup your - * widget in this call back. It's return value is ignored. The @param event - * will always be RT_NULL - */ - rt_bool_t (*on_show) (struct rtgui_object* widget, struct rtgui_event* event); - /* will be called just before the widget is hiden. You can setup your - * widget in this call back. It's return value is ignored. The @param event - * will always be RT_NULL - */ - rt_bool_t (*on_hide) (struct rtgui_object* widget, struct rtgui_event* event); #ifndef RTGUI_USING_SMALL_SIZE rt_bool_t (*on_draw) (struct rtgui_object* widget, struct rtgui_event* event); rt_bool_t (*on_mouseclick) (struct rtgui_object* widget, struct rtgui_event* event); @@ -146,8 +136,6 @@ void rtgui_widget_unfocus(rtgui_widget_t *widget); /* event handler for each command */ void rtgui_widget_set_onfocus(rtgui_widget_t* widget, rtgui_event_handler_ptr handler); void rtgui_widget_set_onunfocus(rtgui_widget_t* widget, rtgui_event_handler_ptr handler); -void rtgui_widget_set_onshow(rtgui_widget_t* widget, rtgui_event_handler_ptr handler); -void rtgui_widget_set_onhide(rtgui_widget_t* widget, rtgui_event_handler_ptr handler); #ifndef RTGUI_USING_SMALL_SIZE void rtgui_widget_set_ondraw(rtgui_widget_t* widget, rtgui_event_handler_ptr handler); void rtgui_widget_set_onmouseclick(rtgui_widget_t* widget, rtgui_event_handler_ptr handler); diff --git a/components/rtgui/include/rtgui/widgets/window.h b/components/rtgui/include/rtgui/widgets/window.h index 735a7b283e..cc502cdbdb 100644 --- a/components/rtgui/include/rtgui/widgets/window.h +++ b/components/rtgui/include/rtgui/widgets/window.h @@ -18,7 +18,6 @@ #include <rtgui/rtgui.h> #include <rtgui/list.h> #include <rtgui/widgets/widget.h> -#include <rtgui/widgets/toplevel.h> #include <rtgui/widgets/box.h> DECLARE_CLASS_TYPE(win); @@ -67,8 +66,11 @@ struct rtgui_win_area; struct rtgui_win { - /* inherit from toplevel */ - struct rtgui_toplevel parent; + /* inherit from container */ + rtgui_container_t parent; + + /* drawing count */ + rt_base_t drawing; /* parent window. RT_NULL if the window is a top level window */ struct rtgui_win *parent_window; @@ -134,6 +136,7 @@ void rtgui_win_move(struct rtgui_win* win, int x, int y); /* reset extent of window */ void rtgui_win_set_rect(rtgui_win_t* win, rtgui_rect_t* rect); +void rtgui_win_update_clip(struct rtgui_win* win); void rtgui_win_set_onactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler); void rtgui_win_set_ondeactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler); |
