diff options
| author | [email protected] <[email protected]> | 2010-07-04 23:58:35 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2010-07-04 23:58:35 +0000 |
| commit | b25f307b9b94918da883ba083ea4b1c33807719d (patch) | |
| tree | f32c8323a8a62736c00d0019e7f63307e8b6727c /components/rtgui/include | |
| parent | e76cd77c561149c3aa259715571d68729672cae6 (diff) | |
implement hardware DC in each widget.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@787 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/include')
| -rw-r--r-- | components/rtgui/include/rtgui/dc_hw.h | 20 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/driver.h | 10 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/rtgui.h | 5 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/rtgui_object.h | 2 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/rtgui_server.h | 2 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/widgets/widget.h | 31 |
6 files changed, 40 insertions, 30 deletions
diff --git a/components/rtgui/include/rtgui/dc_hw.h b/components/rtgui/include/rtgui/dc_hw.h index e40fce4472..7b6e7b5b20 100644 --- a/components/rtgui/include/rtgui/dc_hw.h +++ b/components/rtgui/include/rtgui/dc_hw.h @@ -10,31 +10,19 @@ * Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
+ * 2010-06-14 Bernard embedded hardware dc to each widget
*/
#ifndef __RTGUI_DC_HW_H__
#define __RTGUI_DC_HW_H__
#include <rtgui/dc.h>
-/* hardware device context */
-struct rtgui_dc_hw
-{
- struct rtgui_dc parent;
-
- /* widget owner */
- rtgui_widget_t* owner;
-
- /* visible */
- rt_bool_t visible;
-
- /* display driver */
- struct rtgui_graphic_driver* device;
-};
-
/* create a hardware dc */
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner);
+void rtgui_dc_hw_init(rtgui_widget_t* owner);
/* draw a hline with raw pixel data */
-void rtgui_dc_hw_draw_raw_hline(struct rtgui_dc_hw* dc, rt_uint8_t* raw_ptr, int x1, int x2, int y);
+void rtgui_dc_hw_draw_raw_hline(struct rtgui_dc* dc, rt_uint8_t* raw_ptr, int x1, int x2, int y);
#endif
+
diff --git a/components/rtgui/include/rtgui/driver.h b/components/rtgui/include/rtgui/driver.h index cc5cd6e249..79856856ba 100644 --- a/components/rtgui/include/rtgui/driver.h +++ b/components/rtgui/include/rtgui/driver.h @@ -49,13 +49,19 @@ struct rtgui_graphic_driver rtgui_list_t list;
};
+#ifdef RTGUI_USING_GRAPHIC_DRIVER_LIST
void rtgui_graphic_driver_add(struct rtgui_graphic_driver* driver);
void rtgui_graphic_driver_remove(struct rtgui_graphic_driver* driver);
struct rtgui_graphic_driver* rtgui_graphic_driver_find(char* name);
-struct rtgui_graphic_driver* rtgui_graphic_driver_get_default(void);
+#else
+void rtgui_graphic_driver_add(const struct rtgui_graphic_driver* driver);
+#endif
+
+const struct rtgui_graphic_driver* rtgui_graphic_driver_get_default(void);
-void rtgui_graphic_driver_get_rect(struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
+void rtgui_graphic_driver_get_rect(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
void rtgui_graphic_driver_get_default_rect(rtgui_rect_t *rect);
#endif
+
diff --git a/components/rtgui/include/rtgui/rtgui.h b/components/rtgui/include/rtgui/rtgui.h index d46b83b8d1..3fc9bf3af8 100644 --- a/components/rtgui/include/rtgui/rtgui.h +++ b/components/rtgui/include/rtgui/rtgui.h @@ -25,7 +25,7 @@ struct rtgui_event; struct rtgui_widget; struct rtgui_win; -struct rtgui_font;
+struct rtgui_font; typedef struct rtgui_panel rtgui_panel_t; typedef struct rtgui_win rtgui_win_t; @@ -47,7 +47,7 @@ typedef struct rtgui_rect rtgui_rect_t; #define rtgui_rect_width(r) ((r).x2 - (r).x1) #define rtgui_rect_height(r) ((r).y2 - (r).y1) -typedef unsigned long rtgui_color_t;
+typedef unsigned long rtgui_color_t; struct rtgui_gc { @@ -129,3 +129,4 @@ typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t; #include <rtgui/rtgui_object.h> #endif + diff --git a/components/rtgui/include/rtgui/rtgui_object.h b/components/rtgui/include/rtgui/rtgui_object.h index bab31f15cd..05104f8dd9 100644 --- a/components/rtgui/include/rtgui/rtgui_object.h +++ b/components/rtgui/include/rtgui/rtgui_object.h @@ -22,6 +22,8 @@ extern "C" { #endif
/* rtgui object type */
+#define RTGUI_CONTAINER_OF(obj, type, member) \
+ ((type *)((char *)(obj) - (unsigned long)(&((type *)0)->member)))
/** Casts the function pointer to an rtgui_constructor */
#define RTGUI_CONSTRUCTOR(constructor) ((rtgui_constructor_t)(constructor))
diff --git a/components/rtgui/include/rtgui/rtgui_server.h b/components/rtgui/include/rtgui/rtgui_server.h index 46e1837e35..ebb4807194 100644 --- a/components/rtgui/include/rtgui/rtgui_server.h +++ b/components/rtgui/include/rtgui/rtgui_server.h @@ -72,7 +72,9 @@ void rtgui_server_post_event(struct rtgui_event* event, rt_size_t size); /* register or deregister panel in server */
void rtgui_panel_register(char* name, rtgui_rect_t* extent);
void rtgui_panel_deregister(char* name);
+
void rtgui_panel_set_default_focused(char* name);
+void rtgui_panel_set_nofocused(char* name);
#endif
diff --git a/components/rtgui/include/rtgui/widgets/widget.h b/components/rtgui/include/rtgui/widgets/widget.h index a43d3f7cb7..078f12acd3 100644 --- a/components/rtgui/include/rtgui/widgets/widget.h +++ b/components/rtgui/include/rtgui/widgets/widget.h @@ -25,12 +25,13 @@ extern "C" { #endif -#define RTGUI_WIDGET_FLAG_HIDE 0x01 -#define RTGUI_WIDGET_FLAG_DISABLE 0x02 -#define RTGUI_WIDGET_FLAG_FOCUS 0x04 -#define RTGUI_WIDGET_FLAG_TRANSPARENT 0x08 -#define RTGUI_WIDGET_FLAG_FOCUSABLE 0x10 -#define RTGUI_WIDGET_FLAG_DEFAULT 0x00 +#define RTGUI_WIDGET_FLAG_DEFAULT 0x0000 +#define RTGUI_WIDGET_FLAG_HIDE 0x0001 +#define RTGUI_WIDGET_FLAG_DISABLE 0x0002 +#define RTGUI_WIDGET_FLAG_FOCUS 0x0004 +#define RTGUI_WIDGET_FLAG_TRANSPARENT 0x0008 +#define RTGUI_WIDGET_FLAG_FOCUSABLE 0x0010 +#define RTGUI_WIDGET_FLAG_DC_VISIBLE 0x0100 #define RTGUI_WIDGET_UNHIDE(w) (w)->flag &= ~RTGUI_WIDGET_FLAG_HIDE #define RTGUI_WIDGET_HIDE(w) (w)->flag |= RTGUI_WIDGET_FLAG_HIDE @@ -46,6 +47,11 @@ extern "C" { #define RTGUI_WIDGET_IS_FOCUSABLE(w) ((w)->flag & RTGUI_WIDGET_FLAG_FOCUSABLE) +#define RTGUI_WIDGET_IS_DC_VISIBLE(w) ((w)->flag & RTGUI_WIDGET_FLAG_DC_VISIBLE) +#define RTGUI_WIDGET_DC_SET_VISIBLE(w) (w)->flag |= RTGUI_WIDGET_FLAG_DC_VISIBLE +#define RTGUI_WIDGET_DC_SET_UNVISIBLE(w) (w)->flag &= ~RTGUI_WIDGET_FLAG_DC_VISIBLE +#define RTGUI_WIDGET_DC(w) ((struct rtgui_dc*)&((w)->dc_type)) + /* get rtgui widget object */ #define RTGUI_WIDGET_FOREGROUND(w) ((w)->gc.foreground) #define RTGUI_WIDGET_BACKGROUND(w) ((w)->gc.background) @@ -75,19 +81,24 @@ struct rtgui_widget /* widget flag */ rt_int32_t flag; -#ifndef RTGUI_USING_SMALL_SIZE - /* widget align */ - rt_int32_t align; -#endif + + /* hardware device context */ + rt_uint32_t dc_type; + const struct rtgui_dc_engine* dc_engine; /* the graphic context of widget */ rtgui_gc_t gc; /* the widget extent */ rtgui_rect_t extent; + #ifndef RTGUI_USING_SMALL_SIZE + /* minimal width and height of widget */ rt_int16_t mini_width, mini_height; rt_int16_t margin, margin_style; + + /* widget align */ + rt_int32_t align; #endif /* the rect clip */ |
