本文整理汇总了C++中BMenuBar::Bounds方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenuBar::Bounds方法的具体用法?C++ BMenuBar::Bounds怎么用?C++ BMenuBar::Bounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenuBar
的用法示例。
在下文中一共展示了BMenuBar::Bounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _updateParameterView
void ParameterWindow::_updateParameterView(
BMediaTheme *theme) {
D_INTERNAL(("ParameterWindow::_updateParameterView()\n"));
// clear the old version
if (m_parameters) {
ParameterContainerView *view = dynamic_cast<ParameterContainerView *>(FindView("ParameterContainerView"));
RemoveChild(view);
delete m_parameters;
m_parameters = 0;
delete view;
}
// fetch ParameterWeb from the MediaRoster
BMediaRoster *roster = BMediaRoster::CurrentRoster();
if (roster) {
BParameterWeb *web;
status_t error = roster->GetParameterWebFor(m_node, &web);
if (!error && (web->CountParameters() || web->CountGroups())) {
// if no theme was specified, use the preferred theme
if (!theme) {
theme = BMediaTheme::PreferredTheme();
}
// acquire the view
m_parameters = BMediaTheme::ViewFor(web, 0, theme);
if (m_parameters) {
BMenuBar *menuBar = KeyMenuBar();
m_idealSize = m_parameters->Bounds();
m_idealSize.right += B_V_SCROLL_BAR_WIDTH;
m_idealSize.bottom += B_H_SCROLL_BAR_HEIGHT;
if (menuBar) {
m_parameters->MoveTo(0.0, menuBar->Bounds().bottom + 1.0);
m_idealSize.bottom += menuBar->Bounds().bottom + 1.0;
}
}
}
}
// limit min size to avoid funny-looking scrollbars
float hMin = B_V_SCROLL_BAR_WIDTH*6, vMin = B_H_SCROLL_BAR_HEIGHT*3;
// limit max size to full extents of the parameter view
float hMax = m_idealSize.Width(), vMax = m_idealSize.Height();
SetSizeLimits(hMin, hMax, vMin, vMax);
// adapt the window to the new dimensions
ResizeTo(m_idealSize.Width(), m_idealSize.Height());
m_zoomed = true;
if (m_parameters) {
BRect paramRect = m_parameters->Bounds();
AddChild(new ParameterContainerView(paramRect, m_parameters));
}
}
示例2: BMessage
ReloadedWin::ReloadedWin()
: BWindow(BRect(80,80,847,619),"Reloaded", B_TITLED_WINDOW,
B_NOT_ZOOMABLE|B_NOT_RESIZABLE|B_QUIT_ON_WINDOW_CLOSE)
{
// TODO - compute the size instead of hardcoding it
SetSizeLimits(847-80,847-80,619-61,619-61);
BMenuBar* menu = new BMenuBar(BRect(0,0,Bounds().Width() - 16,16),
"mainmenu", B_FOLLOW_LEFT | B_FOLLOW_TOP);
BMenu* file = new BMenu("File");
menu->AddItem(file);
BMenuItem* insertdsk = new BMenuItem("Insert Disc",
new BMessage('dins'));
file->AddItem(insertdsk);
BMenu* settings = new BMenu("Settings");
menu->AddItem(settings);
BMenuItem* keymap = new BMenuItem("Keymap",
new BMessage('kymp'));
settings->AddItem(keymap);
AddChild(menu);
fStatusLed = new BView(BRect(Bounds().Width() - 16, 0, Bounds().Width(), 16), "fdcLed",
B_FOLLOW_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW);
fStatusLed->SetViewColor(0x77,00,00);
AddChild(fStatusLed);
fBitmapView = new RBitmapView(this, false);
fBitmapView->MoveTo(0, menu->Bounds().bottom + 1);
Show();
}
示例3: SetupSizeAndLayout
void PProjectWindow::SetupSizeAndLayout()
{
inherited::SetupSizeAndLayout();
ResizeTo(180, 400);
SetSizeLimits(100, 100000, 100, 100000);
BRect r(Bounds());
BMenuBar *mbar;
AddChild(mbar = HResources::GetMenuBar(r, rid_Mbar_ProjectWin));
mbar->FindItem(msg_Quit)->SetTarget(be_app);
r.bottom = r.top + kToolBarHeight;
r.OffsetBy(0, mbar->Bounds().bottom + 1);
AddChild(fToolBar = new PToolBar(r, "toolbar"));
r.bottom -= 2;
r.OffsetTo(0, 0);
fToolBar->AddChild(fButtonBar = new HButtonBar(r, "buttonbar", rid_Tbar_ProjectWin, this));
r = Bounds();
r.top = r.bottom - B_H_SCROLL_BAR_HEIGHT + 1;
r.right -= B_V_SCROLL_BAR_WIDTH;
AddChild(fStatus
= new PGroupStatus(r, fDocIO->EntryRef() ? fDocIO->EntryRef()->name : NULL));
r = Bounds();
r.top = fToolBar->Frame().bottom;
r.right -= B_V_SCROLL_BAR_WIDTH;
r.bottom -= B_H_SCROLL_BAR_HEIGHT;
fList = new PTypeAHeadList(r, "group", fStatus);
fList->SetInvocationMessage(new BMessage(msg_PProjectItemInvoked));
fList->SetSelectionMessage(new BMessage(msg_PProjectItemSelected));
AddChild(new BScrollView("scroller", fList, B_FOLLOW_ALL_SIDES, 0, false, true, B_NO_BORDER));
Read();
NameChanged();
SelectionChanged();
}
示例4: BMenuItem
ScribbleWindow::ScribbleWindow()
: BWindow(BRect(100,100,300,400), "Scribble", B_TITLED_WINDOW, 0)
{
BMenuBar *pMenuBar = new BMenuBar(BRect(), "Mainmenu");
BMenu *pMenu = new BMenu("File");
BMenuItem *pCloseItem =
new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'q');
pMenu->AddItem(pCloseItem);
pMenuBar->AddItem(pMenu);
AddChild(pMenuBar);
float menuHeight = pMenuBar->Bounds().Height();
ScribbleView *aView;
// set up a rectangle and instantiate a new view
BRect aRect( Bounds() );
aRect.top = aRect.top+menuHeight+1;
aView = new ScribbleView(aRect);
// add view to window
AddChild(aView);
}
示例5: BuildGUI
void PictureTestWindow::BuildGUI()
{
BView* backdrop = new BView(Bounds(), "backdrop", B_FOLLOW_ALL, B_WILL_DRAW);
backdrop->SetViewColor(::ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(backdrop);
BMenuBar* mb = new BMenuBar(Bounds(), "menubar");
BMenu* m = new BMenu("File");
m->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
m->SetTargetForItems(be_app_messenger);
mb->AddItem(m);
m = new BMenu("Tests");
m->AddItem(new BMenuItem("Run", new BMessage(kMsgRunTests), 'R'));
m->AddItem(new BMenuItem("Run Color Space B_RGB32", new BMessage(kMsgRunTests1), 'S'));
mb->AddItem(m);
backdrop->AddChild(mb);
BRect b = Bounds();
b.top = mb->Bounds().bottom + 1;
fHeader = new BStringView(b, "header",
"X", B_FOLLOW_LEFT | B_FOLLOW_RIGHT | B_FOLLOW_TOP);
float width, height;
fHeader->GetPreferredSize(&width, &height);
fHeader->ResizeTo(b.Width(), height);
backdrop->AddChild(fHeader);
b.top = fHeader->Frame().bottom + 1;
b.right -= B_V_SCROLL_BAR_WIDTH;
b.bottom -= B_H_SCROLL_BAR_HEIGHT;
fListView = new BListView(b, "Results", B_SINGLE_SELECTION_LIST,
B_FOLLOW_ALL_SIDES,
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE);
backdrop->AddChild(new BScrollView("scroll_results", fListView, B_FOLLOW_ALL_SIDES, 0, true, true));
UpdateHeader();
}
示例6: BMessage
ShortcutsWindow::ShortcutsWindow()
:
BWindow(BRect(WINDOW_START_X, WINDOW_START_Y, WINDOW_START_X + MIN_WIDTH,
WINDOW_START_Y + MIN_HEIGHT * 2), "Shortcuts", B_DOCUMENT_WINDOW, 0L),
fSavePanel(NULL),
fOpenPanel(NULL),
fSelectPanel(NULL),
fKeySetModified(false),
fLastOpenWasAppend(false)
{
InitializeMetaMaps();
SetSizeLimits(MIN_WIDTH, MAX_WIDTH, MIN_HEIGHT, MAX_HEIGHT);
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "Menu Bar");
BMenu* fileMenu = new BMenu("File");
fileMenu->AddItem(new BMenuItem("Open KeySet...",
new BMessage(OPEN_KEYSET), 'O'));
fileMenu->AddItem(new BMenuItem("Append KeySet...",
new BMessage(APPEND_KEYSET), 'A'));
fileMenu->AddItem(new BMenuItem("Revert to saved",
new BMessage(REVERT_KEYSET), 'A'));
fileMenu->AddItem(new BSeparatorItem);
fileMenu->AddItem(new BMenuItem("Save KeySet as...",
new BMessage(SAVE_KEYSET_AS), 'S'));
fileMenu->AddItem(new BSeparatorItem);
fileMenu->AddItem(new BMenuItem("About Shortcuts",
new BMessage(B_ABOUT_REQUESTED)));
fileMenu->AddItem(new BSeparatorItem);
fileMenu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
'Q'));
menuBar->AddItem(fileMenu);
AddChild(menuBar);
font_height fh;
be_plain_font->GetHeight(&fh);
float vButtonHeight = ceil(fh.ascent) + ceil(fh.descent) + 5.0f;
BRect tableBounds = Bounds();
tableBounds.top = menuBar->Bounds().bottom + 1;
tableBounds.right -= B_V_SCROLL_BAR_WIDTH;
tableBounds.bottom -= (B_H_SCROLL_BAR_HEIGHT + V_SPACING + vButtonHeight +
V_SPACING * 2);
BScrollView* containerView;
fColumnListView = new ColumnListView(tableBounds, &containerView, NULL,
B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE,
B_SINGLE_SELECTION_LIST, true, true, true, B_NO_BORDER);
fColumnListView->SetEditMessage(new BMessage(HOTKEY_ITEM_MODIFIED),
BMessenger(this));
const float metaWidth = 50.0f;
for (int i = 0; i < ShortcutsSpec::NUM_META_COLUMNS; i++)
fColumnListView->AddColumn(
new CLVColumn(ShortcutsSpec::GetColumnName(i), CreateMetaPopUp(i),
metaWidth, CLV_SORT_KEYABLE));
fColumnListView->AddColumn(new CLVColumn("Key", CreateKeysPopUp(), 60,
CLV_SORT_KEYABLE));
BPopUpMenu* popup = new BPopUpMenu(NULL, false);
popup->AddItem(new BMenuItem("(Choose application with file requester)", NULL));
popup->AddItem(new BMenuItem("*InsertString \"Your Text Here\"", NULL));
popup->AddItem(new BMenuItem("*MoveMouse +20 +0", NULL));
popup->AddItem(new BMenuItem("*MoveMouseTo 50% 50%", NULL));
popup->AddItem(new BMenuItem("*MouseButton 1", NULL));
popup->AddItem(new BMenuItem("*LaunchHandler text/html", NULL));
popup->AddItem(new BMenuItem(
"*Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\"", NULL));
popup->AddItem(new BMenuItem("*MouseDown", NULL));
popup->AddItem(new BMenuItem("*MouseUp", NULL));
popup->AddItem(new BMenuItem(
"*SendMessage application/x-vnd.Be-TRAK 'Tfnd'", NULL));
popup->AddItem(new BMenuItem("*Beep", NULL));
fColumnListView->AddColumn(new CLVColumn("Application", popup, 323.0,
CLV_SORT_KEYABLE));
fColumnListView->SetSortFunction(ShortcutsSpec::MyCompare);
AddChild(containerView);
fColumnListView->SetSelectionMessage(new BMessage(HOTKEY_ITEM_SELECTED));
fColumnListView->SetTarget(this);
BRect buttonBounds = Bounds();
buttonBounds.left += V_SPACING;
buttonBounds.right = ((buttonBounds.right - buttonBounds.left) / 2.0f) +
buttonBounds.left;
buttonBounds.bottom -= V_SPACING * 2;
buttonBounds.top = buttonBounds.bottom - vButtonHeight;
buttonBounds.right -= B_V_SCROLL_BAR_WIDTH;
float origRight = buttonBounds.right;
buttonBounds.right = (buttonBounds.left + origRight) * 0.40f -
(V_SPACING / 2);
AddChild(fAddButton = new ResizableButton(Bounds(), buttonBounds, "add",
"Add new shortcut", new BMessage(ADD_HOTKEY_ITEM)));
buttonBounds.left = buttonBounds.right + V_SPACING;
buttonBounds.right = origRight;
AddChild(fRemoveButton = new ResizableButton(Bounds(), buttonBounds,
//.........这里部分代码省略.........
示例7: if
void
ImageView::SetImage(BMessage *pmsg)
{
// Replace current image with the image
// specified in the given BMessage
entry_ref ref;
if (!pmsg)
ref = fcurrentRef;
else if (pmsg->FindRef("refs", &ref) != B_OK)
// If refs not found, just ignore the message
return;
StatusCheck chk;
try {
BFile file(&ref, B_READ_ONLY);
chk = file.InitCheck();
BTranslatorRoster roster, *proster;
proster = SelectTranslatorRoster(roster);
if (!proster)
// throw exception
chk = B_ERROR;
// determine what type the image is
translator_info tinfo;
BMessage ioExtension;
if (ref != fcurrentRef)
// if new image, reset to first document
fdocumentIndex = 1;
chk = ioExtension.AddInt32("/documentIndex", fdocumentIndex);
chk = proster->Identify(&file, &ioExtension, &tinfo, 0, NULL,
B_TRANSLATOR_BITMAP);
// perform the actual translation
BBitmapStream outstream;
chk = proster->Translate(&file, &tinfo, &ioExtension, &outstream,
B_TRANSLATOR_BITMAP);
BBitmap *pbitmap = NULL;
chk = outstream.DetachBitmap(&pbitmap);
delete fpbitmap;
fpbitmap = pbitmap;
pbitmap = NULL;
fcurrentRef = ref;
// need to keep the ref around if user wants to switch pages
int32 documentCount = 0;
if (ioExtension.FindInt32("/documentCount", &documentCount) == B_OK &&
documentCount > 0)
fdocumentCount = documentCount;
else
fdocumentCount = 1;
// Set the name of the Window to reflect the file name
BWindow *pwin = Window();
BEntry entry(&ref);
BPath path;
if (entry.InitCheck() == B_OK) {
if (path.SetTo(&entry) == B_OK)
pwin->SetTitle(path.Leaf());
else
pwin->SetTitle(IMAGEWINDOW_TITLE);
} else
pwin->SetTitle(IMAGEWINDOW_TITLE);
UpdateInfoWindow(path, ioExtension, tinfo, proster);
// Resize parent window and set size limits to
// reflect the size of the new bitmap
float width, height;
BMenuBar *pbar = pwin->KeyMenuBar();
width = fpbitmap->Bounds().Width() + B_V_SCROLL_BAR_WIDTH + (BORDER_WIDTH * 2);
height = fpbitmap->Bounds().Height() +
pbar->Bounds().Height() + B_H_SCROLL_BAR_HEIGHT + (BORDER_HEIGHT * 2) + 1;
BScreen *pscreen = new BScreen(pwin);
BRect rctscreen = pscreen->Frame();
if (width > rctscreen.Width())
width = rctscreen.Width();
if (height > rctscreen.Height())
height = rctscreen.Height();
pwin->SetSizeLimits(B_V_SCROLL_BAR_WIDTH * 4, width,
pbar->Bounds().Height() + (B_H_SCROLL_BAR_HEIGHT * 4) + 1, height);
pwin->SetZoomLimits(width, height);
AdjustScrollBars();
//pwin->Zoom();
// Perform all of the hard work of resizing the
// window while taking into account the size of
// the screen, the tab and borders of the window
//
// HACK: Need to fix case where window un-zooms
// when the window is already the correct size
// for the current image
// repaint view
Invalidate();
} catch (StatusNotOKException) {
BAlert *palert = new BAlert(NULL,
B_TRANSLATE("Sorry, unable to load the image."),
B_TRANSLATE("OK"));
palert->Go();
//.........这里部分代码省略.........
示例8: BMessage
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entry)
: BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
"Application Type", B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
fChangedProperties(0)
{
// add the menu
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
AddChild(menuBar);
BMenu* menu = new BMenu("File");
fSaveMenuItem = new BMenuItem("Save", new BMessage(kMsgSave), 'S');
fSaveMenuItem->SetEnabled(false);
menu->AddItem(fSaveMenuItem);
BMenuItem* item;
menu->AddItem(item = new BMenuItem("Save into resource file" B_UTF8_ELLIPSIS,
NULL));
item->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED),
'W', B_COMMAND_KEY));
menuBar->AddItem(menu);
// Top view and signature
BRect rect = Bounds();
rect.top = menuBar->Bounds().Height() + 1.0f;
BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
rect = topView->Bounds().InsetByCopy(8.0f, 8.0f);
fSignatureControl = new BTextControl(rect, "signature", "Signature:", NULL,
new BMessage(kMsgSignatureChanged), B_FOLLOW_LEFT_RIGHT);
fSignatureControl->SetModificationMessage(
new BMessage(kMsgSignatureChanged));
fSignatureControl->SetDivider(fSignatureControl->StringWidth(
fSignatureControl->Label()) + 4.0f);
float width, height;
fSignatureControl->GetPreferredSize(&width, &height);
fSignatureControl->ResizeTo(rect.Width(), height);
topView->AddChild(fSignatureControl);
// filter out invalid characters that can't be part of a MIME type name
BTextView* textView = fSignatureControl->TextView();
textView->SetMaxBytes(B_MIME_TYPE_LENGTH);
const char* disallowedCharacters = "<>@,;:\"()[]?=";
for (int32 i = 0; disallowedCharacters[i]; i++) {
textView->DisallowChar(disallowedCharacters[i]);
}
// "Application Flags" group
BFont font(be_bold_font);
font_height fontHeight;
font.GetHeight(&fontHeight);
width = font.StringWidth("Icon") + 16.0f;
if (width < B_LARGE_ICON + 16.0f)
width = B_LARGE_ICON + 16.0f;
rect.top = fSignatureControl->Frame().bottom + 4.0f;
rect.bottom = rect.top + 100.0f;
rect.right -= width + 8.0f;
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
topView->AddChild(box);
fFlagsCheckBox = new BCheckBox(rect, "flags", "Application flags",
new BMessage(kMsgToggleAppFlags));
fFlagsCheckBox->SetValue(B_CONTROL_ON);
fFlagsCheckBox->ResizeToPreferred();
box->SetLabel(fFlagsCheckBox);
rect.top = fFlagsCheckBox->Bounds().Height() + 4.0f;
fSingleLaunchButton = new BRadioButton(rect, "single", "Single launch",
new BMessage(kMsgAppFlagsChanged));
fSingleLaunchButton->ResizeToPreferred();
box->AddChild(fSingleLaunchButton);
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
fMultipleLaunchButton = new BRadioButton(rect, "multiple",
"Multiple launch", new BMessage(kMsgAppFlagsChanged));
fMultipleLaunchButton->ResizeToPreferred();
box->AddChild(fMultipleLaunchButton);
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
fExclusiveLaunchButton = new BRadioButton(rect, "exclusive",
"Exclusive launch", new BMessage(kMsgAppFlagsChanged));
fExclusiveLaunchButton->ResizeToPreferred();
box->AddChild(fExclusiveLaunchButton);
rect.top = fSingleLaunchButton->Frame().top;
rect.left = fExclusiveLaunchButton->Frame().right + 4.0f;
fArgsOnlyCheckBox = new BCheckBox(rect, "args only", "Args only",
new BMessage(kMsgAppFlagsChanged));
fArgsOnlyCheckBox->ResizeToPreferred();
box->AddChild(fArgsOnlyCheckBox);
//.........这里部分代码省略.........
示例9: BMessage
FileTypesWindow::FileTypesWindow(const BMessage& settings)
: BWindow(_Frame(settings), "FileTypes", B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
fNewTypeWindow(NULL)
{
bool showIcons;
bool showRule;
if (settings.FindBool("show_icons", &showIcons) != B_OK)
showIcons = true;
if (settings.FindBool("show_rule", &showRule) != B_OK)
showRule = false;
// add the menu
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
AddChild(menuBar);
BMenu* menu = new BMenu("File");
BMenuItem* item;
menu->AddItem(item = new BMenuItem("New resource file" B_UTF8_ELLIPSIS,
NULL, 'N', B_COMMAND_KEY));
item->SetEnabled(false);
BMenu* recentsMenu = BRecentFilesList::NewFileListMenu("Open" B_UTF8_ELLIPSIS,
NULL, NULL, be_app, 10, false, NULL, kSignature);
item = new BMenuItem(recentsMenu, new BMessage(kMsgOpenFilePanel));
item->SetShortcut('O', B_COMMAND_KEY);
menu->AddItem(item);
menu->AddItem(new BMenuItem("Application types" B_UTF8_ELLIPSIS,
new BMessage(kMsgOpenApplicationTypesWindow)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("About FileTypes" B_UTF8_ELLIPSIS,
new BMessage(B_ABOUT_REQUESTED)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
'Q', B_COMMAND_KEY));
menu->SetTargetForItems(be_app);
menuBar->AddItem(menu);
menu = new BMenu("Settings");
item = new BMenuItem("Show icons in list", new BMessage(kMsgToggleIcons));
item->SetMarked(showIcons);
item->SetTarget(this);
menu->AddItem(item);
item = new BMenuItem("Show recognition rule", new BMessage(kMsgToggleRule));
item->SetMarked(showRule);
item->SetTarget(this);
menu->AddItem(item);
menuBar->AddItem(menu);
// MIME Types list
BRect rect = Bounds();
rect.top = menuBar->Bounds().Height() + 1.0f;
BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
BButton* button = new BButton(rect, "add", "Add" B_UTF8_ELLIPSIS,
new BMessage(kMsgAddType), B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
button->MoveTo(8.0f, topView->Bounds().bottom - 8.0f - button->Bounds().Height());
topView->AddChild(button);
rect = button->Frame();
rect.OffsetBy(rect.Width() + 8.0f, 0.0f);
fRemoveTypeButton = new BButton(rect, "remove", "Remove",
new BMessage(kMsgRemoveType), B_FOLLOW_BOTTOM);
fRemoveTypeButton->ResizeToPreferred();
topView->AddChild(fRemoveTypeButton);
rect.bottom = rect.top - 10.0f;
rect.top = 10.0f;
rect.left = 10.0f;
rect.right -= B_V_SCROLL_BAR_WIDTH + 2.0f;
if (rect.right < 180)
rect.right = 180;
fTypeListView = new MimeTypeListView(rect, "typeview", NULL, showIcons, false,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM);
fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));
BScrollView* scrollView = new BScrollView("scrollview", fTypeListView,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_FRAME_EVENTS | B_WILL_DRAW, false, true);
topView->AddChild(scrollView);
// "Icon" group
font_height plainHeight;
be_plain_font->GetHeight(&plainHeight);
float height = ceilf(plainHeight.ascent + plainHeight.descent
+ plainHeight.leading) + 2.0f;
BFont font(be_bold_font);
float labelWidth = font.StringWidth("Icon");
font_height boldHeight;
font.GetHeight(&boldHeight);
//.........这里部分代码省略.........
示例10: BMessage
ShortcutsWindow::ShortcutsWindow()
:
BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_SYSTEM_NAME("Shortcuts"),
B_TITLED_WINDOW, 0L),
fSavePanel(NULL),
fOpenPanel(NULL),
fSelectPanel(NULL),
fKeySetModified(false),
fLastOpenWasAppend(false)
{
ShortcutsSpec::InitializeMetaMaps();
float spacing = be_control_look->DefaultItemSpacing();
BView* top = new BView(Bounds(), NULL, B_FOLLOW_ALL_SIDES, 0);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(top);
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "Menu Bar");
BMenu* fileMenu = new BMenu(B_TRANSLATE("File"));
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Open KeySet" B_UTF8_ELLIPSIS),
new BMessage(OPEN_KEYSET), 'O'));
fileMenu->AddItem(new BMenuItem(
B_TRANSLATE("Append KeySet" B_UTF8_ELLIPSIS),
new BMessage(APPEND_KEYSET), 'A'));
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Revert to saved"),
new BMessage(REVERT_KEYSET), 'A'));
fileMenu->AddItem(new BSeparatorItem);
fileMenu->AddItem(new BMenuItem(
B_TRANSLATE("Save KeySet as" B_UTF8_ELLIPSIS),
new BMessage(SAVE_KEYSET_AS), 'S'));
fileMenu->AddItem(new BSeparatorItem);
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q'));
menuBar->AddItem(fileMenu);
top->AddChild(menuBar);
BRect tableBounds = Bounds();
tableBounds.top = menuBar->Bounds().bottom + 1;
tableBounds.right -= B_V_SCROLL_BAR_WIDTH;
tableBounds.bottom -= B_H_SCROLL_BAR_HEIGHT;
BScrollView* containerView;
fColumnListView = new ColumnListView(tableBounds, &containerView, NULL,
B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE,
B_SINGLE_SELECTION_LIST, true, true, true, B_NO_BORDER);
fColumnListView->SetEditMessage(new BMessage(HOTKEY_ITEM_MODIFIED),
BMessenger(this));
float minListWidth = 0;
// A running total is kept as the columns are created.
float cellWidth = be_plain_font->StringWidth("Either") + 20;
// ShortcutsSpec does not seem to translate the string "Either".
for (int i = 0; i < ShortcutsSpec::NUM_META_COLUMNS; i++) {
const char* name = ShortcutsSpec::GetColumnName(i);
float headerWidth = be_plain_font->StringWidth(name) + 20;
float width = max_c(headerWidth, cellWidth);
minListWidth += width + 1;
fColumnListView->AddColumn(
new CLVColumn(name, CreateMetaPopUp(i), width, CLV_SORT_KEYABLE));
}
float keyCellWidth = be_plain_font->StringWidth("Caps Lock") + 20;
fColumnListView->AddColumn(new CLVColumn(B_TRANSLATE("Key"),
CreateKeysPopUp(), keyCellWidth, CLV_SORT_KEYABLE));
minListWidth += keyCellWidth + 1;
BPopUpMenu* popup = new BPopUpMenu(NULL, false);
popup->AddItem(new BMenuItem(
B_TRANSLATE("(Choose application with file requester)"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*InsertString \"Your Text Here\""), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*MoveMouse +20 +0"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MoveMouseTo 50% 50%"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseButton 1"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*LaunchHandler text/html"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\""),
NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseDown"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseUp"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*SendMessage application/x-vnd.Be-TRAK 'Tfnd'"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*Beep"), NULL));
fColumnListView->AddColumn(new CLVColumn(B_TRANSLATE("Application"), popup,
323.0, CLV_SORT_KEYABLE));
minListWidth += 323.0 + 1;
minListWidth += B_V_SCROLL_BAR_WIDTH;
fColumnListView->SetSortFunction(ShortcutsSpec::MyCompare);
top->AddChild(containerView);
fColumnListView->SetSelectionMessage(new BMessage(HOTKEY_ITEM_SELECTED));
//.........这里部分代码省略.........
示例11: 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);
//.........这里部分代码省略.........
示例12: mbRect
ActivityWindow::ActivityWindow()
:
BWindow(BRect(100, 100, 500, 350), B_TRANSLATE_SYSTEM_NAME("ActivityMonitor"),
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE)
{
BMessage settings;
_LoadSettings(settings);
BRect frame;
if (settings.FindRect("window frame", &frame) == B_OK) {
MoveTo(frame.LeftTop());
ResizeTo(frame.Width(), frame.Height());
}
#ifdef __HAIKU__
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0);
SetLayout(layout);
// create GUI
BMenuBar* menuBar = new BMenuBar("menu");
layout->AddView(menuBar);
fLayout = new BGroupLayout(B_VERTICAL);
float inset = ceilf(be_plain_font->Size() * 0.7);
fLayout->SetInsets(inset, inset, inset, inset);
fLayout->SetSpacing(inset);
BView* top = new BView("top", 0, fLayout);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
layout->AddView(top);
BMessage viewState;
int32 count = 0;
for (int32 i = 0; settings.FindMessage("activity view", i, &viewState)
== B_OK; i++) {
ActivityView* view = new ActivityView("ActivityMonitor", &viewState);
fLayout->AddItem(view->CreateHistoryLayoutItem());
fLayout->AddItem(view->CreateLegendLayoutItem());
count++;
}
if (count == 0) {
// Add default views (memory & CPU usage)
_AddDefaultView();
_AddDefaultView();
}
#else // !__HAIKU__
BView *layout = new BView(Bounds(), "topmost", B_FOLLOW_NONE, 0);
AddChild(layout);
// create GUI
BRect mbRect(Bounds());
mbRect.bottom = 10;
BMenuBar* menuBar = new BMenuBar(mbRect, "menu");
layout->AddChild(menuBar);
BRect topRect(Bounds());
topRect.top = menuBar->Bounds().bottom + 1;
BView* top = new BView(topRect, "top", B_FOLLOW_ALL, 0);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
layout->AddChild(top);
BMessage viewState;
int32 count = 0;
ActivityView *aview;
BRect rect;
for (int32 i = 0; settings.FindMessage("activity view", i, &viewState)
== B_OK; i++) {
aview = new ActivityView("ActivityMonitor", &viewState);
if (!rect.IsValid())
rect = aview->Bounds();
else
rect.OffsetBySelf(0.0, aview->Bounds().Height());
top->AddChild(aview);
count++;
}
if (count == 0)
top->AddChild(new ActivityView("ActivityMonitor", NULL));
#endif
// add menu
// "File" menu
BMenu* menu = new BMenu(B_TRANSLATE("File"));
menu->AddItem(new BMenuItem(B_TRANSLATE("Add graph"),
new BMessage(kMsgAddView)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q'));
menu->SetTargetForItems(this);
menuBar->AddItem(menu);
// "Settings" menu
menu = new BMenu(B_TRANSLATE("Settings"));
menu->AddItem(new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
new BMessage(kMsgShowSettings)));
menu->SetTargetForItems(this);
menuBar->AddItem(menu);
//.........这里部分代码省略.........
示例13: msg
TeapotWindow::TeapotWindow(BRect rect, const char* name, window_type wt,
ulong something)
:
BDirectWindow(rect, name, wt, something)
{
GLenum type = BGL_RGB | BGL_DEPTH | BGL_DOUBLE;
Lock();
BRect bounds = Bounds();
bounds.bottom = bounds.top + 14;
BMenuBar* menuBar = new BMenuBar(bounds, "main menu");
BMenu* menu;
BMessage msg(kMsgAddModel);
menuBar->AddItem(menu = new BMenu(B_TRANSLATE("File")));
AddChild(menuBar);
menuBar->ResizeToPreferred();
bounds = Bounds();
bounds.top = menuBar->Bounds().bottom + 1;
BView *subView = new BView(bounds, "subview", B_FOLLOW_ALL, 0);
AddChild(subView);
bounds = subView->Bounds();
fObjectView = new(std::nothrow) ObjectView(bounds, "objectView",
B_FOLLOW_ALL_SIDES, type);
subView->AddChild(fObjectView);
BMenuItem* item;
msg.AddInt32("num", 256);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Add a teapot"),
new BMessage(msg), 'N'));
item->SetTarget(fObjectView);
menu->AddSeparatorItem();
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q'));
item->SetTarget(be_app);
msg.RemoveName("num");
menuBar->AddItem(menu = new BMenu(B_TRANSLATE("Options")));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Perspective"),
new BMessage(kMsgPerspective)));
item->SetTarget(fObjectView);
item->SetMarked(false);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("FPS display"),
new BMessage(kMsgFPS)));
item->SetTarget(fObjectView);
item->SetMarked(true);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Filled polygons"),
new BMessage(kMsgFilled)));
item->SetTarget(fObjectView);
item->SetMarked(true);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Lighting"),
new BMessage(kMsgLighting)));
item->SetTarget(fObjectView);
item->SetMarked(true);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Backface culling"),
new BMessage(kMsgCulling)));
item->SetTarget(fObjectView);
item->SetMarked(true);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Z-buffered"),
new BMessage(kMsgZBuffer)));
item->SetTarget(fObjectView);
item->SetMarked(true);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Gouraud shading"),
new BMessage(kMsgGouraud)));
item->SetTarget(fObjectView);
item->SetMarked(true);
// menu->AddItem(item = new BMenuItem("Texture mapped", new BMessage(kMsgTextured)));
// item->SetTarget(fObjectView);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Fog"),
new BMessage(kMsgFog)));
item->SetTarget(fObjectView);
BMenu *subMenu;
menuBar->AddItem(menu = new BMenu(B_TRANSLATE("Lights")));
msg.what = kMsgLights;
msg.AddInt32("num", 1);
menu->AddItem(item = new BMenuItem(subMenu =
new BMenu(B_TRANSLATE("Upper center")), NULL));
item->SetTarget(fObjectView);
msg.AddInt32("color", lightNone);
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Off"),
new BMessage(msg)));
item->SetTarget(fObjectView);
subMenu->AddSeparatorItem();
msg.ReplaceInt32("color", lightWhite);
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("White"),
new BMessage(msg)));
item->SetTarget(fObjectView);
item->SetMarked(true);
msg.ReplaceInt32("color", lightYellow);
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Yellow"),
new BMessage(msg)));
item->SetTarget(fObjectView);
msg.ReplaceInt32("color", lightBlue);
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Blue"),
new BMessage(msg)));
//.........这里部分代码省略.........
示例14: BMessage
SerialWindow::SerialWindow()
: BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle,
B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS)
, fLogFilePanel(NULL)
{
BMenuBar* menuBar = new BMenuBar(Bounds(), "menuBar");
menuBar->ResizeToPreferred();
BRect r = Bounds();
r.top = menuBar->Bounds().bottom + 1;
r.right -= B_V_SCROLL_BAR_WIDTH;
fTermView = new TermView(r);
fTermView->ResizeToPreferred();
r = fTermView->Frame();
r.left = r.right + 1;
r.right = r.left + B_V_SCROLL_BAR_WIDTH;
r.top -= 1;
r.bottom -= B_H_SCROLL_BAR_HEIGHT - 1;
BScrollBar* scrollBar = new BScrollBar(r, "scrollbar", NULL, 0, 0,
B_VERTICAL);
scrollBar->SetTarget(fTermView);
ResizeTo(r.right - 1, r.bottom + B_H_SCROLL_BAR_HEIGHT - 1);
AddChild(menuBar);
AddChild(fTermView);
AddChild(scrollBar);
fConnectionMenu = new BMenu("Connection");
BMenu* fileMenu = new BMenu("File");
BMenu* settingsMenu = new BMenu("Settings");
fConnectionMenu->SetRadioMode(true);
menuBar->AddItem(fConnectionMenu);
menuBar->AddItem(fileMenu);
menuBar->AddItem(settingsMenu);
// TODO edit menu - what's in it ?
//BMenu* editMenu = new BMenu("Edit");
//menuBar->AddItem(editMenu);
BMenuItem* logFile = new BMenuItem("Log to file" B_UTF8_ELLIPSIS,
new BMessage(kMsgLogfile));
fileMenu->AddItem(logFile);
#if 0
// TODO implement these
BMenuItem* xmodemSend = new BMenuItem("X/Y/ZModem send" B_UTF8_ELLIPSIS,
NULL);
fileMenu->AddItem(xmodemSend);
BMenuItem* xmodemReceive = new BMenuItem(
"X/Y/Zmodem receive" B_UTF8_ELLIPSIS, NULL);
fileMenu->AddItem(xmodemReceive);
#endif
// Configuring all this by menus may be a bit unhandy. Make a setting
// window instead ?
fBaudrateMenu = new BMenu("Baud rate");
fBaudrateMenu->SetRadioMode(true);
settingsMenu->AddItem(fBaudrateMenu);
fParityMenu = new BMenu("Parity");
fParityMenu->SetRadioMode(true);
settingsMenu->AddItem(fParityMenu);
fStopbitsMenu = new BMenu("Stop bits");
fStopbitsMenu->SetRadioMode(true);
settingsMenu->AddItem(fStopbitsMenu);
fFlowcontrolMenu = new BMenu("Flow control");
fFlowcontrolMenu->SetRadioMode(true);
settingsMenu->AddItem(fFlowcontrolMenu);
fDatabitsMenu = new BMenu("Data bits");
fDatabitsMenu->SetRadioMode(true);
settingsMenu->AddItem(fDatabitsMenu);
BMessage* message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_NO_PARITY);
BMenuItem* parityNone = new BMenuItem("None", message);
message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_ODD_PARITY);
BMenuItem* parityOdd = new BMenuItem("Odd", message);
message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_EVEN_PARITY);
BMenuItem* parityEven = new BMenuItem("Even", message);
fParityMenu->AddItem(parityNone);
fParityMenu->AddItem(parityOdd);
fParityMenu->AddItem(parityEven);
fParityMenu->SetTargetForItems(be_app);
message = new BMessage(kMsgSettings);
message->AddInt32("databits", B_DATA_BITS_7);
BMenuItem* data7 = new BMenuItem("7", message);
//.........这里部分代码省略.........
示例15: fnr
PrefsWindow::PrefsWindow(uint32 msg) : BWindow(BRect(0, 0, 400, 289), GetString(STR_PREFS_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS), this_messenger(this)
{
int i;
ok_message = msg;
send_quit_on_close = true;
get_system_info(&sys_info);
// Move window to right position
Lock();
MoveTo(80, 80);
// Set up menus
BMenuBar *bar = new BMenuBar(Bounds(), "menu");
BMenu *menu = new BMenu(GetString(STR_PREFS_MENU));
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ABOUT), new BMessage(B_ABOUT_REQUESTED)));
menu->AddItem(new BSeparatorItem);
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_START), new BMessage(MSG_OK)));
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ZAP_PRAM), new BMessage(MSG_ZAP_PRAM)));
menu->AddItem(new BSeparatorItem);
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_QUIT), new BMessage(MSG_CANCEL), 'Q'));
bar->AddItem(menu);
AddChild(bar);
SetKeyMenuBar(bar);
int mbar_height = int(bar->Bounds().bottom) + 1;
// Resize window to fit menu bar
ResizeBy(0, mbar_height);
// Light gray background
BRect b = Bounds();
top = new BView(BRect(0, mbar_height, b.right, b.bottom), "top", B_FOLLOW_NONE, B_WILL_DRAW);
AddChild(top);
top->SetViewColor(fill_color);
top_frame = top->Bounds();
// Create panes
panes[0] = create_volumes_pane();
panes[1] = create_graphics_pane();
panes[2] = create_serial_pane();
panes[3] = create_memory_pane();
// Prefs item tab view
pane_tabs = new BTabView(BRect(10, 10, top_frame.right-10, top_frame.bottom-50), "items", B_WIDTH_FROM_LABEL);
for (i=0; i<NUM_PANES; i++)
pane_tabs->AddTab(panes[i]);
top->AddChild(pane_tabs);
volume_list->Select(0);
// Create volume file panels
add_volume_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_ADD_VOLUME_PANEL));
add_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_ADD_VOLUME_PANEL_BUTTON));
add_volume_panel->Window()->SetTitle(GetString(STR_ADD_VOLUME_TITLE));
create_volume_panel = new BFilePanel(B_SAVE_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_CREATE_VOLUME_PANEL));
create_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_CREATE_VOLUME_PANEL_BUTTON));
create_volume_panel->Window()->SetTitle(GetString(STR_CREATE_VOLUME_TITLE));
create_volume_panel->Window()->Lock();
BView *background = create_volume_panel->Window()->ChildAt(0);
background->FindView("PoseView")->ResizeBy(0, -30);
background->FindView("VScrollBar")->ResizeBy(0, -30);
background->FindView("CountVw")->MoveBy(0, -30);
BView *v = background->FindView("HScrollBar");
if (v)
v->MoveBy(0, -30);
else {
i = 0;
while ((v = background->ChildAt(i++)) != NULL) {
if (v->Name() == NULL || v->Name()[0] == 0) {
v->MoveBy(0, -30); // unnamed horizontal scroll bar
break;
}
}
}
BView *filename = background->FindView("text view");
BRect fnr(filename->Frame());
fnr.OffsetBy(0, -30);
NumberControl *nc = new NumberControl(fnr, 80, "hardfile_size", GetString(STR_HARDFILE_SIZE_CTRL), 40, NULL);
background->AddChild(nc);
create_volume_panel->Window()->Unlock();
// "Start" button
BButton *button = new BButton(BRect(20, top_frame.bottom-35, 90, top_frame.bottom-10), "start", GetString(STR_START_BUTTON), new BMessage(MSG_OK));
top->AddChild(button);
SetDefaultButton(button);
// "Quit" button
top->AddChild(new BButton(BRect(top_frame.right-90, top_frame.bottom-35, top_frame.right-20, top_frame.bottom-10), "cancel", GetString(STR_QUIT_BUTTON), new BMessage(MSG_CANCEL)));
Unlock();
Show();
}