diff options
| author | bernard.xiong <[email protected]> | 2009-11-23 23:34:58 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2009-11-23 23:34:58 +0000 |
| commit | 010cec20096bfdc77538071f5e1a14a5fb1c422c (patch) | |
| tree | fdb1f398ef64d92279164e0ece756c76e7f75058 /rtgui/include | |
| parent | c1e1d638ff5309184f514545cb0bd700088bc732 (diff) | |
add radio player UI
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@171 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'rtgui/include')
| -rw-r--r-- | rtgui/include/rtgui/color.h | 10 | ||||
| -rw-r--r-- | rtgui/include/rtgui/event.h | 8 | ||||
| -rw-r--r-- | rtgui/include/rtgui/image_png.h | 2 | ||||
| -rw-r--r-- | rtgui/include/rtgui/rtgui.h | 9 | ||||
| -rw-r--r-- | rtgui/include/rtgui/rtgui_config.h | 15 | ||||
| -rw-r--r-- | rtgui/include/rtgui/rtgui_object.h | 1 | ||||
| -rw-r--r-- | rtgui/include/rtgui/rtgui_system.h | 3 | ||||
| -rw-r--r-- | rtgui/include/rtgui/rtgui_theme.h | 5 | ||||
| -rw-r--r-- | rtgui/include/rtgui/widgets/container.h | 1 | ||||
| -rw-r--r-- | rtgui/include/rtgui/widgets/toplevel.h | 6 | ||||
| -rw-r--r-- | rtgui/include/rtgui/widgets/view.h | 3 | ||||
| -rw-r--r-- | rtgui/include/rtgui/widgets/window.h | 31 | ||||
| -rw-r--r-- | rtgui/include/rtgui/widgets/workbench.h | 11 |
13 files changed, 61 insertions, 44 deletions
diff --git a/rtgui/include/rtgui/color.h b/rtgui/include/rtgui/color.h index af45664a16..6150b99039 100644 --- a/rtgui/include/rtgui/color.h +++ b/rtgui/include/rtgui/color.h @@ -18,9 +18,9 @@ typedef unsigned long rtgui_color_t;
#define RTGUI_ARGB(a, r, g, b) \
- ((rtgui_color_t)(((rt_uint8_t)(r)|\ - (((unsigned)(rt_uint8_t)(g))<<8))|\ - (((unsigned long)(rt_uint8_t)(b))<<16)|\ + ((rtgui_color_t)(((rt_uint8_t)(r)|\
+ (((unsigned)(rt_uint8_t)(g))<<8))|\
+ (((unsigned long)(rt_uint8_t)(b))<<16)|\
(((unsigned long)(rt_uint8_t)(a))<<24)))
#define RTGUI_RGB(r, g, b) RTGUI_ARGB(255, (r), (g), (b))
@@ -51,7 +51,7 @@ rt_inline rt_uint16_t rtgui_color_to_565(rtgui_color_t c) {
rt_uint16_t pixel;
- pixel = ((RTGUI_RGB_B(c)>> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3);
+ pixel = (rt_uint16_t)(((RTGUI_RGB_B(c)>> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3));
return pixel;
}
@@ -75,7 +75,7 @@ rt_inline rt_uint16_t rtgui_color_to_565p(rtgui_color_t c) {
rt_uint16_t pixel;
- pixel = ((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c)>> 3);
+ pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c)>> 3));
return pixel;
}
diff --git a/rtgui/include/rtgui/event.h b/rtgui/include/rtgui/event.h index 0ff94117ce..e1179d8df4 100644 --- a/rtgui/include/rtgui/event.h +++ b/rtgui/include/rtgui/event.h @@ -213,7 +213,7 @@ struct rtgui_event_win_resize #define rtgui_event_win_activate rtgui_event_win
#define rtgui_event_win_deactivate rtgui_event_win
#define rtgui_event_win_close rtgui_event_win
- +
/* window event init */
#define RTGUI_EVENT_WIN_CREATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_CREATE)
#define RTGUI_EVENT_WIN_DESTROY_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_DESTROY)
@@ -296,9 +296,9 @@ struct rtgui_event_clip_info /* the number of rects */
rt_uint32_t num_rect;
- struct rtgui_rect rects[0];
+ /* rtgui_rect_t *rects */
};
-#define RTGUI_EVENT_GET_RECT(e, i) (&(e->rects[0]) + i)
+#define RTGUI_EVENT_GET_RECT(e, i) &(((rtgui_rect_t*)(e + 1))[i])
#define RTGUI_EVENT_UPDATE_BEGIN_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE_BEGIN)
#define RTGUI_EVENT_UPDATE_END_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE_END)
@@ -420,5 +420,5 @@ struct rtgui_event_resize rt_int16_t w, h;
};
#define RTGUI_EVENT_RESIZE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_RESIZE)
- +
#endif
diff --git a/rtgui/include/rtgui/image_png.h b/rtgui/include/rtgui/image_png.h index 13aff657f9..09454d6a75 100644 --- a/rtgui/include/rtgui/image_png.h +++ b/rtgui/include/rtgui/image_png.h @@ -16,4 +16,6 @@ #include <rtgui/image.h>
+void rtgui_image_png_init(void);
+
#endif
diff --git a/rtgui/include/rtgui/rtgui.h b/rtgui/include/rtgui/rtgui.h index dcc0741dba..50e3b5b59b 100644 --- a/rtgui/include/rtgui/rtgui.h +++ b/rtgui/include/rtgui/rtgui.h @@ -28,7 +28,7 @@ struct rtgui_widget; struct rtgui_win; typedef struct rtgui_panel rtgui_panel_t; -typedef struct rtgui_win rtgui_win_t;
+typedef struct rtgui_win rtgui_win_t; typedef struct rtgui_workbench rtgui_workbench_t; typedef rt_bool_t (*rtgui_event_handler_ptr)(struct rtgui_widget* widget, struct rtgui_event* event); @@ -95,6 +95,13 @@ enum RTGUI_ARRAW RTGUI_ARRAW_RIGHT }; +enum RTGUI_MODAL_CODE +{ + RTGUI_MODAL_OK, + RTGUI_MODAL_CANCEL +}; +typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t; + #include <rtgui/rtgui_object.h> #endif diff --git a/rtgui/include/rtgui/rtgui_config.h b/rtgui/include/rtgui/rtgui_config.h index 4cce06fab4..bc97b028bd 100644 --- a/rtgui/include/rtgui/rtgui_config.h +++ b/rtgui/include/rtgui/rtgui_config.h @@ -22,18 +22,23 @@ /* #define RTGUI_USING_MOUSE_CURSOR */
+/* #define RTGUI_USING_FONT12 */
+
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONTHZ
+#ifdef _WIN32
+#define RTGUI_USING_STDIO_FILERW
+#define RTGUI_IMAGE_PNG
+#define RTGUI_IMAGE_JPG
+#else
+#define RTGUI_USING_DFS_FILERW
#define RTGUI_USING_HZ_FILE
-
-// #define RT_USING_STDIO_FILERW
-#define RT_USING_DFS_FILERW
-// #define RTGUI_IMAGE_PNG
-// #define RTGUI_IMAGE_JPG
+#endif
#define RTGUI_SVR_THREAD_PRIORITY 15
#define RTGUI_SVR_THREAD_TIMESLICE 5
+#define RTGUI_SVR_THREAD_STACK_SIZE 2048
#define RTGUI_APP_THREAD_PRIORITY 25
#define RTGUI_APP_THREAD_TIMESLICE 8
diff --git a/rtgui/include/rtgui/rtgui_object.h b/rtgui/include/rtgui/rtgui_object.h index 9c06137701..bab31f15cd 100644 --- a/rtgui/include/rtgui/rtgui_object.h +++ b/rtgui/include/rtgui/rtgui_object.h @@ -88,7 +88,6 @@ struct rtgui_object /* object type */
rtgui_type_t* type;
- char *name;
rt_bool_t is_static;
};
rtgui_type_t *rtgui_object_type_get(void);
diff --git a/rtgui/include/rtgui/rtgui_system.h b/rtgui/include/rtgui/rtgui_system.h index 9fd76b39c0..e0ceae6f2b 100644 --- a/rtgui/include/rtgui/rtgui_system.h +++ b/rtgui/include/rtgui/rtgui_system.h @@ -31,9 +31,6 @@ struct rtgui_thread /* the owner of thread */
struct rtgui_widget* widget;
-
- /* quit of thread */
- rt_bool_t is_quit;
};
typedef struct rtgui_thread rtgui_thread_t;
struct rtgui_timer;
diff --git a/rtgui/include/rtgui/rtgui_theme.h b/rtgui/include/rtgui/rtgui_theme.h index 28edac0e61..0efde47cad 100644 --- a/rtgui/include/rtgui/rtgui_theme.h +++ b/rtgui/include/rtgui/rtgui_theme.h @@ -26,12 +26,17 @@ extern "C" {
#endif
+void rtgui_system_theme_init(void);
+
void rtgui_theme_draw_win(struct rtgui_topwin* win);
void rtgui_theme_draw_button(rtgui_button_t* btn);
void rtgui_theme_draw_label(rtgui_label_t* label);
void rtgui_theme_draw_textbox(rtgui_textbox_t* box);
void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox);
+rt_uint16_t rtgui_theme_get_selected_height(void);
+void rtgui_theme_draw_selected(struct rtgui_dc* dc, rtgui_rect_t *rect);
+
rtgui_color_t rtgui_theme_default_bc(void);
rtgui_color_t rtgui_theme_default_fc(void);
diff --git a/rtgui/include/rtgui/widgets/container.h b/rtgui/include/rtgui/widgets/container.h index 7f1af7d3d2..4cd1bb0a30 100644 --- a/rtgui/include/rtgui/widgets/container.h +++ b/rtgui/include/rtgui/widgets/container.h @@ -28,6 +28,7 @@ struct rtgui_container /* inherit from widget */
struct rtgui_widget parent;
+ struct rtgui_widget* focused;
rtgui_list_t children;
};
typedef struct rtgui_container rtgui_container_t;
diff --git a/rtgui/include/rtgui/widgets/toplevel.h b/rtgui/include/rtgui/widgets/toplevel.h index 044edf4058..463b7e76d2 100644 --- a/rtgui/include/rtgui/widgets/toplevel.h +++ b/rtgui/include/rtgui/widgets/toplevel.h @@ -37,9 +37,6 @@ struct rtgui_toplevel /* server thread id */
rt_thread_t server;
-
- /* current focus widget */
- rtgui_widget_t* focus;
};
typedef struct rtgui_toplevel rtgui_toplevel_t;
@@ -51,7 +48,4 @@ void rtgui_toplevel_handle_clip(struct rtgui_toplevel* top, struct rtgui_event_clip_info* info);
void rtgui_toplevel_update_clip(rtgui_toplevel_t* top);
-void rtgui_toplevel_set_focus(struct rtgui_toplevel* top, rtgui_widget_t* focus);
-rtgui_widget_t* rtgui_toplevel_get_focus(struct rtgui_toplevel* top);
-
#endif
diff --git a/rtgui/include/rtgui/widgets/view.h b/rtgui/include/rtgui/widgets/view.h index c4033c603e..c1ebfa6913 100644 --- a/rtgui/include/rtgui/widgets/view.h +++ b/rtgui/include/rtgui/widgets/view.h @@ -50,8 +50,9 @@ rt_bool_t rtgui_view_event_handler(struct rtgui_widget* widget, struct rtgui_eve void rtgui_view_set_box(rtgui_view_t* view, rtgui_box_t* box);
-void rtgui_view_show(rtgui_view_t* view);
+rtgui_modal_code_t rtgui_view_show(rtgui_view_t* view, rt_bool_t is_modal);
void rtgui_view_hide(rtgui_view_t* view);
+void rtgui_view_end_modal(rtgui_view_t* view, rtgui_modal_code_t modal_code);
char* rtgui_view_get_title(rtgui_view_t* view);
void rtgui_view_set_title(rtgui_view_t* view, const char* title);
diff --git a/rtgui/include/rtgui/widgets/window.h b/rtgui/include/rtgui/widgets/window.h index 243ab75d26..ea730580ad 100644 --- a/rtgui/include/rtgui/widgets/window.h +++ b/rtgui/include/rtgui/widgets/window.h @@ -27,18 +27,18 @@ /** Checks if the object is an rtgui_win */
#define RTGUI_IS_WIN(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WIN_TYPE))
-#define RTGUI_WIN_STYLE_MODAL 0x00
-#define RTGUI_WIN_STYLE_MODAL_LESS 0x01
-#define RTGUI_WIN_STYLE_NO_TITLE 0x02
-#define RTGUI_WIN_STYLE_NO_BORDER 0x04
-#define RTGUI_WIN_STYLE_SHOW 0x08
-#define RTGUI_WIN_STYLE_CLOSEBOX 0x10
-#define RTGUI_WIN_STYLE_MINIBOX 0x20
-#define RTGUI_WIN_STYLE_ACTIVATE 0x40
-#define RTGUI_WIN_STYLE_NO_FOCUS 0x80
+#define RTGUI_WIN_STYLE_MODAL 0x01 /* modal mode window */
+#define RTGUI_WIN_STYLE_CLOSED 0x02 /* window is closed */
+#define RTGUI_WIN_STYLE_ACTIVATE 0x04 /* window is activated */
+#define RTGUI_WIN_STYLE_NO_FOCUS 0x08 /* non-focused window */
+
+#define RTGUI_WIN_STYLE_NO_TITLE 0x10 /* no title window */
+#define RTGUI_WIN_STYLE_NO_BORDER 0x20 /* no border window */
+#define RTGUI_WIN_STYLE_CLOSEBOX 0x40 /* window has the close button */
+#define RTGUI_WIN_STYLE_MINIBOX 0x80 /* window has the mini button */
#define RTGUI_WIN_STYLE_DEFAULT (RTGUI_WIN_STYLE_CLOSEBOX | RTGUI_WIN_STYLE_MINIBOX)
- +
struct rtgui_win_title;
struct rtgui_win_area;
@@ -51,18 +51,19 @@ struct rtgui_win rtgui_toplevel_t* parent_toplevel;
/* top window style */
- rt_uint32_t style;
+ rt_uint8_t style;
+ rtgui_modal_code_t modal_code;
/* window title */
char* title;
/* call back */
- rt_bool_t (*on_activate) (struct rtgui_widget* widget, struct rtgui_event* event); + rt_bool_t (*on_activate) (struct rtgui_widget* widget, struct rtgui_event* event);
rt_bool_t (*on_deactivate) (struct rtgui_widget* widget, struct rtgui_event* event);
rt_bool_t (*on_close) (struct rtgui_widget* widget, struct rtgui_event* event);
/* reserved user data */
- rt_uint32_t user_data; + rt_uint32_t user_data;
};
rtgui_type_t *rtgui_win_type_get(void);
@@ -71,8 +72,10 @@ rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* tit rtgui_rect_t *rect, rt_uint32_t flag);
void rtgui_win_destroy(rtgui_win_t* win);
-void rtgui_win_show(rtgui_win_t* win);
+rtgui_modal_code_t rtgui_win_show(rtgui_win_t* win, rt_bool_t is_modal);
void rtgui_win_hiden(rtgui_win_t* win);
+void rtgui_win_end_modal(rtgui_win_t* win, rtgui_modal_code_t modal_code);
+
rt_bool_t rtgui_win_is_activated(struct rtgui_win* win);
void rtgui_win_move(struct rtgui_win* win, int x, int y);
diff --git a/rtgui/include/rtgui/widgets/workbench.h b/rtgui/include/rtgui/widgets/workbench.h index dd132757c7..3d8668083a 100644 --- a/rtgui/include/rtgui/widgets/workbench.h +++ b/rtgui/include/rtgui/widgets/workbench.h @@ -22,12 +22,14 @@ #include <rtgui/widgets/view.h>
#include <rtgui/widgets/toplevel.h>
-#define RTGUI_WORKBENCH_FLAG_VISIBLE 0x00
-#define RTGUI_WORKBENCH_FLAG_INVISIBLE 0x01
-#define RTGUI_WORKBENCH_FLAG_FULLSCREEN 0x02
+#define RTGUI_WORKBENCH_FLAG_VISIBLE 0x00 /* workbench is visible */
+#define RTGUI_WORKBENCH_FLAG_INVISIBLE 0x01 /* workbench is invisible */
+#define RTGUI_WORKBENCH_FLAG_FULLSCREEN 0x02 /* workbench is full screen */
+#define RTGUI_WORKBENCH_FLAG_MODAL_MODE 0x04 /* workbench is modal mode showing */
#define RTGUI_WORKBENCH_FLAG_CLOSEBLE 0x00
#define RTGUI_WORKBENCH_FLAG_UNCLOSEBLE 0x10
+#define RTGUI_WORKBENCH_FLAG_CLOSED 0x20
#define RTGUI_WORKBENCH_FLAG_DEFAULT RTGUI_WORKBENCH_FLAG_VISIBLE | RTGUI_WORKBENCH_FLAG_CLOSEBLE
@@ -48,6 +50,7 @@ struct rtgui_workbench /* workbench flag */
rt_uint8_t flag;
+ rtgui_modal_code_t modal_code;
/* workbench title */
unsigned char* title;
@@ -63,7 +66,7 @@ rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* e void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag);
-void rtgui_workbench_event_loop(rtgui_workbench_t* workbench);
+rt_bool_t rtgui_workbench_event_loop(rtgui_workbench_t* workbench);
rt_err_t rtgui_workbench_show (rtgui_workbench_t* workbench);
rt_err_t rtgui_workbench_hide (rtgui_workbench_t* workbench);
|
