Пример #1
0
int main(void)
{
	int i;
	char str[10];
	LCUI_RGB color[6]={{255,255,255},{127,127,127}, {255,0,0}, {255,165,0},
			{30,144,255}, {65,200,65} };
	LCUI_Widget *window, *widget[6], *label[6];
	
	LCUI_Init();
	window = Widget_New( "window" );
	for(i=0; i<6; ++i) {
		widget[i] = Widget_New( NULL );
		label[i] = Widget_New( "label" );
		sprintf(str, "Area %d" , i);
		Label_Text( label[i], str);
		Widget_Container_Add( widget[i], label[i] );
		Window_ClientArea_Add( window, widget[i] );
		Widget_Resize( widget[i], Size(80,80) );
		Widget_SetPosType( widget[i], POS_TYPE_STATIC );
		Widget_SetAlign( label[i], ALIGN_MIDDLE_CENTER, Pos(0,0) );
		Widget_SetBorder( widget[i], Border(1,BORDER_STYLE_SOLID,RGB(0,0,0)) );
		Widget_SetBackgroundTransparent( widget[i], FALSE );
		Widget_SetBackgroundColor( widget[i], color[i] );
		Widget_Show( label[i] );
		Widget_Show( widget[i] );
	}
	
	Window_SetTitleText( window, "测试部件布局-2" ); 
	Widget_Resize( window, Size(320, 240) );
	Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, destroy );
	
	Widget_Show( window );
	
	return LCUI_Main();
}
Пример #2
0
int main(int argc, char*argv[])
/* 主函数,程序的入口 */
{
	LCUI_Init();
	LCUI_Widget *windows[4];
	/* 创建窗口部件 */
	windows[0] = Window_New("主窗口", NULL, Size(320, 240));
	windows[1] = Window_New("子窗口 A", NULL, Size(240, 200));
	windows[2] = Window_New("子窗口 B", NULL, Size(180, 150));
	windows[3] = Window_New("子窗口 C", NULL, Size(150, 100));
	/* 改变风格 */
	Widget_SetStyleID( windows[1], WINDOW_STYLE_PURE_ORANGE );
	Widget_SetStyleID( windows[2], WINDOW_STYLE_PURE_GREEN );
	Widget_SetStyleID( windows[3], WINDOW_STYLE_PURE_RED );
	/* 将子窗口放入主窗口的客户区中 */
	Window_ClientArea_Add( windows[0], windows[1] );
	Window_ClientArea_Add( windows[0], windows[2] );
	Window_ClientArea_Add( windows[0], windows[3] );
	/* 显示它们 */
	Widget_Show(windows[0]); 
	Widget_Show(windows[1]); 
	Widget_Show(windows[2]);
	Widget_Show(windows[3]);
	Widget_Event_Connect( Window_GetCloseButton(windows[0]), EVENT_CLICKED, destroy);
	LCUI_Main(); /* 进入主循环 */ 
	return 0;
}
Пример #3
0
int main(int argc, char **argv)
{
    int i;
    LCUI_Init(0,0,0);
    /* 创建部件 */
    window = Widget_New("window");
    age_label = Widget_New("label");
    button = Button_New("提交");
    age_rb[0] = RadioButton_New("A. 15岁以下");
    age_rb[1] = RadioButton_New("B. 15-20岁");
    age_rb[2] = RadioButton_New("C. 21-25岁");
    age_rb[3] = RadioButton_New("D. 26-30岁");
    age_rb[4] = RadioButton_New("E. 31-40岁");
    age_rb[5] = RadioButton_New("F. 40岁以上");
    /* 设定窗口标题的文本 */
    Window_SetTitleText(window, "测试复选框部件");
    /* 改变尺寸 */
    Widget_Resize(window, Size(320, 240));
    Widget_SetAutoSize( button, FALSE, 0 );
    Widget_Resize(button, Size(60, 25));
    /* 将窗口客户区作为这些部件的容器 */
    Window_ClientArea_Add(window, age_label);
    Window_ClientArea_Add(window, button);
    for(i=0; i<6; i++) {
        Window_ClientArea_Add(window, age_rb[i]);
    }
    /* 调整部件的布局*/
    Widget_SetAlign(age_label, ALIGN_MIDDLE_CENTER, Pos(0,-40));
    Widget_SetAlign(button, ALIGN_MIDDLE_CENTER, Pos(0,60));
    Widget_SetAlign(age_rb[0], ALIGN_MIDDLE_LEFT, Pos(5,-20));
    Widget_SetAlign(age_rb[1], ALIGN_MIDDLE_LEFT, Pos(100,-20));
    Widget_SetAlign(age_rb[2], ALIGN_MIDDLE_LEFT, Pos(200,-20));
    Widget_SetAlign(age_rb[3], ALIGN_MIDDLE_LEFT, Pos(5,0));
    Widget_SetAlign(age_rb[4], ALIGN_MIDDLE_LEFT, Pos(100,0));
    Widget_SetAlign(age_rb[5], ALIGN_MIDDLE_LEFT, Pos(200,0));
    Label_Text(age_label, "你的年龄段是?");

    RadioButton_CreateMutex(age_rb[0], age_rb[1]);
    RadioButton_CreateMutex(age_rb[0], age_rb[2]);
    RadioButton_CreateMutex(age_rb[0], age_rb[3]);
    RadioButton_CreateMutex(age_rb[0], age_rb[4]);
    RadioButton_CreateMutex(age_rb[0], age_rb[5]);

    /* 显示部件 */
    Widget_Show(age_label);
    Widget_Show(button);
    Widget_Show(age_rb[0]);
    for(i=0; i<6; ++i) {
        Widget_Show(age_rb[i]);
    }
    Widget_Show(window);
    Widget_ConnectEvent( button, EVENT_CLICKED, view_result );
    Widget_ConnectEvent( Window_GetCloseButton(window), EVENT_CLICKED, destroy );
    LCUI_Main();
    return 0;
}
Пример #4
0
int main( int argc, char **argv )
{
    int i;

    LCUI_Init(0,0,0);
    /* 创建部件 */
    window  = Widget_New("window");
    label   = Widget_New("label");
    button	= Widget_New("button");
    for(i=0; i<5; ++i) {
        checkbox[i] = Widget_New("check_box");
    }
    CheckBox_TextW( checkbox[0], L"编程" );
    CheckBox_TextW( checkbox[1], L"电影" );
    CheckBox_TextW( checkbox[2], L"动漫" );
    CheckBox_TextW( checkbox[3], L"音乐" );
    CheckBox_TextW( checkbox[4], L"睡觉" );

    Button_TextW( button, L"提交" );
    Window_SetTitleTextW( window, L"测试复选框部件") ;
    window->resize(window, Size(320, 240));
    /* 禁用按钮部件的自动尺寸调整,因为要自定义尺寸 */
    Widget_SetAutoSize( button, FALSE, 0 );
    Widget_Resize(button, Size(60, 25));
    /* 将窗口客户区作为这些部件的容器 */
    Window_ClientArea_Add(window, label);
    Window_ClientArea_Add(window, button);
    for(i=0; i<5; i++) {
        Window_ClientArea_Add(window, checkbox[i]);
    }
    /* 调整部件的布局*/
    Widget_SetAlign(label, ALIGN_MIDDLE_CENTER, Pos(0,-20));
    Widget_SetAlign(button, ALIGN_MIDDLE_CENTER, Pos(0,60));
    Widget_SetAlign(checkbox[0], ALIGN_MIDDLE_CENTER, Pos(-120 ,5));
    Widget_SetAlign(checkbox[1], ALIGN_MIDDLE_CENTER, Pos(-60 ,5));
    Widget_SetAlign(checkbox[2], ALIGN_MIDDLE_CENTER, Pos(0 ,5));
    Widget_SetAlign(checkbox[3], ALIGN_MIDDLE_CENTER, Pos(60 ,5));
    Widget_SetAlign(checkbox[4], ALIGN_MIDDLE_CENTER, Pos(120 ,5));

    Label_TextW(label, L"你都有哪些兴趣爱好?\n");
    /* 显示部件 */
    Widget_Show(label);
    Widget_Show(button);
    for(i=0; i<5; ++i) {
        Widget_Show(checkbox[i]);
    }
    Widget_Show(window);
    /* 为按钮部件关联点击事件,被关联的函数是view_result,它会在点击按钮后被调用 */
    Widget_ConnectEvent( button, EVENT_CLICKED, view_result );
    Widget_ConnectEvent( Window_GetCloseButton(window), EVENT_CLICKED, destroy );
    return LCUI_Main();
}
Пример #5
0
int main(void) 
{
	int i; 
	char text[5][10] = { "蓝色","绿色", "红色", "橙色", "紫色" };
	LCUI_Pos offset_pos[5]={{-120,0},{-60,0},{0,0},{60,0},{120,0}};	

	LCUI_Init();
	
	main_window = Widget_New( "window" ); 
	btn_ok = Widget_New( "button" );
	label = Widget_New( "label" );
	/* 设置窗口的尺寸以及标题栏文本 */
	Widget_Resize( main_window, Size(320, 240) ); 
	Window_SetTitleText( main_window, "测试窗口的风格切换" ); 
	/* 创建5个单选框部件 */
	for(i=0; i<5; ++i) {
		rdbtn[i] = Widget_New( "radio_button" );
		Window_ClientArea_Add( main_window, rdbtn[i] );
		Widget_SetAlign( rdbtn[i], ALIGN_MIDDLE_CENTER, offset_pos[i] );
		RadioButton_Text( rdbtn[i], text[i] );
		Widget_Show( rdbtn[i] );
	}
	/* 为单选框建立互斥关系 */
	RadioButton_CreateMutex(rdbtn[0], rdbtn[1]);
	RadioButton_CreateMutex(rdbtn[0], rdbtn[2]);
	RadioButton_CreateMutex(rdbtn[0], rdbtn[3]);
	RadioButton_CreateMutex(rdbtn[0], rdbtn[4]);
	RadioButton_SetOn( rdbtn[0] );
	/* 禁用按钮部件的自动尺寸调整 */
	Widget_SetAutoSize( btn_ok, FALSE, 0 );
	Widget_Resize( btn_ok, Size(100, 30) );
	/* 将部件加入窗口客户区 */
	Window_ClientArea_Add( main_window, btn_ok );
	Window_ClientArea_Add( main_window, label );
	/* 设置部件的布局 */
	Widget_SetAlign( btn_ok, ALIGN_MIDDLE_CENTER, Pos(0,50) );
	Widget_SetAlign( label, ALIGN_MIDDLE_CENTER, Pos(0,-50) ); 
	/* 设置部件的文本 */
	Button_Text( btn_ok, "应用" ); 
	Label_Text( label, "选择窗口配色:" );
	/* 为按钮的点击事件关联回调函数 */
	Widget_Event_Connect( btn_ok, EVENT_CLICKED, switch_style );
	Widget_Event_Connect( Window_GetCloseButton(main_window), EVENT_CLICKED, destroy );
	/* 显示部件 */
	Widget_Show( btn_ok );
	Widget_Show( label );
	Widget_Show( main_window );
	/* 进入主循环 */
	return LCUI_Main(); 
}
Пример #6
0
int main(void)
{
	LCUI_Widget *window;
	LCUI_Thread t;
	
	setenv( "LCUI_FONTFILE", "../../fonts/msyh.ttf", FALSE );
	LCUI_Init();
	window = Widget_New("window");
	Widget_Resize(window, Size(320, 320));
	Window_SetTitleText(window, "时钟");
	LCUIThread_Create(&t, update_clock, (void*)window); 
	Widget_Event_Connect(Window_GetCloseButton(window), EVENT_CLICKED, destroy);
	Widget_Show(window); 
	return LCUI_Main();
}
Пример #7
0
int main(int argc, char **argv)
{
	int i; 
	LCUI_Pos offset;
	wchar_t text[3][40] = { L"默认模式",L"全屏模式,800x600 分辨率", L"窗口模式,800x600 窗口"};
	LCUI_Init(0,0,0);
	
	main_window = Widget_New( "window" ); 
	btn_ok = Widget_New( "button" );
	label = Widget_New( "label" );
	/* 设置窗口的尺寸以及标题栏文本 */
	Widget_Resize( main_window, Size(320, 240) ); 
	Window_SetTitleTextW( main_window, L"测试视频模式的切换" ); 
	offset.x = 20;
	/* 创建3个单选框部件 */
	for(offset.y=-22,i=0; i<3; ++i,offset.y+=22) {
		rdbtn[i] = Widget_New( "radio_button" );
		Window_ClientArea_Add( main_window, rdbtn[i] );
		Widget_SetAlign( rdbtn[i], ALIGN_MIDDLE_LEFT, offset );
		RadioButton_TextW( rdbtn[i], text[i] );
		Widget_Show( rdbtn[i] );
	}
	/* 为单选框建立互斥关系 */
	RadioButton_CreateMutex(rdbtn[0], rdbtn[1]);
	RadioButton_CreateMutex(rdbtn[0], rdbtn[2]);
	RadioButton_SetOn( rdbtn[0] );
	/* 禁用按钮部件的自动尺寸调整 */
	Widget_SetAutoSize( btn_ok, FALSE, 0 );
	Widget_Resize( btn_ok, Size(100, 30) );
	/* 将部件加入窗口客户区 */
	Window_ClientArea_Add( main_window, btn_ok );
	Window_ClientArea_Add( main_window, label );
	/* 设置部件的布局 */
	Widget_SetAlign( btn_ok, ALIGN_MIDDLE_CENTER, Pos(0,70) );
	Widget_SetAlign( label, ALIGN_MIDDLE_CENTER, Pos(0,-50) ); 
	/* 设置部件的文本 */
	Button_TextW( btn_ok, L"应用" ); 
	Label_TextW( label, L"选择视频模式:" );
	/* 为按钮的点击事件关联回调函数 */
	Widget_ConnectEvent( btn_ok, EVENT_CLICKED, switch_style );
	Widget_ConnectEvent( Window_GetCloseButton(main_window), EVENT_CLICKED, destroy );
	/* 显示部件 */
	Widget_Show( btn_ok );
	Widget_Show( label );
	Widget_Show( main_window );
	/* 进入主循环 */
	return LCUI_Main(); 
}
Пример #8
0
int main( int argc, char*argv[] )
{ 
	LCUI_Graph pic;
	int width = 320, height = 240;
	LCUI_Widget *window, *label, *pic_box, *fore_box;
	
	LCUI_Init();
	Graph_Init(&pic); 
	
	window	 = Widget_New("window");
	label	 = Widget_New("label");
	pic_box	 = Widget_New("picture_box");
	fore_box = Widget_New("picture_box");
	 
	Widget_Resize(fore_box, Size(190, 190));
	Widget_Resize(pic_box, Size(135,135));
	Widget_Resize(window, Size(width, height));
	 
	Window_SetTitleText(window, "头像");
	
	PictureBox_SetSizeMode(pic_box, SIZE_MODE_STRETCH); 
	PictureBox_SetImageFile(pic_box, "image.jpg");
	PictureBox_SetImageFile(fore_box, "border.png");
	 
	Label_Text(label, "蛋疼的头像");
	
	Widget_SetAlign(pic_box, ALIGN_MIDDLE_CENTER, Pos(0, -20));
	Widget_SetAlign(fore_box, ALIGN_MIDDLE_CENTER, Pos(0, -20));
	Widget_SetAlign(label, ALIGN_MIDDLE_CENTER, Pos(0, +75));
	
	Window_ClientArea_Add(window, label);
	Window_ClientArea_Add(window, pic_box); 
	Window_ClientArea_Add(window, fore_box);
	
	Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, destroy );
	
	Widget_Show(label);
	Widget_Show(pic_box);
	Widget_Show(fore_box);
	Widget_Show(window); 
	return LCUI_Main(); 
}
Пример #9
0
int main(int argc, char **argv)
{
	LCUI_Thread thread;
	LCUI_Widget *window, *progbar;
	
	LCUI_Init(800,600,0);
	
	window = Widget_New("window");
	progbar = Widget_New("progress_bar");

	Window_SetTitleTextW(window, L"测试进度条部件");
	Widget_Resize(window, Size(320, 240));
	Window_ClientArea_Add(window, progbar);
	Widget_SetAlign(progbar, ALIGN_MIDDLE_CENTER, Pos(0,0)); 
	Widget_Resize(progbar, Size(300, 25));

	LCUIThread_Create(&thread, change_progress, (void*)progbar);
	Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, destroy );

	Widget_Show(progbar);
	Widget_Show(window);
	return LCUI_Main();
}
Пример #10
0
int main(void)
{
	LCUI_Thread t;
	LCUI_Widget *window, *widget;
	
	LCUI_Init();
	window = Widget_New( "window" );
	widget = Widget_New( NULL );
	Window_SetTitleText( window, "测试部件布局-1" );
	Window_ClientArea_Add( window, widget );
	Widget_Resize( widget, Size(120, 120) );
	Widget_Resize( window, Size(320, 240) );
	Widget_SetBackgroundTransparent( widget, FALSE );
	Widget_SetBorder( widget, Border(1, BORDER_STYLE_SOLID, RGB(0,0,0)) );
	Widget_SetBackgroundColor( widget, RGB(255,0,0) );
	
	Widget_Show( widget );
	Widget_Show( window );
	Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, destroy );
	LCUIThread_Create( &t, thread, widget );
	
	return LCUI_Main();
}
Пример #11
0
Файл: mora.c Проект: yydaor/LCUI
static void
widgets_configure( void )
{
	/* 设定标题栏显示的文本 */
	Window_SetTitleText( window, TEXT_WND_TITLE );
	Window_SetTitleIcon( window, &icon );
	Widget_Resize( window, WND_SIZE );
	/* 将部件加入至相应的容器 */
	Widget_Container_Add( btn_area, btn_s );
	Widget_Container_Add( btn_area, btn_j );
	Widget_Container_Add( btn_area, btn_b );
	Widget_Container_Add( btn_area, btn_next );
	Window_ClientArea_Add( window, label );
	Window_ClientArea_Add( window, l_vs );
	Window_ClientArea_Add( window, me_pic_box );
	Window_ClientArea_Add( window, cpu_pic_box );
	Window_ClientArea_Add( window, btn_area );

	/* 设定label部件显示的文本内容 */
	Label_Text( label,  TEXT_TIP );
	
	/* 设定label部件中的字体大小为55像素,颜色为红色 */
	Label_Text( l_vs, TEXT_VS );
	/* 禁用按钮的自动尺寸调整 */
	Widget_SetAutoSize( btn_b, FALSE, 0 );
	Widget_SetAutoSize( btn_s, FALSE, 0 );
	Widget_SetAutoSize( btn_j, FALSE, 0 );
	Widget_SetAutoSize( btn_next, FALSE, 0 );
	/* 调整这些部件的大小 */
	Widget_SetSize( btn_b, "78px", "30px" );
	Widget_SetSize( btn_s, "77px", "30px" );
	Widget_SetSize( btn_j, "77px", "30px" );
	Widget_SetSize( btn_next, "78px", "30px" );
	Widget_SetSize( btn_area, NULL, "30px" );
	Widget_SetDock( btn_area, DOCK_TYPE_BOTTOM );
	Widget_Resize( me_pic_box, Size(110, 140) );
	Widget_Resize( cpu_pic_box, Size(110, 140) );
	/* 自定义这四个按钮的风格 */
	Button_CustomStyle(	btn_b, &btn_normal, &btn_over, 
				&btn_down, &btn_focus, NULL); 
	Button_CustomStyle(	btn_s, &btn_normal, &btn_over,
				&btn_down, &btn_focus, NULL); 
	Button_CustomStyle(	btn_j, &btn_normal, &btn_over, 
				&btn_down, &btn_focus, NULL); 
	Button_CustomStyle(	btn_next, &btn_normal, &btn_over, 
				&btn_down, &btn_focus, NULL); 
	/* 设定部件的定位类型 */
	Widget_SetPosType( btn_s, POS_TYPE_STATIC );
	Widget_SetPosType( btn_j, POS_TYPE_STATIC );
	Widget_SetPosType( btn_b, POS_TYPE_STATIC );
	Widget_SetPosType( btn_next, POS_TYPE_STATIC );
	/* 设定布局 */
	Widget_SetAlign(me_pic_box, ALIGN_MIDDLE_LEFT, Pos(5, -5));
	Widget_SetAlign(cpu_pic_box, ALIGN_MIDDLE_RIGHT, Pos(-5, -5));
	Widget_SetAlign(label, ALIGN_TOP_CENTER, Pos(0, 3));
	Widget_SetAlign(l_vs, ALIGN_MIDDLE_CENTER, Pos(0, 0));
	/* 设定部件的边框及颜色 */
	Widget_SetBorder(me_pic_box, Border(1, BORDER_STYLE_SOLID, RGB(0,0,0)));
	Widget_SetBorder(cpu_pic_box, Border(1, BORDER_STYLE_SOLID, RGB(0,0,0)));
	/* 关联这些按钮的单击事件 */ 
	Widget_Event_Connect(btn_s, EVENT_CLICKED, select_stone );
	Widget_Event_Connect(btn_j, EVENT_CLICKED, select_knife );
	Widget_Event_Connect(btn_b, EVENT_CLICKED, select_cloth );
	Widget_Event_Connect(btn_next, EVENT_CLICKED, next );
	Widget_Event_Connect(Window_GetCloseButton(window), EVENT_CLICKED, destroy);
}
Пример #12
0
static void
Window_ExecUpdate( LCUI_Widget *win_p )
{
	LCUI_Size size;
	LCUI_Graph *graph;
	LCUI_Border border;
	LCUI_Widget *titlebar, *btn, *client_area;
	LCUI_RGB border_color, back_color;
	
	btn = Window_GetCloseButton(win_p);
	titlebar = Window_GetTitleBar(win_p);
	client_area = Window_GetClientArea(win_p);
	graph = Widget_GetSelfGraph( win_p );
	/* 按不同的风格来处理 */ 
	switch( win_p->style_id ) {
	    case WINDOW_STYLE_NONE:  /* 没有边框 */
		/* 先计算坐标和尺寸 */
		Widget_SetDock( client_area, DOCK_TYPE_FILL );
		Widget_Hide( titlebar );/* 隐藏标题栏 */
		Widget_Show( client_area );/* 客户区需要显示 */
		break;
			
	    case WINDOW_STYLE_LINE: /* 线条边框 */
		Widget_SetBorder(win_p,
		 Border(1, BORDER_STYLE_SOLID, RGB(50,50,50)));
		Widget_SetPadding( win_p, Padding(1,1,1,1) );
		Widget_SetDock( client_area, DOCK_TYPE_FILL );
		Widget_Hide( titlebar );
		Widget_Show( client_area );
		break;

	    case WINDOW_STYLE_PURE_BLUE: 
		back_color = RGB(30,160,225); 
		border_color = RGB(0,130,195);
		goto union_draw_method;
	    case WINDOW_STYLE_PURE_GREEN:
		back_color = RGB(140,190,40);
		border_color = RGB(110,160,10);
		goto union_draw_method;
	    case WINDOW_STYLE_PURE_RED: 
		back_color = RGB(230,20,0);
		border_color = RGB(200,0,0);
		goto union_draw_method;
	    case WINDOW_STYLE_PURE_ORANGE: 
		back_color = RGB(240,150,10);
		border_color = RGB(210,120,0); 
		goto union_draw_method;
	    case WINDOW_STYLE_PURE_PURPLE:
		back_color = RGB(110,20,95);
		border_color = RGB(80,0,65); 
union_draw_method:;
		/* 若窗口未获得焦点 */
		if( !Widget_GetFocus( win_p ) ) {
			back_color = RGB(235,235,235);
			border_color = RGB(211,211,211);
		}
		/* 更新窗口标题栏上的关闭按钮 */
		Widget_Update( btn );
		border = Border(1, BORDER_STYLE_SOLID, border_color);
		Widget_SetBorder( client_area, border);
		Widget_SetBorder( win_p, border);
		Widget_SetBackgroundColor( win_p, back_color );
		Graph_FillColor( graph, back_color );
		Widget_SetBackgroundColor( client_area, RGB(255,255,255) );
		Widget_SetBackgroundImage( titlebar, NULL );
		Widget_SetBackgroundLayout( titlebar, 0 );
		Widget_SetBackgroundTransparent( titlebar, TRUE );
		Widget_SetBackgroundTransparent( client_area, FALSE );
		Widget_SetPadding( win_p, Padding(1,4,4,4) );
		Widget_SetPadding( client_area, Padding(1,1,1,1) );
		size = Widget_GetContainerSize( win_p );
		Widget_Resize( titlebar, Size(size.h, 25) );
		Widget_Resize( client_area, Size(size.w, size.h - 25) );
		Widget_SetDock( titlebar, DOCK_TYPE_TOP ); 
		Widget_SetDock( client_area, DOCK_TYPE_BOTTOM );
		Widget_Show( titlebar );
		Widget_Show( client_area ); 
		break;
	    default:
			//
		break;
	}
}
Пример #13
0
int main(void)
{
	int  i, x, y = 3;
	
	LCUI_Init();
	
	window = Window_New( "测试MessageBox", NULL, Size(320,240) );
	label_btn = Widget_New( "label" );
	label_icon = Widget_New( "label" );
	btn = Widget_New( "button" );
	
	Window_ClientArea_Add( window, label_btn );
	Label_Text( label_btn, "请选择按钮类型:" );
	Widget_Move( label_btn, Pos(5,y) );
	Widget_Show( label_btn );
	
	for(i=0; i<6; ++i) {
		rb_btn[i] = RadioButton_New( rb_btn_text[i] );
		if( i>0 ) {
			RadioButton_CreateMutex( rb_btn[0], rb_btn[i] );
		} else {
			RadioButton_SetOn( rb_btn[0] );
		}
		Window_ClientArea_Add( window, rb_btn[i] );
		y += 16;
		Widget_Move( rb_btn[i], Pos(5,y) );
		Widget_Show( rb_btn[i] );
	}
	
	y += 16;
	Window_ClientArea_Add( window, label_icon );
	Label_Text( label_icon, "请选择图标类型:" );
	Widget_Move( label_icon, Pos(5,y) );
	Widget_Show( label_icon );
	
	for(i=0; i<5; ++i) {
		rb_icon[i] = RadioButton_New( rb_icon_text[i] );
		if( i>0 ) {
			RadioButton_CreateMutex( rb_icon[0], rb_icon[i] );
		} else {
			RadioButton_SetOn( rb_icon[0] );
		}
		Window_ClientArea_Add( window, rb_icon[i] );
		/* 计算当前单选框的坐标 */
		if(i%2 == 0) {
			y += 16;
			x = 5;
		} else {
			x = 150;
		}
		Widget_Move( rb_icon[i], Pos(x,y) );
		Widget_Show( rb_icon[i] );
	}
	
	Button_Text( btn, "显示MessageBox" );
	Widget_SetAlign( btn, ALIGN_BOTTOM_CENTER, Pos(0,-3) );
	Widget_Resize( btn, Size(80, 20) );
	Window_ClientArea_Add( window, btn );
	Widget_Show( btn );
	
	Widget_Event_Connect( btn, EVENT_CLICKED, show_msgbox );
	Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, program_quit );
	Widget_Show( window );
	return LCUI_Main();
}