2012-04-18 23:06:12 +08:00
|
|
|
#include "demo_view.h"
|
|
|
|
#include <rtgui/widgets/box.h>
|
2012-07-20 20:37:56 +08:00
|
|
|
#include <rtgui/widgets/panel.h>
|
|
|
|
#include <rtgui/widgets/label.h>
|
|
|
|
#include <rtgui/widgets/button.h>
|
2012-04-18 23:06:12 +08:00
|
|
|
|
2012-07-20 20:37:56 +08:00
|
|
|
rtgui_container_t* demo_view_box(void)
|
2012-04-18 23:06:12 +08:00
|
|
|
{
|
|
|
|
rtgui_rect_t rect;
|
|
|
|
rtgui_container_t* view;
|
2012-07-20 20:37:56 +08:00
|
|
|
struct rtgui_panel *panel;
|
|
|
|
struct rtgui_box *box;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
2012-07-20 20:37:56 +08:00
|
|
|
struct rtgui_label *label;
|
|
|
|
struct rtgui_button *button;
|
|
|
|
|
|
|
|
view = demo_view("Box View");
|
2012-04-18 23:06:12 +08:00
|
|
|
demo_view_get_rect(view, &rect);
|
|
|
|
|
2012-07-20 20:37:56 +08:00
|
|
|
panel = rtgui_panel_create(RTGUI_BORDER_NONE);
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(panel), &rect);
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(panel));
|
|
|
|
|
|
|
|
box = rtgui_box_create(RTGUI_VERTICAL, 5);
|
|
|
|
rtgui_container_set_box(RTGUI_CONTAINER(panel), box);
|
|
|
|
|
|
|
|
label = rtgui_label_create("label 1");
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(label));
|
|
|
|
label = rtgui_label_create("label 2");
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(label));
|
|
|
|
|
|
|
|
button = rtgui_button_create("button 1");
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button));
|
|
|
|
|
|
|
|
button = rtgui_button_create("button 2");
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button));
|
|
|
|
rtgui_widget_set_miniheight(RTGUI_WIDGET(button), 25);
|
|
|
|
RTGUI_WIDGET_ALIGN(button) = RTGUI_ALIGN_EXPAND;
|
|
|
|
|
|
|
|
rtgui_container_layout(RTGUI_CONTAINER(panel));
|
|
|
|
|
2012-04-18 23:06:12 +08:00
|
|
|
return view;
|
|
|
|
}
|
2012-07-20 20:37:56 +08:00
|
|
|
|