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


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

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


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

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

示例2: selections

void
PopUpResults(vector<BString>& results, MTextAddOn* addon)
{
	BPopUpMenu selections("API Selections", false, false);
	selections.SetFont(be_plain_font);

	for (uint32 i = 0; i < results.size(); i++) {
		BMenuItem* item = new BMenuItem(FormatResultString(results[i]).String(),
										new BMessage(i));
		selections.AddItem(item);
	}

	// Here we get a nice BPoint to popup the results (end of the toolbar).
	BPoint menupos;

	if (addon->Window()->Lock()) {
		float x = addon->Window()->FindView("ButtonBar")->Frame().right + 2;
		float y = addon->Window()->FindView("ToolBar")->Frame().Height() - 2;

		menupos = addon->Window()->Frame().LeftTop() + BPoint(x, y);
		addon->Window()->Unlock();
	}

	BMenuItem* item = selections.Go(menupos, false, true);

	if (item != NULL) {
		int index = item->Command();
		OpenDoc(results[index].String());
	}
}
开发者ID:jscipione,项目名称:Paladin,代码行数:30,代码来源:BeBookFetch.cpp

示例3: menu

void
TListView::MouseDown(BPoint point)
{
	int32 buttons;	
	Looper()->CurrentMessage()->FindInt32("buttons",&buttons);

	if (buttons & B_SECONDARY_MOUSE_BUTTON)
	{
		BFont font = *be_plain_font;
		font.SetSize(10);

		BPopUpMenu menu("enclosure", false, false);
		menu.SetFont(&font);
		menu.AddItem(new BMenuItem(TR("Open attachment"),
			new BMessage(LIST_INVOKED)));
		menu.AddItem(new BMenuItem(TR("Remove attachment"),
			new BMessage(M_REMOVE)));

		BPoint menuStart = ConvertToScreen(point);
		
		BMenuItem *item;
		if ((item = menu.Go(menuStart)) != NULL)
		{
			if (item->Command() == LIST_INVOKED)
			{
				BMessage msg(LIST_INVOKED);
				msg.AddPointer("source",this);
				msg.AddInt32("index",IndexOf(point));
				Window()->PostMessage(&msg,fParent);
			}
			else
			{
				Select(IndexOf(point));
				Window()->PostMessage(item->Command(),fParent);
			}
		}
	}
	else
		BListView::MouseDown(point);
}
开发者ID:mmanley,项目名称:Antares,代码行数:40,代码来源:Enclosures.cpp

示例4:

status_t
InterfaceAddressView::Save()
{
	BMenuItem* item = fModePopUpMenu->FindMarked();
	if (item == NULL)
		return B_ERROR;

	fSettings->SetIP(fFamily, fAddressField->Text());
	fSettings->SetNetmask(fFamily, fNetmaskField->Text());
	fSettings->SetGateway(fFamily, fGatewayField->Text());
	fSettings->SetAutoConfigure(fFamily, item->Command() == M_MODE_AUTO);

	return B_OK;
}
开发者ID:mylegacy,项目名称:haiku,代码行数:14,代码来源:InterfaceAddressView.cpp

示例5: ItemsToPopUpPriorityMenu

void TeamListView::ItemsToPopUpPriorityMenu()
{
	BMenuField *Priority = (BMenuField *)slayer->mainWindow->FindView("MainPriorityField");
	BMenu *menu = Priority->Menu();
	BMenuItem *add;
	int32 i;
	for (i = 2; (add = menu->ItemAt(i)); i++) {
		BMenuItem *newItem;
		if (add->Label() && add->Label()[0])
			newItem = new BMenuItem(add->Label(), new BMessage(
				add->Command()));
		else
			newItem = new BSeparatorItem();
			
		newItem->SetTarget(slayer->mainWindow);
		priorityMenu->AddItem(newItem);
	}
		// priorityMenu->AddItem(add);
}
开发者ID:diversys,项目名称:Slayer,代码行数:19,代码来源:TeamListView.cpp


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