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


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

本文整理汇总了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;
}
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:33,代码来源:main.cpp

示例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;
		}
	}
}
开发者ID:passick,项目名称:Paladin,代码行数:58,代码来源:TemplateWindow.cpp

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

示例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);
	}
}		
开发者ID:HaikuArchives,项目名称:DataPlus,代码行数:26,代码来源:DRRegrView.cpp

示例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;
}
开发者ID:HaikuArchives,项目名称:Hare,代码行数:33,代码来源:GoGoEncoder.cpp

示例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();

}
开发者ID:diversys,项目名称:PecoRename,代码行数:31,代码来源:PecoApp.cpp

示例7:

/***********************************************************
 * Attribute
 ***********************************************************/
int32
HCriteriaView::Attribute() const
{
	BMenu *menu = fAttrMenu->Menu();
	BMenuItem *item = menu->FindMarked();
	if(item)
		return menu->IndexOf(item);
	return 0;	
}
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:12,代码来源:HCriteriaView.cpp

示例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();
}
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:13,代码来源:HAddressView.cpp

示例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);
	}
}
开发者ID:,项目名称:,代码行数:49,代码来源:

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

示例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);
        }
    }
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:15,代码来源:ControlView.cpp

示例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;
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:16,代码来源:ArpFontControl.cpp

示例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();
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:45,代码来源:AddPrinterDialog.cpp

示例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;
}
开发者ID:mmanley,项目名称:Antares,代码行数:23,代码来源:OptionPopUp.cpp

示例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
开发者ID:HaikuArchives,项目名称:Pe,代码行数:20,代码来源:HDialog.cpp


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