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


C++ BMenuItem::Label方法代码示例

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


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

示例1: strcasecmp

static int
compare_menu_items(const void* _a, const void* _b)
{
	BMenuItem* a = *(BMenuItem**)_a;
	BMenuItem* b = *(BMenuItem**)_b;

	return strcasecmp(a->Label(), b->Label());
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:8,代码来源:PreferredAppMenu.cpp

示例2: MessageReceived

void RecipeEditor::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case M_QUIT_APP:
		{
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		}
		case M_CATEGORY_CHANGED:
		{
			BString name;
			if(msg->FindString("name",&name)==B_OK)
				fCategory = name;
			break;
		}
		case M_EDIT_RECIPE:
		{
			BMenuItem *item = fCategories->FindMarked();
			if(fCategory.Compare(item->Label()) == 0)
			{
				UpdateRecipe(fNumber, fCategory.String(), fNameBox->Text(),
						fIngredientBox->Text(), fDirectionsBox->Text());
			}
			else
			{
				// we're also recategorizing the recipe, so we'll just delete the old
				// one and add it to the new one
				DeleteRecipe(fNumber, fCategory.String());
				AddRecipe(fCategory.String(), fNameBox->Text(),
						fIngredientBox->Text(), fDirectionsBox->Text());
			}
			fMessenger.SendMessage(M_SET_RECIPE);
			PostMessage(B_QUIT_REQUESTED);
			break;
		}
		case M_ADD_RECIPE:
		{
			if(fCategory.CountChars() < 1)
			{
				BMenuItem *item = fCategories->FindMarked();
				if(item)
					fCategory = item->Label();
				else
					fCategory = "Misc";
			}
			
			AddRecipe(fCategory.String(), fNameBox->Text(),
					fIngredientBox->Text(), fDirectionsBox->Text());
			PostMessage(B_QUIT_REQUESTED);
			break;
		}
		default:
			BWindow::MessageReceived(msg);
	}
}
开发者ID:HaikuArchives,项目名称:Recibe,代码行数:56,代码来源:RecipeEditor.cpp

示例3:

static int
compare_void_menu_items(const void* _a, const void* _b)
{
	static BCollator collator;

	BMenuItem* a = *(BMenuItem**)_a;
	BMenuItem* b = *(BMenuItem**)_b;

	return collator.Compare(a->Label(), b->Label());
}
开发者ID:looncraz,项目名称:haiku,代码行数:10,代码来源:BootPromptWindow.cpp

示例4: GrabNewFont

void CPrefsDialog::GrabNewFont()
{
	BMenuItem *item;
	
	item = fDocFont->FindMarked();
	if (item) strcpy(fNewFontFamily, item->Label());
	fNewFontSize = atof(GetText("docsize"));
	item = fBorderFont->FindMarked();
	if (item) strcpy(fNewBFontFamily, item->Label());
	fNewBFontSize = atof(GetText("bordersize"));
} /* CPrefsDialog::GrabNewFont */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:11,代码来源:PrefsDialog.cpp

示例5: str

status_t
PMenuItem::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	BMenuItem *backend = (BMenuItem*)fBackend;
	if (str.ICompare("Message") == 0)
		((IntProperty*)prop)->SetValue(backend->Command());
	else if (str.ICompare("Trigger") == 0)
		((CharProperty*)prop)->SetValue(backend->Trigger());
	else if (str.ICompare("Label") == 0)
		((StringProperty*)prop)->SetValue(backend->Label());
	else if (str.ICompare("Frame") == 0)
		((RectProperty*)prop)->SetValue(backend->Frame());
	else if (str.ICompare("Marked") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsMarked());
	else if (str.ICompare("Enabled") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsEnabled());
	else
	{
		return PObject::GetProperty(name, value, index);
	}

	return prop->GetValue(value);
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:31,代码来源:PMenuItem.cpp

示例6: BString

void
IPSettingsView::_ApplyControlsToConfiguration()
{
	fSettings->SetIP(fIPTextControl->Text());
	fSettings->SetNetmask(fNetMaskTextControl->Text());
	fSettings->SetGateway(fGatewayTextControl->Text());

	if (!fNetworkMenuField->IsHidden(fNetworkMenuField)) {
		if (fNetworkMenuField->Menu()->ItemAt(0)->IsMarked()) {
			fSettings->SetWirelessNetwork(NULL);
		} else {
			BMenuItem* item = fNetworkMenuField->Menu()->FindMarked();
			if (item != NULL)
				fSettings->SetWirelessNetwork(item->Label());
		}
	}

	fSettings->SetAutoConfigure(
		strcmp(fTypeMenuField->Menu()->FindMarked()->Label(),
			B_TRANSLATE("DHCP")) == 0);

	fSettings->SetDisabled(
		strcmp(fTypeMenuField->Menu()->FindMarked()->Label(),
			B_TRANSLATE("Disabled")) == 0);

	fSettings->NameServers().MakeEmpty();
	fSettings->NameServers().AddItem(new BString(
		fPrimaryDNSTextControl->Text()));
	fSettings->NameServers().AddItem(new BString(
		fSecondaryDNSTextControl->Text()));
	fSettings->SetDomain(fDomainTextControl->Text());

	fApplyButton->SetEnabled(false);
	fRevertButton->SetEnabled(true);
}
开发者ID:dakk,项目名称:Haiku-WIPs,代码行数:35,代码来源:IPSettingsView.cpp

