Ejemplo n.º 1
0
static void 
Update_Label(LCUI_Widget *widget)
/* 功能:更新label部件 */
{
	int mode; 
	LCUI_Size max;
	LCUI_Label *label;
	
	label = Get_Widget_PrivData( widget );
	if(!Graph_Valid(&widget->background_image)) {
		mode = GRAPH_MIX_FLAG_REPLACE; /* 替换模式 */
	} else {
		mode = GRAPH_MIX_FLAG_OVERLAY; /* 叠加模式 */ 
	}
	/* 先绘制文本位图,在绘制前它会更新位图尺寸 */
	TextLayer_Draw( widget, &label->layer, mode );
	/* 获取尺寸 */
	max = TextLayer_Get_Size( &label->layer );
	if( widget->dock == DOCK_TYPE_NONE && label->auto_size
	 && Size_Cmp( max, widget->size ) != 0 ) {
		/* 如果开启了自动调整大小,并且尺寸有改变 */ 
		Resize_Widget(widget, max );
		Refresh_Widget(widget);
	}
}
Ejemplo n.º 2
0
static void Update_Label(LCUI_Widget *widget)
/* 功能:更新label部件 */
{
	int mode; 
	LCUI_Size max;
	LCUI_TextLayer *layer;
	
	layer = Get_Widget_PrivData( widget );
	max = TextLayer_Get_Size( layer );  
	if( widget->auto_size && Size_Cmp( max, widget->size ) != 0 ) {
		/* 如果开启了自动调整大小,并且尺寸有改变 */ 
		Resize_Widget(widget, max );
		Refresh_Widget(widget);
		return;
	}
	if(!Graph_Valid(&widget->background_image)) {
		mode = GRAPH_MIX_FLAG_REPLACE; /* 替换模式 */
	} else {
		mode = GRAPH_MIX_FLAG_OVERLAY; /* 叠加模式 */ 
	}
	layer = Get_Widget_PrivData( widget );
	TextLayer_Draw( widget, layer, mode );
}