PrefletView::PrefletView(SettingsHost* host) : BView("pages", B_WILL_DRAW) { // Page selector fRule = new BIconRule("icon_rule"); fRule->SetSelectionMessage(new BMessage(kPageSelected)); (void)fRule->AddIcon(_T("General"), NULL); (void)fRule->AddIcon(_T("Display"), NULL); //(void)fRule->AddIcon(_T("Notifications"), NULL); // View for card layout fPagesView = new BView("pages", B_WILL_DRAW); // Pages GeneralView* general = new GeneralView(host); DisplayView* display = new DisplayView(host); NotificationsView* apps = new NotificationsView(); // Calculate inset float inset = ceilf(be_plain_font->Size() * 0.7f); // Build the layout SetLayout(new BGroupLayout(B_VERTICAL)); // Card layout for pages BCardLayout* layout = new BCardLayout(); fPagesView->SetLayout(layout); layout->AddView(general); layout->AddView(display); layout->AddView(apps); // Add childs AddChild(BGroupLayoutBuilder(B_VERTICAL, inset) .Add(fRule) .Add(fPagesView) ); // Select the first view Select(0); }
CamStatusView::CamStatusView(Controller* controller) : BView("CamStatusView", B_WILL_DRAW|B_PULSE_NEEDED), fController(controller), fStringView(NULL), fBitmapView(NULL), fEncodingStringView(NULL), fStatusBar(NULL), fNumFrames(0), fRecording(false), fPaused(false), fRecordingBitmap(NULL), fPauseBitmap(NULL) { BCardLayout* cardLayout = new BCardLayout(); SetLayout(cardLayout); BRect bitmapRect(0, 0, kBitmapSize, kBitmapSize); fRecordingBitmap = new BBitmap(bitmapRect, B_RGBA32); fPauseBitmap = new BBitmap(bitmapRect, B_RGBA32); BView* statusView = BLayoutBuilder::Group<>() .SetInsets(0) .Add(fEncodingStringView = new BStringView("stringview", kEncodingString)) .Add(fStatusBar = new BStatusBar("", "")) .View(); fStatusBar->SetExplicitMinSize(BSize(100, 20)); BView* layoutView = BLayoutBuilder::Group<>() .SetInsets(0) .Add(fBitmapView = new SquareBitmapView("bitmap view")) .Add(fStringView = new BStringView("cam string view", "")) .View(); cardLayout->AddView(layoutView); cardLayout->AddView(statusView); fBitmapView->SetBitmap(NULL); BFont font; GetFont(&font); float scaledSize = kBitmapSize * (capped_size(font.Size()) / 12); fBitmapView->SetExplicitMinSize(BSize(scaledSize, scaledSize)); fBitmapView->SetExplicitMaxSize(BSize(scaledSize, scaledSize)); fBitmapView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP)); fStringView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); cardLayout->SetVisibleItem(int32(0)); }