当前位置: 首页>>代码示例>>C++>>正文


C++ rtgui_container_add_child函数代码示例

本文整理汇总了C++中rtgui_container_add_child函数的典型用法代码示例。如果您正苦于以下问题:C++ rtgui_container_add_child函数的具体用法?C++ rtgui_container_add_child怎么用?C++ rtgui_container_add_child使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rtgui_container_add_child函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: demo_view

/* 创建用于演示自定义控件的视图 */
rtgui_container_t *demo_view_mywidget(void)
{
	rtgui_container_t *container;
	rtgui_rect_t rect;
	rtgui_mywidget_t *mywidget;

	/* 先创建一个演示用的视图 */
	container = demo_view("MyWidget View");

	/* 获得视图的位置信息 */
	demo_view_get_rect(container, &rect);
	rect.x1 += 5;
	rect.x2 = rect.y1 + 80;
	rect.y1 += 5;
	rect.y2 = rect.y1 + 80;
	/* 创建一个自定义控件 */
	mywidget = rtgui_mywidget_create(&rect);
	/* container是一个container控件,调用add_child方法添加这个自控件 */
	rtgui_container_add_child(container, RTGUI_WIDGET(mywidget));

	/* 获得视图的位置信息 */
	demo_view_get_rect(container, &rect);
	rect.x1 += 25;
	rect.x2 = rect.y1 + 40;
	rect.y1 += 5 + 100;
	rect.y2 = rect.y1 + 40;
	/* 创建一个自定义控件 */
	mywidget = rtgui_mywidget_create(&rect);
	/* container是一个container控件,调用add_child方法添加这个自控件 */
	rtgui_container_add_child(container, RTGUI_WIDGET(mywidget));

	return container;
}
开发者ID:Paolo-Maffei,项目名称:rt-thread-stm32f4discovery,代码行数:34,代码来源:demo_view_mywidget.c

示例2: app_lcd

static void app_lcd(void *parameter)
{
    /* create application */
	struct rtgui_app *app;
    struct rtgui_rect rect1 = {0, 0, 240, 320};
    struct rtgui_button* btn;
    struct rtgui_label *lb;

	app = rtgui_app_create("lcd_app");

    if (!app)
    {
        rt_kprintf("Create application \"lcd_app\" failed!\n");
        return;
    }

    /* create main window */
    win_main = rtgui_win_create(RT_NULL, "main",
                    &rect1,
                    RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
    if (win_main == RT_NULL)
    {
        rt_kprintf("Create window \"main\" failed!\n");
        rtgui_app_destroy(app);
        return;
    }
    RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(win_main)) = green;

    rect1.x1 = rect1.y1 = 50;
    rect1.x2 -= 50;
    rect1.y2 -= 50;
    lb = rtgui_label_create("I am a transparent label!!!!!!!!!");
    rtgui_widget_set_rect(RTGUI_WIDGET(lb), &rect1);
    RTGUI_WIDGET_FLAG(RTGUI_WIDGET(lb)) |= RTGUI_WIDGET_FLAG_TRANSPARENT;

    rect1.x1 += 20;
    rect1.y1 += 20;
	notebook = rtgui_notebook_create(&rect1, 0);
    /* create lable in main container */
    btn = rtgui_button_create("Here I am.");
    rtgui_notebook_add(notebook, "btn A", RTGUI_WIDGET(btn));
    rtgui_button_set_onbutton(btn, remove_myself);
    btn = rtgui_button_create("There I am.");
    rtgui_notebook_add(notebook, "btn B", RTGUI_WIDGET(btn));

    rtgui_container_add_child(RTGUI_CONTAINER(win_main), RTGUI_WIDGET(lb));
	rtgui_container_add_child(RTGUI_CONTAINER(win_main), RTGUI_WIDGET(notebook));

    rtgui_win_show(win_main, RT_FALSE);

    rtgui_app_run(app);
    rtgui_app_destroy(app);
}
开发者ID:201409366,项目名称:RTGUI,代码行数:53,代码来源:application.c

