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


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

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


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

示例1: zoomRect

status_t
TWindowMenuItem::Invoke(BMessage* /*message*/)
{
	if (!fDragging) {
		if (fID >= 0) {
			int32 action = (modifiers() & B_CONTROL_KEY) != 0
				? B_MINIMIZE_WINDOW : B_BRING_TO_FRONT;

			bool doZoom = false;
			BRect zoomRect(0.0f, 0.0f, 0.0f, 0.0f);
			BMenuItem* item;
			if (!fExpanded)
				item = Menu()->Superitem();
			else
				item = this;

			if (item->Menu()->Window() != NULL) {
				zoomRect = item->Menu()->ConvertToScreen(item->Frame());
				doZoom = (fMini && action == B_BRING_TO_FRONT)
					|| (!fMini && action == B_MINIMIZE_WINDOW);
			}

			do_window_action(fID, action, zoomRect, doZoom);
		}
	}
	return B_OK;
}
开发者ID:DonCN,项目名称:haiku,代码行数:27,代码来源:WindowMenuItem.cpp

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

示例3: zoomRect

status_t
TShowHideMenuItem::Invoke(BMessage *)
{
	bool doZoom = false;
	BRect zoomRect(0, 0, 0, 0);
	BMenuItem *item = Menu()->Superitem();

	if (item->Menu()->Window() != NULL) { 
		zoomRect = item->Menu()->ConvertToScreen(item->Frame());
		doZoom = true;
	}
	return TeamShowHideCommon(static_cast<int32>(fAction), fTeams, zoomRect, doZoom);
}
开发者ID:HaikuArchives,项目名称:OpenTracker,代码行数:13,代码来源:ShowHideMenuItem.cpp

示例4: UpdateYearsMenu

/*!	\brief	Update menu of years
 *	\details	After the user selects another year, the whole 
 *				years' menu should be changed. The selected year
 *				becomes the middle of the menu, with years before
 *				and after it surrounding it from top and bottom
 *				(respectively).
 *	\param[in]	prevYear		The year that was previously selected.
 *	\param[in]	curYear		The year that is selected now.
 */
void CalendarControl::UpdateYearsMenu(int prevYear, int curYear) {
	BMenuItem* item; BMenu* menu;
	BString sb;
	BRect fr;
	sb << prevYear;
	if (!fDateSelector) return;
	if ( (item = fDateSelector->FindItem(sb.String())) == NULL) {
		return;
	}
	fr = item->Frame();
	fDateSelector->RemoveItem( item );
	delete item;
	menu = CreateYearsMenu( curYear );
	if ( menu ) {
		fDateSelector->AddItem( menu, fr );
	}
}	// <-- end of function "CalendarControl::UpdateYearsMenu"
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:26,代码来源:CalendarControl.cpp


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