示例#1
0
文件: apps_list.c 项目: amsl/RTGUI
struct rtgui_panel* apps_list_create(struct rtgui_panel* panel)
{
	struct rtgui_rect rect;

	RT_ASSERT(panel != RT_NULL);

	if (app_default_icon == RT_NULL)
	{
		app_default_icon = rtgui_image_create_from_mem("xpm", (const rt_uint8_t*)exec_xpm, sizeof(exec_xpm), RT_FALSE);
	}
	if (app_close == RT_NULL)
	{
		app_close = rtgui_image_create_from_mem("xpm", (const rt_uint8_t *)close_xpm, sizeof(close_xpm), RT_FALSE);
	}

	rtgui_widget_get_extent(RTGUI_WIDGET(panel), &rect);

	/* create application list */
	rtgui_rect_inflate(&rect, -15);

	app_list = rtgui_listctrl_create(RTGUI_CONTAINER(panel), (rt_uint32_t)app_items, app_count, 15,15,RC_W(rect)-30,RC_H(rect)-30, _app_info_draw);
	rtgui_listctrl_set_itemheight(app_list, app_default_icon->h + 2);
	rtgui_listctrl_set_onitem(app_list, _handle_app_activate);
	rtgui_object_set_event_handler(RTGUI_OBJECT(app_list), apps_listctrl_event_handler);

	//rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(app_list));

	return RTGUI_PANEL(panel);
}
示例#2
0
文件: program.c 项目: lgnq/mini2440
struct rtgui_panel* program_create(struct rtgui_panel* panel)
{
    int i = 0;
    struct rtgui_rect rect;

    RT_ASSERT(panel != RT_NULL);
    rtgui_widget_get_extent(RTGUI_WIDGET(panel), &rect);

    items = (struct rtgui_list_item *) rtgui_malloc((ITEM_MAX) * sizeof(struct rtgui_list_item));
    for(i=0; i< ITEM_MAX; i++) items[i].action = exec_app;

    /* create application list */
    rtgui_rect_inflate(&rect, -15);

    scan_app_dir(APP_PATH);
    if(pos >= 0) 
    {
        _view = rtgui_list_view_create(items, pos + 1, &rect, RTGUI_LIST_VIEW_ICON);
        rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(_view));
    }        

    return RTGUI_PANEL(panel);
}
示例#3
0
文件: appmgr.c 项目: aozima/RTGUI
void app_mgr_win_init(void)
{
	struct rtgui_win* win;
	rtgui_rect_t rect;
	struct rtgui_notebook *notebook;
	rtgui_listbox_t* box;
	struct rtgui_image* pressed_image;
	struct rtgui_image* unpressed_image;
	int font_size;
	struct block_panel* block;
	int angle_y;
	
	/* create main window of Application Manager */
	win = rtgui_mainwin_create(RT_NULL, "AppMgr", RTGUI_WIN_STYLE_MAINWIN);
	RTGUI_WIDGET_BACKGROUND(win) = RTGUI_RGB(241, 241, 241);

	/* create icon image */
	pressed_image = rtgui_image_create_from_mem("xpm", (const rt_uint8_t*)home_xpm, sizeof(home_xpm), RT_FALSE);
	unpressed_image = rtgui_image_create_from_mem("xpm", (const rt_uint8_t*)home_gray_xpm, sizeof(home_gray_xpm), RT_FALSE);
	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(win), "AppMgr", &rect);
	font_size = rtgui_rect_height(rect);

	/* create notebook */
	rtgui_widget_get_extent(RTGUI_WIDGET(win), &rect);
	notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_LEFT);
	RTGUI_WIDGET_BACKGROUND(notebook) = RTGUI_RGB(241, 241, 241);
	rtgui_notebook_set_tab_height(notebook, pressed_image->h + font_size + 3 * RTGUI_WIDGET_DEFAULT_MARGIN);
	rtgui_notebook_set_tab_width(notebook, 65);
	angle_y = rect.x1;

	/* create navigation */
	rtgui_notebook_get_client_rect(notebook, &rect);
	block = block_panel_create(angle_y + notebook->tab_h/2, &rect);
	RTGUI_WIDGET_BACKGROUND(block) = RTGUI_RGB(241, 241, 241);
	rtgui_notebook_add_image(notebook, "AppTask", RTGUI_WIDGET(block),
		pressed_image, unpressed_image);
	apps_list_create(RTGUI_PANEL(block));
	angle_y += notebook->tab_h;

	block = block_panel_create(angle_y + notebook->tab_h/2, &rect);
	RTGUI_WIDGET_BACKGROUND(block) = RTGUI_RGB(241, 241, 241);
	rtgui_notebook_add_image(notebook, "Tab 1", RTGUI_WIDGET(block),
		pressed_image, unpressed_image);
	{
		struct rtgui_rect box_rect;
		block_panel_get_client_extent(block, &box_rect);
		// rtgui_widget_get_extent(RTGUI_WIDGET(block), &box_rect);
		// rtgui_rect_inflate(&box_rect, -15);
		box = rtgui_listbox_create(items, sizeof(items)/sizeof(struct rtgui_listbox_item), &box_rect);
		rtgui_container_add_child(RTGUI_CONTAINER(block), RTGUI_WIDGET(box));
	}
	angle_y += notebook->tab_h;

	block = block_panel_create(angle_y + notebook->tab_h/2, &rect);
	RTGUI_WIDGET_BACKGROUND(block) = RTGUI_RGB(241, 241, 241);
	rtgui_notebook_add_image(notebook, "Tab 2", RTGUI_WIDGET(block), 
		pressed_image, unpressed_image);
	angle_y += notebook->tab_h;

	rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(notebook));

	rtgui_win_show(win, RT_FALSE);

	/* set as main window */
	rtgui_app_set_main_win(win);
}