void cdraw::render_GUI_CheckBox(float x, float y, float w, float h, float *color) { Box(x, y, w, h, color); Border(x, y, w, h, 1, colorBlack); Border(x+3, y+3, w-6, h-6, 1, colorBlack); }
/* 更新当前文本框的样式 */ static void TextBox_ExecUpdateStyle( LCUI_Widget *widget ) { LCUI_Border border; Widget_SetBackgroundColor( widget, RGB(255,255,255) ); Widget_SetBackgroundTransparent( widget, FALSE ); /* 如果该部件已经获得全局焦点 */ if( Widget_GetGlobalFocus( widget ) ) { border = Border( 1, BORDER_STYLE_SOLID, RGB(55,123,203) ); Widget_SetBorder( widget, border ); return; } Border_Radius( &border, 0 ); /* 根据不同的状态,设定不同的边框样式 */ switch( widget->state ) { case WIDGET_STATE_NORMAL: border.left_width = 1; border.left_style = BORDER_STYLE_SOLID; border.left_color = RGB(204,204,204); border.top_width = 1; border.top_style = BORDER_STYLE_SOLID; border.top_color = RGB(204,204,204); border.right_width = 1; border.right_style = BORDER_STYLE_SOLID; border.right_color = RGB(221,221,221); border.bottom_width = 1; border.bottom_style = BORDER_STYLE_SOLID; border.bottom_color = RGB(221,221,221); break; case WIDGET_STATE_OVERLAY : border.left_width = 1; border.left_style = BORDER_STYLE_SOLID; border.left_color = RGB(171,171,171); border.top_width = 1; border.top_style = BORDER_STYLE_SOLID; border.top_color = RGB(171,171,171); border.right_width = 1; border.right_style = BORDER_STYLE_SOLID; border.right_color = RGB(204,204,204); border.bottom_width = 1; border.bottom_style = BORDER_STYLE_SOLID; border.bottom_color = RGB(204,204,204); break; case WIDGET_STATE_ACTIVE : border = Border( 1, BORDER_STYLE_SOLID, RGB(55,123,203) ); break; case WIDGET_STATE_DISABLE : break; default : break; } Widget_SetBorder( widget, border ); }
Border Menubar::_getEntryBorder() const { //TODO: This doesn't take ContentShift for different states into account. if( m_pEntrySkin ) { Rect r = m_pEntrySkin->contentRect( Rect(0,0,1000,1000), StateEnum::Normal ); return Border(r.x,r.y,1000-r.w,1000-r.h); } else return Border(10,0,10,0); // 10 pixels on each side as default margin. Should do something more intelligent here, like taking fonts avgSpacing into account... }
Elements Region::buildElements(Nodes& Base) { Elements Result; if(typ==1) { if(numofrows<=numofcols) { for(int i=0;i<numofcols;i++) for(int j=0;j<numofrows;j++) { Result.push_back(Triangle(Base,i*(numofrows+1)+j,i*(numofrows+1)+j+1,(i+1)*(numofrows+1)+j),Element(i*(numofrows+1)+j,i*(numofrows+1)+j+1,(i+1)*(numofrows+1)+j)); Result.push_back(Triangle(Base,i*(numofrows+1)+j+1,(i+1)*(numofrows+1)+j+1,(i+1)*(numofrows+1)+j),Element(i*(numofrows+1)+j+1,(i+1)*(numofrows+1)+j+1,(i+1)*(numofrows+1)+j)); if(i==0&&CONDLEFT) Result.addcondition(Border(true,j,j+1,Base.node(j),Base.node(j+1),ENV_TEMPLEFT)); if(i==numofcols-1&&CONDRIGHT) Result.addcondition(Border(true,(numofcols)*(numofrows+1)+j,(numofcols)*(numofrows+1)+j+1,Base.node((numofcols)*(numofrows+1)+j),Base.node((numofcols)*(numofrows+1)+j+1),ENV_TEMPRIGHT)); if(j==0&&CONDDOWN) Result.addcondition(Border(true,(i)*(numofrows+1)+j,(i+1)*(numofrows+1)+j,Base.node((i)*(numofrows+1)+j),Base.node((i+1)*(numofrows+1)+j),ENV_TEMPDOWN)); if(j==numofrows-1&&CONDUP) Result.addcondition(Border(true,(i)*(numofrows+1)+j+1,(i+1)*(numofrows+1)+j+1,Base.node((i)*(numofrows+1)+j+1),Base.node((i+1)*(numofrows+1)+j+1),ENV_TEMPUP)); } } else { for(int j=0;j<numofrows;j++) for(int i=0;i<numofcols;i++) { Result.push_back(Triangle(Base,j*(numofcols+1)+i,j*(numofcols+1)+i+1,(j+1)*(numofcols+1)+i),Element(j*(numofcols+1)+i,j*(numofcols+1)+i+1,(j+1)*(numofcols+1)+i)); Result.push_back(Triangle(Base,j*(numofcols+1)+i+1,(j+1)*(numofcols+1)+i+1,(j+1)*(numofcols+1)+i),Element(j*(numofcols+1)+i+1,(j+1)*(numofcols+1)+i+1,(j+1)*(numofcols+1)+i)); if(j==0&&CONDDOWN) Result.addcondition(Border(true,i,i+1,Base.node(i),Base.node(i+1),ENV_TEMPDOWN)); if(j==numofrows-1&&CONDUP) Result.addcondition(Border(true,(numofrows)*(numofcols+1)+i,(numofrows)*(numofcols+1)+i+1,Base.node((numofrows)*(numofcols+1)+i),Base.node((numofrows)*(numofcols+1)+i+1),ENV_TEMPUP)); if(i==0&&CONDLEFT) Result.addcondition(Border(true,(j)*(numofcols+1)+i,(j+1)*(numofcols+1)+i,Base.node((j)*(numofcols+1)+i),Base.node((j+1)*(numofcols+1)+i),ENV_TEMPLEFT)); if(i==numofcols-1&&CONDRIGHT) Result.addcondition(Border(true,(j)*(numofcols+1)+i+1,(j+1)*(numofcols+1)+i+1,Base.node((j)*(numofcols+1)+i+1),Base.node((j+1)*(numofcols+1)+i+1),ENV_TEMPRIGHT)); } } } return Result; }
ubi_btNodePtr ubi_btLastOf( ubi_btRootPtr RootPtr, ubi_btItemPtr MatchMe, ubi_btNodePtr p ) /* ------------------------------------------------------------------------ ** * Given a tree that a allows duplicate keys, and a pointer to a node in * the tree, this function will return a pointer to the last (traversal * order) node with the same key value. * * Input: RootPtr - A pointer to the root of the tree. * MatchMe - A pointer to the key value. This should probably * point to the key within node *p. * p - A pointer to a node in the tree. * Output: A pointer to the last node in the set of nodes with keys * matching <FindMe>. * Notes: Node *p MUST be in the set of nodes with keys matching * <FindMe>. If not, this function will return NULL. * * 4.7: Bug found & fixed by Massimo Campostrini, * Istituto Nazionale di Fisica Nucleare, Sezione di Pisa. * * ------------------------------------------------------------------------ ** */ { /* If our starting point is invalid, return NULL. */ if( (NULL != p) || (ubi_trEQUAL != ubi_trAbNormal( (*(RootPtr->cmp))( MatchMe, p ) )) ) return( NULL ); return( Border( RootPtr, MatchMe, p, ubi_trRIGHT ) ); } /* ubi_btLastOf */
static void Window_OnUpdate( LCUI_Widget *window ) { LCUI_Window *wnd; LCUI_Border border; char h_str[20]; wnd = (LCUI_Window*)Widget_GetPrivateData( window ); border = Border( 1, BORDER_STYLE_SOLID, RGB(200,200,200) ); border.top_width = TOP_PANDDING; /* 若窗口已获得焦点 */ if( Widget_GetFocus( window ) ) { border.top_color = wnd->theme_color; border.bottom_color = wnd->theme_color; border.left_color = wnd->theme_color; border.right_color = wnd->theme_color; Widget_SetShadow( window, BoxShadow(0,0,8,wnd->theme_color) ); } else { Widget_SetShadow( window, BoxShadow(0,0,8,ARGB(120,200,200,200)) ); } Widget_SetBorder( window, border ); /* 更新窗口标题栏上的关闭按钮 */ Widget_Update( wnd->btn_close ); sprintf( h_str, "%dpx", Widget_GetContainerHeight(window)-35 ); Widget_SetSize( wnd->client_area, "100%", h_str ); }
/* * 创建一个部件,作为滚动条的容器 * 再创建一个部件,作为滚动条 * 限制滚动条的移动范围 * */ static void ScrollBar_Init( LCUI_Widget *widget ) { LCUI_ScrollBar *scrollbar; scrollbar = WidgetPrivData_New(widget, sizeof(LCUI_ScrollBar)); scrollbar->data.max_num = 100; scrollbar->data.current_num = 100; scrollbar->data.max_size = 100; scrollbar->data.current_size = 100; scrollbar->direction = 0; scrollbar->callback_func = NULL; scrollbar->widget = Widget_New("button"); /* 禁用部件的自动尺寸调整 */ Widget_SetAutoSize( scrollbar->widget, FALSE, 0 ); Widget_Container_Add( widget, scrollbar->widget ); Widget_SetSize( scrollbar->widget, "100%", "100%" ); Widget_LimitPos( scrollbar->widget, Pos(0,0), Pos(0,0) ); Widget_SetBorder( widget, Border(1, BORDER_STYLE_SOLID, RGB(100,100,100)) ); Widget_SetPadding( widget, Padding(1,1,1,1) ); Widget_SetBackgroundColor( widget, RGB(200,200,200) ); Widget_SetBackgroundTransparent( widget, FALSE ); Widget_Show( scrollbar->widget ); Widget_Event_Connect( scrollbar->widget, EVENT_DRAG, ScrollBar_Drag ); }
static void Button_ExecDefalutUpdate( LCUI_Widget *widget ) { LCUI_Border border; LCUI_RGB border_color; switch( widget->state ) { case WIDGET_STATE_NORMAL: Widget_SetBackgroundColor( widget, RGB(230,230,230) ); /* 获得焦点的按钮,使用另一种颜色的边框 */ if( Widget_GetFocus(widget) ) { border_color = RGB(50,150,255); } else { border_color = RGB(172,172,172); } break; case WIDGET_STATE_OVERLAY : Widget_SetBackgroundColor( widget, RGB(232,242,252) ); border_color = RGB(126,180,234); break; case WIDGET_STATE_ACTIVE : Widget_SetBackgroundColor( widget, RGB(207,230,252) ); border_color = RGB(86,157,229); break; case WIDGET_STATE_DISABLE : Widget_SetBackgroundColor( widget, RGB(200,200,200) ); border_color = RGB(172,172,172); break; default : break; } border = Border(1, BORDER_STYLE_SOLID, border_color ); Widget_SetBorder( widget, border ); Widget_SetBackgroundTransparent( widget, FALSE ); }
/** 捕捉键盘按键输入 */ static void StartCatchKey( LCUI_Widget *btn ) { if( tip_box ) { return; } /* 创建提示框 */ tip_box = Widget_New(NULL); tip_label = Widget_New("label"); /* 将label部件添加至提示框中 */ Widget_Container_Add( tip_box, tip_label ); /* 设置提示框中显示的文本 */ Label_TextW( tip_label, TEXT_PLEASE_PRESS_KEY ); /* 设置提示框位置、尺寸及样式 */ Widget_SetAlign( tip_label, ALIGN_MIDDLE_CENTER, Pos(0,0) ); Widget_SetAlign( tip_box, ALIGN_MIDDLE_CENTER, Pos(0,0) ); Widget_Resize( tip_box, TIPBOX_SIZE ); Widget_SetBackgroundTransparent( tip_box, FALSE ); Widget_SetBorder( tip_box, Border(1,BORDER_STYLE_SOLID,RGB(200,200,200)) ); /* 连接LCUI_KEYDOWN事件,以在键盘按键被按下时进行响应 */ keyboard_connect_id = LCUISysEvent_Connect( LCUI_KEYDOWN, ProcKeyDown, btn ); Widget_Show( tip_label ); Widget_SetModal( tip_box, TRUE ); Widget_Show( tip_box ); }
static void ProgressBar_Init(LCUI_Widget *widget) /* 功能:初始化进度条的数据结构体 */ { LCUI_ProgressBar *pb = (LCUI_ProgressBar*) Widget_Create_PrivData (widget, sizeof(LCUI_ProgressBar)); pb->thread = 0; Graph_Init(&pb->fore_graph); Graph_Init(&pb->flash_image); pb->img_move_speed = 200; pb->sleep_time = 100000; pb->max_value = 1; pb->value = 0; LCUI_Widget *f_pb, *img_pb; f_pb = Create_Widget("picture_box"); img_pb = Create_Widget("picture_box"); /* 以自己为容器,将这些部件放进去 */ Widget_Container_Add(f_pb, img_pb); Widget_Container_Add(widget, f_pb); /* 没有背景图时就填充背景色 */ Set_Widget_BG_Mode(widget, BG_MODE_FILL_BACKCOLOR); Set_Widget_Border(widget, RGB(50,50,50), Border(1,1,1,1)); Set_Widget_Style(widget, "classic"); /* 进度条为经典风格 */ Set_PictureBox_Size_Mode(f_pb, SIZE_MODE_STRETCH); Show_Widget(f_pb); Show_Widget(img_pb); pb->fore_pic_box = f_pb; pb->img_pic_box = img_pb; }
void display() { glViewportIndexedf(0, 0, 0, float(Window.Size.x), float(Window.Size.y)); glDrawBuffer(GL_BACK); glClearBufferfv(GL_COLOR, 0, &glm::vec4(0.0f, 0.5f, 1.0f, 1.0f)[0]); // Renderer to image { glDrawBuffer(GL_NONE); glBindProgramPipeline(PipelineName[pipeline::SAVE]); glBindImageTexture(glf::semantic::image::DIFFUSE, TextureName, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8); glBindVertexArray(VertexArrayName); glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0); } // Read from image { GLint Border(8); glEnable(GL_SCISSOR_TEST); glScissorIndexed(0, Border, Border, Window.Size.x - 2 * Border, Window.Size.y - 2 * Border); glDrawBuffer(GL_BACK); glBindProgramPipeline(PipelineName[pipeline::READ]); glBindImageTexture(glf::semantic::image::DIFFUSE, TextureName, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8); glBindVertexArray(VertexArrayName); glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0); glDisable(GL_SCISSOR_TEST); } glf::swapBuffers(); }
void CWidget::InitDraw() { if (m_bSizeChanged) { m_bSizeChanged = false; MoveWindow(0, 0); // Move to a safe position first WindowResize(this, Width(), Height()); MoveWindow(X(), Y()); UpdateSize(); TUI.QueueRefresh(); } if (m_bColorsChanged) { if (m_bFocused) wbkgdset(m_pNCursWin, ' ' | TUI.GetColorPair(m_FColors.first, m_FColors.second) | A_BOLD); else wbkgdset(m_pNCursWin, ' ' | TUI.GetColorPair(m_DFColors.first, m_DFColors.second) | A_BOLD); m_bColorsChanged = false; UpdateColors(); } WindowErase(this); if (HasBox()) Border(this); }
int main(int argc, char *argv[]) { int i; LCUI_Init( argc, argv ); LCUI_RGB color[6]={{255,255,255},{127,127,127}, {255,0,0}, {255,165,0}, {30,144,255}, {65,200,65} }; LCUI_Widget *window, *widget[6], *label[6]; window = Create_Widget( "window" ); for(i=0; i<6; ++i) { widget[i] = Create_Widget( NULL ); label[i] = Create_Widget( "label" ); Label_Text( label[i], "Area %d" , i); Widget_Container_Add( widget[i], label[i] ); Window_Client_Area_Add( window, widget[i] ); Resize_Widget( widget[i], Size(80,80) ); Set_Widget_PosType( widget[i], POS_TYPE_STATIC ); Set_Widget_Align( label[i], ALIGN_MIDDLE_CENTER, Pos(0,0) ); Set_Widget_Border( widget[i], RGB(0,0,0), Border(1,1,1,1) ); Set_Widget_BG_Mode( widget[i], BG_MODE_FILL_BACKCOLOR ); Set_Widget_Backcolor( widget[i], color[i] ); Show_Widget( label[i] ); Show_Widget( widget[i] ); } Set_Window_Title_Text( window, "测试部件布局-2" ); Resize_Widget( window, Size(320, 240) ); Show_Widget( window ); return LCUI_Main(); }
int main(void) { int i; char str[10]; LCUI_RGB color[6]={{255,255,255},{127,127,127}, {255,0,0}, {255,165,0}, {30,144,255}, {65,200,65} }; LCUI_Widget *window, *widget[6], *label[6]; LCUI_Init(); window = Widget_New( "window" ); for(i=0; i<6; ++i) { widget[i] = Widget_New( NULL ); label[i] = Widget_New( "label" ); sprintf(str, "Area %d" , i); Label_Text( label[i], str); Widget_Container_Add( widget[i], label[i] ); Window_ClientArea_Add( window, widget[i] ); Widget_Resize( widget[i], Size(80,80) ); Widget_SetPosType( widget[i], POS_TYPE_STATIC ); Widget_SetAlign( label[i], ALIGN_MIDDLE_CENTER, Pos(0,0) ); Widget_SetBorder( widget[i], Border(1,BORDER_STYLE_SOLID,RGB(0,0,0)) ); Widget_SetBackgroundTransparent( widget[i], FALSE ); Widget_SetBackgroundColor( widget[i], color[i] ); Widget_Show( label[i] ); Widget_Show( widget[i] ); } Window_SetTitleText( window, "测试部件布局-2" ); Widget_Resize( window, Size(320, 240) ); Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, destroy ); Widget_Show( window ); return LCUI_Main(); }
/* * 创建一个部件,作为滚动条的容器 * 再创建一个部件,作为滚动条 * 限制滚动条的移动范围 * */ static void ScrollBar_Init( LCUI_Widget *widget ) { LCUI_ScrollBar *scrollbar; scrollbar = Widget_Create_PrivData(widget, sizeof(LCUI_ScrollBar)); scrollbar->data.max_num = 100; scrollbar->data.current_num = 100; scrollbar->data.max_size = 100; scrollbar->data.current_size = 100; scrollbar->direction = 0; scrollbar->callback_func = NULL; scrollbar->widget = Create_Widget("button"); /* 禁用部件的自动尺寸调整 */ Widget_AutoSize( scrollbar->widget, FALSE, 0 ); Widget_Container_Add( widget, scrollbar->widget ); Set_Widget_Size( scrollbar->widget, "100%", "100%" ); Limit_Widget_Pos( scrollbar->widget, Pos(0,0), Pos(0,0) ); Set_Widget_Border( widget, RGB(100,100,100), Border(1,1,1,1) ); Set_Widget_Padding( widget, Padding(1,1,1,1) ); Set_Widget_Backcolor( widget, RGB(200,200,200) ); Set_Widget_BG_Mode( widget, BG_MODE_FILL_BACKCOLOR ); Show_Widget( scrollbar->widget ); Widget_Drag_Event_Connect( scrollbar->widget, ScrollBar_Drag ); }
void Hull::generate() { this->borders.clear(); int count = this->points.size(); for (int i = 0; i < count; i++) { this->borders.insert(this->borders.end(), Border(this->points[i], this->points[(i + 1) % count])); } }
// Add a Border to the scene // The type can be 0 (upper), 1 (lower), 2 (right) or 3 (left) void Scene::addBorder(int type, int x1, int y1, int c2) { if(nb_borders < NB_BORDERS){ nb_borders++; Border* new_borders = (Border*) malloc(nb_borders*sizeof(Border)); memcpy(new_borders, borders, (nb_borders-1)*sizeof(Border)); new_borders[nb_borders-1] = Border(type, x1, y1, c2); free(borders); borders = new_borders; } }
void HScroller::Update() { IntCoord oldleft, oldright, newleft, newright; int oldwidth, newwidth; Perspective* p; if (canvas == nil) { return; } p = view; GetBarInfo(shown, oldleft, oldwidth); GetBarInfo(p, newleft, newwidth); if (oldleft != newleft || oldwidth != newwidth) { oldright = oldleft+oldwidth-1; newright = newleft+newwidth-1; if (oldright >= newleft && newright >= oldleft) { if (oldright > newright) { Background(newright+1, inset, oldright, ymax-inset); Border(newright); } else if (oldright < newright) { Bar(oldright, newright-oldright); Sides(oldright, newright); Border(newright); } if (oldleft > newleft) { Bar(newleft+1, oldleft-newleft); Sides(newleft, oldleft); Border(newleft); } else if (oldleft < newleft) { Background(oldleft, inset, newleft-1, ymax-inset); Border(newleft); } } else { Background(oldleft, inset, oldright, ymax-inset); Bar(newleft, newwidth); Outline(newleft, newwidth); } } *shown = *p; }
void VScroller::Update() { IntCoord oldbottom, oldtop, newbottom, newtop; int oldheight, newheight; Perspective* p; if (canvas == nil) { return; } p = view; GetBarInfo(shown, oldbottom, oldheight); GetBarInfo(p, newbottom, newheight); if (oldbottom != newbottom || oldheight != newheight) { oldtop = oldbottom+oldheight-1; newtop = newbottom+newheight-1; if (oldtop >= newbottom && newtop >= oldbottom) { if (oldtop > newtop) { Background(inset, newtop+1, xmax-inset, oldtop); Border(newtop); } else if (oldtop < newtop) { Bar(oldtop, newtop-oldtop); Sides(oldtop, newtop); Border(newtop); } if (oldbottom > newbottom) { Bar(newbottom+1, oldbottom-newbottom); Sides(newbottom, oldbottom); Border(newbottom); } else if (oldbottom < newbottom) { Background(inset, oldbottom, xmax-inset, newbottom-1); Border(newbottom); } } else { Background(inset, oldbottom, xmax-inset, oldtop); Bar(newbottom, newheight); Outline(newbottom, newheight); } } *shown = *p; }
void ArpBox::MessageReceived(BMessage *message) { status_t err = B_OK; int32 index = 0; BMessage spec; const char* property = 0; int32 what=0; if( message->GetCurrentSpecifier(&index, &spec, &what, &property) == B_OK ) { BPropertyInfo prop_info(properties_box); int32 propi = prop_info.FindMatch(message, index, &spec, what, property); if( propi >= 0 ) { if( properties_box[propi].extra_data == 1 ) { if( message->what == B_SET_PROPERTY ) { const char* str = 0; err = message->FindString("data", &str); if( !err ) { SetLabel(str); InvalidateDimens(); return; } } else if( message->what == B_GET_PROPERTY ) { BMessage ret(B_REPLY); err = ret.AddString("result", Label()); ret.AddInt32("error", err); message->SendReply(&ret); return; } } else if( properties_box[propi].extra_data == 2 ) { if( message->what == B_SET_PROPERTY ) { int32 value = 0; err = message->FindInt32("data", &value); if( !err ) { SetBorder((border_style)value); InvalidateDimens(); return; } } else if( message->what == B_GET_PROPERTY ) { BMessage ret(B_REPLY); err = ret.AddInt32("result", Border()); ret.AddInt32("error", err); message->SendReply(&ret); return; } } } } if( LayoutMessageReceived(message) == B_OK ) return; BBox::MessageReceived(message); }
// AttachedToWindow void YBScrollView::AttachedToWindow() { BScrollView::AttachedToWindow(); SetViewColor(B_TRANSPARENT_32_BIT); // relayout scrollbars as in R5 // TODO: make this complete for all border_styles // and the horizontal scrollbar (but for now it is sufficient) BRect bounds = Bounds(); switch (Border()) { case B_FANCY_BORDER: { BScrollBar* vScrollBar = ScrollBar(B_VERTICAL); if (vScrollBar) { vScrollBar->MoveTo(bounds.right - (B_V_SCROLL_BAR_WIDTH + 1), bounds.top + 1); vScrollBar->ResizeTo(vScrollBar->Frame().Width(), bounds.Height() - 2); } BScrollBar* hScrollBar = ScrollBar(B_HORIZONTAL); if (hScrollBar) { hScrollBar->MoveTo(bounds.left + 1, bounds.bottom - (B_H_SCROLL_BAR_HEIGHT + 1)); hScrollBar->ResizeTo(bounds.Width() - 2, hScrollBar->Frame().Height()); } if (BView* target = Target()) { target->MoveTo(2.0, 2.0); if (vScrollBar && hScrollBar) { target->ResizeTo(bounds.Width() - (B_V_SCROLL_BAR_WIDTH + 4), bounds.Height() - (B_H_SCROLL_BAR_HEIGHT + 4)); } else if (vScrollBar) { target->ResizeTo(bounds.Width() - (B_V_SCROLL_BAR_WIDTH + 4), bounds.Height() - 4); } else if (hScrollBar) { target->ResizeTo(bounds.Width() - 4, bounds.Height() - (B_H_SCROLL_BAR_HEIGHT + 4)); } else { target->ResizeTo(bounds.Width() - 4, bounds.Height() - 4); } } break; } default: break; } }
void GameWindow_InitLicenseWindow(void) { window = Widget_New("window"); label_license = Widget_New("label"); textbox_license = Widget_New("text_box"); box = Widget_New(NULL); btn_ok = Widget_New("button"); Window_ClientArea_Add( window, label_license ); Window_ClientArea_Add( window, box ); Window_ClientArea_Add( window, btn_ok ); Widget_Container_Add( box, textbox_license ); Widget_SetBackgroundColor( label_license, RGB(255,255,255) ); Widget_SetBackgroundTransparent( label_license, FALSE ); Widget_SetAlign( label_license, ALIGN_TOP_CENTER, Pos(0,0) ); Widget_SetAlign( box, ALIGN_TOP_CENTER, Pos(0,8) ); Widget_SetAlign( btn_ok, ALIGN_BOTTOM_CENTER, Pos(0,-5) ); Label_TextW( label_license, TEXT_LICENSE ); Button_TextW( btn_ok, TEXT_OK ); TextBox_SetAutoWrap( textbox_license, TRUE ); TextBox_SetMultiline( textbox_license, TRUE ); TextBox_SetReadOnly( textbox_license, TRUE ); TextBox_SetUsingStyleTags( textbox_license, TRUE ); TextBox_TextW( textbox_license, license_text ); TextBox_ShowCursor( textbox_license, FALSE ); Widget_SetStyleID( window, WINDOW_STYLE_LINE ); Widget_SetPadding( Window_GetClientArea(window), Padding(10,10,10,10) ); Widget_SetAutoSize( btn_ok, FALSE, 0 ); Widget_SetBorder( box, Border(1,BORDER_STYLE_SOLID,RGB(200,200,200)) ); Widget_SetPadding( box, Padding(10,10,10,10) ); Widget_SetSize( box, "100%", "280px" ); Widget_SetSize( textbox_license, "100%", "100%" ); Widget_Resize( window, WINDOW_SIZE ); Widget_Resize( btn_ok, BTN_SIZE ); Widget_ConnectEvent( btn_ok, EVENT_CLICKED, btn_ok_on_clicked ); Widget_Show( textbox_license ); Widget_Show( box ); Widget_Show( label_license ); Widget_Show( btn_ok ); }
// Handle size changes. Set the contained controls extents. Called by framework void CMessageListBox::SizeChanged() { innerRect = Border().InnerRect(Rect()); // Application Title rect. Fills the controls top area TSize titleSize(innerRect.Width(), iAppTitle->MinimumSize().iHeight); TRect titleRect(innerRect.iTl, titleSize); iAppTitle->SetRect(titleRect); // List box size and rect. Fills the remaining area TSize listBoxSize(innerRect.Width(), innerRect.Height() - iAppTitle->MinimumSize().iHeight); TRect listBoxRect(TPoint(titleRect.iTl.iX, titleRect.iBr.iY+1), listBoxSize); iListbox->SetRect(listBoxRect); }
// Set the left and right view controls positions. Called by framework void CRegisterView::SizeChanged() { TRect innerRect = Border().InnerRect(Rect()); // This should be same as // Rect(), because this // window has no border. if(iMainScreenView) { TRect MainScreenView(innerRect); MainScreenView.SetWidth(innerRect.Width()/3); MainScreenView.Shrink(5,5); // Allow space for border shadows iMainScreenView->SetRect(MainScreenView); } if(iMainSubScreenView) { TRect MainSubScreenView(innerRect); MainSubScreenView.iTl.iX = innerRect.iTl.iX + innerRect.Width()/3; MainSubScreenView.SetWidth(innerRect.Width()/1.5); MainSubScreenView.Shrink(5,5); // Allow space for border shadows iMainSubScreenView->SetRect(MainSubScreenView); } }
// Draw this control to the screen. Draw the area empty with // appropriate color. If the control is focused, draw shadow border. void CPhotoModeListBox::Draw(const TRect& aRect) const { CWindowGc& gc = SystemGc(); gc.SetClippingRect(aRect); gc.Clear(iBorder.OuterRect(aRect)); gc.SetBrushStyle(CGraphicsContext::ESolidBrush); if (IsFocused()) { CEikBorderedControl::Draw(iBorder.OuterRect(aRect)); // Shadow border gc.SetBrushColor(TRgb(KFocusedBkgColor)); } else { gc.SetBrushColor(TRgb(KNonFocusedBkgColor)); } // Fill the controls background. The color depends on the focus status. In // this example this has no effect, because contained controls are drawn // over the same area. Here just for demonstrating design principle. gc.DrawRect(Border().InnerRect(Rect())); }
GSplitter::GSplitter() { d = new GSplitterPrivate; d->PosA.ZOff(0, 0); d->PosB.ZOff(0, 0); d->ViewA = 0; d->ViewB = 0; d->BorderA = false; d->BorderB = false; d->SplitFollow = false; d->BarSize = SPLITER_BAR_DEFAULT; d->Vertical = true; d->SplitPos = 100; GRect r(0, 0, 2000, 1000); SetPos(r); Name("LGI_Spliter"); d->SplitSet = d->SplitPos = -1; d->Moving = false; Border(true); Raised(true); SetPourLargest(true); _BorderSize = 1; #if WINNATIVE d->OverBar = false; d->Cursor = 0; d->OldCursor = 0; SetStyle(GetStyle() | WS_CLIPCHILDREN); #elif defined BEOS Handle()->SetViewColor(B_TRANSPARENT_COLOR); #endif IsVertical(true); Value(0); LgiResources::StyleElement(this); }
int main(void) { LCUI_Thread t; LCUI_Widget *window, *widget; LCUI_Init(); window = Widget_New( "window" ); widget = Widget_New( NULL ); Window_SetTitleText( window, "测试部件布局-1" ); Window_ClientArea_Add( window, widget ); Widget_Resize( widget, Size(120, 120) ); Widget_Resize( window, Size(320, 240) ); Widget_SetBackgroundTransparent( widget, FALSE ); Widget_SetBorder( widget, Border(1, BORDER_STYLE_SOLID, RGB(0,0,0)) ); Widget_SetBackgroundColor( widget, RGB(255,0,0) ); Widget_Show( widget ); Widget_Show( window ); Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, destroy ); LCUIThread_Create( &t, thread, widget ); return LCUI_Main(); }
/*--------------------------------------------------------------------------*/ void PegColorLight::Draw() { if (!mwNumStates || !mpStateColor) { return; } BeginDraw(); PegColor Color(mpStateColor[mwCurState], mpStateColor[mwCurState], CF_FILL); if(mwStyle & LS_RECTANGLE) { StandardBorder(mpStateColor[mwCurState]); } else if(mwStyle & LS_CIRCLE) { if(mwStyle & AF_TRANSPARENT && Parent()) { StandardBorder(Parent()->muColors[PCI_NORMAL]); } SIGNED iWidth = mClient.Width() / 2; SIGNED iHeight = mClient.Height() / 2; Circle(iWidth + mClient.wLeft, iHeight + mClient.wTop, PEGMIN(iWidth, iHeight), Color, 1); PegColor Border(PCLR_SHADOW, PCLR_SHADOW, CF_NONE); Circle(iWidth + mClient.wLeft, iHeight + mClient.wTop, PEGMIN(iWidth, iHeight), Border, 1); } DrawChildren(); EndDraw(); }
bool render() { glm::vec2 WindowSize(this->getWindowSize()); glViewportIndexedf(0, 0, 0, WindowSize.x, WindowSize.y); glDrawBuffer(GL_BACK); glClearBufferfv(GL_COLOR, 0, &glm::vec4(0.0f, 0.5f, 1.0f, 1.0f)[0]); // Renderer to image { glDrawBuffer(GL_NONE); glBindProgramPipeline(PipelineName[pipeline::SAVE]); glBindImageTexture(semantic::image::DIFFUSE, TextureName, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8); glBindVertexArray(VertexArrayName); glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0); } // Read from image { GLint Border(8); glEnable(GL_SCISSOR_TEST); glScissorIndexed(0, Border, Border, static_cast<GLsizei>(WindowSize.x - 2) * Border, static_cast<GLsizei>(WindowSize.y - 2) * Border); glDrawBuffer(GL_BACK); glBindProgramPipeline(PipelineName[pipeline::READ]); glBindImageTexture(semantic::image::DIFFUSE, TextureName, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8); glBindVertexArray(VertexArrayName); glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0); glDisable(GL_SCISSOR_TEST); } return true; }
/** The window has a sunken 3D border. */ void SunkenEdge() { Border(); #ifdef USE_GDI ex_style |= WS_EX_CLIENTEDGE; #endif }