本文整理汇总了C++中BBox::ConstrainClippingRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::ConstrainClippingRegion方法的具体用法?C++ BBox::ConstrainClippingRegion怎么用?C++ BBox::ConstrainClippingRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::ConstrainClippingRegion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clipreg
NetworkWindow::NetworkWindow()
: BWindow(BRect(0, 0, 435, 309),"Network",
B_TITLED_WINDOW,B_NOT_ANCHORED_ON_ACTIVATE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE,
B_CURRENT_WORKSPACE)
{
BScreen screen;
BRect screenframe = screen.Frame(), bounds = Bounds(), workrect(0,0,1,1);
float width,height;
float screenx, screeny;
screenx = ((screenframe.right + 1) / 2) - (bounds.right / 2) - 1;
screeny = ((screenframe.bottom + 1) / 2) - (bounds.bottom / 2) - 1;
MoveTo(screenx, screeny);
fView = new BView(bounds,"View",B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(fView);
fRestart = new BButton(workrect,"Restart_Networking",
"Restart Networking",new BMessage(kRestart_Networking_M),
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fRestart->GetPreferredSize(&width,&height);
fRestart->ResizeTo(width,height);
fRestart->MoveTo(10,bounds.bottom - 10 - height);
// We fake the divider line by using a BBox. We have to call ConstrainClippingRegion
// because otherwise we also see the corners drawn, which doesn't look nice
BBox *vr = new BBox(BRect(width + 18, bounds.bottom - 11 - height, width + 19,
bounds.bottom - 9),
"vertical_rule", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fView->AddChild(vr);
BRegion clipreg(vr->Bounds().InsetByCopy(0,2));
vr->ConstrainClippingRegion(&clipreg);
fRevert = new BButton(BRect(width + 25,bounds.bottom - 10 - height,width + 26,
bounds.bottom - 10),
"Revert","Revert", new BMessage(kRevert_M),
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fRevert->ResizeToPreferred();
fRevert->SetEnabled(false);
fSave = new BButton(workrect,"Save","Save",new BMessage(kSave_M),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fSave->GetPreferredSize(&width,&height);
fSave->ResizeTo(width,height);
fSave->MoveTo(bounds.right - 10 - width, bounds.bottom - 10 - height);
fSave->MakeDefault(true);
fSave->SetEnabled(false);
BBox *hr = new BBox(BRect(0,bounds.bottom - height - 20,bounds.right,
bounds.bottom - height - 19),
"horizontal_rule",B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
fView->AddChild(hr);
workrect = Bounds();
workrect.bottom = hr->Frame().top;
workrect.top = 10;
fTabView = new BTabView(workrect,"tab_view",B_WIDTH_FROM_WIDEST, B_FOLLOW_ALL);
fTabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fView->AddChild(fTabView);
bounds.bottom -= fTabView->TabHeight();
fView->AddChild(fRestart);
fView->AddChild(fRevert);
fView->AddChild(fSave);
bounds = fTabView->Bounds();
bounds.bottom -= fTabView->TabHeight();
fIdentityView = new BView(bounds,"Identity",B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
fIdentityView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fIdentity = new BTab();
fTabView->AddTab(fIdentityView,fIdentity);
// We can just pick a view to call StringWidth because we're not using anything
// except the unaltered be_plain_font. Note that for each BTextControl pair we
// just use the longer word of the two in order to save us some speed and code size
float labelwidth = fTabView->StringWidth("Domain name: ");
workrect.Set(10,20,11,21);
fDomain = new BTextControl(workrect,"Domain_Name","Domain name:"," ",
new BMessage(kSOMETHING_HAS_CHANGED_M));
// BTextControl::ResizeToPreferred() is a little strange for our purposes, so we
// get the preferred size and ignore the width that we get.
fDomain->GetPreferredSize(&width, &height);
fDomain->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
fDomain->SetDivider(labelwidth);
workrect.left = 10;
workrect.right = 11;
workrect.top = height + 30;
workrect.bottom = workrect.top + height;
fHost = new BTextControl(workrect,"Host_Name","Host name:",NULL,
new BMessage(kSOMETHING_HAS_CHANGED_M));
//.........这里部分代码省略.........