示例3: demo_modalwin_onbutton

/* 触发模态窗口显示 */
static void demo_modalwin_onbutton(struct rtgui_object *object, rtgui_event_t *event)
{
    rtgui_win_t *win;
    rtgui_label_t *label;
    rtgui_rect_t rect = {0, 0, 150, 80};

    rtgui_rect_moveto(&rect, delta_x, delta_y);
    delta_x += 20;
    delta_y += 20;

    /* 创建一个窗口 */
    win = rtgui_win_create(main_win,
                           get_win_title(), &rect, RTGUI_WIN_STYLE_DEFAULT);

    rect.x1 += 20;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;

    label = rtgui_label_create("这是一个模式窗口");
    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));

    /* 模态显示窗口 */
    rtgui_win_show(win, RT_TRUE);

    /* 删除非自动删除窗口 */
    rtgui_win_destroy(win);
}
开发者ID:EvanZheng,项目名称:RTGUI,代码行数:30,代码来源:demo_view_window.c

示例4: demo_view_notebook

/* 创建用于演示notebook控件的视图 */
rtgui_view_t* demo_view_notebook(rtgui_workbench_t* workbench)
{
	rtgui_rect_t rect;
	rtgui_view_t* view;
	rtgui_notebook_t* notebook;
	rtgui_listbox_t* box;

	/* 先创建一个演示用的视图 */
	view = demo_view(workbench, "Notebook View");

	/* 获得视图的位置信息 */
	demo_view_get_rect(view, &rect);

	notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_BOTTOM);
	/* view是一个container控件,调用add_child方法添加这个notebook控件 */
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(notebook));

	box = rtgui_listbox_create(items, sizeof(items)/sizeof(struct rtgui_listbox_item), &rect);
	rtgui_notebook_add(notebook, "Tab 1", RTGUI_WIDGET(box));

	box = rtgui_listbox_create(items2, sizeof(items2)/sizeof(struct rtgui_listbox_item), &rect);
	rtgui_notebook_add(notebook, "Tab 2", RTGUI_WIDGET(box));

	return view;
}
开发者ID:CollinsLiu,项目名称:rt-thread-pc,代码行数:26,代码来源:demo_view_notebook.c

示例5: rtgui_filelist_view_menu_pop

static void rtgui_filelist_view_menu_pop(rtgui_widget_t *parent)
{
	rtgui_win_t *menu;
	rtgui_listbox_t *listbox;
	rtgui_rect_t screen, rect = {0, 0, 140, 85};

	rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &screen);
	rtgui_rect_moveto_align(&screen, &rect, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);

	menu = rtgui_win_create(RTGUI_WIN(rtgui_widget_get_toplevel(parent)),
							"Folder Menu", &rect, RTGUI_WIN_STYLE_DEFAULT);
	if (menu != RT_NULL)
	{
		/* set user data on menu window */
		menu->user_data = (rt_uint32_t)parent;

		rtgui_win_set_ondeactivate(menu, rtgui_filelist_view_on_menu_deactivate);

		listbox = rtgui_listbox_create(items, sizeof(items)/sizeof(items[0]), &rect);
		rtgui_listbox_set_onitem(listbox, rtgui_filelist_view_on_folder_item);
		rtgui_container_add_child(RTGUI_CONTAINER(menu), RTGUI_WIDGET(listbox));
		rtgui_win_show(menu, RT_FALSE);
		rtgui_widget_focus(RTGUI_WIDGET(listbox));
		rtgui_listbox_set_current_item(listbox, 0);
	}
}
开发者ID:zdgaoyu,项目名称:RTGUI,代码行数:26,代码来源:filelist_view.c

示例6: listitem_action

