static void hide_textbox_cursor( LCUI_Widget *widget ) { LCUI_TextBox *tb; if( widget == NULL ) { return; } tb = Widget_GetPrivData( widget ); Widget_Hide( tb->cursor ); }
static void _putout_textbox_cursor( LCUI_Widget *widget, LCUI_WidgetEvent *unused ) { LCUI_TextBox *tb; if( widget == active_textbox ) { active_textbox = NULL; } tb = Widget_GetPrivData( widget ); Widget_Hide( tb->cursor ); Widget_Draw( widget ); }
static void OnSidebarBtnClick( LCUI_Widget self, LCUI_WidgetEvent e, void *unused ) { int i; LCUI_Widget sidebar; LCUI_Widget btn, view = e->data; const char *view_id = view->id; Widget_RemoveClass( view, "hide" ); Widget_UpdateStyle( view, TRUE ); Widget_Show( view ); for( i = 0; i < MAX_VIEWS; ++i ) { if( strcmp( view_id, btn_view_ids[i][1] ) == 0 ) { continue; } btn = LCUIWidget_GetById( btn_view_ids[i][0] ); view = LCUIWidget_GetById( btn_view_ids[i][1] ); Widget_AddClass( view, "hide" ); Widget_RemoveClass( btn, "active" ); Widget_Hide( view ); } sidebar = LCUIWidget_GetById( "main-sidebar" ); Widget_AddClass( sidebar, "sidebar-mini" ); Widget_AddClass( self, "active" ); }
void GameWindow_HideLicenseWindow(void) { Widget_Hide( window ); }
static void TextBox_ScrollBar_UpdateSize( 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_GetLabel( widget ); /* 获取文本图层 */ layer = TextBox_GetTextLayer( widget ); /* 获取文本图层和文本框区域的尺寸 */ layer_size = TextLayer_GetSize( layer ); area_size = Widget_GetContainerSize( widget ); /* 获取纵向和横向滚动条 */ scrollbar[0] = TextBox_GetScrollbar( widget, 0 ); scrollbar[1] = TextBox_GetScrollbar( widget, 1 ); /* 如果文本图层高度超过显示区域 */ if( layer->enable_multiline && area_size.h > 0 && layer_size.h > area_size.h ) { tmp = area_size.w - Widget_GetWidth( scrollbar[0] ); #ifdef LCUI_BUILD_IN_LINUX snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp ); #else sprintf_s( size_str, sizeof(size_str)-1, "%dpx", tmp ); #endif Widget_SetSize( label, size_str, NULL ); /* 修改滚动条中记录的最大值和当前值,让滚动条在更新后有相应的长度 */ ScrollBar_SetMaxSize( scrollbar[0], layer_size.h ); ScrollBar_SetCurrentSize( scrollbar[0], area_size.h ); Widget_Show( scrollbar[0] ); /* 如果横向滚动条可见 */ if( scrollbar[1]->visible ) { tmp = area_size.h - Widget_GetHeight( scrollbar[1] ); #ifdef LCUI_BUILD_IN_LINUX snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp ); #else sprintf_s( size_str, sizeof(size_str)-1, "%dpx", tmp ); #endif Widget_SetSize( scrollbar[0], NULL, size_str ); } else { Widget_SetSize( scrollbar[0], NULL, "100%" ); } } else { /* 不需要显示滚动条 */ Widget_Hide( scrollbar[0] ); Widget_SetSize( label, "100%", NULL ); } /* 和上面的处理基本一样,这个是处理横向滚动条 */ if( layer->enable_multiline && area_size.w > 0 && layer_size.w > area_size.w ) { tmp = area_size.h - Widget_GetHeight( scrollbar[1] ); #ifdef LCUI_BUILD_IN_LINUX snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp ); #else sprintf_s( size_str, sizeof(size_str)-1, "%dpx", tmp ); #endif Widget_SetSize( label, NULL, size_str ); ScrollBar_SetMaxSize( scrollbar[1], layer_size.w ); ScrollBar_SetCurrentSize( scrollbar[1], area_size.w ); Widget_Show( scrollbar[1] ); if( scrollbar[0]->visible ) { tmp = area_size.w - Widget_GetWidth( scrollbar[0] ); #ifdef LCUI_BUILD_IN_LINUX snprintf( size_str, sizeof(size_str)-1, "%dpx", tmp ); #else sprintf_s( size_str, sizeof(size_str)-1, "%dpx", tmp ); #endif Widget_SetSize( scrollbar[1], size_str, NULL ); } else { Widget_SetSize( scrollbar[1], "100%", NULL ); } } else { Widget_SetSize( label, NULL, "100%" ); Widget_Hide( scrollbar[1] ); } }
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; } }
/** 隐藏键位设置窗口 */ void GameWindow_HideSetKeyboardWindow(void) { Widget_Hide( window ); }