本文整理汇总了C++中BBox::SetViewColor方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::SetViewColor方法的具体用法?C++ BBox::SetViewColor怎么用?C++ BBox::SetViewColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::SetViewColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BBox
NPError NP_LOADDS
NPP_SetWindow(NPP instance, NPWindow* window){
BView* bw=(BView*)window->window;
if(bw->Window()->Lock() ){
if(bw->FindView("pippo")==NULL){
printf("Adding border\n\n");
BBox* box;
bw->AddChild(box=new BBox(bw->Bounds(),"pippo"));
box->SetViewColor(0,0,0);
}
bw->Window()->Unlock();
}
return NPERR_NO_ERROR;
}
示例2: BWindow
JoyWin::JoyWin(BRect frame, const char *title)
: BWindow(frame, title, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE), fSystemUsedSelect(false),
fJoystick(new BJoystick)
{
fProbeButton = new BButton(BRect(15.00, 260.00, 115.00, 285.00),
"ProbeButton", "Probe", new BMessage(PROBE));
fCalibrateButton = new BButton(BRect(270.00, 260.00, 370.00, 285.00),
"CalibrateButton", "Calibrate", new BMessage(CALIBRATE));
fGamePortL = new BListView(BRect(15.00, 30.00, 145.00, 250.00),
"gamePort");
fGamePortL->SetSelectionMessage(new BMessage(PORT_SELECTED));
fGamePortL->SetInvocationMessage(new BMessage(PORT_INVOKE));
fConControllerL = new BListView(BRect(175.00,30.00,370.00,250.00),
"conController");
fConControllerL->SetSelectionMessage(new BMessage(JOY_SELECTED));
fConControllerL->SetInvocationMessage(new BMessage(JOY_INVOKE));
fGamePortS = new BStringView(BRect(15, 5, 160, 25), "gpString",
"Game port");
fGamePortS->SetFont(be_bold_font);
fConControllerS = new BStringView(BRect(170, 5, 330, 25), "ccString",
"Connected controller");
fConControllerS->SetFont(be_bold_font);
fCheckbox = new BCheckBox(BRect(131.00, 260.00, 227.00, 280.00),
"Disabled", "Disabled", new BMessage(DISABLEPORT));
BBox *box = new BBox( Bounds(),"box", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE,
B_PLAIN_BORDER);
box->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// Add listViews with their scrolls
box->AddChild(new BScrollView("PortScroll", fGamePortL,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, false, true));
box->AddChild(new BScrollView("ConScroll", fConControllerL, B_FOLLOW_ALL,
B_WILL_DRAW, false, true));
// Adding object
box->AddChild(fCheckbox);
box->AddChild(fGamePortS);
box->AddChild(fConControllerS);
box->AddChild(fProbeButton);
box->AddChild(fCalibrateButton);
AddChild(box);
SetSizeLimits(400, 600, Bounds().Height(), Bounds().Height());
/* Add all the devices */
int32 nr = fJoystick->CountDevices();
for (int32 i = 0; i < nr;i++) {
//BString str(path.Path());
char buf[B_OS_NAME_LENGTH];
fJoystick->GetDeviceName(i, buf, B_OS_NAME_LENGTH);
fGamePortL->AddItem(new PortItem(buf));
}
fGamePortL->Select(0);
/* Add the joysticks specifications */
_AddToList(fConControllerL, JOY_SELECTED, JOYSTICKFILEPATH);
_GetSettings();
}
示例3: b
// constructor
ObjectWindow::ObjectWindow(BRect frame, const char* name)
: BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
{
BRect b(Bounds());
b.bottom = b.top + 8;
BMenuBar* menuBar = new BMenuBar(b, "menu bar");
AddChild(menuBar);
BMenu* menu = new BMenu("File");
menuBar->AddItem(menu);
menu->AddItem(new BMenu("Submenu"));
BMenuItem* menuItem = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
'Q');
menu->AddItem(menuItem);
b = Bounds();
b.top = menuBar->Bounds().bottom + 1;
b.right = ceilf((b.left + b.right) / 2.0);
BBox* bg = new BBox(b, "bg box", B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW,
B_PLAIN_BORDER);
AddChild(bg);
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// object view occupies the right side of the window
b.left = b.right + 1.0;
b.right = Bounds().right - B_V_SCROLL_BAR_WIDTH;
b.bottom -= B_H_SCROLL_BAR_HEIGHT;
fObjectView = new ObjectView(b, "object view", B_FOLLOW_ALL,
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
// wrap a scroll view around the object view
BScrollView* scrollView = new BScrollView("object scroller", fObjectView,
B_FOLLOW_ALL, 0, true, true, B_NO_BORDER);
if (BScrollBar* scrollBar = fObjectView->ScrollBar(B_VERTICAL)) {
scrollBar->SetRange(0.0, fObjectView->Bounds().Height());
scrollBar->SetProportion(0.5);
}
if (BScrollBar* scrollBar = fObjectView->ScrollBar(B_HORIZONTAL)) {
scrollBar->SetRange(0.0, fObjectView->Bounds().Width());
scrollBar->SetProportion(0.5);
}
AddChild(scrollView);
b = bg->Bounds();
// controls occupy the left side of the window
b.InsetBy(5.0, 5.0);
BBox* controlGroup = new BBox(b, "controls box",
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, B_FANCY_BORDER);
controlGroup->SetLabel("Controls");
bg->AddChild(controlGroup);
b = controlGroup->Bounds();
b.top += controlGroup->InnerFrame().top;
b.bottom = b.top + 25.0;
b.InsetBy(10.0, 10.0);
b.right = b.left + b.Width() / 2.0 - 5.0;
// new button
fNewB = new BButton(b, "new button", "New Object",
new BMessage(MSG_NEW_OBJECT));
controlGroup->AddChild(fNewB);
SetDefaultButton(fNewB);
// clear button
b.OffsetBy(0, fNewB->Bounds().Height() + 5.0);
fClearB = new BButton(b, "clear button", "Clear", new BMessage(MSG_CLEAR));
controlGroup->AddChild(fClearB);
// object type radio buttons
BMessage* message;
BRadioButton* radioButton;
b.OffsetBy(0, fClearB->Bounds().Height() + 5.0);
message = new BMessage(MSG_SET_OBJECT_TYPE);
message->AddInt32("type", OBJECT_LINE);
radioButton = new BRadioButton(b, "radio 1", "Line", message);
controlGroup->AddChild(radioButton);
radioButton->SetValue(B_CONTROL_ON);
b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
message = new BMessage(MSG_SET_OBJECT_TYPE);
message->AddInt32("type", OBJECT_RECT);
radioButton = new BRadioButton(b, "radio 2", "Rect", message);
controlGroup->AddChild(radioButton);
b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
message = new BMessage(MSG_SET_OBJECT_TYPE);
message->AddInt32("type", OBJECT_ROUND_RECT);
radioButton = new BRadioButton(b, "radio 3", "Round Rect", message);
controlGroup->AddChild(radioButton);
b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
//.........这里部分代码省略.........