mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-20 17:44:20 +08:00
add font and change theme.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@327 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -48,6 +48,23 @@ rtgui_view_t* demo_view(rtgui_workbench_t* workbench)
|
||||
{
|
||||
struct rtgui_rect rect;
|
||||
struct rtgui_button *next_btn, *prev_btn;
|
||||
struct rtgui_label *label;
|
||||
struct rtgui_staticline *line;
|
||||
|
||||
/* get view's rect */
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||
rect.x1 += 5; rect.y1 += 5;
|
||||
rect.x2 -= 5; rect.y2 -= 5;
|
||||
rect.y2 = rect.y1 + 20;
|
||||
|
||||
/* create view label */
|
||||
label = rtgui_label_create("Demo Label");
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
|
||||
rect.y1 += 20; rect.y2 += 20;
|
||||
line = rtgui_staticline_create(RTGUI_HORIZONTAL);
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(line), &rect);
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(line));
|
||||
|
||||
/* get view's rect */
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||
@@ -93,6 +110,7 @@ rtgui_box_t* demo_view_create_box(rtgui_view_t* view, int orient)
|
||||
|
||||
/* get rect of view */
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||
rect.y1 += 45;
|
||||
rect.y2 -= 25;
|
||||
|
||||
box = rtgui_box_create(orient, &rect);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
static struct rtgui_timer *timer;
|
||||
static struct rtgui_label* label;
|
||||
static struct rtgui_win* msgbox;
|
||||
static struct rtgui_win* msgbox = RT_NULL;
|
||||
static rt_uint8_t label_text[80];
|
||||
static int cnt = 5;
|
||||
|
||||
@@ -29,20 +29,8 @@ void diag_close(struct rtgui_timer* timer, void* parameter)
|
||||
|
||||
void window_demo()
|
||||
{
|
||||
rt_mq_t mq;
|
||||
rt_thread_t tid;
|
||||
rt_uint32_t user_data;
|
||||
struct rtgui_rect rect = {50, 50, 200, 200};
|
||||
|
||||
tid = rt_thread_self();
|
||||
if (tid == RT_NULL) return; /* can't use in none-scheduler environement */
|
||||
user_data = tid->user_data;
|
||||
|
||||
/* create gui message queue */
|
||||
mq = rt_mq_create("msgbox", 256, 4, RT_IPC_FLAG_FIFO);
|
||||
/* register message queue on current thread */
|
||||
rtgui_thread_register(rt_thread_self(), mq);
|
||||
|
||||
msgbox = rtgui_win_create(RT_NULL, "Information", &rect, RTGUI_WIN_STYLE_DEFAULT);
|
||||
if (msgbox != RT_NULL)
|
||||
{
|
||||
@@ -64,15 +52,6 @@ void window_demo()
|
||||
|
||||
timer = rtgui_timer_create(200, RT_TIMER_FLAG_PERIODIC, diag_close, RT_NULL);
|
||||
rtgui_timer_start(timer);
|
||||
|
||||
rtgui_win_event_loop(msgbox);
|
||||
|
||||
rtgui_thread_deregister(rt_thread_self());
|
||||
/* remove RTGUI message queue */
|
||||
rt_mq_delete(mq);
|
||||
|
||||
/* recover user data */
|
||||
tid->user_data = user_data;
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
@@ -108,7 +87,6 @@ rtgui_view_t* demo_view_window(rtgui_workbench_t* workbench)
|
||||
rtgui_button_t *button;
|
||||
|
||||
view = demo_view(workbench);
|
||||
demo_view_get_rect(view, &rect);
|
||||
|
||||
demo_view_get_rect(view, &rect);
|
||||
rect.x1 += 5; rect.x2 = rect.x1 + 100;
|
||||
|
||||
@@ -55,6 +55,7 @@ static void workbench_entry(void* parameter)
|
||||
/* 在工作台上添加一个视图 */
|
||||
rtgui_workbench_add_view(workbench, view);
|
||||
|
||||
demo_view_window(workbench);
|
||||
demo_view_label(workbench);
|
||||
demo_view_button(workbench);
|
||||
demo_view_checkbox(workbench);
|
||||
|
||||
Reference in New Issue
Block a user