当前位置: 首页>>代码示例>>C++>>正文


C++ BMenuBar::AddItem方法代码示例

本文整理汇总了C++中BMenuBar::AddItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenuBar::AddItem方法的具体用法?C++ BMenuBar::AddItem怎么用?C++ BMenuBar::AddItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BMenuBar的用法示例。


在下文中一共展示了BMenuBar::AddItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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();
}
开发者ID:pedgarcia,项目名称:cpcsdk,代码行数:32,代码来源:RWin.cpp

示例2: AddMainMenu

void SeqStudioWindow::AddMainMenu(BRect f)
{
	BMenuBar*		menuBar;
	BMenu*			menu;
	BMenuItem*		item;
	menuBar = new BMenuBar(	f, NULL, B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT,
							B_ITEMS_IN_ROW, FALSE);
	/* Entry Menu
	 */
	mPortMenu = new BMenu("MIDI Port", B_ITEMS_IN_COLUMN);
	add_menu_item(mPortMenu,	DELETE_STR,		DELETE_PORT_MSG,		'T');
	item = new BMenuItem(mPortMenu);
	menuBar->AddItem(mPortMenu, ENTRY_MENU_INDEX);

	/* Attributes Menu
	 */
	menu = new BMenu("Attributes", B_ITEMS_IN_COLUMN);
	item = new BMenuItem(menu);
	menuBar->AddItem(item, ATTRIBUTES_MENU_INDEX);
	add_attribute_item(menu, MIDI_PORT_STR);
	add_attribute_item(menu, TYPE_STR);
	add_attribute_item(menu, DEVICE_STR);
	add_attribute_item(menu, LABEL_STR);

	AddChild(menuBar);
	SetKeyMenuBar(menuBar);
}
开发者ID:dtbinh,项目名称:Sequitur,代码行数:27,代码来源:SeqStudioWindow.cpp

示例3: menuRect

GDWindow::GDWindow(BRect frame)
				: BWindow(frame, "GrafDemo 4.6", B_DOCUMENT_WINDOW,0)
{
	Lock();
	// Add the graph to the window
	BRect grafRect = Bounds();
	grafRect.top += mb_height + 2;
	mGraphView= new GDView(grafRect);
	AddChild(mGraphView);
	SetSizeLimits(frame.right - frame.left,9999,frame.bottom - frame.top,9999);

	// Add the main menu bar and menus
	BRect menuRect(0,0,1000,mb_height);
	BMenuBar* menuBar = new BMenuBar(menuRect,"MB");
	
	BMenu*	fileMenu = new BMenu("File");
	BMenuItem* aboutItem = new BMenuItem("About...",new BMessage(B_ABOUT_REQUESTED));
	aboutItem->SetTarget(be_app);
	fileMenu->AddItem(aboutItem);
	fileMenu->AddSeparatorItem();
	fileMenu->AddItem(new BMenuItem("Quit",new BMessage(B_QUIT_REQUESTED)));
	menuBar->AddItem(fileMenu);
	
	BMenu*	editMenu = new BMenu("Edit");
	editMenu->AddItem(new BMenuItem("Erase",new BMessage(G_erase_data)));
	editMenu->AddItem(new BMenuItem("Reset Axes",new BMessage(G_reset_axes)));
	editMenu->SetTargetForItems(mGraphView);
	menuBar->AddItem(editMenu);
	
	BMenu*	paramsMenu = new BMenu("Params");
	BMessage* cFitMesg = new BMessage(G_set_params);
	cFitMesg->AddInt16(pName,0);
	BMessage* p2Mesg = new BMessage(G_set_params);
	p2Mesg->AddInt16(pName,2);
	BMessage* p3Mesg = new BMessage(G_set_params);
	p3Mesg->AddInt16(pName,3);
	BMessage* p4Mesg = new BMessage(G_set_params);
	p4Mesg->AddInt16(pName,4);
	paramsMenu->AddItem(new BMenuItem("Cubic Spline",cFitMesg));
	paramsMenu->AddSeparatorItem();
	paramsMenu->AddItem(new BMenuItem("1st Order",p2Mesg));
	paramsMenu->AddItem(new BMenuItem("2nd Order",p3Mesg));
	paramsMenu->AddItem(new BMenuItem("3rd Order",p4Mesg));
	paramsMenu->SetRadioMode(true);
	paramsMenu->FindItem("2nd Order")->SetMarked(true);
	paramsMenu->SetTargetForItems(mGraphView);
	menuBar->AddItem(paramsMenu);

	BMenu*	axisMenu = new BMenu("Axes");
	axisMenu->AddItem(new BMenuItem("Set Axes"B_UTF8_ELLIPSIS,new BMessage(G_change_axis)));
	axisMenu->SetTargetForItems(mGraphView);
	menuBar->AddItem(axisMenu);

	AddChild(menuBar);
	
	Unlock();
}
开发者ID:HaikuArchives,项目名称:PlottingTools,代码行数:57,代码来源:GDWindow.cpp

