本文整理汇总了C++中BMenuBar::SetBorder方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenuBar::SetBorder方法的具体用法?C++ BMenuBar::SetBorder怎么用?C++ BMenuBar::SetBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenuBar
的用法示例。
在下文中一共展示了BMenuBar::SetBorder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
MidiMonitorApp::MidiMonitorApp ( void )
: BApplication ("application/x-vnd.tebo-midimonitor")
{
BRect aRect;
BList windows;
const float menuHeight = 20;
int initPort = 0; // set this from prefs instead...archive?
bool isPortOpen = FALSE;
char str[80], portname[132];
midiPort = new BMidiPort;
numPorts = midiPort->CountDevices();
midiPort->GetDeviceName ( initPort, portname );
if ( midiPort->Open (portname) != B_NO_ERROR ) {
sprintf ( str, "can't open %s", portname );
BAlert *b = new BAlert ("", str, "ug" );
b->Go();
} else {
// sprintf ( str, "opened %s", portNames[initPort] );
// BAlert *b = new BAlert ("", str, "okay!" );
// b->Go();
isPortOpen = TRUE;
}
theMidiMonitor = new M2BMidiMonitor ();
theMidiMonitor->Start();
midiPort->Connect ( theMidiMonitor );
if ( isPortOpen )
midiPort->Start();
aRect.Set(20, 100, 340, 400);
BWindow *aWindow = (BWindow *) new M2BWindow(aRect);
aRect.OffsetTo(B_ORIGIN);
BView *aView = (BView *) new M2BView(aRect, "M2BView",
(M2BMidiMonitor*)theMidiMonitor, menuHeight);
aWindow->AddChild(aView);
aWindow->Show();
windows.AddItem ( aWindow );
aRect.Set ( 0,0,1000,menuHeight);
BMenuBar *menubar = new BMenuBar ( aRect, "menubar" );
menubar->SetBorder ( B_BORDER_FRAME );
BMenuItem *item;
BMenu *menu = new BMenu("File");
item = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q');
item->SetTarget(be_app);
menu->AddItem(item);
menubar->AddItem ( menu );
// add the port selection menu
menu = new BMenu ( "Port" );
for ( int i = 0; i < numPorts; i++ ) {
midiPort->GetDeviceName ( i, portname );
item = new BMenuItem ( portname,
new BMessage ( MSG_MIDIMONITOR_MIDI_PORT ) );
item->Message()->AddString ( "port", portname );
menu->AddItem ( item );
}
menu->SetRadioMode ( TRUE );
menu->ItemAt(initPort)->SetMarked ( TRUE );
menu->SetTargetForItems ( be_app );
menubar->AddItem ( menu );
aView->AddChild ( menubar );
}