本文整理汇总了C++中BMenu::FindMarked方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenu::FindMarked方法的具体用法?C++ BMenu::FindMarked怎么用?C++ BMenu::FindMarked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenu
的用法示例。
在下文中一共展示了BMenu::FindMarked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveprefs
int CharismaWindow::saveprefs()
{
FILE *f;
BMenu *m;
char fname[B_PATH_NAME_LENGTH];
int r;
BRect rect;
r=find_directory(B_COMMON_SETTINGS_DIRECTORY,0,true,fname,sizeof fname);
if(r) return r;
strcat(fname,"/");
strcat(fname,"Charisma_settings");
f=fopen(fname,"w");
if(!f)return -1;
fprintf(f,"Charisma_settings\n");
fprintf(f,"version=1\n");
fprintf(f,"directory=%s\n",g_webdir);
m=modemenu->Menu();
fprintf(f,"mode=%d\n",m->IndexOf(m->FindMarked()));
m=smartrefresh->Menu();
fprintf(f,"smart_refresh=%d\n",m->IndexOf(m->FindMarked()));
fprintf(f,"external_control=%s\n",extcontrol_item->IsMarked()?"yes":"no");
fprintf(f,"netpositive_autoset=%s\n",netposautoset_item->IsMarked()?"yes":"no");
rect=Frame();
fprintf(f,"position=%f,%f\n",rect.left,rect.top);
fprintf(f,"minimized=%s\n",isminim?"yes":"no");
fclose(f);
return 0;
}
示例2: projmsg
void
TemplateWindow::MessageReceived(BMessage *msg)
{
switch (msg->what)
{
case M_NAME_CHANGED:
case M_TARGET_CHANGED:
{
if (fNameBox->Text() && strlen(fNameBox->Text()) > 0 &&
fTargetBox->Text() && strlen(fTargetBox->Text()) > 0)
fOK->SetEnabled(true);
else
fOK->SetEnabled(false);
break;
}
case M_CREATE_PROJECT:
{
BMenu *menu = fTemplateField->Menu();
BMenuItem *item = menu->FindMarked();
if (!item)
break;
int32 selection = menu->IndexOf(item);
ProjectTemplate *ptemp = fTempList.TemplateAt(selection);
BMessage projmsg(M_CREATE_PROJECT),reply;
projmsg.AddString("name",fNameBox->Text());
projmsg.AddString("target",fTargetBox->Text());
projmsg.AddInt32("type",ptemp->TargetType());
projmsg.AddString("path",fPathBox->Path());
projmsg.AddString("template", ptemp->GetRef().name);
projmsg.AddString("pldfile", ptemp->ProjectFileName());
BMenu *scmMenu = fSCMChooser->Menu();
int32 scm = scmMenu->IndexOf(scmMenu->FindMarked());
projmsg.AddInt32("scmtype",scm);
if (!ptemp->ProjectFileName())
{
for (int32 i = 0; i < ptemp->CountFiles(); i++)
projmsg.AddRef("refs",ptemp->FileAt(i));
for (int32 i = 0; i < ptemp->CountLibs(); i++)
projmsg.AddRef("libs",ptemp->LibAt(i));
}
projmsg.AddBool("createfolder",(fCreateFolder->Value() == B_CONTROL_ON));
be_app_messenger.SendMessage(&projmsg,&reply);
PostMessage(B_QUIT_REQUESTED);
break;
}
default:
{
DWindow::MessageReceived(msg);
break;
}
}
}
示例3: bool
void
Renamer_Remove::DetachedFromWindow()
{
BMessage msg;
msg.AddInt32("pos1", fPosition1->Value());
msg.AddInt32("pos2", fPosition2->Value());
BMenu* menu = fDirection1->Menu();
msg.AddBool("direction1", bool(menu->IndexOf(menu->FindMarked())));
menu = fDirection2->Menu();
msg.AddBool("direction2", bool(menu->IndexOf(menu->FindMarked())));
UpdatePreferences("ren_remove", msg);
}
示例4: BMessage
// -------------------------------------------------------------------
void
DRRegrView::MessageReceived(BMessage* theMesg)
{
BMessage* dispMesg;
int16 itemChecked;
BMenu* theMenu;
switch (theMesg->what) {
case apply_change :
dispMesg = new BMessage(set_display);
dispMesg->AddInt64(disp_set_name,mKey);
dispMesg->AddInt16(disp_mark_name,mPlotMark->PlotMark());
dispMesg->AddInt32(mark_col_name,mColorCtrl->Value());
theMenu = mLineSelect->Menu();
itemChecked = theMenu->IndexOf(theMenu->FindMarked());
dispMesg->AddInt16(disp_line_name,itemChecked);
be_app->PostMessage(dispMesg);
delete dispMesg;
break;
default :
BView::MessageReceived(theMesg);
}
}
示例5: 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;
}
示例6: NoRenamer
void PecoApp::NoRenamer() {
if (fRenameMode == MODE_NONE) return;
fWindow->Lock();
BMenuField *myField = (BMenuField *)fWindow->FindView("selectMode");
BMenu *myMenu = myField->Menu();
myMenu->FindMarked()->SetMarked(false);
myField->MenuItem()->SetLabel(STR_PLEASE_SELECT);
BView *bottomView = fWindow->FindView("bottomView");
bottomView->RemoveChild((BView *)((PecoApp *)be_app)->fRenamers[fRenameMode]);
fRenameMode = MODE_NONE;
float deltaHeight = - be_plain_font->Size()*2 - 40;
float min_h, max_h, min_v, max_v;
fWindow->GetSizeLimits( &min_h, &max_h, &min_v, &max_v );
fWindow->SetSizeLimits( min_h, max_h, min_v + deltaHeight, max_v );
fWindow->FindView("topView")->SetResizingMode(0);
fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
fWindow->ResizeBy(0, deltaHeight);
fWindow->FindView("topView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_BOTTOM);
fWindow->Unlock();
}
示例7:
/***********************************************************
* Attribute
***********************************************************/
int32
HCriteriaView::Attribute() const
{
BMenu *menu = fAttrMenu->Menu();
BMenuItem *item = menu->FindMarked();
if(item)
return menu->IndexOf(item);
return 0;
}
示例8:
/***********************************************************
* AccountName
***********************************************************/
const char*
HAddressView::AccountName()
{
BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
BMenu *menu = field->Menu();
BMenuItem *item = menu->FindMarked();
if(!item)
return NULL;
return item->Label();
}
示例9:
void
PreferenceFont::MessageReceived (BMessage *msg)
{
switch (msg->what)
{
case M_FONT_CHANGE:
{
const char *family, *style;
BMenuItem *item;
int32 which;
msg->FindInt32 ("which", &which);
// Unmark
for (int32 i = 0; i < clientFont[which]->Menu()->CountItems(); ++i)
{
BMenu *menu (clientFont[which]->Menu()->SubmenuAt (i));
if ((item = menu->FindMarked()) != 0)
{
item->SetMarked (false);
break;
}
}
msg->FindPointer ("source", reinterpret_cast<void **>(&item));
item->SetMarked (true);
msg->FindString ("family", &family);
msg->FindString ("style", &style);
clientFont[which]->MenuItem()->SetLabel (family);
bowser_app->ClientFontFamilyAndStyle (which, family, style);
break;
}
case M_FONT_SIZE_CHANGE:
{
int32 which, size;
msg->FindInt32 ("which", &which);
msg->FindInt32 ("size", &size);
bowser_app->ClientFontSize (which, size);
}
default:
BView::MessageReceived (msg);
}
}
示例10: l
void T9InputServerMethod::SetMode(T9Mode mode)
{
BAutolock l(fLocker);
BMenuItem *item;
// XXX: check
fMode = mode;
item = fDeskbarMenu->FindMarked();
if (item)
item->SetMarked(false);
item = fDeskbarMenu->ItemAt((int32)mode);
if (item)
item->SetMarked(true);
// necessary to update the copy used by the Deskbar icon.
SetMenu(fDeskbarMenu, BMessenger(this));
}
示例11:
void
ControlView::_DeselectOldItems()
{
BMenuItem* oldItem = fFontFamilyMenu->FindMarked();
if (oldItem) {
oldItem->SetMarked(false);
BMenu* submenu = oldItem->Submenu();
if (submenu) {
BMenuItem* marked = submenu->FindMarked();
if (marked)
marked->SetMarked(false);
}
}
}
示例12: Font
ArpFont ArpFontControl::Font() const
{
ArpFont f;
if (!mFontCtrl || !mSizeCtrl) return f;
BMenu* m = mFontCtrl->Menu();
if (!m) return f;
BMenuItem* item = m->FindMarked();
if (!item) return f;
const BString16* lbl = item->Label();
if (lbl) {
BString16 s(*lbl);
f.SetFamilyAndStyle(&s);
}
f.SetSize(float(mSizeCtrl->Value()));
return f;
}
示例13:
void
AddPrinterDialog::_HandleChangedTransport(BMessage *msg)
{
BString name;
if (msg->FindString("name", &name) != B_OK) {
name = "";
}
fTransportText = name;
BString path;
if (msg->FindString("path", &path) == B_OK) {
// transport path selected
fTransportPathText = path;
// mark sub menu
void* pointer;
if (msg->FindPointer("source", &pointer) == B_OK) {
BMenuItem* item = (BMenuItem*)pointer;
// Update printer name with Transport Path if not filled in
if (strlen(fName->Text()) == 0)
fName->SetText(item->Label());
BMenu* menu = item->Menu();
int32 index = fTransport->IndexOf(menu);
item = fTransport->ItemAt(index);
if (item != NULL)
item->SetMarked(true);
}
} else {
// transport selected
fTransportPathText = "";
// remove mark from item in sub menu of transport sub menu
for (int32 i = fTransport->CountItems() - 1; i >= 0; i --) {
BMenu* menu = fTransport->SubmenuAt(i);
if (menu != NULL) {
BMenuItem* item = menu->FindMarked();
if (item != NULL)
item->SetMarked(false);
}
}
}
_Update();
}
示例14:
/*! \brief Gets the currently selected option.
\param outName A pointer to a string which will held the option's name.
\param outValue A pointer to an integer which will held the option's value.
\return The index of the selected option.
*/
int32
BOptionPopUp::SelectedOption(const char **outName, int32 *outValue) const
{
BMenu *menu = fMenuField->Menu();
if (menu != NULL) {
BMenuItem *marked = menu->FindMarked();
if (marked != NULL) {
if (outName != NULL)
*outName = marked->Label();
if (outValue != NULL)
marked->Message()->FindInt32("be:value", outValue);
return menu->IndexOf(marked);
}
}
return B_ERROR;
}
示例15: GetValue
int HDialog::GetValue(const char *id) const
{
BView *v = FindView(id);
if (v == NULL) THROW(("View '%s' not found", id));
// according to stroustrup I shouldn't do this:
if (typeid(*v) == typeid(BMenuField))
{
BMenu *menu = static_cast<BMenuField*>(v)->Menu();
return std::max(menu->IndexOf(menu->FindMarked()) + 1, (int32)1);
}
else if (typeid(*v) == typeid(BTextControl))
return atoi(GetText(id));
else if (typeid(*v) == typeid(BSlider))
return static_cast<BSlider*>(v)->Value();
THROW(("view '%s' not of valid type", id));
return 0;
} // HDialog::GetValue