提交 8d99235d 编写于 作者: B bernard.xiong

add more GUI example.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@310 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 201113c5
#include "demo_view.h"
#include <rtgui/widgets/label.h>
#include <rtgui/widgets/button.h>
// #include <rtgui/widgets/fn_view.h>
static rtgui_label_t* label;
void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event)
{
/* create a fn view */
}
rtgui_view_t* demo_fn_view(rtgui_workbench_t* workbench)
{
rtgui_rect_t rect;
rtgui_view_t* view;
rtgui_button_t* open_btn;
rtgui_font_t* font;
view = demo_view(workbench);
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
font = rtgui_font_refer("asc", 12);
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5; rect.y2 = rect.y1 + 20;
label = rtgui_label_create("fn: ");
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 80;
rect.y1 += 30; rect.y2 = rect.y1 + 20;
open_btn = rtgui_button_create("Open File");
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(open_btn));
rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(open_btn)) = font;
rtgui_button_set_onbutton(open_btn, open_btn_onbutton);
return view;
}
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_server.h>
/*
* Panel demo for 240x320
* info panel: (0, 0) - (240, 25)
* main panel: (0, 25) - (240, 320)
*/
void panel_init(void)
{
rtgui_rect_t rect;
......
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_server.h>
/*
* a single panel for 240x320
*/
void panel_init(void)
{
rtgui_rect_t rect;
/* register main panel */
rect.x1 = 0;
rect.y1 = 0;
rect.x2 = 240;
rect.y2 = 320;
rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main");
}
#include <rtgui/rtgui.h>
#include <rtgui/widgets/view.h>
#include <rtgui/widgets/button.h>
#include <rtgui/widgets/workbench.h>
static rtgui_view_t* demo_view_list[32];
static rt_uint32_t demo_view_current = 0;
static rt_uint32_t demo_view_number = 0;
static void demo_view_next(struct rtgui_widget* widget, rtgui_event_t *event)
{
RT_ASSERT(widget != RT_NULL);
if (demo_view_current + 1< demo_view_number)
{
demo_view_current ++;
rtgui_view_show(demo_view_list[demo_view_current], RT_FALSE);
}
}
static void demo_view_prev(struct rtgui_widget* widget, rtgui_event_t *event)
{
RT_ASSERT(widget != RT_NULL);
if (demo_view_current != 0)
{
demo_view_current --;
rtgui_view_show(demo_view_list[demo_view_current], RT_FALSE);
}
}
rtgui_view_t* demo_view(rtgui_workbench_t* workbench)
{
char view_name[32];
struct rtgui_view* view;
rt_sprintf(view_name, "view %d", demo_view_number + 1);
view = rtgui_view_create(view_name);
/* add to the list */
demo_view_list[demo_view_number] = view;
demo_view_number ++;
rtgui_workbench_add_view(workbench, view);
/* add next and prev button */
{
struct rtgui_rect rect;
struct rtgui_button *next_btn, *prev_btn;
/* get view's rect */
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
rect.x2 -= 5; rect.y2 -= 5;
rect.x1 = rect.x2 - 50; rect.y1 = rect.y2 - 20;
/* create next button */
next_btn = rtgui_button_create("Next");
rtgui_button_set_onbutton(next_btn, demo_view_next);
rtgui_widget_set_rect(RTGUI_WIDGET(next_btn), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(next_btn));
/* get view's rect */
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
rect.x1 += 5; rect.y2 -= 5;
rect.x2 = rect.x1 + 50; rect.y1 = rect.y2 - 20;
/* create previous button */
prev_btn = rtgui_button_create("Prev");
rtgui_button_set_onbutton(prev_btn, demo_view_prev);
rtgui_widget_set_rect(RTGUI_WIDGET(prev_btn), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(prev_btn));
}
return view;
}
void demo_view_get_rect(rtgui_view_t* view, rtgui_rect_t *rect)
{
RT_ASSERT(view != RT_NULL);
RT_ASSERT(rect != RT_NULL);
rtgui_widget_get_rect(RTGUI_WIDGET(view), rect);
/* remove the command button rect */
rect->y2 -= 25;
}
#ifndef RTGUI_USING_SMALL_SIZE
rtgui_box_t* demo_view_create_box(rtgui_view_t* view, int orient)
{
rtgui_rect_t rect;
rtgui_box_t* box;
/* get rect of view */
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
rect.y2 -= 25;
box = rtgui_box_create(orient, &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(box));
return box;
}
#endif
void demo_view_show()
{
if (demo_view_number != 0)
{
rtgui_view_show(demo_view_list[demo_view_current], RT_FALSE);
}
}
#ifndef __DEMO_VIEW_H__
#define __DEMO_VIEW_H__
#include <rtgui/rtgui.h>
#include <rtgui/widgets/view.h>
#include <rtgui/widgets/workbench.h>
#ifndef RTGUI_USING_SMALL_SIZE
#include <rtgui/widgets/box.h>
#endif
rtgui_view_t* demo_view(rtgui_workbench_t* workbench);
void demo_view_get_rect(rtgui_view_t* view, rtgui_rect_t *rect);
void demo_view_show(void);
#ifndef RTGUI_USING_SMALL_SIZE
rtgui_box_t* demo_view_create_box(rtgui_view_t* view, int orient);
#endif
#endif
#include "demo_view.h"
#ifndef RTGUI_USING_SMALL_SIZE
#include <rtgui/widgets/box.h>
rtgui_view_t* demo_view_box(rtgui_workbench_t* workbench)
{
rtgui_rect_t rect;
rtgui_view_t* view;
view = demo_view(workbench);
demo_view_get_rect(view, &rect);
return view;
}
#endif
#include "demo_view.h"
#include <rtgui/widgets/button.h>
rtgui_view_t* demo_view_button(rtgui_workbench_t* workbench)
{
rtgui_rect_t rect;
rtgui_view_t* view;
rtgui_button_t* button;
rtgui_font_t* font;
/* create a demo view */
view = demo_view(workbench);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("Red");
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(button)) = red;
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("Blue");
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(button)) = blue;
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25 + 25; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("12 font");
font = rtgui_font_refer("asc", 12);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(button)) = font;
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25 + 25 + 25; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("16 font");
font = rtgui_font_refer("asc", 16);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(button)) = font;
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
return view;
}
#include "demo_view.h"
#include <rtgui/widgets/checkbox.h>
rtgui_view_t* demo_view_checkbox(rtgui_workbench_t* workbench)
{
rtgui_rect_t rect;
rtgui_view_t* view;
rtgui_checkbox_t* checkbox;
rtgui_font_t* font;
/* create a demo view */
view = demo_view(workbench);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5; rect.y2 = rect.y1 + 20;
checkbox = rtgui_checkbox_create("Red");
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = red;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25; rect.y2 = rect.y1 + 20;
checkbox = rtgui_checkbox_create("Blue");
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = blue;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25 + 25; rect.y2 = rect.y1 + 20;
checkbox = rtgui_checkbox_create("12 font");
font = rtgui_font_refer("asc", 12);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(checkbox)) = font;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25 + 25 + 25; rect.y2 = rect.y1 + 20;
checkbox = rtgui_checkbox_create("16 font");
font = rtgui_font_refer("asc", 16);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(checkbox)) = font;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox));
return view;
}
#include "demo_view.h"
#include <rtgui/widgets/label.h>
rtgui_view_t* demo_view_label(rtgui_workbench_t* workbench)
{
rtgui_rect_t rect;
rtgui_view_t* view;
rtgui_label_t* label;
rtgui_font_t* font;
/* create a demo view */
view = demo_view(workbench);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5; rect.y2 = rect.y1 + 20;
label = rtgui_label_create("Red Left");
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_LEFT;
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = red;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5 + 25; rect.y2 = rect.y1 + 20;
label = rtgui_label_create("Blue Right");
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_RIGHT;
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = blue;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5 + 25 + 25; rect.y2 = rect.y1 + 20;
label = rtgui_label_create("Green Center");
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = green;
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(label)) = RTGUI_ALIGN_CENTER_HORIZONTAL;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5 + 25 + 25 + 25; rect.y2 = rect.y1 + 20;
label = rtgui_label_create("12 font");
font = rtgui_font_refer("asc", 12);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
demo_view_get_rect(view, &rect);
rect.x1 += 5;
rect.y1 += 5 + 25 + 25 + 25 + 25; rect.y2 = rect.y1 + 20;
label = rtgui_label_create("16 font");
font = rtgui_font_refer("asc", 16);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
return view;
}
#include "demo_view.h"
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/label.h>
#include <rtgui/widgets/progressbar.h>
static rtgui_progressbar_t* hbar;
static rtgui_progressbar_t* vbar;
static rtgui_timer_t *bar_timer = RT_NULL;
void progressbar_timeout(struct rtgui_timer* timer, void* parameter)
{
static rt_uint32_t value = 0;
value ++;
if (value == 100) value = 0;
rtgui_progressbar_set_value(hbar, value);
rtgui_progressbar_set_value(vbar, value);
}
rtgui_view_t *demo_view_progressbar(rtgui_workbench_t* workbench)
{
rtgui_view_t *view;
rtgui_rect_t rect;
rtgui_label_t *label;
/* create a demo view */
view = demo_view(workbench);
/* get demo view rect */
demo_view_get_rect(view, &rect);
label = rtgui_label_create("horizontal progress bar:");
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5; rect.y2 = rect.y1 + 18;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rect.y1 += 20; rect.y2 = rect.y1 + 18;
hbar = rtgui_progressbar_create(RTGUI_HORIZONTAL, 100, &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(hbar));
/* get demo view rect */
demo_view_get_rect(view, &rect);
label = rtgui_label_create("vertical progress bar:");
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 45; rect.y2 = rect.y1 + 18;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rect.x1 += 110; rect.x2 = rect.x1 + 20;
rect.y1 += 18 + 5; rect.y2 = rect.y1 + 150;
vbar = rtgui_progressbar_create(RTGUI_VERTICAL, 100, &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(vbar));
bar_timer = rtgui_timer_create(50, RT_TIMER_FLAG_PERIODIC,
progressbar_timeout, RT_NULL);
rtgui_timer_start(bar_timer);
return view;
}
#include "demo_view.h"
#include <rtgui/widgets/radiobox.h>
static char* radio_item[5] =
{
"one",
"two",
"three",
"item 1",
"item 2"
};
static char* radio_item_h[3] =
{
"one", "two", "three"
};
rtgui_view_t* demo_view_radiobox(rtgui_workbench_t* workbench)
{
rtgui_rect_t rect;
rtgui_view_t* view;
rtgui_radiobox_t* radiobox;
view = demo_view(workbench);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5; rect.y2 = rect.y1 + 5 * 25;
radiobox = rtgui_radiobox_create("Radio Box", RTGUI_VERTICAL, radio_item, 5);
rtgui_radiobox_set_selection(radiobox, 0);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(radiobox));
rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 -= 5;
rect.y1 = 5 + 5 * 25; rect.y2 = rect.y1 + 60;
radiobox = rtgui_radiobox_create("Radio Box", RTGUI_HORIZONTAL, radio_item_h, 3);
rtgui_radiobox_set_selection(radiobox, 0);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(radiobox));
rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect);
return view;
}
#include "demo_view.h"
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/label.h>
#include <rtgui/widgets/slider.h>
rtgui_view_t *demo_view_slider(rtgui_workbench_t* workbench)
{
rtgui_view_t *view;
rtgui_rect_t rect;
rtgui_label_t *label;
rtgui_slider_t *slider;
/* create a demo view */
view = demo_view(workbench);
/* get demo view rect */
demo_view_get_rect(view, &rect);
label = rtgui_label_create("horizontal slider:");
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 5; rect.y2 = rect.y1 + 18;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rect.y1 += 20; rect.y2 = rect.y1 + 18;
slider = rtgui_slider_create(0, 100, RTGUI_HORIZONTAL);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(slider));
rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect);
/* get demo view rect */
demo_view_get_rect(view, &rect);
label = rtgui_label_create("vertical slider:");
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
rect.x1 += 5; rect.x2 -= 5;
rect.y1 += 50; rect.y2 = rect.y1 + 18;
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rect.x1 += 110; rect.x2 = rect.x1 + 20;
rect.y1 += 18 + 5; rect.y2 = rect.y1 + 150;
slider = rtgui_slider_create(0, 100, RTGUI_VERTICAL);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(slider));
rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect);
return view;
}
......@@ -2,6 +2,8 @@
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/window.h>
#include <rtgui/widgets/label.h>
#include <rtgui/widgets/button.h>
#include "demo_view.h"
static struct rtgui_timer *timer;
static struct rtgui_label* label;
......@@ -12,7 +14,7 @@ static int cnt = 5;
void diag_close(struct rtgui_timer* timer, void* parameter)
{
sprintf(label_text, "closed then %d second!", cnt);
rtgui_label_set_text(label, label_text);
rtgui_widget_update(RTGUI_WIDGET(label));
if (cnt == 0)
......@@ -73,17 +75,6 @@ void window_demo()
tid->user_data = user_data;
}
void window_demo_init()
{
rt_thread_t tid;
tid = rt_thread_create("win",
window_demo, RT_NULL,
2048, 25, 10);
if (tid != RT_NULL) rt_thread_startup(tid);
}
#ifdef RT_USING_FINSH
#include <finsh.h>
void win_demo()
......@@ -92,3 +83,64 @@ void win_demo()
}
FINSH_FUNCTION_EXPORT(win_demo, a window demo)
#endif
static void demo_win_onbutton(struct rtgui_widget* widget, rtgui_event_t* event)
{
window_demo();
}
static void demo_autowin_onbutton(struct rtgui_widget* widget, rtgui_event_t* event)
{
}
static void demo_modalwin_onbutton(struct rtgui_widget* widget, rtgui_event_t* event)
{
}
static void demo_ntitlewin_onbutton(struct rtgui_widget* widget, rtgui_event_t* event)
{
}
rtgui_view_t* demo_view_window(rtgui_workbench_t* workbench)
{
rtgui_rect_t rect;
rtgui_view_t* view;
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;
rect.y1 += 5; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("Normal Win");
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
rtgui_button_set_onbutton(button, demo_win_onbutton);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("Auto Win");
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
rtgui_button_set_onbutton(button, demo_autowin_onbutton);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25 + 25; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("Modal Win");
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
rtgui_button_set_onbutton(button, demo_modalwin_onbutton);
demo_view_get_rect(view, &rect);
rect.x1 += 5; rect.x2 = rect.x1 + 100;
rect.y1 += 5 + 25 + 25 + 25; rect.y2 = rect.y1 + 20;
button = rtgui_button_create("NoTitle Win");
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
rtgui_button_set_onbutton(button, demo_ntitlewin_onbutton);
return view;
}
......@@ -55,8 +55,16 @@ static void workbench_entry(void* parameter)
/* 在工作台上添加一个视图 */
rtgui_workbench_add_view(workbench, view);
/* 显示这个视图 */
rtgui_view_show(view, RT_FALSE);
demo_view_label(workbench);
demo_view_button(workbench);
demo_view_checkbox(workbench);
demo_view_progressbar(workbench);
demo_view_radiobox(workbench);
demo_fn_view(workbench);
demo_view_slider(workbench);
/* 显示视图 */
demo_view_show();
/* 执行工作台事件循环 */
rtgui_workbench_event_loop(workbench);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册