Beispiel #1
0
static void 
hide_textbox_cursor( )
{
	if( !active_textbox ) {
		return;
	}
	
	LCUI_TextBox *tb;
	tb = Get_Widget_PrivData( active_textbox );
	Hide_Widget( tb->cursor );
}
Beispiel #2
0
static void Show_ProgressBar(LCUI_Widget *widget)
/* 功能:在显示进度条时,处理其它操作 */
{
	LCUI_ProgressBar *pb = (LCUI_ProgressBar*)Get_Widget_PrivData(widget);
	if(Strcmp(&widget->style, "dynamic") == 0) {
		if(pb->thread == 0) {
			Show_Widget(pb->img_pic_box);
			LCUI_Thread_Create(&pb->thread, NULL, Move_Flash_Img, (void*)widget);
		}
	} else {
		Hide_Widget(pb->img_pic_box);
		if(pb->thread != 0) {/* 否则,如果线程ID不为0,就撤销线程 */
			LCUI_Thread_Cancel(pb->thread);
			pb->thread = 0;
		}
	}
}
Beispiel #3
0
void Window_Widget_Auto_Size(LCUI_Widget *win_p)
/* 功能:在窗口尺寸改变时自动改变标题栏和客户区的尺寸 */
{
    int x, y, width, height;
    LCUI_Widget *titlebar;
    LCUI_Widget *client_area;

    titlebar = Get_Window_TitleBar(win_p);
    client_area = Get_Window_Client_Area(win_p);

    /* 按不同的风格来处理 */
    switch(Get_Widget_Border_Style(win_p)) {
    case BORDER_STYLE_NONE:  /* 没有边框 */
        /* 先计算坐标和尺寸 */
        x = win_p->border.left;
        y = win_p->border.top;
        width = win_p->size.w - x - win_p->border.right;
        height = win_p->size.h - y - win_p->border.bottom;

        Move_Widget( client_area, Pos(x, y) );/* 调整位置 */
        Resize_Widget( client_area, Size(width, height) );/* 调整大小 */
        Hide_Widget( titlebar );/* 隐藏标题栏 */
        Show_Widget( client_area );/* 客户区需要显示 */
        break;

    case BORDER_STYLE_LINE_BORDER: /* 线条边框 */
        Move_Widget( client_area, Pos(0, 0) );
        Resize_Widget( client_area,
                       Size(win_p->size.w, win_p->size.h) );
        Hide_Widget( titlebar);
        Show_Widget( client_area);
        break;

    case BORDER_STYLE_STANDARD: /* 标准边框 */
        /*
         * 说明:由于用户区的尺寸和位置的调整,需要确定标题栏的尺寸,因此,
         * 调用Exec_Resize_Widget()函数立刻调整标题栏尺寸,如果是调用
         * Resize_Widget()函数,那么,确定的尺寸会有误,因为标题栏的尺
         * 寸还是以前的尺寸。
         * */
        Set_Widget_Border(win_p, RGB(50,50,50), Border(1,1,1,1));
        /* 先计算坐标和尺寸 */
        x = win_p->border.left;
        y = win_p->border.top;
        width = win_p->size.w - x - win_p->border.right;
        height = win_p->size.h - y - win_p->border.bottom;

        Move_Widget(titlebar, Pos(x, y) );
        Resize_Widget(titlebar, Size(width, 25));

        Set_Widget_Align(client_area, ALIGN_BOTTOM_CENTER, Pos(0, y));
        Resize_Widget(client_area, Size(width, height - 23));
        /* 标题栏和客户区都需要显示 */
        Show_Widget(titlebar);
        Show_Widget(client_area);
        break;

    default:
        //
        break;
    }
}
Beispiel #4
0
static void 
TextBox_ScrollBar_Update_Size( LCUI_Widget *widget )
/* 更新滚动条的长度 */
{
	int tmp;
	char size_str[15];
	LCUI_Size area_size, layer_size;
	LCUI_Widget *scrollbar[2], *label;
	LCUI_TextLayer *layer;
	
	label = TextBox_Get_Label( widget );
	/* 获取文本图层 */
	layer = TextBox_Get_TextLayer( widget );
	
	/* 获取文本图层和文本框区域的尺寸 */
	layer_size = TextLayer_Get_Size( layer );
	area_size = Get_Container_Size( widget );
	/* 获取纵向和横向滚动条 */
	scrollbar[0] = TextBox_Get_Scrollbar( widget, 0 );
	scrollbar[1] = TextBox_Get_Scrollbar( widget, 1 );
	
	/* 如果文本图层高度超过显示区域 */
	if( layer->enable_multiline && area_size.h > 0 
	  && layer_size.h > area_size.h ) {
		tmp = area_size.w - Get_Widget_Width( scrollbar[0] );
		snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp );
		Set_Widget_Size( label, size_str, NULL );
		
		/* 修改滚动条中记录的最大值和当前值,让滚动条在更新后有相应的长度 */
		ScrollBar_Set_MaxSize( scrollbar[0], layer_size.h );
		ScrollBar_Set_CurrentSize( scrollbar[0], area_size.h );
		Show_Widget( scrollbar[0] );
		/* 如果横向滚动条可见 */
		if( scrollbar[1]->visible ) {
			tmp = area_size.h - Get_Widget_Height( scrollbar[1] );
			snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp );
			Set_Widget_Size( scrollbar[0], NULL, size_str );
		} else {
			Set_Widget_Size( scrollbar[0], NULL, "100%" );
		}
	} else {
		/* 不需要显示滚动条 */
		Hide_Widget( scrollbar[0] );
		Set_Widget_Size( label, "100%", NULL );
	}
	/* 和上面的处理基本一样,这个是处理横向滚动条 */
	if( layer->enable_multiline &&
	 area_size.w > 0 && layer_size.w > area_size.w ) {
		tmp = area_size.h - Get_Widget_Height( scrollbar[1] );
		snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp );
		Set_Widget_Size( label, NULL, size_str );
		
		ScrollBar_Set_MaxSize( scrollbar[1], layer_size.w );
		ScrollBar_Set_CurrentSize( scrollbar[1], area_size.w );
		Show_Widget( scrollbar[1] );
		
		if( scrollbar[0]->visible ) {
			tmp = area_size.w - Get_Widget_Width( scrollbar[0] );
			snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp );
			Set_Widget_Size( scrollbar[1], size_str, NULL );
		} else {
			Set_Widget_Size( scrollbar[1], "100%", NULL );
		}
	} else {
		Set_Widget_Size( label, NULL, "100%" );
		Hide_Widget( scrollbar[1] );
	}
}