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


C++ BMenu::SetRadioMode方法代码示例

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


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

示例1: BMenu

Window::Window()
	:
	BWindow(BRect(100, 100, 620, 200), "Alert-Test", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	BMenu* sizeMenu = new BMenu("Button size");
	sizeMenu->SetLabelFromMarked(true);
	sizeMenu->SetRadioMode(true);
	sizeMenu->AddItem(new BMenuItem("As usual", NULL));
	sizeMenu->AddItem(new BMenuItem("From widest", NULL));
	sizeMenu->AddItem(new BMenuItem("From label", NULL));
	sizeMenu->ItemAt(0)->SetMarked(true);
	fSizeField = new BMenuField("Button size", sizeMenu);

	BMenu* typeMenu = new BMenu("Alert type");
	typeMenu->SetLabelFromMarked(true);
	typeMenu->SetRadioMode(true);
	typeMenu->AddItem(new BMenuItem("Empty", NULL));
	typeMenu->AddItem(new BMenuItem("Info", NULL));
	typeMenu->AddItem(new BMenuItem("Idea", NULL));
	typeMenu->AddItem(new BMenuItem("Warning", NULL));
	typeMenu->AddItem(new BMenuItem("Stop", NULL));
	typeMenu->ItemAt(0)->SetMarked(true);
	fTypeField = new BMenuField("Alert type", typeMenu);

	BMenu* spacingMenu = new BMenu("Button spacing");
	spacingMenu->SetLabelFromMarked(true);
	spacingMenu->SetRadioMode(true);
	spacingMenu->AddItem(new BMenuItem("Even", NULL));
	spacingMenu->AddItem(new BMenuItem("Offset", NULL));
	spacingMenu->ItemAt(0)->SetMarked(true);
	fSpacingField = new BMenuField("Button spacing", spacingMenu);

	fCountSlider = new BSlider("count", "Button count", NULL, 1, 3,
		B_HORIZONTAL);
	fCountSlider->SetValue(3);
	fCountSlider->SetLimitLabels("1", "3");
	fCountSlider->SetHashMarkCount(3);
	fCountSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);

	fLastStringView = new BStringView("last pressed", "");
	fLastStringView->SetAlignment(B_ALIGN_CENTER);

	BButton* button = new BButton("Show alert", new BMessage(kMsgShowAlert));

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.Add(fSizeField)
		.Add(fTypeField)
		.Add(fSpacingField)
		.Add(fCountSlider)
		.AddGlue()
		.Add(fLastStringView)
		.Add(button)
		.SetInsets(B_USE_DEFAULT_SPACING);

	CenterOnScreen();
	SetFlags(Flags() | B_CLOSE_ON_ESCAPE);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:58,代码来源:SimpleAlertTest.cpp

示例2: Bounds

/***********************************************************
 * InitGUI
 ***********************************************************/
void
HCriteriaView::InitGUI()
{
	BRect rect = Bounds();
	rect.left += 5;
	rect.top += 2;
	rect.right = rect.left + 80;
	BMenu *menu = new BMenu("menu");
	menu->AddItem(new BMenuItem(_("Subject"),NULL));
	menu->AddItem(new BMenuItem(_("To"),NULL));
	menu->AddItem(new BMenuItem(_("From"),NULL));
	menu->AddItem(new BMenuItem(_("Cc"),NULL));
	menu->AddItem(new BMenuItem(_("Reply-To"),NULL));
	menu->AddItem(new BMenuItem(_("Account"),NULL));
	menu->ItemAt(0)->SetMarked(true);
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	fAttrMenu = new BMenuField(rect,"attr","",menu);
	fAttrMenu->SetDivider(0);
	AddChild(fAttrMenu);
	
	rect.OffsetBy(80,0);
	menu = new BMenu("menu");
	menu->AddItem(new BMenuItem(_("contains"),NULL));
	menu->AddItem(new BMenuItem(_("is"),NULL));
	menu->AddItem(new BMenuItem(_("begin with"),NULL));
	menu->AddItem(new BMenuItem(_("end with"),NULL));
	menu->ItemAt(0)->SetMarked(true);
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	fOpMenu = new BMenuField(rect,"op","",menu);
	fOpMenu->SetDivider(0);
	AddChild(fOpMenu);
	
	rect.OffsetBy(80,2);
	rect.right= Bounds().right - 70;
	fValue = new BTextControl(rect,"value","","",NULL);
	fValue->SetDivider(0);
	AddChild(fValue);
	
	rect.right = Bounds().right - 5;
	rect.left = Bounds().right - 65;
	menu = new BMenu("operator");
	menu->AddItem(new BMenuItem(_("and"),NULL));
	menu->AddItem(new BMenuItem(_("or"),NULL));
	menu->ItemAt(0)->SetMarked(true);
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	fOp2Menu= new BMenuField(rect,"op2","",menu);
	fOp2Menu->SetDivider(0);
	AddChild(fOp2Menu);
}
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:55,代码来源:HCriteriaView.cpp

