Ejemplo n.º 1
0
static LCUI_TextLayer *
TextBox_Get_TextLayer( LCUI_Widget *widget )
{
	LCUI_TextBox *textbox;
	textbox = Get_Widget_PrivData( widget );
	return Get_Widget_PrivData( textbox->text );
}
Ejemplo n.º 2
0
void Set_PictureBox_Size_Mode(LCUI_Widget *widget, int mode)
/* 功能:设定图片盒子的图像显示模式 */
{
    LCUI_PictureBox *pic_box = (LCUI_PictureBox*)
                               Get_Widget_PrivData(widget);

    if(pic_box->size_mode == mode) return;

    float scale_x,scale_y;
    pic_box->size_mode = mode;
    if(pic_box->image == NULL) return;

    switch(mode) {
    case SIZE_MODE_BLOCK_ZOOM:
    case SIZE_MODE_ZOOM:
        if( widget->size.w <= 0 || widget->size.h <= 0) {
            pic_box->scale = 1.0;
        } else {
            scale_x = (float)widget->size.w / pic_box->image->width;
            scale_y = (float)widget->size.h / pic_box->image->height;
            if(scale_x < scale_y) pic_box->scale = scale_x;
            else pic_box->scale = scale_y;
        }
        Zoom_PictureBox_View_Area(widget, pic_box->scale);
        break;
    default:
        pic_box->scale = 1.0;
        break;
    }
    Draw_Widget(widget);
}
Ejemplo n.º 3
0
LCUI_Graph *Get_PictureBox_Graph(LCUI_Widget *widget)
/* 功能:获取PictureBox部件内的图像指针 */
{
    LCUI_PictureBox *pic_box = (LCUI_PictureBox*)
                               Get_Widget_PrivData(widget);
    return pic_box->image;
}
Ejemplo n.º 4
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.º 5
0
static void Destroy_Label(LCUI_Widget *widget)
/* 功能:释放label部件占用的资源 */
{
	LCUI_TextLayer *layer;
	layer = Get_Widget_PrivData( widget );
	Destroy_TextLayer( layer );
}
Ejemplo n.º 6
0
float Get_PictureBox_Zoom_Scale(LCUI_Widget *widget)
/* 功能:获取图片盒子的缩放比例 */
{
    LCUI_PictureBox *pic_box = (LCUI_PictureBox*)
                               Get_Widget_PrivData(widget);
    return pic_box->scale;
}
Ejemplo n.º 7
0
void Set_ProgressBar_Max_Value(LCUI_Widget *widget, int max_value)
/* 功能:设定进度条最大值 */
{
	LCUI_ProgressBar *pb = Get_Widget_PrivData(widget);
	pb->max_value = max_value; 
	Draw_Widget(widget); 
}
Ejemplo n.º 8
0
void Set_ProgressBar_Value(LCUI_Widget *widget, int value)
/* 功能:设定进度条当前值 */
{
	LCUI_ProgressBar *pb = Get_Widget_PrivData(widget);
	pb->value = value; 
	Draw_Widget(widget);
}
Ejemplo n.º 9
0
LCUI_Widget *Get_Window_Client_Area(LCUI_Widget *window)
/* 功能:获取窗口客户区的指针 */
{
    LCUI_Window *win_p;
    win_p = (LCUI_Window *)Get_Widget_PrivData(window);
    return win_p->client_area;
}
Ejemplo n.º 10
0
int Zoom_PictureBox_View_Area(LCUI_Widget *widget, float scale)
/* 功能:缩放PictureBox部件的图片浏览区域 */
{
	LCUI_Graph buff, temp;
	LCUI_PictureBox *pic_box;
	
	pic_box = Get_Widget_PrivData(widget);
	if(!Graph_Valid(pic_box->image)) {
		return -1;
	}
	Graph_Init(&buff);
	Graph_Init(&temp);
	/* 有效范围为2%~2000% */
	if(scale < 0.02) {
		scale = 0.02;
	}
	if(scale > 20) {
		scale = 20;
	}
	if(pic_box->size_mode != SIZE_MODE_ZOOM
	 && pic_box->size_mode != SIZE_MODE_BLOCK_ZOOM) {
		pic_box->size_mode = SIZE_MODE_ZOOM; /* 改为缩放模式 */
	}
	pic_box->scale = scale; 
	Update_BuffGraph(widget); 
	Update_ReadBox(widget);
	Draw_Widget(widget);
	Refresh_Widget(widget);
	return 0;
}
Ejemplo n.º 11
0
void Set_Window_Title_Text(LCUI_Widget *win_p, const char *text)
/* 功能:为窗口设置标题文字 */
{
    LCUI_Widget *titlebar = Get_Window_TitleBar(win_p);
    LCUI_TitleBar *title = Get_Widget_PrivData(titlebar);
    Set_Label_Text(title->label, text);
}
Ejemplo n.º 12
0
/**************************** 私有函数 **********************************/
static void
Move_ScrollBar( LCUI_Widget *widget, LCUI_Pos new_pos )
{
	double scale;
	int size;
	LCUI_ScrollBar *scrollbar;
	
	scrollbar = Get_Widget_PrivData( widget->parent );
	/* 使该坐标在限制范围内 */
	new_pos = Get_Widget_Valid_Pos( widget, new_pos );
	/* 判断滚动条的方向 */
	if( scrollbar->direction == 0 ) { /* 纵向 */
		/* 先得到容器高度 */
		size = _Get_Widget_Container_Height( widget );
		/* 减去自身高度 */
		size -= _Get_Widget_Height( widget );
		/* 再用当前坐标除以size,得到比例 */
		scale = new_pos.y * 1.0 / size;
		/* 将max_num乘以比例,得出current_num的值 */
		scrollbar->data.current_num = scale * scrollbar->data.max_num;
	} else { /* 横向 */
		size = _Get_Widget_Container_Width( widget );
		size -= _Get_Widget_Width( widget );
		scale = new_pos.x * 1.0 / size;
		scrollbar->data.current_num = scale * scrollbar->data.max_num;
	}
	Move_Widget( widget, new_pos );
}
Ejemplo n.º 13
0
static void Destroy_ProgressBar(LCUI_Widget *widget)
/* 功能:释放进度条部件占用的内存资源 */
{
	LCUI_ProgressBar *pb = (LCUI_ProgressBar*)Get_Widget_PrivData(widget);
	Graph_Free(&pb->fore_graph);
	Graph_Free(&pb->flash_image);
}
Ejemplo n.º 14
0
LCUI_Rect Get_PictureBox_View_Area(LCUI_Widget *widget)
/* 功能:获取图片盒子的图片显示的区域 */
{
    LCUI_PictureBox *pic_box = (LCUI_PictureBox*)
                               Get_Widget_PrivData(widget);
    return pic_box->read_box;
}
Ejemplo n.º 15
0
LCUI_Widget *
TextBox_Get_Cursor( LCUI_Widget *widget )
/* 获取文本框部件内的光标 */
{
	LCUI_TextBox *tb;
	tb = Get_Widget_PrivData( widget );
	return tb->cursor;
}
Ejemplo n.º 16
0
LCUI_Widget*
TextBox_Get_Label( LCUI_Widget *widget )
/* 获取文本框部件内的label部件指针 */
{
	LCUI_TextBox *textbox;
	textbox = Get_Widget_PrivData( widget );
	return textbox->text;
}
Ejemplo n.º 17
0
static void Refresh_Label_FontBitmap(LCUI_Widget *widget)
/* 功能:刷新label部件内的字体位图 */
{
	LCUI_TextLayer *layer;
	
	layer = Get_Widget_PrivData( widget );
	TextLayer_Refresh( layer ); 
}
Ejemplo n.º 18
0
static void Destroy_PictureBox(LCUI_Widget* widget)
/* 功能:释放图片盒子占用的内存资源 */
{
    LCUI_PictureBox *pic_box = (LCUI_PictureBox*)
                               Get_Widget_PrivData(widget);
    Graph_Free(&pic_box->buff_graph);
    Graph_Free(&pic_box->error_image);
    Graph_Free(&pic_box->initial_image);
}
Ejemplo n.º 19
0
LCUI_TextLayer *
Label_Get_TextLayer( LCUI_Widget *widget )
/* 获取label部件内的文本图层的指针 */
{
	LCUI_Label *label;
	
	label = Get_Widget_PrivData( widget );
	return &label->layer;
}
Ejemplo n.º 20
0
void 
ScrollBar_Set_CurrentNum( LCUI_Widget *widget, int current_num )
{
	LCUI_ScrollBar *scrollbar;
	
	scrollbar = Get_Widget_PrivData( widget );
	scrollbar->data.current_num = current_num;
	Update_Widget( widget );
}
Ejemplo n.º 21
0
int Set_Label_TextStyle( LCUI_Widget *widget, LCUI_TextStyle style )
/* 为Label部件内显示的文本设定文本样式 */
{
	LCUI_TextLayer *layer;
	layer = Get_Widget_PrivData( widget );
	TextLayer_Text_Set_Default_Style( layer, style );
	Update_Label( widget );
	return 0;
}
Ejemplo n.º 22
0
void 
ScrollBar_Set_CurrentSize( LCUI_Widget *widget, int current_size )
{
	LCUI_ScrollBar *scrollbar;
	
	scrollbar = Get_Widget_PrivData( widget );
	scrollbar->data.current_size = current_size;
	Update_Widget( widget );
}
Ejemplo n.º 23
0
void 
ScrollBar_Set_MaxNum( LCUI_Widget *widget, int max_num )
{
	LCUI_ScrollBar *scrollbar;
	
	scrollbar = Get_Widget_PrivData( widget );
	scrollbar->data.max_num = max_num;
	Update_Widget( widget );
}
Ejemplo n.º 24
0
void 
ScrollBar_Set_MaxSize( LCUI_Widget *widget, int max_size )
{
	LCUI_ScrollBar *scrollbar;
	
	scrollbar = Get_Widget_PrivData( widget );
	scrollbar->data.max_size = max_size;
	Update_Widget( widget );
}
Ejemplo n.º 25
0
ScrollBar_Data 
ScrollBar_Get_Data ( LCUI_Widget *widget )
/* 获取滚动条的数据 */
{
	LCUI_ScrollBar *scrollbar;
	
	scrollbar = Get_Widget_PrivData( widget );
	return scrollbar->data;
}
Ejemplo n.º 26
0
/**************************** 公共函数 **********************************/
LCUI_Widget *
Get_ScrollBar( LCUI_Widget *widget )
/* 获取滚动条部件 */
{
	LCUI_ScrollBar *scrollbar;
	
	scrollbar = Get_Widget_PrivData( widget );
	return scrollbar->widget;
}
Ejemplo n.º 27
0
static LCUI_Widget *
TextBox_Get_Scrollbar( LCUI_Widget *widget, int which )
{
	LCUI_TextBox *tb;
	tb = Get_Widget_PrivData( widget );
	if( which == 0 ) {
		return tb->scrollbar[0];
	}
	return tb->scrollbar[1];
}
Ejemplo n.º 28
0
LCUI_Widget *Get_Window_TitleBar(LCUI_Widget *window)
/* 功能:获取窗口标题栏的指针 */
{
    LCUI_Window *win_p;
    win_p = (LCUI_Window *)Get_Widget_PrivData(window);
    if(win_p == NULL) {
        return NULL;
    }
    return win_p->titlebar;
}
Ejemplo n.º 29
0
static void 
show_textbox_cursor( )
{
	if( !active_textbox ) {
		return;
	}
	
	LCUI_TextBox *tb;
	tb = Get_Widget_PrivData( active_textbox );
	Show_Widget( tb->cursor );
}
Ejemplo n.º 30
0
int Set_PictureBox_InitImage(LCUI_Widget *widget, LCUI_Graph *pic)
/* 功能:设定正在加载另一图像时显示的图像 */
{
    LCUI_PictureBox *pic_box = (LCUI_PictureBox*)Get_Widget_PrivData(widget);

    if(Graph_Valid(pic)) {
        Graph_Copy(&pic_box->initial_image, pic);
        return 0;
    }
    return -1;
}