示例#1
0
/** 将 widget 与 sruface 进行绑定 */
static void LCUIDisplay_BindSurface( LCUI_Widget widget )
{
	LCUI_Rect *p_rect;
	SurfaceRecord *p_sr;
	if( LCUIDisplay_GetBindSurface(widget) ) {
		return;
	}
	p_sr = NEW( SurfaceRecord, 1 );
	p_sr->widget = widget;
	p_sr->surface = Surface_New();
	Surface_SetCaptionW( p_sr->surface, widget->title );
	p_rect = &widget->box.graph;
	if( widget->style->sheet[key_top].is_valid &&
	    widget->style->sheet[key_left].is_valid ) {
		Surface_Move( p_sr->surface, p_rect->x, p_rect->y );
	}
	Surface_Resize( p_sr->surface, p_rect->w, p_rect->h );
	if( widget->computed_style.visible ) {
		Surface_Show( p_sr->surface );
	} else {
		Surface_Hide( p_sr->surface );
	}
	Widget_InvalidateArea( widget, NULL, SV_GRAPH_BOX );
	LinkedList_Append( &display.surfaces, p_sr );
}
示例#2
0
/** 将 widget 与 sruface 进行绑定 */
static void LCUIDisplay_BindSurface( LCUI_Widget widget )
{
	SurfaceRecord *p_sr;
	LCUI_Rect *p_rect;
	if( LCUIDisplay_GetBindSurface(widget) ) {
		return;
	}
	p_sr = (SurfaceRecord*)LinkedList_Alloc( &display.surfaces );
	p_sr->widget = widget;
	/**
	 * 初次调用 Surface_New() 耗时较长, 所以先为 p_sr->surface 设置初
	 * 始值,避免在 Surface_New() 返回前被当成正常指针使用。
	 */
	p_sr->surface = NULL;
	p_sr->surface = Surface_New();
	Surface_SetCaptionW( p_sr->surface, widget->title );
	p_rect = &widget->base.box.graph;
	Surface_Move( p_sr->surface, p_rect->x, p_rect->y );
	Surface_Resize( p_sr->surface, p_rect->w, p_rect->h );
	if( widget->style.visible ) {
		Surface_Show( p_sr->surface );
	} else {
		Surface_Hide( p_sr->surface );
	}
	Widget_InvalidateArea( widget, NULL, SV_GRAPH_BOX );
}
示例#3
0
void Surface_Init(uint16_t width, uint16_t heigth) {
	Surface_SetGenericSurface(Surface_New(width, heigth));
}