示例3: name

/* static */
BMenu*
TermWindow::_MakeEncodingMenu()
{
	BMenu* menu = new (std::nothrow) BMenu(B_TRANSLATE("Text encoding"));
	if (menu == NULL)
		return NULL;

	BCharacterSetRoster roster;
	BCharacterSet charset;
	while (roster.GetNextCharacterSet(&charset) == B_OK) {
		int encoding = M_UTF8;
		const char* mime = charset.GetMIMEName();
		if (mime == NULL || strcasecmp(mime, "UTF-8") != 0)
			encoding = charset.GetConversionID();

		// filter out currently (???) not supported USC-2 and UTF-16
		if (encoding == B_UTF16_CONVERSION || encoding == B_UNICODE_CONVERSION)
			continue;

		BString name(charset.GetPrintName());
		if (mime)
			name << " (" << mime << ")";

		BMessage *message = new BMessage(MENU_ENCODING);
		if (message != NULL) {
			message->AddInt32("op", (int32)encoding);
			menu->AddItem(new BMenuItem(name, message));
		}
	}

	menu->SetRadioMode(true);

	return menu;
}
开发者ID:DonCN,项目名称:haiku,代码行数:35,代码来源:TermWindow.cpp

示例4: BMenu

int32
OggEncoder::LoadDefaultMenu() {
	PRINT(("OggEncoder::LoadDefaultMenu()\n"));

	BMenu* bitrateMenu;
	BMenuItem* item;

	menu = new BMenu(name.String());

	//Bitrate Menu
	bitrateMenu = new BMenu(BITRATE_STR);
	bitrateMenu->SetRadioMode(true);

	item = new BMenuItem(_112KBPS, NULL);
	bitrateMenu->AddItem(item);

	item = new BMenuItem(_128KBPS, NULL);
	item->SetMarked(true);
	bitrateMenu->AddItem(item);

	item = new BMenuItem(_160KBPS, NULL);
	bitrateMenu->AddItem(item);

	item = new BMenuItem(_192KBPS, NULL);
	bitrateMenu->AddItem(item);

	item = new BMenuItem(_256KBPS, NULL);
	bitrateMenu->AddItem(item);

	item = new BMenuItem(_350KBPS, NULL);
	bitrateMenu->AddItem(item);

	menu->AddItem(bitrateMenu);
}
开发者ID:HaikuArchives,项目名称:Hare,代码行数:34,代码来源:OggEncoder.cpp

示例5: BMenu

/*!	\brief		Creates list of all Calendar Modules in the system.
 *		\attention	It is assumed that \c global_ListOfCalendarModules is set up
 *						before constructing this control.
 */
