本文整理汇总了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());
}
示例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);
}
}
示例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());
}
示例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 */
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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);
}
}
示例15: RememberSettings
void RIFFWAVESettingsWindow::RememberSettings(PSettings *settings)
{
BMenuItem *item;
item = formatPop->FindMarked();
if (item != NULL)
settings->WriteStringEntryValue("General", "OutputFormat", item->Label());
}