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


C++ BMenuField::Menu方法代码示例

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


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

示例1: address

/***********************************************************
 * SetFrom
 ***********************************************************/
void
HAddressView::SetFrom(const char* in_address)
{
	if( ::strlen(in_address) == 0)
		return;
	BString address(in_address);
	
	// Compare existing accounts	
	char name[B_FILE_NAME_LENGTH];
	BPath path;
	::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
	path.Append(APP_NAME);
	path.Append("Accounts");
	BDirectory dir(path.Path());
	status_t err = B_OK;
	BEntry entry;
	bool changed = false;
	
	while(err == B_OK)
	{
		if( (err = dir.GetNextEntry(&entry)) != B_OK  )
			break;
		BFile file(&entry,B_READ_ONLY);
		if(file.InitCheck() == B_OK && entry.IsFile())
		{
			BMessage msg;
			msg.Unflatten(&file);
			BString myAddress;
			PRINT(("%s\n",in_address));
			if(msg.FindString("address",&myAddress) != B_OK)
				myAddress = "";
			// Change account
			if(address.FindFirst(myAddress) != B_ERROR)
			{
				entry.GetName(name);	
				ChangeAccount(name);
				// Set From menu
				BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
				BMenu *menu = field->Menu();
				BMenuItem *item = menu->FindItem(name);
				if(item)
					item->SetMarked(true);
				changed=true;
				break;
			}
		}
	}
	
	if(!changed && cast_as(Window()->FindView("HMailView"),BTextView))
	{
		BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
		BMenuItem *item(NULL);
		item = field->Menu()->FindMarked();
		if(item)
		{
			ChangeAccount(item->Label());
			item->SetMarked(true);	
		}
	}
}
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:63,代码来源:HAddressView.cpp

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

示例3: ChangeRenamer

void PecoApp::ChangeRenamer() {
	BMenuField	*myField = (BMenuField *)fWindow->FindView("selectMode");
	BMenu		*myMenu = myField->Menu();
	if (fRenameMode != myMenu->IndexOf(myField->Menu()->FindMarked())) {
		BView	*bottomView = fWindow->FindView("bottomView");
		fWindow->Lock();
		if (fRenameMode != -1) 
			bottomView->RemoveChild((BView *)((PecoApp *)be_app)->fRenamers[fRenameMode]);
		else {
			float deltaHeight = be_plain_font->Size()*2 + 40;
			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);	
			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 );
		}
		fRenameMode = myMenu->IndexOf(myField->Menu()->FindMarked());
		bottomView->AddChild(((PecoApp *)be_app)->fRenamers[fRenameMode]);
		if (((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0) != NULL) 
			((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0)->MakeFocus();
		else
			fWindow->FindView("DoIt")->MakeFocus();
		fWindow->Unlock();
		MakeList();
	}
}
开发者ID:diversys,项目名称:PecoRename,代码行数:29,代码来源:PecoApp.cpp

示例4: getprefs

int CharismaWindow::getprefs()
{
	FILE *f;
	char s[200],param[200];
	int d;
	char fname[B_PATH_NAME_LENGTH];
	int r;
	float x,y;

	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,"r");
	if(!f)return -1;

	if(!fgets(s,sizeof s,f)) goto error;
	if(strcmp(s,"Charisma_settings\n")) goto error;
	
	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"version=%d",&d)) goto error;

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"directory=%[^\n]",g_webdir)) goto error;

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"mode=%d",&d)) goto error;
	modemenu->Menu()->ItemAt(d)->SetMarked(true);

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"smart_refresh=%d",&d)) goto error;
	smartrefresh->Menu()->ItemAt(d)->SetMarked(true);

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"external_control=%s",param)) goto error;
	extcontrol_item->SetMarked(!strcmp(param,"yes"));

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"netpositive_autoset=%s",param)) goto error;
	netposautoset_item->SetMarked(!strcmp(param,"yes"));

	if(!fgets(s,sizeof s,f)) goto error;
	if(2!=sscanf(s,"position=%f,%f\n",&x,&y)) goto error;
	MoveTo(x,y);

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"minimized=%s",&param)) goto error;
	if(!strcmp(param,"yes")) Minimize(true);

	fclose(f);
	update_proxy_settings();
	return 0;
	