/* 列表项的动作函数 */
static void listitem_action(rtgui_widget_t *widget, void *parameter)
{
    char label_text[32];
    rtgui_win_t *win;
    rtgui_label_t *label;
    rtgui_rect_t rect = {0, 0, 150, 80};
    int no = (int)parameter;

    rtgui_rect_moveto(&rect, 20, 50);

    /* 显示消息窗口 */
    win = rtgui_win_create(main_win,
                           "窗口", &rect, RTGUI_WIN_STYLE_DEFAULT);

    rect.x1 += 20;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;

    /* 添加相应的标签 */
    rt_sprintf(label_text, "动作 %d", no);
    label = rtgui_label_create(label_text);

    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    rtgui_container_add_child(win, RTGUI_WIDGET(label));

    /* 非模态显示窗口 */
    rtgui_win_show(win, RT_FALSE);
}
开发者ID:201409366,项目名称:RTGUI,代码行数:30,代码来源:demo_listview.c

示例7: show_modal_info

rt_bool_t show_modal_info(struct rtgui_widget *object, struct rtgui_event *event)
{
	rtgui_label_t *label;
	struct rtgui_win *win;
	rtgui_rect_t rect = {0, 60, 150, 100};
	win = rtgui_win_create(main_win,
						   "Info",
						   &rect,
						   RTGUI_WIN_STYLE_DEFAULT);

	rect.x1 += 20;
	rect.x2 -= 5;
	rect.y1 += 5;
	rect.y2 = rect.y1 + 20;

	label = rtgui_label_create("modal mode info");
	rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
	rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label));

	rtgui_win_show(win, RT_TRUE);

	rtgui_win_destroy(win);

	return RT_TRUE;
}
开发者ID:EvanZheng,项目名称:RTGUI,代码行数:25,代码来源:swin_focus.c

示例8: rtgui_win_set_box

void rtgui_win_set_box(rtgui_win_t* win, rtgui_box_t* box)
{
    if (win == RT_NULL || box == RT_NULL) return;

    rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(box));
    rtgui_widget_set_rect(RTGUI_WIDGET(box), &(RTGUI_WIDGET(win)->extent));
}
开发者ID:zhangjinxing,项目名称:RTGUI,代码行数:7,代码来源:window.c

示例9: rtgui_filelist_view_menu_pop

static void rtgui_filelist_view_menu_pop(rtgui_widget_t *parent)
{
    struct rtgui_win *menu;
    rtgui_rect_t screen, rect = {0, 0, 140, 85};

    rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &screen);
    rtgui_rect_moveto_align(&screen, &rect, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);

    menu = rtgui_win_create(RTGUI_WIN(rtgui_widget_get_toplevel(parent)),
                            "Folder Menu", &rect, RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);
    if (menu != RT_NULL)
    {
        rtgui_listbox_t *listbox;
        /* Pass the pointer to filelist_view via user_data. */
        menu->user_data = (rt_uint32_t)parent;

        rtgui_win_set_ondeactivate(menu, rtgui_filelist_view_on_menu_deactivate);

        listbox = rtgui_listbox_create(_folder_actions,
                                       sizeof(_folder_actions) / sizeof(_folder_actions[0]),
                                       &rect);
        /* Set the item index *before* setup the callback. `set_current_item`
         * will invoke the "onitem". So just keep it clean when setting the
         * current item. */
        rtgui_listbox_set_current_item(listbox, 0);
        rtgui_listbox_set_onitem(listbox, rtgui_filelist_view_on_folder_item);

        rtgui_container_add_child(RTGUI_CONTAINER(menu), RTGUI_WIDGET(listbox));

        rtgui_win_show(menu, RT_TRUE);
    }
}
开发者ID:KodakWang,项目名称:RTGUI,代码行数:32,代码来源:filelist_view.c

示例10: demo_autowin_onbutton