BMenu*		CalendarControl::CreateMenuOfCalendarModules()
{
	BMenu* toReturn = new BMenu( "Calendar Modules" , B_ITEMS_IN_COLUMN );
	if ( !toReturn ) { return NULL; }
	toReturn->SetRadioMode( true );
	toReturn->SetLabelFromMarked( true );
	
	BMenuItem* item;
	BMessage*  toSend;
	BString	  tempNameOfModule;
	CalendarModule* module;
	
	// Fill the menu
	for ( int i = 0; i < NUMBER_OF_CALENDAR_MODULES; ++i ) {
		module = ( CalendarModule* )global_ListOfCalendarModules.ItemAt( i );
		
		if ( !module ) { continue; }
		tempNameOfModule.SetTo( module->Identify() );
		
		toSend = new BMessage( kCalendarModuleChosen );
		if ( !toSend ) { continue; }
		toSend->AddString( "Name of calendar module", tempNameOfModule );
		
		item = new BMenuItem( tempNameOfModule.String(), toSend );
		if ( !item ) { continue; }
		
		toReturn->AddItem( item );
		
		if ( tempNameOfModule == fRepresentedTime.GetCalendarModule() ) {
			item->SetMarked( true );
		}
	}
	return toReturn;
}	// <-- end of function CalendarControl::CreateMenuOfCalendarModules
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:38,代码来源:CalendarControl.cpp

示例6: FTSetFont

// ----------------------------------------------------------------------- RHTML_Preferences_Win - FTSetFont -
void RHTMLPreferencesWin::FTSetFont(const char *font,const char *style ="")
{
 fFTFontsBox->RemoveChild(fFTDFStyle);

 font_family fFamily;
 font_style fStyle;
 BMenu *fSMenu;
 
 strcpy(fFamily,font);
 int32 styleNum = count_font_styles(fFamily);
 if (style!="")
 {
  fSMenu = new BMenu(fOptions->GetLocaleString("Preferences_Window_FileTypes",style));
 } else
 if (styleNum>0)
 {
  get_font_style(fFamily, 0, &fStyle);
  fSMenu = new BMenu(fOptions->GetLocaleString("Preferences_Window_FileTypes",fStyle));
 } else fSMenu = new BMenu("");

 fSMenu->SetRadioMode(false);
 fSMenu->SetLabelFromMarked(true);

 for (int32 ii = 0; ii < styleNum; ii++)
 {
  get_font_style(fFamily, ii, &fStyle);
  BMessage*	msg = new BMessage('FTFS');
  msg->AddString("font_style", fStyle);  
  fSMenu->AddItem(new BMenuItem(fOptions->GetLocaleString("Preferences_Window_FileTypes",fStyle),msg));
 }

 fFTDFStyle= new BMenuField(BRect(10,45,180,75),"Font Style",fOptions->GetLocaleString("Preferences_Window_FileTypes","Style"),fSMenu);
 fFTDFStyle->SetDivider(60);
 fFTFontsBox->AddChild(fFTDFStyle);
}
开发者ID:puckipedia,项目名称:Globe,代码行数:36,代码来源:RHTML_prefwin.cpp

示例7: cmi

BMenu *CreateColorMenu(const char *name, int columns, int n, rgb_color *colors, BMessage *msg) {
	if (columns > n) columns = n;
	int rows = (n + columns-1) / columns; // ceil((float)n / (float)columns)

	ColorMenuItem cmi(colors[0], NULL);
	float w, h;
	cmi.GetSize(w, h);
	
	BMenu *menu = new BMenu(name, columns * w, rows * h); 
	menu->SetRadioMode(true);
	
	BRect frame; float left, top;
	int i = 0, x, y; BMessage *m = NULL; 
	for (y = 0; y < rows; y++)
		for (x = 0; x < columns; x++) {
			left = x * w;
			top = y * h;
			frame.Set(left, top, left + w - 1, top + h - 1);
			
			if (msg != NULL) {
				m = new BMessage(*msg);
				ArchiveColor(NULL, m, colors[i]);
			}
			menu->AddItem(new ColorMenuItem(colors[i], m), frame);
			i++; if (i == n) return menu;
		}
	return menu;
}
开发者ID:HaikuArchives,项目名称:PlottingTools,代码行数:28,代码来源:ColorMenuItem.cpp

示例8: GetFont

