本文整理汇总了C++中BView类的典型用法代码示例。如果您正苦于以下问题:C++ BView类的具体用法?C++ BView怎么用?C++ BView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HWindow
DocInfoWindow::DocInfoWindow(BMessage *docInfo)
: HWindow(BRect(0, 0, 400, 250), "Document Information", B_TITLED_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL, B_NOT_MINIMIZABLE),
fDocInfo(docInfo)
{
BRect bounds(Bounds());
BView *background = new BView(bounds, "bachground", B_FOLLOW_ALL, B_WILL_DRAW);
background->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(background);
bounds.InsetBy(10.0, 10.0);
BButton *button = new BButton(bounds, "ok", "OK", new BMessage(OK_MSG),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
background->AddChild(button);
button->ResizeToPreferred();
button->MoveTo(bounds.right - button->Bounds().Width(),
bounds.bottom - button->Bounds().Height());
BRect buttonFrame(button->Frame());
button = new BButton(buttonFrame, "cancel", "Cancel", new BMessage(CANCEL_MSG),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
background->AddChild(button);
button->ResizeToPreferred();
button->MoveTo(buttonFrame.left - (button->Bounds().Width() + 10.0),
buttonFrame.top);
bounds.bottom = buttonFrame.top - 10.0;
#if HAVE_FULLVERSION_PDF_LIB
BString permissions;
if (_DocInfo()->FindString("permissions", &permissions) == B_OK)
fPermissions.Decode(permissions.String());
BTabView *tabView = new BTabView(bounds, "tabView");
_SetupDocInfoView(_CreateTabPanel(tabView, "Information"));
_SetupPasswordView(_CreateTabPanel(tabView, "Password"));
_SetupPermissionsView(_CreateTabPanel(tabView, "Permissions"));
background->AddChild(tabView);
#else
BBox* panel = new BBox(bounds, "top_panel", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_NO_BORDER);
_SetupDocInfoView(panel);
background->AddChild(panel);
#endif
if (fTable->ChildAt(0))
fTable->ChildAt(0)->MakeFocus();
BRect winFrame(Frame());
BRect screenFrame(BScreen().Frame());
MoveTo((screenFrame.right - winFrame.right) / 2,
(screenFrame.bottom - winFrame.bottom) / 2);
SetSizeLimits(400.0, 10000.0, 250.0, 10000.0);
}
示例2: BWindow
DesktopWindow::DesktopWindow(BRect frame, bool editMode)
: BWindow(frame, B_TRANSLATE("Desktop"),
kPrivateDesktopWindowLook,
kPrivateDesktopWindowFeel,
B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
| B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
| B_ASYNCHRONOUS_CONTROLS,
editMode?B_CURRENT_WORKSPACE:B_ALL_WORKSPACES),
fEditShelfMode(editMode)
{
BScreen screen;
BView *desktop = new BView(Bounds(), "desktop", B_FOLLOW_NONE, 0);
desktop->SetViewColor(screen.DesktopColor());
AddChild(desktop);
// load the shelf
BPath path;
status_t err;
entry_ref ref;
err = find_directory(B_SYSTEM_SETTINGS_DIRECTORY, &path, true);
if (err >= B_OK) {
BDirectory dir(path.Path());
if (!dir.Contains("x-vnd.Haiku-Login", B_DIRECTORY_NODE))
dir.CreateDirectory("x-vnd.Haiku-Login", NULL);
path.Append("x-vnd.Haiku-Login");
dir.SetTo(path.Path());
if (!dir.Contains("Shelf", B_FILE_NODE))
dir.CreateFile("Shelf", NULL);
path.Append("Shelf");
get_ref_for_path(path.Path(), &ref);
}
fDesktopShelf = new BShelf(&ref, desktop, fEditShelfMode, "DesktopShelf");
if (fDesktopShelf)
fDesktopShelf->SetDisplaysZombies(true);
}
示例3: cast_as
void
BBox::SetLabel(const char *label)
{
if (!(label == NULL || *label == 0)) {
BStringView *strView = cast_as(fLabelView, BStringView);
if (strView != NULL) {
strView->SetText(label);
strView->ResizeToPreferred();
ReAdjustLabel();
return;
}
if ((strView = new BStringView(BRect(0, 0, 1, 1), NULL, label, B_FOLLOW_NONE)) == NULL) return;
strView->SetFont(be_bold_font);
strView->ResizeToPreferred();
if (SetLabel(strView) != B_OK) delete strView;
} else if (fLabelView != NULL) {
BView *view = fLabelView;
fLabelView = NULL;
view->RemoveSelf();
delete view;
}
}
示例4: Looper
/**
Starts dragging.
*/
void SplitView::MouseDown(BPoint where)
{
// This is an event hook so there must be a Looper.
BMessage *message = Looper()->CurrentMessage();
int32 clicks = 0;
message->FindInt32("clicks", &clicks);
fDoubleClick = clicks == 2;
if (!fDragged) {
fDragged = true;
fGrabPoint = where;
BView *child = NULL;
for (int i=0; (child = ChildAt(i)); i++) {
if (fLayout.Mode() == B_HORIZONTAL && child->Frame().left > where.x)
break;
if (fLayout.Mode() == B_VERTICAL && child->Frame().top > where.y)
break;
}
if (child)
fSelected = child->PreviousSibling();
Draw(Bounds());
// Subscribe to off-view mouse events.
SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY | B_LOCK_WINDOW_FOCUS);
}
}
示例5: NewConfigView
// ---------------------------------------------------------------
// MakeConfigurationView
//
// Makes a BView object for configuring / displaying info about
// this translator.
//
// Preconditions:
//
// Parameters: ioExtension, configuration options for the
// translator
//
// outView, the view to configure the
// translator is stored here
//
// outExtent, the bounds of the view are
// stored here
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
status_t
BaseTranslator::MakeConfigurationView(BMessage *ioExtension, BView **outView,
BRect *outExtent)
{
if (!outView || !outExtent)
return B_BAD_VALUE;
if (ioExtension && fSettings->LoadSettings(ioExtension) != B_OK)
return B_BAD_VALUE;
BView *view = NewConfigView(AcquireSettings());
// implemented in derived class
if (view) {
*outView = view;
if ((view->Flags() & B_SUPPORTS_LAYOUT) != 0)
view->ResizeTo(view->ExplicitPreferredSize());
*outExtent = view->Bounds();
return B_OK;
} else
return BTranslator::MakeConfigurationView(ioExtension, outView,
outExtent);
}
示例6: BWindow
InfoWindow::InfoWindow(BRect r)
: BWindow(r,"Update Progress",B_MODAL_WINDOW,B_NOT_RESIZABLE)
{
BView *mainView = new BView(Bounds(),NULL,B_FOLLOW_ALL,B_WILL_DRAW);
mainView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(mainView);
BRect sv = Bounds();
sv.bottom = sv.top+14;
line1 = new BStringView(sv,NULL,T("Updating..."));
sv.top = sv.bottom;
sv.bottom += 14;
line2 = new BStringView(sv,NULL,"");
sv.bottom = Bounds().bottom;
sv.top = sv.bottom-30;
bar = new BStatusBar(sv,NULL);
mainView->AddChild(line1);
mainView->AddChild(line2);
mainView->AddChild(bar);
Show();
}
示例7: r
BView*
DelayEffect::SettingsPanel()
{
BRect r(0,0,200,100);
BView *view = new BView(r, "delayview", B_FOLLOW_ALL, B_WILL_DRAW);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
delay = new SpinSlider("delay", B_TRANSLATE("Delay (ms)"),
new BMessage(CONTROL_CHANGED), 1, 500);
// delay->SetValue(Prefs.filter_delay_delay * 1000);
gain = new SpinSlider("gain", B_TRANSLATE("Gain %"),
new BMessage(CONTROL_CHANGED), 1, 200);
// gain->SetValue(Prefs.filter_delay_gain * 100);
BLayoutBuilder::Group<>(view, B_VERTICAL, 2)
.Add(delay, 0)
.Add(gain, 1)
.End();
return view;
}
示例8: switch
void FontDrawView::MessageReceived(BMessage *message)
{ BView *parentview;
BWindow *parentwin;
switch(message->what)
{
case FONTVIEW_TOGGLE:
parentview=Parent();
parentwin=parentview->Window();
if(IsHidden())
{
parentwin->PostMessage(FONTVIEW_TOGGLE);
Show();
}
else
{
parentwin->PostMessage(FONTVIEW_TOGGLE);
Hide();
}
break;
default:
BView::MessageReceived(message);
}
}
示例9: AttribView
AttribFill::AttribFill ()
: AttribView (BRect (0, 0, 146, 146), lstring (24, "Fill"))
{
SetViewColor (LightGrey);
BBox *tolSets = new BBox (BRect (4, 4, 142, 142), "tol");
tolSets->SetLabel (lstring (338, "Tolerance"));
AddChild (tolSets);
tol = new BRadioButton (BRect (8, 13, 124, 30), "tol", lstring (339, "Visual Distance"), new BMessage ('AFtV'));
rgb = new BRadioButton (BRect (8, 30, 124, 46), "rgb", lstring (340, "Absolute RGB"), new BMessage ('AFtS'));
tol->SetValue (B_CONTROL_ON);
tolSets->AddChild (tol);
tolSets->AddChild (rgb);
TabView *bgTab = new TabView (BRect (4, 50, 132, 134), "AttribFill Tab");
tolSets->AddChild (bgTab);
BView *tolTab = new BView (BRect (2, TAB_HEIGHT + 4, 126, TAB_HEIGHT + 63), "tol View", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
BView *rgbTab = new BView (BRect (2, TAB_HEIGHT + 4, 126, TAB_HEIGHT + 63), "rgb View", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
tolTab->SetViewColor (LightGrey);
rgbTab->SetViewColor (LightGrey);
bgTab->AddView (tolTab, lstring (341, "Visual"));
bgTab->AddView (rgbTab, lstring (342, "RGB"));
BStringView *explD = new BStringView (BRect (2, 8, 122, 20), "explD", lstring (343, "Visual Factors:"));
BStringView *facD = new BStringView (BRect (2, 20, 122, 32), "facD", lstring (344, "R: 0.213 G: 0.715 B: 0.072"));
explD->SetFontSize (10);
facD->SetFontSize (10);
sT = new Slider (BRect (4, 42, 122, 58), 10, "D", 0, 255, 1, new BMessage ('AFcT'));
sR = new Slider (BRect (4, 2, 122, 18), 10, "R", 0, 255, 1, new BMessage ('AFcR'));
sG = new Slider (BRect (4, 22, 122, 38), 10, "G", 0, 255, 1, new BMessage ('AFcG'));
sB = new Slider (BRect (4, 42, 122, 58), 10, "B", 0, 255, 1, new BMessage ('AFcB'));
tolTab->AddChild (sT);
tolTab->AddChild (explD);
tolTab->AddChild (facD);
rgbTab->AddChild (sR);
rgbTab->AddChild (sG);
rgbTab->AddChild (sB);
fTolMode = FILLTOL_TOL;
fTolerance = 0;
fToleranceRGB.red = 0;
fToleranceRGB.green = 0;
fToleranceRGB.blue = 0;
fCurrentProperty = 0;
}
示例10: BBitmap
void MediaNodePanel::_updateBitmap()
{
if (m_bitmap)
{
delete m_bitmap;
}
BBitmap *tempBitmap = new BBitmap(Frame().OffsetToCopy(0.0, 0.0), B_CMAP8, true);
tempBitmap->Lock();
{
BView *tempView = new BView(tempBitmap->Bounds(), "", B_FOLLOW_NONE, 0);
tempBitmap->AddChild(tempView);
tempView->SetOrigin(0.0, 0.0);
int32 layout = dynamic_cast<MediaRoutingView *>(view())->getLayout();
_drawInto(tempView, tempView->Bounds(), layout);
tempView->Sync();
tempBitmap->RemoveChild(tempView);
delete tempView;
}
tempBitmap->Unlock();
m_bitmap = new BBitmap(tempBitmap);
delete tempBitmap;
}
示例11: BView
BView* SeqEditMultiFilterWindow::NewGeneralView(BRect frame)
{
BView* v = new BView(frame, GENERAL_STR, B_FOLLOW_ALL, 0);
if (!v) return NULL;
v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
float fh = arp_get_font_height(v);
float spaceX = 5, spaceY = 5;
float divider = v->StringWidth("Author:") + 10;
BRect f(spaceX, 0, frame.Width() - spaceX, fh);
/* The Name field.
*/
mNameCtrl = new BTextControl(f, "name_ctrl", "Name:", NULL, new BMessage(NAME_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
if (mNameCtrl) {
f.top = mNameCtrl->Frame().bottom;
mNameCtrl->SetDivider(divider);
mNameCtrl->MakeFocus(true);
v->AddChild(mNameCtrl);
}
/* The Key field.
*/
f.top += spaceY;
f.bottom = f.top + fh;
mKeyCtrl = new BTextControl(f, "key_ctrl", "Key:", NULL, new BMessage(KEY_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
if (mKeyCtrl) {
f.top = mKeyCtrl->Frame().bottom;
mKeyCtrl->SetDivider(divider);
v->AddChild(mKeyCtrl);
}
/* The Author field.
*/
f.top += spaceY;
f.bottom = f.top + fh;
mAuthorCtrl = new BTextControl(f, "author_ctrl", "Author:", NULL, new BMessage(AUTHOR_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
if (mAuthorCtrl) {
f.top = mAuthorCtrl->Frame().bottom;
mAuthorCtrl->SetDivider(divider);
v->AddChild(mAuthorCtrl);
}
/* The Email field.
*/
f.top += spaceY;
f.bottom = f.top + fh;
mEmailCtrl = new BTextControl(f, "email_ctrl", "Email:", NULL, new BMessage(EMAIL_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
if (mEmailCtrl) {
f.top = mEmailCtrl->Frame().bottom;
mEmailCtrl->SetDivider(divider);
v->AddChild(mEmailCtrl);
}
return v;
}
示例12: DWindow
RunArgsWindow::RunArgsWindow(Project *proj)
: DWindow(BRect(0,0,400,300),"Run Arguments",B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE),
fProject(proj)
{
AddCommonFilter(new EscapeCancelFilter());
BView *top = GetBackgroundView();
fArgText = new AutoTextControl(BRect(10,10,11,11),"argtext",TR("Arguments: "),
fProject->GetRunArgs(), new BMessage,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
top->AddChild(fArgText);
fArgText->ResizeToPreferred();
fArgText->ResizeTo(Bounds().Width() - 20,fArgText->Bounds().Height());
fArgText->SetDivider(fArgText->StringWidth(TR("Arguments: ")) + 5);
ResizeTo(Bounds().Width(),fArgText->Frame().bottom + 10);
MakeCenteredOnShow(true);
fArgText->MakeFocus(true);
fArgText->TextView()->SelectAll();
}
示例13: DWindow
LibraryWindow::LibraryWindow(BRect frame, const BMessenger &parent, Project *project)
: DWindow(frame,NULL,B_TITLED_WINDOW,B_ASYNCHRONOUS_CONTROLS |
B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE),
fParent(parent),
fProject(project)
{
if (project)
{
BString title(TR("Libraries: "));
title << project->GetName();
SetTitle(title.String());
}
BView *top = GetBackgroundView();
BRect r(10,10,11,11);
BStringView *label = new BStringView(r,"label",TR("Choose the system libraries "
"for your project."));
label->ResizeToPreferred();
top->AddChild(label);
label->SetText(TR("Scanning libraries…"));
r = Bounds().InsetByCopy(10,10);
r.top = label->Frame().top + 20;
r.right -= B_V_SCROLL_BAR_WIDTH;
fCheckList = new BView(r,"checklist",B_FOLLOW_ALL,B_WILL_DRAW);
BScrollView *scrollView = new BScrollView("scrollView",fCheckList,
B_FOLLOW_ALL, 0,false,true);
top->AddChild(scrollView);
fScanThread = spawn_thread(ScanThread,"libscanthread",B_NORMAL_PRIORITY,this);
resume_thread(fScanThread);
fCheckList->MakeFocus(true);
}
示例14: _InitOffscreen
void
KeyboardLayoutView::Draw(BRect updateRect)
{
if (fOldSize != BSize(Bounds().Width(), Bounds().Height())) {
_InitOffscreen();
_LayoutKeyboard();
}
BView* view;
if (fOffscreenBitmap != NULL) {
view = fOffscreenView;
view->LockLooper();
} else
view = this;
// Draw background
if (Parent())
view->SetLowColor(Parent()->ViewColor());
else
view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->FillRect(updateRect, B_SOLID_LOW);
// Draw keys
for (int32 i = 0; i < fLayout->CountKeys(); i++) {
Key* key = fLayout->KeyAt(i);
_DrawKey(view, updateRect, key, _FrameFor(key),
_IsKeyPressed(key->code));
}
// Draw LED indicators
for (int32 i = 0; i < fLayout->CountIndicators(); i++) {
Indicator* indicator = fLayout->IndicatorAt(i);
_DrawIndicator(view, updateRect, indicator, _FrameFor(indicator->frame),
(fModifiers & indicator->modifier) != 0);
}
if (fOffscreenBitmap != NULL) {
view->Sync();
view->UnlockLooper();
DrawBitmapAsync(fOffscreenBitmap, BPoint(0, 0));
}
}
示例15: bounds
void
IconSpewer::DrawSomeNew()
{
target->Lock();
BView* view = target->FindView("iconView");
ASSERT(view);
BRect bounds(target->Bounds());
view->SetHighColor(Color(255, 255, 255));
view->FillRect(bounds);
view->SetHighColor(Color(0, 0, 0));
char buffer[256];
if (cycleTime) {
sprintf(buffer, "last cycle time %" B_PRId64 " ms", cycleTime/1000);
view->DrawString(buffer, BPoint(20, bounds.bottom - 20));
}
if (numDrawn) {
sprintf(buffer, "average draw time %" B_PRId64 " us per icon",
watch.ElapsedTime() / numDrawn);
view->DrawString(buffer, BPoint(20, bounds.bottom - 30));
}
sprintf(buffer, "directory: %s", currentPath.Path());
view->DrawString(buffer, BPoint(20, bounds.bottom - 40));
target->Unlock();
for (int32 row = 0; row < kRowCount; row++) {
for (int32 column = 0; column < kColumnCount; column++) {
BEntry entry(NextRef());
Model model(&entry, true);
if (!target->Lock())
return;
if (model.IsDirectory())
entry.GetPath(¤tPath);
IconCache::sIconCache->Draw(&model, view,
BPoint(column * (kIconSize + 2), row * (kIconSize + 2)),
kNormalIcon, kIconSize, true);
target->Unlock();
numDrawn++;
}
}
}