/* 触发自动窗口显示 */
static void demo_autowin_onbutton(struct rtgui_object *object, rtgui_event_t *event)
{
    struct rtgui_rect rect = {50, 50, 200, 200};

    /* don't create the window twice */
    if (autowin)
        return;

    autowin = rtgui_win_create(main_win, "Information",
                              &rect, RTGUI_WIN_STYLE_DEFAULT | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);
    if (autowin == RT_NULL)
        return;

    cnt = 5;
    rt_sprintf(label_text, "closed then %d second!", cnt);
    label = rtgui_label_create(label_text);
    rect.x1 += 5;
    rect.x2 -= 5;
    rect.y1 += 5;
    rect.y2 = rect.y1 + 20;
    rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
    rtgui_container_add_child(RTGUI_CONTAINER(autowin),
                              RTGUI_WIDGET(label));

    /* 设置关闭窗口时的动作 */
    rtgui_win_set_onclose(autowin, auto_window_close);

    rtgui_win_show(autowin, RT_FALSE);
    /* 创建一个定时器 */
    timer = rtgui_timer_create(100, RT_TIMER_FLAG_PERIODIC, diag_close, RT_NULL);
    rtgui_timer_start(timer);
}
开发者ID:EvanZheng,项目名称:RTGUI,代码行数:33,代码来源:demo_view_window.c

示例11: demo_listview_icon_view

/* 创建用于演示列表视图的视图 */
rtgui_view_t* demo_listview_icon_view(rtgui_workbench_t* workbench)
{
	rtgui_rect_t rect;
	rtgui_view_t *view;
	rtgui_button_t* open_btn;

	view = demo_view(workbench, "图标视图演示");

	if (item_icon == RT_NULL)
		item_icon = rtgui_image_create_from_mem("xpm",
			(const rt_uint8_t*)image_xpm, sizeof(image_xpm), RT_TRUE);
	if (exit_icon == RT_NULL)
		exit_icon = rtgui_image_create_from_mem("xpm",
			(const rt_uint8_t*)exit_xpm, sizeof(exit_xpm), RT_TRUE);

	/* 添加动作按钮 */
	demo_view_get_rect(view, &rect);
	rect.x1 += 5;
	rect.x2 = rect.x1 + 80;
	rect.y1 += 30;
	rect.y2 = rect.y1 + 20;
	open_btn = rtgui_button_create("打开图标列表");
	rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(open_btn));
	rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect);
	rtgui_button_set_onbutton(open_btn, open_btn_onbutton);

	return view;
}
开发者ID:aspirefhaha,项目名称:ad7606_stm32107,代码行数:29,代码来源:demo_listview_icon.c

示例12: rtgui_menu_create

struct rtgui_menu* rtgui_menu_create(const char* title, struct rtgui_menu* parent_menu, 
	const struct rtgui_menu_item* items, rt_uint16_t count)
{
	rtgui_rect_t rect = {0, 0, 100, 100};
    struct rtgui_menu* menu;

    menu = (struct rtgui_menu*) rtgui_widget_create ( RTGUI_MENU_TYPE );
	if (menu != RT_NULL)
	{
		rtgui_win_set_title(RTGUI_WIN(menu), title);
		menu->parent_menu = parent_menu;
		menu->items = items;
		menu->items_count = count;

		rtgui_widget_set_rect(RTGUI_WIDGET(menu), &rect);
		rtgui_rect_inflate(&rect, -1);
		/* create menu item list */
		menu->items_list = rtgui_listctrl_create((rt_uint32_t)items, count, &rect, _rtgui_menu_item_ondraw); 
		RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(menu->items_list)) = rtgui_theme_default_bc();
		rtgui_container_add_child(RTGUI_CONTAINER(menu), RTGUI_WIDGET(menu->items_list));
		rtgui_listctrl_set_onitem(menu->items_list, _rtgui_menu_onitem);
	}

	return menu;
}
开发者ID:pengdonglin137,项目名称:iboot,代码行数:25,代码来源:menu.c

示例13: rtgui_terminal_create