error:
	fclose(f);
	update_proxy_settings();
	return -1;
}
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:59,代码来源:main.cpp

示例5:

void
BMailProtocolConfigView::SetTo(MailAddonSettings& settings)
{
 	const BMessage* archive = &settings.Settings();

	BString host = archive->FindString("server");
	if (archive->HasInt32("port"))
		host << ':' << archive->FindInt32("port");

	SetTextControl(this,"host", host.String());
	SetTextControl(this,"user", archive->FindString("username"));

	char *password = get_passwd(archive, "cpasswd");
	if (password) {
		SetTextControl(this,"pass", password);
		delete[] password;
	} else
		SetTextControl(this,"pass", archive->FindString("password"));

	if (archive->HasInt32("flavor")) {
		BMenuField *menu = (BMenuField *)(FindView("flavor"));
		if (menu != NULL) {
			if (BMenuItem *item = menu->Menu()->ItemAt(archive->FindInt32("flavor")))
				item->SetMarked(true);
		}
	}

	if (archive->HasInt32("auth_method")) {
		BMenuField *menu = (BMenuField *)(FindView("auth_method"));
		if (menu != NULL) {
			if (BMenuItem *item = menu->Menu()->ItemAt(archive->FindInt32("auth_method"))) {
				item->SetMarked(true);
				if (item->Command() != 'none') {
					enable_control("user");
					enable_control("pass");
				}
			}
		}
	}


	BCheckBox *box = (BCheckBox *)(FindView("leave_mail_on_server"));
	if (box != NULL)
		box->SetValue(archive->FindBool("leave_mail_on_server") ? B_CONTROL_ON : B_CONTROL_OFF);

	box = (BCheckBox *)(FindView("delete_remote_when_local"));
	if (box != NULL) {
		box->SetValue(archive->FindBool("delete_remote_when_local") ? B_CONTROL_ON : B_CONTROL_OFF);

		if (archive->FindBool("leave_mail_on_server"))
			box->SetEnabled(true);
		else
			box->SetEnabled(false);
	}

	if (fBodyDownloadConfig)
		fBodyDownloadConfig->SetTo(settings);
}
开发者ID:mylegacy,项目名称:haiku,代码行数:58,代码来源:ProtocolConfigView.cpp

示例6: setdefaults

void CharismaWindow::setdefaults()
{
	extcontrol_item->SetMarked(1);
	netposautoset_item->SetMarked(0);
		
	modemenu->Menu()->ItemAt(k_offline)->SetMarked(true);
	smartrefresh->Menu()->ItemAt(3)->SetMarked(true);

	update_proxy_settings();
}
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:10,代码来源:main.cpp

示例7: BMenuItem

void
BMailProtocolConfigView::AddFlavor(const char *label)
{
	BMenuField *menu = (BMenuField *)(FindView("flavor"));
	if (menu != NULL) {
		menu->Menu()->AddItem(new BMenuItem(label,NULL));
		if (menu->Menu()->FindMarked() == NULL)
			menu->Menu()->ItemAt(0)->SetMarked(true);
	}
}
开发者ID:mylegacy,项目名称:haiku,代码行数:10,代码来源:ProtocolConfigView.cpp

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

示例9: PostInit