void
ControlView::_UpdateFontmenus(bool setInitialfont)
{
    BFont font;
    BMenu* stylemenu = NULL;

    font_family fontFamilyName, currentFamily;
    font_style fontStyleName, currentStyle;

    GetFont(&font);
    font.GetFamilyAndStyle(&currentFamily, &currentStyle);

    const int32 fontfamilies = count_font_families();

    fFontFamilyMenu->RemoveItems(0, fFontFamilyMenu->CountItems(), true);

    for (int32 i = 0; i < fontfamilies; i++) {
        if (get_font_family(i, &fontFamilyName) == B_OK) {
            stylemenu = new BMenu(fontFamilyName);
            const int32 styles = count_font_styles(fontFamilyName);

            BMessage* familyMsg = new BMessage(FONTFAMILY_CHANGED_MSG);
            familyMsg->AddString("_family", fontFamilyName);
            BMenuItem* familyItem = new BMenuItem(stylemenu, familyMsg);
            fFontFamilyMenu->AddItem(familyItem);

            for (int32 j = 0; j < styles; j++) {
                if (get_font_style(fontFamilyName, j, &fontStyleName) == B_OK) {
                    BMessage* fontMsg = new BMessage(FONTSTYLE_CHANGED_MSG);
                    fontMsg->AddString("_family", fontFamilyName);
                    fontMsg->AddString("_style", fontStyleName);

                    BMenuItem* styleItem = new BMenuItem(fontStyleName, fontMsg);
                    styleItem->SetMarked(false);

                    // setInitialfont is used when we attach the FontField
                    if (!strcmp(fontStyleName, currentStyle)
                            && !strcmp(fontFamilyName, currentFamily)
                            && setInitialfont) {
                        styleItem->SetMarked(true);
                        familyItem->SetMarked(true);

                        BString string;
                        string << currentFamily << " " << currentStyle;

                        if (fFontMenuField)
                            fFontMenuField->MenuItem()->SetLabel(string.String());
                    }
                    stylemenu->AddItem(styleItem);
                }
            }
        }
        stylemenu->SetRadioMode(true);
        stylemenu->SetTargetForItems(this);
    }

    fFontFamilyMenu->SetLabelFromMarked(true);
    fFontFamilyMenu->SetTargetForItems(this);
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:59,代码来源:ControlView.cpp

示例9: 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

示例10: BMessage

void
HWindow::_InitGUI()
{
	fEventList = new HEventList();
	fEventList->SetType(BMediaFiles::B_SOUNDS);
	fEventList->SetSelectionMode(B_SINGLE_SELECTION_LIST);

	BMenu* menu = new BMenu("file");
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(B_TRANSLATE("<none>"),
		new BMessage(M_NONE_MESSAGE)));
	menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
		new BMessage(M_OTHER_MESSAGE)));

	BString label(B_TRANSLATE("Sound file:"));
	BMenuField* menuField = new BMenuField("filemenu", label, menu);
	menuField->SetDivider(menuField->StringWidth(label) + 10);

	BSize buttonsSize(be_plain_font->Size() * 2.5, be_plain_font->Size() * 2.5);

	BButton* stopbutton = new BButton("stop", "\xE2\x96\xA0",
		new BMessage(M_STOP_MESSAGE));
	stopbutton->SetEnabled(false);
	stopbutton->SetExplicitSize(buttonsSize);

	// We need at least one view to trigger B_PULSE_NEEDED events which we will
	// intercept in DispatchMessage to trigger the buttons enabling or disabling.
	stopbutton->SetFlags(stopbutton->Flags() | B_PULSE_NEEDED);

	BButton* playbutton = new BButton("play", "\xE2\x96\xB6",
		new BMessage(M_PLAY_MESSAGE));
	playbutton->SetEnabled(false);
	playbutton->SetExplicitSize(buttonsSize);

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.SetInsets(B_USE_WINDOW_SPACING)
		.Add(fEventList)
		.AddGroup(B_HORIZONTAL)
			.Add(menuField)
			.AddGroup(B_HORIZONTAL, 0)
				.Add(playbutton)
				.Add(stopbutton)
			.End()
		.End();

	// setup file menu
	_SetupMenuField();
	BMenuItem* noneItem = menu->FindItem(B_TRANSLATE("<none>"));
	if (noneItem != NULL)
		noneItem->SetMarked(true);

	_UpdateZoomLimits();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:55,代码来源:HWindow.cpp