示例4: r

MainWindow::MainWindow(void)
	:	BWindow(BRect(5,25,250,350),"PDesigner",B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS),
		fProject(NULL)
{
	BRect r(Bounds());
	r.bottom = 20;
	BMenuBar *bar = new BMenuBar(r,"menubar");
	AddChild(bar);
	
	r = Bounds();
	r.top = 21;
	BView *top = new BView(r, "top", B_FOLLOW_ALL, B_WILL_DRAW);
	AddChild(top);
	top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	
	r = top->Bounds();
	r.right -= B_V_SCROLL_BAR_WIDTH;
	r.bottom -= B_H_SCROLL_BAR_HEIGHT;
	fListView = new BOutlineListView(r,"listview",B_SINGLE_SELECTION_LIST,B_FOLLOW_ALL);
	BScrollView *scroll = new BScrollView("listscroll",fListView,B_FOLLOW_ALL,0,true,true);
	top->AddChild(scroll);
	fListView->SetSelectionMessage(new BMessage(M_OBJECT_SELECTED));
	
	BMenu *menu = new BMenu("File");
	menu->AddItem(new BMenuItem("New Project",new BMessage(M_NEW_PROJECT),'N', B_COMMAND_KEY));
	bar->AddItem(menu);
	
	menu = new BMenu("Project");
	menu->AddItem(new BMenuItem("Add Window",new BMessage(M_ADD_WINDOW),'A'));
	
	BMessage *menumsg = new BMessage(M_ADD_CONTROL);
	menumsg->AddString("type","PView");
	menu->AddItem(new BMenuItem("Add View",menumsg,'V'));

	menumsg = new BMessage(M_ADD_CONTROL);
	menumsg->AddString("type","PButton");
	menu->AddItem(new BMenuItem("Add Button",menumsg));
	
	menumsg = new BMessage(M_ADD_CONTROL);
	menumsg->AddString("type","PCheckBox");
	menu->AddItem(new BMenuItem("Add Check Box",menumsg));
	
	menu->AddItem(new BMenuItem("Delete Item",new BMessage(M_REMOVE_SELECTED),'D'));
	bar->AddItem(menu);
	
	menu = new BMenu("Window");
	menu->AddItem(new BMenuItem("Toggle Properties",new BMessage(M_TOGGLE_PROPERTY_WIN)));
	bar->AddItem(menu);
	
	fPropertyWin = new PropertyWindow();
	fPropertyWin->Show();
	
	fObjectWin = new ObjectWindow(BMessenger(this));
	fObjectWin->Show();
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:55,代码来源:MainWindow.cpp

示例5: BMessage

BMenuBar*
KeymapWindow::_CreateMenu()
{
	BMenuBar* menuBar = new BMenuBar(Bounds(), "menubar");
	BMenuItem* item;

	// Create the File menu
	BMenu* menu = new BMenu(TR("File"));
	menu->AddItem(new BMenuItem(TR("Open" B_UTF8_ELLIPSIS),
		new BMessage(kMsgMenuFileOpen), 'O'));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(TR("Save as" B_UTF8_ELLIPSIS),
		new BMessage(kMsgMenuFileSaveAs)));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(TR("Quit"),
		new BMessage(B_QUIT_REQUESTED), 'Q'));
	menuBar->AddItem(menu);

	// Create keyboard layout menu
	fLayoutMenu = new BMenu(TR("Layout"));
	fLayoutMenu->SetRadioMode(true);
	fLayoutMenu->AddItem(item = new BMenuItem(
		fKeyboardLayoutView->GetKeyboardLayout()->Name(),
		new BMessage(kChangeKeyboardLayout)));
	item->SetMarked(true);

	_AddKeyboardLayouts(fLayoutMenu);
	menuBar->AddItem(fLayoutMenu);

	// Create the Font menu
	fFontMenu = new BMenu(TR("Font"));
	fFontMenu->SetRadioMode(true);
	int32 numFamilies = count_font_families();
	font_family family, currentFamily;
	font_style currentStyle;
	uint32 flags;

	be_plain_font->GetFamilyAndStyle(&currentFamily, &currentStyle);

	for (int32 i = 0; i < numFamilies; i++) {
		if (get_font_family(i, &family, &flags) == B_OK) {
			BMenuItem *item =
				new BMenuItem(family, new BMessage(kMsgMenuFontChanged));
			fFontMenu->AddItem(item);

			if (!strcmp(family, currentFamily))
				item->SetMarked(true);
		}
	}
	menuBar->AddItem(fFontMenu);

	return menuBar;
}
开发者ID:mmanley,项目名称:Antares,代码行数:53,代码来源:KeymapWindow.cpp