rtgui_terminal_t* rtgui_terminal_create(pvoid parent,const char* text, int left,int top,int w,int h)
{
	rtgui_container_t *container;
	rtgui_terminal_t* tma;

	RT_ASSERT(parent != RT_NULL);
	container = RTGUI_CONTAINER(parent);

	tma = rtgui_widget_create(RTGUI_TERMINAL_TYPE);
	if(tma != RT_NULL)
	{
		rtgui_rect_t rect;
		rtgui_widget_get_rect(container, &rect);
		rtgui_widget_rect_to_device(container,&rect);
		rect.x1 += left;
		rect.y1 += top;
		rect.x2 = rect.x1+w;
		rect.y2 = rect.y1+h;
		rtgui_widget_set_rect(tma,&rect);
		rtgui_container_add_child(container, tma);

		/* calculate line width and line page count */
		rtgui_terminal_calc_width(tma);
		/* set text */
		rtgui_terminal_calc_line(tma, text);
	}

	return tma;
}
开发者ID:amsl,项目名称:RTGUI,代码行数:29,代码来源:terminal.c

示例14: main

int main(int argc, char** argv)
{
	struct rtgui_app* application;
	struct rtgui_win* win;
    struct rtgui_button *button;

	application = rtgui_app_create("button");
	if (application != RT_NULL)
	{
		rtgui_rect_t rect;

		win = rtgui_mainwin_create(RT_NULL, "button",
			RTGUI_WIN_STYLE_MAINWIN | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE);
        rtgui_widget_get_extent(RTGUI_WIDGET(win), &rect);

		/* create lable in app window */
        button = rtgui_button_create("close");
		rtgui_button_set_onbutton(button, _on_close);
        rect.x2 -= 5; rect.y2 -= 5;
        rect.x1 = rect.x2 - 80; rect.y1 = rect.y2 - 25;
		rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(button));

		rtgui_win_show(win, RT_TRUE);
		rtgui_app_destroy(application);
	}

    return 0;
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:29,代码来源:button.c

示例15: creat_software_ver_not_match_win

int creat_software_ver_not_match_win(struct rtgui_widget* widget)
{
	rtgui_rect_t rect = {60, 45, 260, 160};
	rtgui_label_t *label1;
	rtgui_label_t *label2;
	rtgui_toplevel_t *parent;

	if (RT_NULL != software_version_not_match_win)
		return FAIL;

	parent = RTGUI_TOPLEVEL(rtgui_widget_get_toplevel(widget));

	software_version_not_match_win = rtgui_win_create(parent,
		"致命错误", &rect, RTGUI_WIN_STYLE_MODAL);

	rtgui_widget_get_extent(RTGUI_WIDGET(software_version_not_match_win),&rect);
	rect.x1 += 20;
	rect.x2 -= 20;
	rect.y1 += 20;
	rect.y2 = rect.y1 + 30;
	label1 = rtgui_label_create("接收端与lcd软件版本");
	if (NULL != label1) {
		rtgui_widget_set_rect(RTGUI_WIDGET(label1), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(software_version_not_match_win), RTGUI_WIDGET(label1));
	}

	rtgui_widget_get_extent(RTGUI_WIDGET(software_version_not_match_win),&rect);
	rect.x1 += 70;
	rect.x2 -= 30;
	rect.y1 += 50;
	rect.y2 = rect.y1 + 30;
	label2 = rtgui_label_create("不匹配!");
	if (NULL != label2) {
		rtgui_widget_set_rect(RTGUI_WIDGET(label2), &rect);
		rtgui_container_add_child(RTGUI_CONTAINER(software_version_not_match_win), RTGUI_WIDGET(label2));
	}

	send_cmd_to_rxe(1, SWITCH2PT);

	rtgui_win_show(software_version_not_match_win, RT_TRUE);

	rtgui_win_destroy(software_version_not_match_win);
	software_version_not_match_win = RT_NULL;

	return SUCC;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:46,代码来源:zvd_gui_app.c


注:本文中的rtgui_container_add_child函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。