示例11: msg

void
AddPrinterDialog::_FillTransportMenu(BMenu* menu)
{
	BMessenger msgr;
	if (GetPrinterServerMessenger(msgr) != B_OK)
		return;

	for (long idx = 0; ; idx++) {
		BMessage reply, msg(B_GET_PROPERTY);
		msg.AddSpecifier("Transport", idx);
		if (msgr.SendMessage(&msg, &reply) != B_OK)
			break;

		BMessenger transport;
		if (reply.FindMessenger("result", &transport) != B_OK)
			break;

		// Got messenger to transport now
		msg.MakeEmpty();
		msg.what = B_GET_PROPERTY;
		msg.AddSpecifier("Name");
		if (transport.SendMessage(&msg, &reply) != B_OK)
			continue;

		BString transportName;
		if (reply.FindString("result", &transportName) != B_OK)
			continue;

		// Now get ports...
		BString portId, portName;
		int32 error;
		msg.MakeEmpty();
		msg.what = B_GET_PROPERTY;
		msg.AddSpecifier("Ports");
		if (transport.SendMessage(&msg, &reply) != B_OK
				|| reply.FindInt32("error", &error) != B_OK
				|| error != B_OK
				|| (transportName == "IPP"
						&& reply.FindString("port_id", &portId) != B_OK)) {
			// Transport does not provide list of ports
			BMessage* menuMsg = new BMessage(kTransportSelectedMsg);
			menuMsg->AddString("name", transportName);
			menu->AddItem(new BMenuItem(transportName.String(), menuMsg));
			continue;
		}

		// Create submenu
		BMenu* transportMenu = new TransportMenu(transportName.String(),
			kTransportSelectedMsg, transport, transportName);
		menu->AddItem(transportMenu);
		transportMenu->SetRadioMode(true);
		menu->ItemAt(menu->IndexOf(transportMenu))->
			SetMessage(new BMessage(kTransportSelectedMsg));
	}
}
开发者ID:looncraz,项目名称:haiku,代码行数:55,代码来源:AddPrinterDialog.cpp

示例12: new_device_control