示例7: MessageReceived

void ToolbarView::MessageReceived(BMessage *msg) {
UT_UTF8String ucsText;
	switch (msg->what) {
	case 'ddwn': {
		int32 i, id, item;
		msg->FindInt32("id", &id);
		msg->FindInt32("item", &item);
		
		for (i=0; i<item_count; i++) {
			if (items[i].id == id)
				break;
		}
		if(i >= item_count) {
			return;
		}
		BMenuItem *mnuitem;
		mnuitem = items[i].menu->Menu()->FindMarked();
		//char buffer[255];
		//strcpy(buffer, mnuitem->Label());
		ucsText = mnuitem->Label();
		m_pBeOSToolbar->toolbarEvent(id, ucsText.ucs4_str().ucs4_str(), ucsText.ucs4_str().length());
		break;
	}
		
	default:		
		BView::MessageReceived(msg);
	}
}
开发者ID:HaikuArchives,项目名称:AbiWord,代码行数:28,代码来源:ev_BeOSToolbar.cpp

示例8:

bool
AutoConfigView::GetBasicAccountInfo(account_info &info)
{
	status_t status = B_OK;

	BString inboundProtocolName = "";
	BMenuItem* item = fInProtocolsField->Menu()->FindMarked();
	if (item) {
		inboundProtocolName = item->Label();
		item->Message()->FindRef("protocol", &(info.inboundProtocol));
	}
	else
		status = B_ERROR;

	if (inboundProtocolName.FindFirst("IMAP") >= 0)
		info.inboundType = IMAP;
	else
		info.inboundType = POP;

	info.outboundProtocol = fSMTPAddOnRef;
	info.name = fNameView->Text();
	info.accountName = fAccountNameView->Text();
	info.email = fEmailView->Text();
	info.loginName = fLoginNameView->Text();
	info.password = fPasswordView->Text();

	return status;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:28,代码来源:AutoConfigView.cpp

示例9: node

extern "C" void
process_refs(entry_ref dir, BMessage* message, void* /*reserved*/)
{
	BPopUpMenu* menu = new BPopUpMenu("status");
	retrieve_status_items(menu);

	BMenuItem* item = menu->Go(mouse_position() - BPoint(5, 5), false, true);
	if (item == NULL)
		return;

	BString status = item->Label();

	entry_ref ref;
	for (int i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) {
		BNode node(&ref);
		BString type;

		if (node.InitCheck() == B_OK
			&& node.ReadAttrString("BEOS:TYPE", &type) == B_OK
			&& type == "text/x-email") {
			BString previousStatus;

			// Only update the attribute if there is an actual change
			if (node.ReadAttrString("MAIL:status", &previousStatus) != B_OK
				|| previousStatus != status)
				node.WriteAttrString("MAIL:status", &status);
		}
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:29,代码来源:MarkAs.cpp

示例10:

void
AppearancePrefView::_SetCurrentColorScheme()
{
	PrefHandler* pref = PrefHandler::Default();

	gCustomColorScheme.text_fore_color = pref->getRGB(PREF_TEXT_FORE_COLOR);
	gCustomColorScheme.text_back_color = pref->getRGB(PREF_TEXT_BACK_COLOR);
	gCustomColorScheme.select_fore_color = pref->getRGB(PREF_SELECT_FORE_COLOR);
	gCustomColorScheme.select_back_color = pref->getRGB(PREF_SELECT_BACK_COLOR);
	gCustomColorScheme.cursor_fore_color = pref->getRGB(PREF_CURSOR_FORE_COLOR);
	gCustomColorScheme.cursor_back_color = pref->getRGB(PREF_CURSOR_BACK_COLOR);

	const char* currentSchemeName = NULL;

	for (const color_scheme** schemes = gPredefinedColorSchemes;
			*schemes != NULL; schemes++) {
		if (gCustomColorScheme == **schemes) {
			currentSchemeName = (*schemes)->name;
			break;
		}
	}

	for (int32 i = 0; i < fColorSchemeField->Menu()->CountItems(); i++) {
		BMenuItem* item = fColorSchemeField->Menu()->ItemAt(i);
		if (strcmp(item->Label(), currentSchemeName) == 0) {
			item->SetMarked(true);
			break;
		}
	}
}
开发者ID:sahil9912,项目名称:haiku,代码行数:30,代码来源:AppearPrefView.cpp

示例11: BMenu

BMenu *
TestView::AddMenuSorted(BMenu *parent,const char *name)
{
	// XXX: TODO: This doesn't work for some reason -- the items aren't sorted :(
	
	if (!name)
		return NULL;
	
	BMenu *menu = new BMenu(name);
	
	for (int32 i = 0; i < parent->CountItems(); i++)
	{
		BMenuItem *item = parent->ItemAt(i);
		
		if (strcmp(item->Label(),name) == -1)
		{
//		printf("INSERT: %s is after %s\n",name,item->Label());
			parent->AddItem(menu,i);
			return menu;
		}
	}
	
//	if (parent->CountItems())
//		printf("%s is after %s\n",name,parent->ItemAt(parent->CountItems() - 1)->Label());
//	else
//		printf("%s is last\n",name);

	parent->AddItem(menu);
	return menu;
}
开发者ID:puckipedia,项目名称:Filer,代码行数:30,代码来源:TestView.cpp

示例12: if

int32
GoGoEncoder::GetFormat(char* format) {
	PRINT(("GoGoEncoder::GetFormat(char*)\n"));

	BMenuItem* item;
	BMenu* formatMenu;

	item = menu->FindItem(OUTPUT_FORMAT_STR);
	if (!item) {
		return B_ERROR;
	}
	formatMenu = item->Submenu();
	if (!formatMenu) {
		return B_ERROR;
	}

	item = formatMenu->FindMarked();
	if (!item) {
		return B_ERROR;
	}

	const char* label = item->Label();

	if (strcmp(label, STEREO) == 0) {
		strcpy(format, STEREO_CODE);
	} else if (strcmp(label, MONO) == 0) {
		strcpy(format, MONO_CODE);
	} else if (strcmp(label, JSTEREO) == 0) {
		strcpy(format, JSTEREO_CODE);
	}

	return B_OK;
}
开发者ID:HaikuArchives,项目名称:Hare,代码行数:33,代码来源:GoGoEncoder.cpp

示例13:

void
FrequencyMenu::UpdateMenu()
{
	freq_preferences* pref = fStorage->GetPreferences();
	switch (pref->mode) {
		case DYNAMIC:
			_SetL1MenuLabelFrom(fDynamicPerformance);
			break;

		case PERFORMANCE:
			_SetL1MenuLabelFrom(fHighPerformance);
			break;

		case LOW_ENERGIE:
			_SetL1MenuLabelFrom(fLowEnergie);
			break;

		case CUSTOM:
		{
			BMenuItem* markedItem = fCustomStateMenu->FindMarked();
			if (markedItem)
				markedItem->SetMarked(false);
			BMenuItem* customItem
				= fCustomStateMenu->ItemAt(pref->custom_stepping);
			if (customItem)
				customItem->SetMarked(true);
			BMenuItem* superItem = fCustomStateMenu->Supermenu()->Superitem();
			if (superItem && customItem)
				superItem->SetLabel(customItem->Label());
			break;
		}
	}
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:33,代码来源:StatusView.cpp

示例14:

void
TermWindow::_GetPreferredFont(BFont& font)
{
	// Default to be_fixed_font
	font = be_fixed_font;

	const char* family
		= PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY);
	const char* style
		= PrefHandler::Default()->getString(PREF_HALF_FONT_STYLE);
	const char* size = PrefHandler::Default()->getString(PREF_HALF_FONT_SIZE);

	font.SetFamilyAndStyle(family, style);
	font.SetSize(atoi(size));

	// mark the font size menu item
	for (int32 i = 0; i < fFontSizeMenu->CountItems(); i++) {
		BMenuItem* item = fFontSizeMenu->ItemAt(i);
		if (item == NULL)
			continue;

		item->SetMarked(false);
		if (strcmp(item->Label(), size) == 0)
			item->SetMarked(true);
	}
}
开发者ID:DonCN,项目名称:haiku,代码行数:26,代码来源:TermWindow.cpp

示例15: RememberSettings

void RIFFWAVESettingsWindow::RememberSettings(PSettings *settings)
{
	BMenuItem *item;

	item = formatPop->FindMarked();
	if (item != NULL)
		settings->WriteStringEntryValue("General", "OutputFormat", item->Label());
}
开发者ID:pulkomandy,项目名称:APlayer,代码行数:8,代码来源:RIFF-WAVESettingsWindow.cpp


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