void CPasteFunctionDialog::PostInit()
{
	fCellView = fOwner->GetCellView();
	
	BAutolock lock(this);
	if (!lock.IsLocked())
		THROW((errLockWindow));

	fList = (BListView *)FindView("list");
	fList->SetInvocationMessage(new BMessage(msg_OK));
	fList->SetSelectionMessage(new BMessage(msg_FuncChanged));
//	fList->SetFont(be_plain_font);

	fFuncDescription = (BTextView *)FindView("desc");

	BMenuField *mf = dynamic_cast<BMenuField *>(FindView("group"));
	fMenu = mf->Menu();
	fMenu->AddItem(new BMenuItem("All", new BMessage(msg_MenuChanged)));
	fMenu->AddSeparatorItem();
	fMenu->AddItem(new BMenuItem("Cell", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Date-Time", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Financial", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Math", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Statistical", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Text", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Logical", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Engineering", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Plugins", new BMessage(msg_MenuChanged)));

	fMenu->FindItem("All")->SetMarked(true);

	FillList();
	
	Show();
} /* CPasteFunctionDialog::CPasteFunctionDialog */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:35,代码来源:PasteFunctionDialog.cpp

示例10:

status_t
NotifierConfigView::SaveInto(BMailAddOnSettings& settings) const
{
	int32 method = 0;

	BMenuField *field;
	if ((field = dynamic_cast<BMenuField *>(FindView("notify"))) != NULL) {
		for (int32 i = field->Menu()->CountItems(); i-- > 0;) {
			BMenuItem *item = field->Menu()->ItemAt(i);
			if (item->IsMarked())
				method |= 1L << i;
		}
	}

	return settings.SetInt32("notification_method", method);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:16,代码来源:NotifierConfigView.cpp

示例11: SetValue

void HDialog::SetValue(const char *id, int value)
{
	BView *v = FindView(id);
	if (v == NULL) THROW(("View '%s' not found", id));

	if (typeid(*v) == typeid(BMenuField))
	{
		BMenuField *mf = static_cast<BMenuField*>(v);
		BMenuItem *item = mf->Menu()->ItemAt(value - 1);
		if (item)
			item->SetMarked(true);
		return;
	}
	else if (typeid(*v) == typeid(BTextControl))
	{
		char b[32];
		sprintf(b, "%d", value);
		SetText(id, b);
		return;
	}
	else if (typeid(*v) == typeid(BSlider))
	{
		static_cast<BSlider*>(v)->SetValue(value);
		return;
	}

	THROW(("view '%s' not found", id));
} // HDialog::SetValue
开发者ID:HaikuArchives,项目名称:Pe,代码行数:28,代码来源:HDialog.cpp

示例12: BMessage

void
TestWindow::AddTest(Test* test)
{
	if (test == NULL || fTests.HasItem(test))
		return;

	if (!fTests.AddItem(test)) {
		delete test;
		return;
	}

	BMessage* message = new BMessage(MSG_SELECT_TEST);
	message->AddInt32("index", fTests.CountItems() - 1);

	BMenuItem* item = new BMenuItem(test->Name(), message);
	if (!fTestSelectionField->Menu()->AddItem(item)) {
		fTests.RemoveItem(fTests.CountItems() - 1);
		delete test;
		delete item;
		return;
	}

	if (fTests.CountItems() == 1)
		SetToTest(0);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:25,代码来源:main.cpp

示例13:

/***********************************************************
 * 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

示例14: UpdatePopUpPriorityMenu

void TeamListView::UpdatePopUpPriorityMenu()
{
	BMenuField *Priority = (BMenuField *)slayer->mainWindow->FindView("MainPriorityField");
	BMenu *menu = Priority->Menu();
	BMenuItem *item;
	int32 i;
	for (i = 2; (item = menu->ItemAt(i)); i++) {
		priorityMenu->ItemAt(i-2)->SetMarked(item->IsMarked());
		priorityMenu->ItemAt(i-2)->SetEnabled(item->IsEnabled());
	}
}
开发者ID:diversys,项目名称:Slayer,代码行数:11,代码来源:TeamListView.cpp

示例15:

void
TestWindow::SetToTest(int32 index)
{
	Test* test = (Test*)fTests.ItemAt(index);
	if (test == NULL)
		return;

	fTestSelectionField->Menu()->ItemAt(index)->SetMarked(true);

	fClippingTestView->SetTestRenderer(test->ClippingTest());
	fValidateTestView->SetTestRenderer(test->ValidateTest());
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:12,代码来源:main.cpp


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