示例6: BMenuBar

BMenuBar*
FaberView::BuildMainMenuBar()
{
	BMenuBar* menuBar = new BMenuBar("MainMenuBar");

	RecentsMenuBuilder builder;
	fFileMenu = MenuBuilder::BuildMenu(kFileMenu, NULL, &builder);
	menuBar->AddItem(fFileMenu);

	fEditMenu = MenuBuilder::BuildMenu(kEditMenu);
	menuBar->AddItem(fEditMenu);

	fProjectMenu = MenuBuilder::BuildMenu(kProjectMenu);
	menuBar->AddItem(fProjectMenu);

	fTracksMenu = MenuBuilder::BuildMenu(kTracksMenu);
	menuBar->AddItem(fTracksMenu);

	fEffectsMenu = BuildEffectsMenu();
	menuBar->AddItem(fEffectsMenu);

	fGenerateMenu = BuildGenerateMenu();
	menuBar->AddItem(fGenerateMenu);

	fEngineMenu = MenuBuilder::BuildMenu(kEngineMenu);
	menuBar->AddItem(fEngineMenu);

	menuBar->AddItem(MenuBuilder::BuildMenu(kHelpMenu));

	return menuBar;
}
开发者ID:Barrett17,项目名称:Faber,代码行数:31,代码来源:FaberView.cpp

示例7: BApplication

SketchApp::SketchApp()
		  		  : BApplication("application/x-vnd.Prok-Sketch")
{
	// most of this function was ripped out of Be's old HelloWorld Example
	SketchWindow	*mainWindow = NULL;
	SketchView		*aView = NULL;
	BMenuBar		*myMenubar = NULL;
	BMenu			*firstMenu = NULL, *secondMenu = NULL;
	BRect			aRect;
	menu_info		m_info;
	int32			menubarheight=0;
	
	// the price we pay to be font sensitive...
	get_menu_info(&m_info);
	menubarheight = (int32)m_info.font_size + 8;
	aRect.Set(100, 100, 449, 349 + menubarheight);
	mainWindow = new SketchWindow(aRect);
	
	// a pretty standard set of menus
	aRect.Set(0,0, mainWindow->Bounds().Width(), menubarheight);
	myMenubar = new BMenuBar(aRect, "menubar");
	// main menu
	firstMenu = new BMenu("Sketch");
	firstMenu->AddItem(new BMenuItem("About Sketch", new BMessage(B_ABOUT_REQUESTED), 'A', B_COMMAND_KEY));
	firstMenu->AddItem(new BMenuItem("Save", new BMessage(SAVE_BITMAP), 'S', B_COMMAND_KEY));
	firstMenu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY));
	((BMenuItem *)firstMenu->ItemAt(0))->SetTarget(be_app);
	((BMenuItem *)firstMenu->ItemAt(1))->SetTarget(be_app);
	
#if __INTEL__ // only cuz the translation kit is busted in R3, will undo in R3.1
	//((BMenuItem *)firstMenu->ItemAt(1))->SetEnabled(false);
