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-08-13 16:32:01 +08:00
|
|
|
rtgui_container_t *demo_view_box(void)
|
2012-04-18 23:06:12 +08:00
|
|
|
{
|
|
|
|
rtgui_rect_t rect;
|
2012-08-13 16:32:01 +08:00
|
|
|
rtgui_container_t *view;
|
|
|
|
struct rtgui_panel *panel;
|
|
|
|
struct rtgui_box *box;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
struct rtgui_label *label;
|
|
|
|
struct rtgui_button *button;
|
2012-07-20 20:37:56 +08:00
|
|
|
|
|
|
|
view = demo_view("Box View");
|
2012-04-18 23:06:12 +08:00
|
|
|
demo_view_get_rect(view, &rect);
|
|
|
|
|
2012-08-13 16:32:01 +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));
|
2012-07-20 20:37:56 +08:00
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
box = rtgui_box_create(RTGUI_VERTICAL, 5);
|
|
|
|
rtgui_container_set_box(RTGUI_CONTAINER(panel), box);
|
2012-07-20 20:37:56 +08:00
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
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));
|
2012-07-20 20:37:56 +08:00
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
button = rtgui_button_create("button 1");
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button));
|
2012-07-20 20:37:56 +08:00
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
button = rtgui_button_create("button 2");
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button));
|
2013-02-01 10:27:10 +08:00
|
|
|
rtgui_widget_set_minheight(RTGUI_WIDGET(button), 25);
|
2012-08-13 16:32:01 +08:00
|
|
|
RTGUI_WIDGET_ALIGN(button) = RTGUI_ALIGN_EXPAND;
|
2012-07-20 20:37:56 +08:00
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
rtgui_container_layout(RTGUI_CONTAINER(panel));
|
2012-07-20 20:37:56 +08:00
|
|
|
|
2012-04-18 23:06:12 +08:00
|
|
|
return view;
|
|
|
|
}
|
2012-07-20 20:37:56 +08:00
|
|
|
|