本文整理汇总了C++中TTeamMenuItem::Label方法的典型用法代码示例。如果您正苦于以下问题:C++ TTeamMenuItem::Label方法的具体用法?C++ TTeamMenuItem::Label怎么用?C++ TTeamMenuItem::Label使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTeamMenuItem
的用法示例。
在下文中一共展示了TTeamMenuItem::Label方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TTeamMenuItem
void
TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name,
char* signature)
{
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
desk_settings* settings = static_cast<TBarApp*>(be_app)->Settings();
float itemWidth = -1.0f;
if (fVertical)
itemWidth = fBarView->Bounds().Width();
else {
itemWidth = iconSize;
if (!settings->hideLabels)
itemWidth += gMinimumWindowWidth - kMinimumIconSize;
else
itemWidth += kIconPadding * 2;
}
float itemHeight = -1.0f;
TTeamMenuItem* item = new TTeamMenuItem(team, icon, name, signature,
itemWidth, itemHeight);
if (settings->trackerAlwaysFirst
&& strcasecmp(signature, kTrackerSignature) == 0) {
AddItem(item, 0);
} else if (settings->sortRunningApps) {
TTeamMenuItem* teamItem = dynamic_cast<TTeamMenuItem*>(ItemAt(0));
int32 firstApp = 0;
// if Tracker should always be the first item, we need to skip it
// when sorting in the current item
if (settings->trackerAlwaysFirst && teamItem != NULL
&& strcasecmp(teamItem->Signature(), kTrackerSignature) == 0) {
firstApp++;
}
BCollator collator;
BLocale::Default()->GetCollator(&collator);
int32 i = firstApp;
int32 itemCount = CountItems();
while (i < itemCount) {
teamItem = dynamic_cast<TTeamMenuItem*>(ItemAt(i));
if (teamItem != NULL && collator.Compare(teamItem->Label(), name)
> 0) {
AddItem(item, i);
break;
}
i++;
}
// was the item added to the list yet?
if (i == itemCount)
AddItem(item);
} else
AddItem(item);
if (fVertical && settings->superExpando && settings->expandNewTeams)
item->ToggleExpandState(false);
SizeWindow(1);
Window()->UpdateIfNeeded();
}
示例2: Window
void
TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message)
{
int32 buttons;
BMessage* currentMessage = Window()->CurrentMessage();
if (currentMessage == NULL
|| currentMessage->FindInt32("buttons", &buttons) != B_OK) {
buttons = 0;
}
if (message == NULL) {
// force a cleanup
_FinishedDrag();
switch (code) {
case B_INSIDE_VIEW:
{
BMenuItem* menuItem;
TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem);
TWindowMenuItem* windowMenuItem
= dynamic_cast<TWindowMenuItem*>(menuItem);
if (item == NULL || menuItem == NULL) {
// item is NULL, remove the tooltip and break out
fLastMousedOverItem = NULL;
SetToolTip((const char*)NULL);
break;
}
if (menuItem == fLastMousedOverItem) {
// already set the tooltip for this item, break out
break;
}
if (windowMenuItem != NULL && fBarView->Vertical()
&& fBarView->ExpandoState() && item->IsExpanded()) {
// expando mode window menu item
fLastMousedOverItem = menuItem;
if (strcasecmp(windowMenuItem->TruncatedLabel(),
windowMenuItem->Label()) > 0) {
// label is truncated, set tooltip
SetToolTip(windowMenuItem->Label());
} else
SetToolTip((const char*)NULL);
break;
}
if (!dynamic_cast<TBarApp*>(be_app)->Settings()->hideLabels) {
// item has a visible label, set tool tip if truncated
fLastMousedOverItem = menuItem;
if (strcasecmp(item->TruncatedLabel(), item->Label()) > 0) {
// label is truncated, set tooltip
SetToolTip(item->Label());
} else
SetToolTip((const char*)NULL);
break;
}
SetToolTip(item->Label());
// new item, set the tooltip to the item label
fLastMousedOverItem = menuItem;
// save the current menuitem for the next MouseMoved() call
break;
}
}
BMenuBar::MouseMoved(where, code, message);
return;
}
if (buttons == 0)
return;
switch (code) {
case B_ENTERED_VIEW:
// fPreviousDragTargetItem should always be NULL here anyways.
if (fPreviousDragTargetItem != NULL)
_FinishedDrag();
fBarView->CacheDragData(message);
fPreviousDragTargetItem = NULL;
break;
case B_OUTSIDE_VIEW:
// NOTE: Should not be here, but for the sake of defensive
// programming... fall-through
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);
//.........这里部分代码省略.........