#endif
	// edit menu
	secondMenu = new BMenu("Edit");
	secondMenu->AddItem(new BMenuItem("Erase", new BMessage(ANIMATED_ERASE), 'E', B_COMMAND_KEY));
	myMenubar->AddItem(firstMenu);
	myMenubar->AddItem(secondMenu);
	
	// SketchView
	aRect.Set(0,menubarheight -1, mainWindow->Bounds().Width(), mainWindow->Bounds().Height());
	aView = new SketchView(aRect, "SketchView");
	
	// add views to window
	mainWindow->AddChild(aView);
	mainWindow->AddChild(myMenubar);
	
	// make window visible
	mainWindow->Show();
}
开发者ID:jwiggins,项目名称:BeOS-Projects,代码行数:49,代码来源:Sketch.cpp

示例8: BMenuBar

void
CAssemblyWindow::AddMenuBar()
{
	BMenu *menu, *subMenu;
	BMenuItem *item;

	BMenuBar *menuBar = new BMenuBar(Bounds(), "General");

	// Create the 'File' menu
	CreateFileMenu(menuBar);

	// Create the edit menu
	menu = new BMenu("Edit");
	menu->AddItem(new BMenuItem("Undo", new BMessage(MENU_UNDO), 'Z'));
	menu->AddItem(new BMenuItem("Redo", new BMessage(MENU_REDO), 'Z', B_SHIFT_KEY));
	menu->AddSeparatorItem();
	menu->AddItem(item = new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
	item->SetEnabled(false);
	menu->AddItem(item = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
	item->SetEnabled(false);
	menu->AddItem(item = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
	item->SetEnabled(false);
	menu->AddItem(new CQuickKeyMenuItem("Clear", new BMessage(MENU_CLEAR), B_DELETE, "Del"));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A'));
	menuBar->AddItem(menu);

	// Create the 'Play' menu
	menu = new BMenu("Play");
	menu->AddItem(new CQuickKeyMenuItem("Pause", new BMessage(MENU_PAUSE), B_SPACE, "Space"));
	menu->AddSeparatorItem();
	menu->AddItem(new CQuickKeyMenuItem("Start", new BMessage(MENU_PLAY), B_ENTER, "Enter"));
	menu->AddItem(new CQuickKeyMenuItem("Play Section", new BMessage(MENU_PLAY_SECTION ), 'p', "p"));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem("Set Section", new BMessage(MENU_SET_SECTION), 'S', B_SHIFT_KEY));
	menuBar->AddItem(menu);
	
	// Create the 'View' menu
	menu = new BMenu("View");
	subMenu = new BMenu("Add Strip");
	menu->AddItem(subMenu);
	menuBar->AddItem(menu);

	// Create the 'Window' menu
	CreateWindowMenu(menuBar);

	// Add the menus
	AddChild(menuBar);
}
开发者ID:HaikuArchives,项目名称:MeV,代码行数:49,代码来源:AssemblyWindow.cpp

示例9: BWindow

BeCheckersWindow::BeCheckersWindow(BRect frame, const char *title)
					: BWindow(frame,
							  title,
							  B_TITLED_WINDOW,
							  B_NOT_RESIZABLE | B_NOT_ZOOMABLE) {
	BMenuBar *mb = new BMenuBar(BRect(0, 0, frame.right, 15), "MenuBar");
	BMenu *menu = new BMenu("File");
	menu->AddItem(new BMenuItem("New", new BMessage(BECHECKERS_NEW), 'N'));
	menu->AddItem(new BMenuItem("Open...", new BMessage(BECHECKERS_OPEN), 'O'));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem("Save", new BMessage(BECHECKERS_SAVE), 'S'));
	menu->AddItem(new BMenuItem("Save As", new BMessage(BECHECKERS_SAVEAS)));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem("About BeCheckers...", new BMessage(B_ABOUT_REQUESTED)));
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
	mb->AddItem(menu);
	AddChild(mb);

	mvIndicationLabel = new BStringView(BRect(0, 472, 450, 485), "Status", "Dark to move");
	mvIndicationLabel->SetViewColor(232, 232, 232);
	mvIndicationLabel->SetAlignment(B_ALIGN_CENTER);
	AddChild(mvIndicationLabel);

	StartGame();
}
开发者ID:noryb009,项目名称:BeCheckers,代码行数:26,代码来源:BeCheckersWindow.cpp

示例10: r

