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


C++ TTeamMenuItem::HasLabel方法代码示例

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


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

示例1: TeamItemAtPoint

void
TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message)
{
	if (message == NULL) {
		// force a cleanup
		_FinishedDrag();

		switch (code) {
			case B_ENTERED_VIEW:
			case B_INSIDE_VIEW:
			{
				TTeamMenuItem* item = TeamItemAtPoint(where);
				if (item == NULL) {
					// item is NULL, break out
					fLastMousedOverItem = NULL;
					break;
				}

				if (item->HasLabel()) {
					// item has a visible label, set the item and break out
					fLastMousedOverItem = item;
					break;
				}

				if (item == fLastMousedOverItem) {
					// already set the tooltip for this item, break out
					break;
				}

				// new item, update the tooltip with the item name
				SetToolTip(item->Name());

				// save the current item for the next MouseMoved() call
				fLastMousedOverItem = item;

				break;
			}

			case B_OUTSIDE_VIEW:
			case B_EXITED_VIEW:
				fLastMousedOverItem = NULL;
				break;
		}

		BMenuBar::MouseMoved(where, code, message);
		return;
	}

	uint32 buttons;
	if (Window()->CurrentMessage() == NULL
		|| Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons)
			< B_OK) {
		buttons = 0;
	}

	if (buttons == 0)
		return;

	switch (code) {
		case B_ENTERED_VIEW:
			// fPreviousDragTargetItem should always be NULL here anyways.
			if (fPreviousDragTargetItem)
				_FinishedDrag();

			fBarView->CacheDragData(message);
			fPreviousDragTargetItem = NULL;
			break;

		case B_OUTSIDE_VIEW:
			// NOTE: Should not be here, but for the sake of defensive
			// programming...
		case B_EXITED_VIEW:
			_FinishedDrag();
			break;

		case B_INSIDE_VIEW:
			if (fBarView->Dragging()) {
				TTeamMenuItem* item = NULL;
				int32 itemCount = CountItems();
				for (int32 i = 0; i < itemCount; i++) {
					BMenuItem* _item = ItemAt(i);
					if (_item->Frame().Contains(where)) {
						item = dynamic_cast<TTeamMenuItem*>(_item);
						break;
					}
				}
				if (item == fPreviousDragTargetItem)
					break;
				if (fPreviousDragTargetItem != NULL)
					fPreviousDragTargetItem->SetOverrideSelected(false);
				if (item != NULL)
					item->SetOverrideSelected(true);
				fPreviousDragTargetItem = item;
			}
			break;
	}
}
开发者ID:,项目名称:,代码行数:97,代码来源:


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