static BMenuField* new_device_control(BRect f)
{
	BMenu*						menu = new BMenu("device_menu");
	if (!menu) return NULL;
	menu->SetLabelFromMarked(true);
	menu->SetRadioMode(true);
	add_device_menu_items(menu);
	BMenuField*	field = new BMenuField(f, "device_field", "Device:", menu, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	if (!field) {
		delete menu;
		return NULL;
	}
	return field;
}
开发者ID:dtbinh,项目名称:Sequitur,代码行数:14,代码来源:SeqStudioWindow.cpp

示例13: FTHSetFSize

// --------------------------------------------------------------------- RHTML_Preferences_Win - FTHSetFSize -
void RHTMLPreferencesWin::FTHSetFSize(uint FontColor)
{
 fFTHFontBox->RemoveChild(fFTHStyle);

 font_family fFamily;
 font_style	fStyle;
  BMessage *msg;

// - Style

 BMenu *fStyleMenu;
 
 fOptions->DefaultFont->GetFamilyAndStyle(&fFamily,&fStyle);
 int32 styleNum = count_font_styles(fFamily);

 if (fOptions->FileTypes[fFTHFileTypes]->Font[FontColor]->Style.ICompare("Default style")==0)
 {
  fStyleMenu = new BMenu(fOptions->GetLocaleString("Preferences_Window_FileTypes","Default style"));
 } else
  fStyleMenu = new BMenu(fOptions->GetLocaleString("Preferences_Window_FileTypes",fOptions->FileTypes[fFTHFileTypes]->Font[FontColor]->Style.String()));

 fStyleMenu->SetRadioMode(false);
 fStyleMenu->SetLabelFromMarked(true);

 msg = new BMessage(R_FTH_Style_MSG);
 msg->AddString("font_style","Default style");
 fStyleMenu->AddItem(new BMenuItem(fOptions->GetLocaleString("Preferences_Window_FileTypes","Default style"),msg));

 for (int32 ii = 0; ii < styleNum; ii++)
 {
  get_font_style(fFamily, ii, &fStyle);
  msg = new BMessage(R_FTH_Style_MSG);
  msg->AddString("font_style", fStyle);  
  fStyleMenu->AddItem(new BMenuItem(fOptions->GetLocaleString("Preferences_Window_FileTypes",fStyle),msg));
 }
 
 fFTHStyle= new BMenuField(BRect(10,15,210,40),"Style",fOptions->GetLocaleString("Preferences_Window_FileTypes","Style"),fStyleMenu);
 fFTHStyle->SetDivider(80);
 fFTHFontBox->AddChild(fFTHStyle);
  
// - Color

 rgb_color rgb;
 rgb.alpha=fOptions->FileTypes[fFTHFileTypes]->Color[FontColor]->alpha;
 rgb.red=fOptions->FileTypes[fFTHFileTypes]->Color[FontColor]->red;
 rgb.green=fOptions->FileTypes[fFTHFileTypes]->Color[FontColor]->green;
 rgb.blue=fOptions->FileTypes[fFTHFileTypes]->Color[FontColor]->blue;
 fFTHCC->SetValue(rgb);
}
开发者ID:puckipedia,项目名称:Globe,代码行数:50,代码来源:RHTML_prefwin.cpp

示例14: BMenu

/*static*/ BMenu*
AppearancePrefView::_MakeFontSizeMenu(const char* label, uint32 command,
	const char* family, const char* style, const char* size)
{
	BMenu* menu = new BMenu(label);
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(false);

	int32 sizes[] = {
		8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, 0
	};

	bool found = false;

	for (uint32 i = 0; sizes[i]; i++) {
		BString fontSize;
		fontSize << sizes[i];
		BMessage* message = new BMessage(command);
		message->AddString("font_family", family);
		message->AddString("font_style", style);
		message->AddString("font_size", fontSize.String());
		BMenuItem* item = new BMenuItem(fontSize.String(), message);
		menu->AddItem(item);
		if (sizes[i] == atoi(size)) {
			item->SetMarked(true);
			found = true;
		}
	}

	if (!found) {
		for (uint32 i = 0; sizes[i]; i++) {
			if (sizes[i] > atoi(size)) {
				BMessage* message = new BMessage(command);
				message->AddString("font_family", family);
				message->AddString("font_style", style);
				message->AddString("font_size", size);
				BMenuItem* item = new BMenuItem(size, message);
				item->SetMarked(true);
				menu->AddItem(item, i);
				break;
			}
		}
	}

	return menu;
}
开发者ID:sahil9912,项目名称:haiku,代码行数:46,代码来源:AppearPrefView.cpp

示例15: BMessage

BMenu*
CharacterWindow::_CreateFontMenu()
{
	BMenu* menu = new BMenu(B_TRANSLATE("Font"));
	BMenuItem* item;

	font_family currentFamily;
	font_style currentStyle;
	fCharacterView->CharacterFont().GetFamilyAndStyle(&currentFamily,
		&currentStyle);

	int32 numFamilies = count_font_families();

	menu->SetRadioMode(true);

	for (int32 i = 0; i < numFamilies; i++) {
		font_family family;
		if (get_font_family(i, &family) == B_OK) {
			BMenu* subMenu = new BMenu(family);
			menu->AddItem(new BMenuItem(subMenu,
				new BMessage(kMsgFontSelected)));

			int numStyles = count_font_styles(family);
			for (int32 j = 0; j < numStyles; j++) {
				font_style style;
				uint32 flags;
				if (get_font_style(family, j, &style, &flags) == B_OK) {
					item = new BMenuItem(style, new BMessage(kMsgFontSelected));
					subMenu->AddItem(item);

					if (!strcmp(family, currentFamily)
						&& !strcmp(style, currentStyle)) {
						fSelectedFontItem = item;
						item->SetMarked(true);
					}
				}
			}
		}
	}

	item = menu->FindItem(currentFamily);
	item->SetMarked(true);

	return menu;
}
开发者ID:,项目名称:,代码行数:45,代码来源:


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