CGraphWindow::CGraphWindow(CCellWindow *inOwner, BRect inRect, image_id inAddOn)
	: BWindow(inRect, "Graph", B_DOCUMENT_WINDOW, 0)
{
	fOwner  = inOwner;
	fAddOnImage = inAddOn;
	
	inOwner->GetCellView()->GetSelection(&fSelection);
	fContainer = inOwner->GetCellView()->GetContainer();
	
	CGraphPlugIn* (*createGraph)(BRect frame, range selection, CContainer *container); 
	if (get_image_symbol(fAddOnImage, "NewGraphPlugIn__F5BRect5rangeP10CContainer",
		B_SYMBOL_TYPE_TEXT, &createGraph) != B_NO_ERROR)
		THROW((errCreatingGraph));
	
	BRect r(Bounds());
	r.bottom = GetMBarHeight();
	BMenuBar *mbar = new BMenuBar(r, "mbar");
	AddChild(mbar);

	BMenu *file = new BMenu("File");
	file->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'));
	mbar->AddItem(file);
	
	BMenu *edit = new BMenu("Edit");
	edit->AddItem(new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
	mbar->AddItem(edit);
	
	r = Bounds();
	r.top += GetMBarHeight();
	
	BView *background = new BView(r, "background", B_FOLLOW_ALL_SIDES,
		B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
	AddChild(background);
	
	r.OffsetTo(0, 0);
	r.InsetBy(B_V_SCROLL_BAR_WIDTH, B_H_SCROLL_BAR_HEIGHT);
	fMainView = (*createGraph)(r, fSelection, fContainer);
	if (fMainView == NULL)
		THROW((errCreatingGraphView));

	background->AddChild(fMainView);
	fMainView->DataChanged();

	Show();
} /* CGraphWindow::CGraphWindow */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:45,代码来源:GraphWindow.cpp

示例11: BFilePanel

StyledEditApp::StyledEditApp()
	:
	BApplication(APP_SIGNATURE),
	fOpenPanel(NULL)
{
	B_TRANSLATE_MARK_SYSTEM_NAME_VOID("StyledEdit");

	fOpenPanel = new BFilePanel();
	fOpenAsEncoding = 0;

	BMenuBar* menuBar
		= dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar"));
	if (menuBar != NULL) {
		fOpenPanelEncodingMenu = new BMenu(B_TRANSLATE("Encoding"));
		fOpenPanelEncodingMenu->SetRadioMode(true);

		menuBar->AddItem(fOpenPanelEncodingMenu);

		BCharacterSetRoster roster;
		BCharacterSet charset;
		while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) {
			BString name;
			if (charset.GetFontID() == B_UNICODE_UTF8)
				name = B_TRANSLATE("Default");
			else
				name = charset.GetPrintName();

			const char* mime = charset.GetMIMEName();
			if (mime != NULL) {
				name.Append(" (");
				name.Append(mime);
				name.Append(")");
			}
			BMenuItem* item
				= new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING));
			item->SetTarget(this);
			fOpenPanelEncodingMenu->AddItem(item);
			if (charset.GetFontID() == fOpenAsEncoding)
				item->SetMarked(true);
		}
	} else
		fOpenPanelEncodingMenu = NULL;

	fWindowCount = 0;
	fNextUntitledWindow = 1;
	fBadArguments = false;

	float factor = be_plain_font->Size() / 12.0f;
	sCascadeOffset *= factor;
	sTopLeft.x *= factor;
	sTopLeft.y *= factor;
	sWindowRect.left *= factor;
	sWindowRect.top *= factor;
	sWindowRect.right *= factor;
	sWindowRect.bottom *= factor;
	sWindowRect.PrintToStream();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:57,代码来源:StyledEditApp.cpp

示例12: BWindow

