本文整理汇总了C++中BMenuBar::Frame方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenuBar::Frame方法的具体用法?C++ BMenuBar::Frame怎么用?C++ BMenuBar::Frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenuBar
的用法示例。
在下文中一共展示了BMenuBar::Frame方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Minimize
void CharismaWindow::Minimize(bool minimize)
{
const float margin=4.0f;
BRect r;
// en réalité, minimize est ignoré
if(!isminim){
menubar->Hide();
setupview->MoveTo(B_ORIGIN);
modemenu->MoveTo(margin,margin);
r=modemenu->Frame();
ResizeTo(r.right+margin,r.bottom+margin);
SetLook(B_MODAL_WINDOW_LOOK);
isminim=1;
}else{
menubar->Show();
setupview->MoveTo(0,menubar->Frame().bottom);
modemenu->MoveTo(10.0f,10.0f);
r=setupview->Frame();
ResizeTo(r.right,r.bottom);
SetLook(B_TITLED_WINDOW_LOOK);
isminim=0;
}
}
示例2: frame
App::App() :
BApplication("application/glyphaiii")
{
BRect frame(0, 0, 640, 460);
BWindow *win = new BWindow(frame, "Glypha III",
B_TITLED_WINDOW, B_NOT_ZOOMABLE);
BMenuBar *menuBar = new BMenuBar(BRect(0,0,0,0), NULL);
BMenu *menu = new BMenu("File");
BMenuItem *item = new BMenuItem("Quit", NULL, 'Q');
menu->AddItem(item);
menuBar->AddItem(menu);
win->AddChild(menuBar);
win->ResizeBy(0, menuBar->Frame().Height());
GameGLView *glview = new GameGLView(BRect(0, menuBar->Frame().Height() + 1, 640, 480));
win->AddChild(glview);
win->CenterOnScreen();
win->Show();
}
示例3: KeyMenuBar
void
BafxWindow::ReplaceContent(BView* inContent)
{
Lock();
if (contentView != NULL) {
RemoveChild(contentView);
contentView = NULL;
}
BMenuBar* menuBar = KeyMenuBar();
BRect menuFrame = menuBar->Frame();
BRect rect = Bounds();
rect.top += menuFrame.Height()+1;
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
inContent->ResizeTo(rect.Width(), rect.Height());
inContent->MoveTo(rect.left, rect.top);
AddChild(inContent);
contentView = inContent;
Unlock();
}
示例4: rctbar
ImageWindow::ImageWindow(BRect rect, const char *name)
: BWindow(rect, name, B_DOCUMENT_WINDOW, 0)
{
// Setup menu bar
BRect rctbar(0, 0, 100, 10);
BMenuBar *pbar = new BMenuBar(rctbar, "MenuBar");
BMenu *pmnufile = new BMenu(B_TRANSLATE("File"));
BMenuItem *pitmopen = new BMenuItem(B_TRANSLATE("Open..."),
new BMessage(M_OPEN_IMAGE), 'O', 0);
BMenuItem *pitmsave = new BMenuItem(B_TRANSLATE("Save..."),
new BMessage(M_SAVE_IMAGE), 'S', 0);
BMenuItem *pitmquit = new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q', 0);
pmnufile->AddItem(pitmopen);
pmnufile->AddItem(pitmsave);
pmnufile->AddSeparatorItem();
pmnufile->AddItem(pitmquit);
pbar->AddItem(pmnufile);
BMenu *pmnuview = new BMenu(B_TRANSLATE("View"));
BMenuItem *pitmfirst = new BMenuItem(B_TRANSLATE("First Page"),
new BMessage(M_VIEW_FIRST_PAGE), 'F', 0);
BMenuItem *pitmlast = new BMenuItem(B_TRANSLATE("Last Page"),
new BMessage(M_VIEW_LAST_PAGE), 'L', 0);
BMenuItem *pitmnext = new BMenuItem(B_TRANSLATE("Next Page"),
new BMessage(M_VIEW_NEXT_PAGE), 'N', 0);
BMenuItem *pitmprev = new BMenuItem(B_TRANSLATE("Previous Page"),
new BMessage(M_VIEW_PREV_PAGE), 'P', 0);
pmnuview->AddItem(pitmfirst);
pmnuview->AddItem(pitmlast);
pmnuview->AddItem(pitmnext);
pmnuview->AddItem(pitmprev);
pbar->AddItem(pmnuview);
BMenu *pmnuwindow = new BMenu(B_TRANSLATE("Window"));
BMenuItem *pitmactives = new BMenuItem(B_TRANSLATE("Active Translators"),
new BMessage(M_ACTIVE_TRANSLATORS_WINDOW), 'T', 0);
pitmactives->SetTarget(be_app);
BMenuItem *pitminfo = new BMenuItem(B_TRANSLATE("Info"),
new BMessage(M_INFO_WINDOW), 'I', 0);
pitminfo->SetTarget(be_app);
pmnuwindow->AddItem(pitmactives);
pmnuwindow->AddItem(pitminfo);
pbar->AddItem(pmnuwindow);
AddChild(pbar);
// Setup image view
BRect rctview = Bounds();
rctview.top = pbar->Frame().bottom + 1;
rctview.right -= B_V_SCROLL_BAR_WIDTH;
rctview.bottom -= B_H_SCROLL_BAR_HEIGHT;
fpimageView = new ImageView(rctview, "ImageView");
AddChild(new BScrollView("ImageScroll", fpimageView,
B_FOLLOW_ALL_SIDES, 0, true, true));
// Setup file open panel
BMessenger messenger(this);
BMessage message(M_OPEN_FILE_PANEL);
fpopenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, NULL, 0L, false,
&message, NULL, false, true);
SetSizeLimits(200, 10000, 150, 10000);
}
示例5: BMessage
SudokuWindow::SudokuWindow()
:
BWindow(BRect(100, 100, 500, 520), B_TRANSLATE_SYSTEM_NAME("Sudoku"),
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE),
fGenerator(NULL),
fStoredState(NULL),
fExportFormat(kExportAsText)
{
BMessage settings;
_LoadSettings(settings);
BRect frame;
if (settings.FindRect("window frame", &frame) == B_OK) {
MoveTo(frame.LeftTop());
ResizeTo(frame.Width(), frame.Height());
frame.OffsetTo(B_ORIGIN);
} else
frame = Bounds();
if (settings.HasMessage("stored state")) {
fStoredState = new BMessage;
if (settings.FindMessage("stored state", fStoredState) != B_OK) {
delete fStoredState;
fStoredState = NULL;
}
}
int32 level = 0;
settings.FindInt32("level", &level);
// create GUI
BMenuBar* menuBar = new BMenuBar(Bounds(), "menu");
AddChild(menuBar);
frame.top = menuBar->Frame().bottom;
BView* top = new BView(frame, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(top);
fSudokuView = new SudokuView(
top->Bounds().InsetByCopy(10, 10).OffsetToSelf(0, 0),
"sudoku view", settings, B_FOLLOW_NONE);
CenteredViewContainer* container = new CenteredViewContainer(fSudokuView,
top->Bounds().InsetByCopy(10, 10),
"center", B_FOLLOW_ALL);
container->SetHighColor(top->ViewColor());
top->AddChild(container);
// add menu
// "File" menu
BMenu* menu = new BMenu(B_TRANSLATE("File"));
fNewMenu = new BMenu(B_TRANSLATE("New"));
menu->AddItem(new BMenuItem(fNewMenu, new BMessage(kMsgGenerateSudoku)));
fNewMenu->Superitem()->SetShortcut('N', B_COMMAND_KEY);
BMessage* message = new BMessage(kMsgGenerateSudoku);
message->AddInt32("level", kEasyLevel);
fNewMenu->AddItem(new BMenuItem(B_TRANSLATE("Easy"), message));
message = new BMessage(kMsgGenerateSudoku);
message->AddInt32("level", kAdvancedLevel);
fNewMenu->AddItem(new BMenuItem(B_TRANSLATE("Advanced"), message));
message = new BMessage(kMsgGenerateSudoku);
message->AddInt32("level", kHardLevel);
fNewMenu->AddItem(new BMenuItem(B_TRANSLATE("Hard"), message));
fNewMenu->AddSeparatorItem();
fNewMenu->AddItem(new BMenuItem(B_TRANSLATE("Blank"),
new BMessage(kMsgNewBlank)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Start again"),
new BMessage(kMsgStartAgain)));
menu->AddSeparatorItem();
BMenu* recentsMenu = BRecentFilesList::NewFileListMenu(
B_TRANSLATE("Open file" B_UTF8_ELLIPSIS), NULL, NULL, this, 10, false,
NULL, kSignature);
BMenuItem *item;
menu->AddItem(item = new BMenuItem(recentsMenu,
new BMessage(kMsgOpenFilePanel)));
item->SetShortcut('O', B_COMMAND_KEY);
menu->AddSeparatorItem();
BMenu* subMenu = new BMenu(B_TRANSLATE("Export as" B_UTF8_ELLIPSIS));
message = new BMessage(kMsgExportAs);
message->AddInt32("as", kExportAsText);
subMenu->AddItem(new BMenuItem(B_TRANSLATE("Text"), message));
message= new BMessage(kMsgExportAs);
message->AddInt32("as", kExportAsHTML);
subMenu->AddItem(new BMenuItem(B_TRANSLATE("HTML"), message));
menu->AddItem(subMenu);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Copy"),
new BMessage(B_COPY), 'C'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
//.........这里部分代码省略.........
示例6: BMessage
RouteWindow::RouteWindow(RouteAppNodeManager* manager)
:
BWindow(s_initFrame, s_windowName, B_DOCUMENT_WINDOW, 0),
m_hScrollBar(0),
m_vScrollBar(0),
m_transportWindow(0),
m_dormantNodeWindow(0),
m_selectedGroupID(0),
m_zoomed(false),
m_zooming(false)
{
BRect b = Bounds();
// initialize the menu bar: add all menus that target this window
BMenuBar* pMenuBar = new BMenuBar(b, "menuBar");
BMenu* pFileMenu = new BMenu("File");
BMenuItem* item = new BMenuItem("Open" B_UTF8_ELLIPSIS,
new BMessage(RouteApp::M_SHOW_OPEN_PANEL), 'O');
item->SetTarget(be_app);
pFileMenu->AddItem(item);
pFileMenu->AddItem(new BSeparatorItem());
item = new BMenuItem("Save nodes" B_UTF8_ELLIPSIS,
new BMessage(RouteApp::M_SHOW_SAVE_PANEL), 'S');
item->SetTarget(be_app);
pFileMenu->AddItem(item);
pFileMenu->AddItem(new BSeparatorItem());
pFileMenu->AddItem(new BMenuItem("About Cortex/Route" B_UTF8_ELLIPSIS,
new BMessage(B_ABOUT_REQUESTED)));
pFileMenu->AddItem(new BSeparatorItem());
pFileMenu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)));
pMenuBar->AddItem(pFileMenu);
AddChild(pMenuBar);
// build the routing view
BRect rvBounds = b;
rvBounds.top = pMenuBar->Frame().bottom+1;
rvBounds.right -= B_V_SCROLL_BAR_WIDTH;
rvBounds.bottom -= B_H_SCROLL_BAR_HEIGHT;
m_routingView = new MediaRoutingView(manager, rvBounds, "routingView");
BRect hsBounds = rvBounds;
hsBounds.left = rvBounds.left + 199;
hsBounds.top = hsBounds.bottom + 1;
hsBounds.right++;
hsBounds.bottom = b.bottom + 1;
m_hScrollBar = new BScrollBar(hsBounds, "hScrollBar", m_routingView,
0, 0, B_HORIZONTAL);
AddChild(m_hScrollBar);
BRect vsBounds = rvBounds;
vsBounds.left = vsBounds.right + 1;
vsBounds.top--;
vsBounds.right = b.right + 1;
vsBounds.bottom++;
m_vScrollBar = new BScrollBar(vsBounds, "vScrollBar", m_routingView,
0, 0, B_VERTICAL);
AddChild(m_vScrollBar);
BRect svBounds = rvBounds;
svBounds.left -= 1;
svBounds.right = hsBounds.left - 1;
svBounds.top = svBounds.bottom + 1;
svBounds.bottom = b.bottom + 1;
m_statusView = new StatusView(svBounds, manager, m_hScrollBar);
AddChild(m_statusView);
AddChild(m_routingView);
float minWidth, maxWidth, minHeight, maxHeight;
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
minWidth = m_statusView->Frame().Width() + 6 * B_V_SCROLL_BAR_WIDTH;
minHeight = 6 * B_H_SCROLL_BAR_HEIGHT;
SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
// construct the Window menu
BMenu* windowMenu = new BMenu("Window");
m_transportWindowItem = new BMenuItem(
"Show transport",
new BMessage(M_TOGGLE_TRANSPORT_WINDOW));
windowMenu->AddItem(m_transportWindowItem);
m_dormantNodeWindowItem = new BMenuItem(
"Show add-ons",
new BMessage(M_TOGGLE_DORMANT_NODE_WINDOW));
windowMenu->AddItem(m_dormantNodeWindowItem);
windowMenu->AddItem(new BSeparatorItem());
m_pullPalettesItem = new BMenuItem(
"Pull palettes",
new BMessage(M_TOGGLE_PULLING_PALETTES));
windowMenu->AddItem(m_pullPalettesItem);
pMenuBar->AddItem(windowMenu);
// create the dormant-nodes palette
_toggleDormantNodeWindow();
//.........这里部分代码省略.........
示例7: BMessage
MainWindow::MainWindow(BRect frame)
:
BWindow(frame, B_TRANSLATE_SYSTEM_NAME("DriveSetup"), B_DOCUMENT_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE),
fCurrentDisk(NULL),
fCurrentPartitionID(-1),
fSpaceIDMap()
{
BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu");
// create all the menu items
fWipeMI = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"),
new BMessage(MSG_FORMAT));
fEjectMI = new BMenuItem(B_TRANSLATE("Eject"),
new BMessage(MSG_EJECT), 'E');
fSurfaceTestMI = new BMenuItem(
B_TRANSLATE("Surface test (not implemented)"),
new BMessage(MSG_SURFACE_TEST));
fRescanMI = new BMenuItem(B_TRANSLATE("Rescan"), new BMessage(MSG_RESCAN));
fCreateMI = new BMenuItem(B_TRANSLATE("Create" B_UTF8_ELLIPSIS),
new BMessage(MSG_CREATE), 'C');
fDeleteMI = new BMenuItem(B_TRANSLATE("Delete"),
new BMessage(MSG_DELETE), 'D');
fMountMI = new BMenuItem(B_TRANSLATE("Mount"),
new BMessage(MSG_MOUNT), 'M');
fUnmountMI = new BMenuItem(B_TRANSLATE("Unmount"),
new BMessage(MSG_UNMOUNT), 'U');
fMountAllMI = new BMenuItem(B_TRANSLATE("Mount all"),
new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY);
// Disk menu
fDiskMenu = new BMenu(B_TRANSLATE("Disk"));
// fDiskMenu->AddItem(fWipeMI);
fDiskInitMenu = new BMenu(B_TRANSLATE("Initialize"));
fDiskMenu->AddItem(fDiskInitMenu);
fDiskMenu->AddSeparatorItem();
fDiskMenu->AddItem(fEjectMI);
// fDiskMenu->AddItem(fSurfaceTestMI);
fDiskMenu->AddItem(fRescanMI);
menuBar->AddItem(fDiskMenu);
// Parition menu
fPartitionMenu = new BMenu(B_TRANSLATE("Partition"));
fPartitionMenu->AddItem(fCreateMI);
fFormatMenu = new BMenu(B_TRANSLATE("Format"));
fPartitionMenu->AddItem(fFormatMenu);
fPartitionMenu->AddItem(fDeleteMI);
fPartitionMenu->AddSeparatorItem();
fPartitionMenu->AddItem(fMountMI);
fPartitionMenu->AddItem(fUnmountMI);
fPartitionMenu->AddSeparatorItem();
fPartitionMenu->AddItem(fMountAllMI);
menuBar->AddItem(fPartitionMenu);
AddChild(menuBar);
// add DiskView
BRect r(Bounds());
r.top = menuBar->Frame().bottom + 1;
r.bottom = floorf(r.top + r.Height() * 0.33);
fDiskView = new DiskView(r, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
fSpaceIDMap);
AddChild(fDiskView);
// add PartitionListView
r.top = r.bottom + 2;
r.bottom = Bounds().bottom;
r.InsetBy(-1, -1);
fListView = new PartitionListView(r, B_FOLLOW_ALL);
AddChild(fListView);
// configure PartitionListView
fListView->SetSelectionMode(B_SINGLE_SELECTION_LIST);
fListView->SetSelectionMessage(new BMessage(MSG_PARTITION_ROW_SELECTED));
fListView->SetTarget(this);
fListView->MakeFocus(true);
status_t ret = fDDRoster.StartWatching(BMessenger(this));
if (ret != B_OK) {
fprintf(stderr, "Failed to start watching for device changes: %s\n",
strerror(ret));
}
// visit all disks in the system and show their contents
_ScanDrives();
if (!be_roster->IsRunning(kDeskbarSignature))
SetFlags(Flags() | B_NOT_MINIMIZABLE);
//.........这里部分代码省略.........
示例8: BDirectWindow
MacWindow::MacWindow(BRect frame, const BeOS_monitor_desc& monitor)
: BDirectWindow(frame, GetString(STR_WINDOW_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE)
, monitor(monitor)
{
supports_direct_mode = SupportsWindowMode();
// Move window to right position
Lock();
MoveTo(80, 60);
// Allocate bitmap and Mac frame buffer
uint32 x = frame.IntegerWidth() + 1;
uint32 y = frame.IntegerHeight() + 1;
int fbsize = x * y;
const video_mode &mode = monitor.get_current_mode();
switch (mode.depth) {
case VDEPTH_1BIT:
fprintf(stderr, "1BIT SCREEN CREATED");
the_bitmap = new BBitmap(frame, B_GRAY1);
fbsize /= 8;
break;
case VDEPTH_8BIT:
fprintf(stderr, "8BIT SCREEN CREATED");
the_bitmap = new BBitmap(frame, B_CMAP8);
break;
case VDEPTH_32BIT:
fprintf(stderr, "32BIT SCREEN CREATED");
the_bitmap = new BBitmap(frame, B_RGB32_BIG);
fbsize *= 4;
break;
default:
fprintf(stderr, "width: %d", 1 << mode.depth);
debugger("OOPS");
}
#if REAL_ADDRESSING
monitor.set_mac_frame_base((uint32)the_bitmap->Bits());
#else
monitor.set_mac_frame_base(MacFrameBaseMac);
#endif
#if !REAL_ADDRESSING
// Set variables for UAE memory mapping
MacFrameBaseHost = (uint8*)the_bitmap->Bits();
MacFrameSize = fbsize;
MacFrameLayout = FLAYOUT_DIRECT;
#endif
// Create bitmap view
main_view = new BitmapView(frame, the_bitmap);
AddChild(main_view);
main_view->MakeFocus();
// Read frame skip prefs
frame_skip = PrefsFindInt32("frameskip");
if (frame_skip == 0)
frame_skip = 1;
// Set up menus
BRect bounds = Bounds();
bounds.OffsetBy(0, bounds.IntegerHeight() + 1);
BMenuItem *item;
BMenuBar *bar = new BMenuBar(bounds, "menu");
BMenu *menu = new BMenu(GetString(STR_WINDOW_MENU));
menu->AddItem(new BMenuItem(GetString(STR_WINDOW_ITEM_ABOUT), new BMessage(MSG_ABOUT_REQUESTED)));
menu->AddItem(new BSeparatorItem);
BMenu *submenu = new BMenu(GetString(STR_WINDOW_ITEM_REFRESH));
submenu->AddItem(new BMenuItem(GetString(STR_REF_5HZ_LAB), new BMessage(MSG_REF_5HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_7_5HZ_LAB), new BMessage(MSG_REF_7_5HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_10HZ_LAB), new BMessage(MSG_REF_10HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_15HZ_LAB), new BMessage(MSG_REF_15HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_30HZ_LAB), new BMessage(MSG_REF_30HZ)));
submenu->AddItem(new BMenuItem(GetString(STR_REF_60HZ_LAB), new BMessage(MSG_REF_60HZ)));
submenu->SetRadioMode(true);
if (frame_skip == 12) {
if ((item = submenu->FindItem(GetString(STR_REF_5HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 8) {
if ((item = submenu->FindItem(GetString(STR_REF_7_5HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 6) {
if ((item = submenu->FindItem(GetString(STR_REF_10HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 4) {
if ((item = submenu->FindItem(GetString(STR_REF_15HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 2) {
if ((item = submenu->FindItem(GetString(STR_REF_30HZ_LAB))) != NULL)
item->SetMarked(true);
} else if (frame_skip == 1) {
if ((item = submenu->FindItem(GetString(STR_REF_60HZ_LAB))) != NULL)
item->SetMarked(true);
}
menu->AddItem(submenu);
submenu = new BMenu(GetString(STR_WINDOW_ITEM_MOUNT));
SysCreateVolumeMenu(submenu, MSG_MOUNT);
menu->AddItem(submenu);
#if DEBUGGER_AVAILABLE
menu->AddItem(new BMenuItem("Debugger", new BMessage(MSG_DEBUGGER)));
#endif
//.........这里部分代码省略.........