示例#1
0
static void application_entry(void* parameter)
{
	struct rtgui_application *app;
	struct rtgui_rect rect;

	app = rtgui_application_create(rt_thread_self(), "gui_demo");
	if (app == RT_NULL)
		return;

	/* create a full screen window */
	rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect);

	main_win = rtgui_win_create(RT_NULL, "demo_win", &rect,
                        RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
	if (main_win == RT_NULL)
	{
		rtgui_application_destroy(app);
		return;
	}

	rtgui_win_set_onkey(main_win, demo_handle_key);

	/* create a no title notebook that we can switch demo on it easily. */
	the_notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_NOTAB);
	if (the_notebook == RT_NULL)
	{
		rtgui_win_destroy(main_win);
		rtgui_application_destroy(app);
		return;
	}

	rtgui_container_add_child(RTGUI_CONTAINER(main_win), RTGUI_WIDGET(the_notebook));

	/* 初始化各个例子的视图 */
	demo_view_benchmark();

	demo_view_dc();
#ifdef RTGUI_USING_TTF
	demo_view_ttf();
#endif

#ifndef RTGUI_USING_SMALL_SIZE
	demo_view_dc_buffer();
#endif
	demo_view_animation();
#ifndef RTGUI_USING_SMALL_SIZE
	demo_view_buffer_animation();
	demo_view_instrument_panel();
#endif
	demo_view_window();
	demo_view_label();
	demo_view_button();
	demo_view_checkbox();
	demo_view_progressbar();
	demo_view_scrollbar();
	demo_view_radiobox();
	demo_view_textbox();
	demo_view_listbox();
	demo_view_menu();
	demo_view_listctrl();
	demo_view_combobox();
	demo_view_slider();
	demo_view_notebook();
	demo_view_mywidget();
#if 0
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
	demo_view_image();
#endif
#ifdef RT_USING_MODULE	
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
	demo_view_module();
#endif
#endif
	demo_listview_view();
	demo_listview_icon_view();
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
	demo_fn_view();
#endif
#endif

	rtgui_win_show(main_win, RT_FALSE);

	/* 执行工作台事件循环 */
	rtgui_application_run(app);

	rtgui_application_destroy(app);
}
示例#2
0
static void workbench_entry(void* parameter)
{
	rt_mq_t mq;
	struct rtgui_workbench* workbench;

	/* 创建GUI应用需要的消息队列 */
#ifdef RTGUI_USING_SMALL_SIZE
	mq = rt_mq_create("workbench", 32, 32, RT_IPC_FLAG_FIFO);
#else
	mq = rt_mq_create("workbench", 256, 32, RT_IPC_FLAG_FIFO);
#endif
	/* 注册当前线程为GUI线程 */
	rtgui_thread_register(rt_thread_self(), mq);

	/* 创建一个工作台 */
	workbench = rtgui_workbench_create("main", "workbench");
	if (workbench == RT_NULL) return;

	rtgui_widget_set_event_handler(RTGUI_WIDGET(workbench), demo_workbench_event_handler);

	/* 初始化各个例子的视图 */
#if RT_VERSION == 4
	demo_view_benchmark(workbench);
#endif

	demo_view_dc(workbench);
#if RT_VERSION == 4
#ifdef RTGUI_USING_TTF
	demo_view_ttf(workbench);
#endif
#endif

#ifndef RTGUI_USING_SMALL_SIZE
	demo_view_dc_buffer(workbench);
#endif
	demo_view_animation(workbench);
#ifndef RTGUI_USING_SMALL_SIZE
	demo_view_buffer_animation(workbench);
	// demo_view_instrument_panel(workbench);
#endif
	demo_view_window(workbench);
	demo_view_label(workbench);
	demo_view_button(workbench);
	demo_view_checkbox(workbench);
	demo_view_progressbar(workbench);
	demo_view_scrollbar(workbench);
	demo_view_radiobox(workbench);
	demo_view_textbox(workbench);
	demo_view_listbox(workbench);
	demo_view_menu(workbench);
	demo_view_listctrl(workbench);
	demo_view_combobox(workbench);
	demo_view_slider(workbench);
	demo_view_notebook(workbench);
	demo_view_mywidget(workbench);
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
	demo_view_image(workbench);
#endif
#ifdef RT_USING_MODULE	
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
	demo_view_module(workbench);
#endif
#endif
	demo_listview_view(workbench);
	demo_listview_icon_view(workbench);
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
	demo_fn_view(workbench);
#endif

	/* 显示视图 */
	demo_view_show();

	/* 执行工作台事件循环 */
	rtgui_workbench_event_loop(workbench);

	/* 去注册GUI线程 */
	rtgui_thread_deregister(rt_thread_self());
	rt_mq_delete(mq);
}