Fenster::Fenster() : BWindow( BRect( 20, 40, 620, 460), "PecoRename", B_TITLED_WINDOW, 0){
// Menü
	BMenuBar* MenuBar = new BMenuBar( BRect( 0, 0, 0, 0 ), "MenuBar" );

	BMenu* Menu;

	Menu = new BMenu(STR_MENU_FILE);
	MenuBar->AddItem(Menu);

	Menu->AddItem(new BMenuItem(STR_MENU_NEW, 				new BMessage(MSG_MENU_NEW), 'N'));
	Menu->AddItem(new BMenuItem(STR_MENU_OPEN, 				new BMessage(MSG_SELECT_FILES), 'O'));
	Menu->AddSeparatorItem();
	Menu->AddItem(new BMenuItem(STR_MENU_ABOUT, 			new BMessage(B_ABOUT_REQUESTED)));
	Menu->AddSeparatorItem();
	Menu->AddItem(new BMenuItem(STR_MENU_QUIT, 				new BMessage(B_QUIT_REQUESTED), 'Q'));

	Menu = new BMenu(STR_MENU_TOOLS);
	MenuBar->AddItem(Menu);

	Menu->AddItem(new BMenuItem(STR_MENU_CREATE_SCRIPT, 	new BMessage(MSG_MENU_SCRIPT)));

	Menu = new BMenu(STR_MENU_HELP);
	MenuBar->AddItem(Menu);

	Menu->AddItem(new BMenuItem(STR_MENU_DOCU, new BMessage(MSG_MENU_DOCU)));

	AddChild( MenuBar );
// Größe bestimmen + Fenster anpassen
	float BarWidth, BarHeight;
	MenuBar->GetPreferredSize ( &BarWidth, &BarHeight );
	SetSizeLimits( 600, 600, 10000, 155 + BarHeight + 5 * be_plain_font->Size() + 2 * be_bold_font->Size());

// Main Frame
	BRect MainFrame = Bounds();
	MainFrame.top += BarHeight;

	MainView* mainView = new MainView( MainFrame );
	AddChild( mainView );
	
	BTextControl*	TextControl = (BTextControl *)FindView("pfadView");
	TextControl->TextView()->MakeEditable(false);

};
开发者ID:mmadia,项目名称:pecorename,代码行数:43,代码来源:Fenster.cpp

示例13: BMenuBar

void
show_window(BWindow *window)
{
	BMenuBar *bar = new BMenuBar(BRect(0, 0, 10, 10), "menuBar");
	
	BMenu *menu = new BMenu("menu ONE");
	
	menu->AddItem(new BMenuItem("ONE", new BMessage('1ONE')));
	menu->AddItem(new BMenuItem("TWO", new BMessage('2TWO')));
	bar->AddItem(menu);

	menu = new BMenu("menu TWO");
	menu->AddItem(new BMenuItem("ONE", new BMessage('1ONE')));
	menu->AddItem(new BMenuItem("TWO", new BMessage('2TWO')));
	bar->AddItem(menu);
	
	window->AddChild(bar);
	window->Show();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:19,代码来源:MenuBeginningTest.cpp

示例14: 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();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:39,代码来源:PictureTestWindow.cpp

示例15: BMessage

ApplicationWindow::ApplicationWindow(BRect frame, bool visible)
	:
	BWindow(frame, B_TRANSLATE_SYSTEM_NAME("PackageManager"),
		B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
		B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE),
	fMinimizeOnClose(false)
{
	SetPulseRate(1000000);

	SetLayout(new BGroupLayout(B_VERTICAL, 0.0));

	ApplicationsContainerView* downloadsGroupView = new ApplicationsContainerView();
	fApplicationViewsLayout = downloadsGroupView->GroupLayout();

	BMenuBar* menuBar = new BMenuBar("Menu bar");
	BMenu* menu = new BMenu("Actions");
	menu->AddItem(new BMenuItem("Apply changes",
		new BMessage('NADA')));
	menu->AddItem(new BMenuItem("Exit", new BMessage(B_QUIT_REQUESTED)));
	menuBar->AddItem(menu);

	fApplicationsScrollView = new ApplicationContainerScrollView(downloadsGroupView);

	fDiscardButton = new BButton("Revert",
		new BMessage('NADA'));
	fDiscardButton->SetEnabled(false);

	fApplyChangesButton = new BButton("Apply",
		new BMessage('NADA'));
	fApplyChangesButton->SetEnabled(false);

	const float spacing = be_control_look->DefaultItemSpacing();

	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0.0)
		.Add(menuBar)
		.Add(fApplicationsScrollView)
		.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
			.AddGlue()
			.Add(fApplyChangesButton)
			.Add(fDiscardButton)
			.SetInsets(12, 5, 12, 5)
		)
	);

	PostMessage(INIT);

	if (!visible)
		Hide();
	Show();
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:51,代码来源:ApplicationWindow.cpp


注:本文中的BMenuBar::AddItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。