本文整理汇总了C++中BButton::MakeDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ BButton::MakeDefault方法的具体用法?C++ BButton::MakeDefault怎么用?C++ BButton::MakeDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BButton
的用法示例。
在下文中一共展示了BButton::MakeDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
StringInputWindow::StringInputWindow(const char *title, const char *text, BMessage msg,
BMessenger target)
: DWindow(BRect(0,0,300,200),title,B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE),
fMessage(msg),
fMessenger(target)
{
MakeCenteredOnShow(true);
BView *top = GetBackgroundView();
BRect r = Bounds().InsetByCopy(10,10);
r.bottom = r.top + 10;
BRect textRect = r.OffsetToCopy(0,0);
textRect.InsetBy(10,10);
fTextView = new BTextView(r,"paneltext",textRect,B_FOLLOW_LEFT | B_FOLLOW_TOP);
top->AddChild(fTextView);
fTextView->MakeEditable(false);
fTextView->SetText(text);
fTextView->ResizeTo(r.Width(), 20.0 + (fTextView->CountLines() *
fTextView->TextHeight(0,fTextView->TextLength())));
fTextView->SetViewColor(top->ViewColor());
fText = new BTextControl(BRect(10,10,11,11),"nametext","", "", new BMessage);
top->AddChild(fText);
fText->ResizeToPreferred();
fText->ResizeTo(Bounds().Width() - 20,fText->Bounds().Height());
fText->SetDivider(0.0);
fText->MoveTo(10,fTextView->Frame().bottom + 10.0);
r = fText->Frame();
r.OffsetBy(0,r.Height() + 10.0);
BButton *cancel = new BButton(r,"cancel","Cancel",
new BMessage(B_QUIT_REQUESTED));
cancel->ResizeToPreferred();
top->AddChild(cancel);
ResizeTo(300, cancel->Frame().bottom + 10);
cancel->MoveTo( Bounds().Width() - (cancel->Bounds().Width() * 2) - 20,
cancel->Frame().top);
r = cancel->Frame();
r.OffsetBy(r.Width() + 10,0);
BButton *open = new BButton(r,"ok","OK", new BMessage(M_INVOKE));
top->AddChild(open);
open->MakeDefault(true);
fText->MakeFocus(true);
open->MakeDefault(true);
}
示例2: MAX
void
SetupView::AttachedToWindow()
{
float width = MAX(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10;
/* server name box */
fServerAddress = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "<printer's hostname or address>", NULL);
AddChild(fServerAddress);
fServerAddress->SetDivider(width);
/* queue name box */
fQueuePort = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "9100", NULL); // 9100 is default HP JetDirect port number
AddChild(fQueuePort);
fQueuePort->SetDivider(width);
/* cancel */
BButton* button = new BButton(CANCEL_RECT, "", CANCEL_TEXT, new BMessage(M_CANCEL));
AddChild(button);
/* ok */
button = new BButton(OK_RECT, "", OK_TEXT, new BMessage(M_OK));
AddChild(button);
button->MakeDefault(true);
}
示例3: r
TStatusWindow::TStatusWindow(BRect rect, BMessenger target, const char* status)
: BWindow(rect, "", B_MODAL_WINDOW, B_NOT_RESIZABLE),
fTarget(target)
{
BView* view = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(view);
BRect r(STATUS_FIELD_H, STATUS_FIELD_V,
STATUS_FIELD_WIDTH, STATUS_FIELD_V + STATUS_FIELD_HEIGHT);
fStatus = new BTextControl(r, "", STATUS_TEXT, status, new BMessage(STATUS));
view->AddChild(fStatus);
fStatus->SetDivider(fStatus->StringWidth(STATUS_TEXT) + 6);
fStatus->BTextControl::MakeFocus(true);
r.Set(S_OK_BUTTON_X1, S_OK_BUTTON_Y1, S_OK_BUTTON_X2, S_OK_BUTTON_Y2);
BButton *button = new BButton(r, "", S_OK_BUTTON_TEXT, new BMessage(OK));
view->AddChild(button);
button->MakeDefault(true);
r.Set(S_CANCEL_BUTTON_X1, S_CANCEL_BUTTON_Y1, S_CANCEL_BUTTON_X2, S_CANCEL_BUTTON_Y2);
button = new BButton(r, "", S_CANCEL_BUTTON_TEXT, new BMessage(CANCEL));
view->AddChild(button);
Show();
}
示例4: bmpRect
GroupPropertiesView::GroupPropertiesView(BRect rect, const char *name) :
BView(rect, "GroupInfoView", B_FOLLOW_ALL, B_WILL_DRAW)
{
newGroup = name == NULL;
strcpy(group, newGroup ? "unknown" : name);
getGroupDesc(group, desc, sizeof(desc));
rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR);
SetViewColor(gray);
BRect bmpRect(0.0, 0.0, 31.0, 31.0);
icon = new BBitmap(bmpRect, B_CMAP8);
BMimeType mime("application/x-vnd.Teldar-Group");
mime.GetIcon(icon, B_LARGE_ICON);
BRect r(10, 52, 200, 72);
editName = new BTextControl(r, "GroupName", "Name:", group, NULL);
editName->SetDivider(70);
editName->SetEnabled(newGroup);
AddChild(editName);
r.Set(10, 77, 250, 97);
editDesc = new BTextControl(r, "Description", "Description:", desc, NULL);
editDesc->SetDivider(70);
AddChild(editDesc);
r.Set(205, 320, 275, 340);
BButton *okBtn = new BButton(r, "OkayBtn", "OK", new BMessage(MSG_GROUP_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
okBtn->MakeDefault(true);
AddChild(okBtn);
r.Set(285, 320, 360, 340);
AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_GROUP_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));
r.Set(285, 125, 360, 145);
AddChild(new BButton(r, "AddUserBtn", "Add", new BMessage(MSG_GROUP_ADD), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));
r.Set(285, 155, 360, 175);
removeBtn = new BButton(r, "RemoveBtn", "Remove", new BMessage(MSG_GROUP_REMOVE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
removeBtn->SetEnabled(false);
AddChild(removeBtn);
// Now add the membership list.
CLVContainerView *listContView;
r.Set(13, 125, 280 - B_V_SCROLL_BAR_WIDTH, 305);
listView = new SmartColumnListView(r, &listContView, NULL, B_FOLLOW_ALL_SIDES,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE, B_SINGLE_SELECTION_LIST,
false, false, true, false, B_FANCY_BORDER);
listView->AddColumn(new CLVColumn(NULL, 20.0, CLV_LOCK_AT_BEGINNING | CLV_NOT_MOVABLE |
CLV_NOT_RESIZABLE | CLV_PUSH_PASS | CLV_MERGE_WITH_RIGHT));
listView->AddColumn(new CLVColumn("User", 85.0, CLV_SORT_KEYABLE, 50.0));
listView->AddColumn(new CLVColumn("Full Name", 130.0, CLV_SORT_KEYABLE));
listView->SetSelectionMessage(new BMessage(MSG_MEMBER_SELECT));
listView->SetInvocationMessage(new BMessage(MSG_LIST_DESELECT));
AddGroupMembers(listView);
AddChild(listContView);
}
示例5: bmpRect
LoginView::LoginView(BRect rect, char *server, char *share) :
BView(rect, "LoginView", B_FOLLOW_ALL, B_WILL_DRAW)
{
strcpy(resource, share);
strcat(resource, " on ");
strcat(resource, server);
rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR);
SetViewColor(gray);
BRect bmpRect(0.0, 0.0, 31.0, 31.0);
icon = new BBitmap(bmpRect, B_CMAP8);
BMimeType mime("application/x-vnd.Teldar-FileSharing");
mime.GetIcon(icon, B_LARGE_ICON);
BRect r(10, 72, 240, 92);
user = new BTextControl(r, "User", "User:", "", NULL);
user->SetDivider(55);
AddChild(user);
r.top = 97;
r.bottom = r.top + 20;
password = new BTextControl(r, "Password", "Password:", "", NULL);
password->SetDivider(55);
password->TextView()->HideTyping(true);
AddChild(password);
r.Set(LOGIN_PANEL_WIDTH - 160, LOGIN_PANEL_HEIGHT - 33, LOGIN_PANEL_WIDTH - 90, LOGIN_PANEL_HEIGHT - 13);
BButton *okBtn = new BButton(r, "OkayBtn", "Login", new BMessage(MSG_LOGIN_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
okBtn->MakeDefault(true);
AddChild(okBtn);
r.Set(LOGIN_PANEL_WIDTH - 80, LOGIN_PANEL_HEIGHT - 33, LOGIN_PANEL_WIDTH - 10, LOGIN_PANEL_HEIGHT - 13);
AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_LOGIN_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));
}
示例6: bmpRect
InetHostView(BRect rect) :
BView(rect, "InetHostView", B_FOLLOW_ALL, B_WILL_DRAW)
{
rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR);
SetViewColor(gray);
BRect bmpRect(0.0, 0.0, 31.0, 31.0);
icon = new BBitmap(bmpRect, B_CMAP8);
BMimeType mime("application/x-vnd.BeServed-inetserver");
mime.GetIcon(icon, B_LARGE_ICON);
BRect r(10, 52, 310, 72);
editName = new BTextControl(r, "ShareName", "Name or Address:", "", NULL);
editName->SetDivider(90);
AddChild(editName);
r.Set(155, 97, 225, 117);
BButton *okBtn = new BButton(r, "OkayBtn", "OK", new BMessage(MSG_HOST_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
okBtn->MakeDefault(true);
AddChild(okBtn);
r.Set(235, 97, 310, 117);
AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_HOST_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));
editName->MakeFocus();
}
示例7: BMessage
void
LprSetupView::AttachedToWindow()
{
float width = max(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10;
/* server name box */
// TODO remember previous value
fServer = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "192.168.0.0",
NULL);
AddChild(fServer);
fServer->SetDivider(width);
/* queue name box */
// TODO remember previous value
fQueue = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "LPT1_PASSTHRU",
NULL);
AddChild(fQueue);
fQueue->SetDivider(width);
/* cancel */
BButton *button = new BButton(CANCEL_RECT, "", CANCEL_TEXT,
new BMessage(M_CANCEL));
AddChild(button);
/* ok */
button = new BButton(OK_RECT, "", OK_TEXT, new BMessage(M_OK));
AddChild(button);
button->MakeDefault(true);
}
示例8: AttachedToWindow
void AboutBoxView::AttachedToWindow()
{
BRect rect;
rect.Set(110, 50, 175, 55);
BButton *button = new BButton(rect, "", "OK", new BMessage(kMsgOK));
AddChild(button);
button->MakeDefault(true);
}
示例9: BMessage
FindOpenFileWindow::FindOpenFileWindow(const char* panelText)
:
DWindow(BRect(0, 0, 0, 0), TR("Find and open file"), B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
AddCommonFilter(new EscapeCancelFilter());
BView* top = GetBackgroundView();
fNameTextControl = new AutoTextControl("nameText", TR("Open: "), "",
new BMessage);
fNameTextControl->SetExplicitMinSize(
BSize(fNameTextControl->StringWidth("M") * 20, B_SIZE_UNSET));
fSystemCheckBox = new BCheckBox("systembox", TR("Search only system folders"),
new BMessage);
BButton* cancel = new BButton("cancel", TR("Cancel"),
new BMessage(B_QUIT_REQUESTED));
BButton* open = new BButton("open", TR("Open"), new BMessage(M_FIND_FILE));
BLayoutBuilder::Group<>(top, B_VERTICAL)
.AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0)
.Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0)
.Add(fSystemCheckBox, 1, 1)
.End()
.AddGlue()
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(cancel)
.Add(open)
.End()
.SetInsets(B_USE_WINDOW_INSETS)
.End();
BString text = panelText;
if (text.CountChars() > 1) {
fNameTextControl->SetText(text.String());
int32 position = text.FindLast(".");
if (position > 0)
fNameTextControl->TextView()->Select(0, position);
else
fNameTextControl->TextView()->SelectAll();
} else {
fNameTextControl->SetText(".h");
fNameTextControl->TextView()->GoToLine(0);
}
open->MakeDefault(true);
fNameTextControl->MakeFocus(true);
CenterOnScreen();
}
示例10: BView
AskName::AskName():
BWindow(BRect(100, 100, 500, 200), "Enter your name",
B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
| B_NOT_MINIMIZABLE),
Text(NULL),
text(NULL)
{
BView *back;
BButton * Accept;
BTextView *TV;
BStringView *str;
const char *names[] =
{
"BeOS forever!",
"BShisen Rules!",
"Thanks Sheppy",
"Say NO to drugs!",
"Say NO to piracy!",
"Say YES to BeOS!",
"Just say \"BShisen\"",
"Say YES to BShisen!",
};
back = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
back->SetViewColor(216, 216, 216);
AddChild(back);
str = new BStringView(BRect(10, 10, 390, 25), "",
"Congratulations! Enter your name for posterity.");
str->SetFont(be_bold_font);
back->AddChild(str);
Accept = new BButton( BRect(10, 60+5, 90, 75+5), "Accept",
"Accept", new BMessage(ACCEPT_BUTTON));
Accept->MakeDefault(true);
back->AddChild(Accept);
Text = new BTextControl(BRect(10, 35, 390, 50), "",
"Your Name", "", NULL);
Text->SetDivider(Text->StringWidth("Your Name "));
TV = Text->TextView();
TV->SetMaxBytes(31);
Text->SetText(REGISTERED ? names[rand() % 8] : "I Want To Register!");
back->AddChild(Text);
Text->MakeFocus(true);
}
示例11: done
ID_Win::ID_Win(BLooper *l, unsigned int g):
Txt_Ctl(NULL), done(0), Game(0),
BWindow(BRect(100, 100, 300, 180), "New Game By ID",
B_TITLED_WINDOW,
B_NOT_RESIZABLE | /*B_NOT_CLOSABLE |*/ B_NOT_ZOOMABLE
| B_NOT_MINIMIZABLE)
{
BView *back;
BButton * Cancel;
BButton * Accept;
BTextView *T;
register int i;
loop = l;
Game = g;
back = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
back->SetViewColor(216, 216, 216);
AddChild(back);
Accept = new BButton( BRect(10, 40, 90, 55), "Accept",
"Accept", new BMessage(ACCEPT_BUTTON));
Accept->MakeDefault(true);
back->AddChild(Accept);
Cancel = new BButton( BRect(120, 40, 190, 55), "Cancel",
"Cancel", new BMessage(CANCEL_BUTTON));
back->AddChild(Cancel);
Txt_Ctl = new BTextControl(BRect(10, 10, 190, 25), "",
"Game Number", "", NULL);
T = Txt_Ctl->TextView();
/*
* Only allow #s in there.
*/
for (i = 0; i < 256; i++)
T->DisallowChar(i);
for (i = '0'; i < '9' + 1; i++)
T->AllowChar(i);
back->AddChild(Txt_Ctl);
char buffer[64];
if (!Game) Game = rand();
sprintf(buffer, "%d", Game);
Txt_Ctl->SetText(buffer);
Txt_Ctl->MakeFocus(true);
//Port = create_port(1, "ID Window Port");
Show();
}
示例12: rect
AlertView::AlertView(BRect frame, const char *name)
: BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED),
// we will wait 12 seconds until we send a message
fSeconds(12)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fBitmap = InitIcon();
BRect rect(60, 8, 400, 36);
BStringView *stringView = new BStringView(rect, NULL,
"Do you wish to keep these settings?");
stringView->SetFont(be_bold_font);
stringView->ResizeToPreferred();
AddChild(stringView);
rect = stringView->Frame();
rect.OffsetBy(0, rect.Height());
fCountdownView = new BStringView(rect, "countdown", NULL);
UpdateCountdownView();
fCountdownView->ResizeToPreferred();
AddChild(fCountdownView);
BButton* keepButton = new BButton(rect, "keep", "Keep",
new BMessage(BUTTON_KEEP_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
keepButton->ResizeToPreferred();
AddChild(keepButton);
BButton* button = new BButton(rect, "undo", "Undo",
new BMessage(BUTTON_UNDO_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
AddChild(button);
// we're resizing ourselves to the right size
// (but we're not implementing GetPreferredSize(), bad style!)
float width = stringView->Frame().right;
if (fCountdownView->Frame().right > width)
width = fCountdownView->Frame().right;
if (width < Bounds().Width())
width = Bounds().Width();
float height
= fCountdownView->Frame().bottom + 24 + button->Bounds().Height();
ResizeTo(width, height);
keepButton->MoveTo(Bounds().Width() - 8 - keepButton->Bounds().Width(),
Bounds().Height() - 8 - keepButton->Bounds().Height());
button->MoveTo(keepButton->Frame().left - button->Bounds().Width() - 8,
keepButton->Frame().top);
keepButton->MakeDefault(true);
}
示例13: font
//===========================PrefsWindow======================================
PrefsWindow::PrefsWindow(BRect frame, BMessenger *messenger)
: BWindow(frame, "Preferences", B_FLOATING_WINDOW, B_NOT_ZOOMABLE|B_NOT_RESIZABLE|B_NOT_CLOSABLE|B_ASYNCHRONOUS_CONTROLS),
m_msgr(messenger),
m_colourPrefsChanged(false),
m_fontSizeChanged(false),
m_toolbarChanged(false)
{
SetFeel(B_NORMAL_WINDOW_FEEL);
m_parent = new BView(Bounds(), "parent", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
m_parent->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(m_parent);
prefsLock.Lock();
BFont font(be_fixed_font);
float fontSize = 10.0f;
if (preferences.FindFloat(K_FONT_SIZE, &fontSize) == B_OK)
font.SetSize(fontSize);
prefsLock.Unlock();
float prefsListWidth = 80.0f;
BRect prefsListFrame(10.0f, 10.0f, 10.0f + prefsListWidth, Bounds().bottom - 10.0f);
PrefsListView *prefsListView = new PrefsListView(prefsListFrame, m_parent);
BScrollView *prefsListScroll = new BScrollView("ScrollView", prefsListView, B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW,false,false);
m_parent->AddChild(prefsListScroll);
float bwidth = 80.0f,
bheight = 30.0f,
bspacing = 10.0f
;
BRect okButtonFrame(Bounds().right - bspacing - bwidth, Bounds().bottom - bspacing - bheight, Bounds().right - bspacing,Bounds().bottom - bspacing);
BButton *okButton = new BButton(okButtonFrame, "okButton", "Ok", new BMessage(PrefsConstants::K_PREFS_VIEW_OK));
m_parent->AddChild(okButton);
okButton->MakeDefault(true);
BRect cancelButtonFrame = okButtonFrame;
cancelButtonFrame.OffsetBy(-(bwidth + 2.0f * bspacing), 0.0f);
BButton *cancelButton = new BButton(cancelButtonFrame,"cancelButton","Cancel",new BMessage(PrefsConstants::K_PREFS_VIEW_CANCEL));
m_parent->AddChild(cancelButton);
float respiteWidth = 41.0f;
BRect boxRect(10.0f + prefsListWidth + 10.0f , 2.0f, Bounds().right - 7.0f , Bounds().bottom - 10.0f - respiteWidth);
prefsListView->AddItem(new PrefsListItem(constructGeneralBox(boxRect), m_parent, "General"));
prefsListView->AddItem(new PrefsListItem(constructCommandBox(boxRect), m_parent, "Commands"));
prefsListView->AddItem(new PrefsListItem(constructColourBox(boxRect), m_parent, "TexView"));
prefsListView->AddItem(new PrefsListItem(constructToolbarBox(boxRect), m_parent, "Toolbars"));
prefsListView->Select(0);
prefsListView->MakeFocus(true);
}
示例14: AddViews
void SeqPrefWin::AddViews(const BMessage& prefs)
{
BRect b = Bounds();
/* Add the bottom panel with the Cancel OK buttons. When this
* block is done, it will adjust the bounds accordingly (i.e.,
* without the space used by this view).
*/
{
float buttonW = 60, buttonH = 24;
float edgeR = 8, edgeB = 8, edgeT = 8;
BRect f(b);
f.top = f.bottom - edgeB - buttonH - edgeT;
BView* v = new BView( f, "button_panel", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM, 0 );
if( v ) {
BRect f( b.right - edgeR - buttonW, edgeT, b.right - edgeR, edgeT + buttonH );
BButton* button = new BButton( f, "ok_button", "OK", new BMessage( OK_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
if( button ) {
v->AddChild( button );
button->MakeDefault( true );
}
f.OffsetBy( 0-(buttonW + 10), 0 );
button = new BButton( f, "cancel_button", "Cancel", new BMessage( CANCEL_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
if( button ) v->AddChild( button );
v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
AddChild( v );
b.bottom = b.bottom - edgeB - buttonH - edgeT - 1;
}
}
BTabView* tv = new BTabView(b, TABVIEW_STR);
if (!tv) return;
BView* fileView = NewFileView(b, prefs);
if (fileView) tv->AddTab(fileView);
BView* editView = NewEditView(b, prefs);
if (editView) tv->AddTab(editView);
BView* playbackView = NewTrackView(b, prefs);
if (playbackView) tv->AddTab(playbackView);
mFactoryView = NewFactoriesView(b, prefs);
if (mFactoryView) tv->AddTab(mFactoryView);
AddChild(tv);
/* NOTE: Have to do this after the tab view's been added to the window or else
* you get a crash. It's a bug in the tab view, nothing to be done about it.
*/
tv->SetTabWidth(B_WIDTH_FROM_WIDEST);
}
示例15: BMessage
BackupView::BackupView(BRect frame)
:
BView(frame, "BackupView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ViewColor());
SetHighColor(0, 0, 0);
SetLayout(new BGroupLayout(B_VERTICAL));
fBackupList = new BListView(BRect(0, 0, 0, 0), "items", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
for (uint32 i = 0; i < LOCATION_COUNT; i++) {
BackupListItem* item = new BackupListItem(i, gLocationMap[i].name,
gLocationMap[i].description);
fBackupList->AddItem(item);
}
// Add total size
BStringView* backupSize = new BStringView("total size", "Total size:");
fBackupSizeText = new BStringView("backup size", "");
fBackupSizeText->SetAlignment(B_ALIGN_RIGHT);
BButton* button = new BButton(BRect(0, 0, 10, 10), "backup", "Backup!",
new BMessage(kMsgDoBackup));
button->MakeDefault(true);
BGroupLayout* totalGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
.AddGrid()
.Add(backupSize, 0, 0)
.Add(fBackupSizeText, 1, 0)
.End()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
;
// Attach all of the LayoutGroups to the view
AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
.Add(new BScrollView("backup item list", fBackupList, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true))
.Add(totalGroup)
.Add(button)
);
// Refresh the sizes of each item
RefreshSizes();
Show();
}