本文整理汇总了C++中TTeamMenuItem::SetOverrideHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ TTeamMenuItem::SetOverrideHeight方法的具体用法?C++ TTeamMenuItem::SetOverrideHeight怎么用?C++ TTeamMenuItem::SetOverrideHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTeamMenuItem
的用法示例。
在下文中一共展示了TTeamMenuItem::SetOverrideHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: self
void
TExpandoMenuBar::BuildItems()
{
BMessenger self(this);
TBarApp::Subscribe(self, &fTeamList);
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
desk_settings* settings = static_cast<TBarApp*>(be_app)->Settings();
float itemWidth = -1.0f;
if (fVertical)
itemWidth = Frame().Width();
else {
itemWidth = iconSize;
if (!settings->hideLabels)
itemWidth += gMinimumWindowWidth - kMinimumIconSize;
else
itemWidth += kIconPadding * 2;
}
float itemHeight = -1.0f;
TeamMenuItemMap items;
int32 itemCount = CountItems();
BList itemList(itemCount);
for (int32 i = 0; i < itemCount; i++) {
BMenuItem* menuItem = RemoveItem((int32)0);
itemList.AddItem(menuItem);
TTeamMenuItem* item = dynamic_cast<TTeamMenuItem*>(menuItem);
if (item != NULL)
items[BString(item->Signature()).ToLower()] = item;
}
if (settings->sortRunningApps)
fTeamList.SortItems(TTeamMenu::CompareByName);
int32 teamCount = fTeamList.CountItems();
for (int32 i = 0; i < teamCount; i++) {
BarTeamInfo* barInfo = (BarTeamInfo*)fTeamList.ItemAt(i);
TeamMenuItemMap::const_iterator iter
= items.find(BString(barInfo->sig).ToLower());
if (iter == items.end()) {
// new team
TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams,
barInfo->icon, barInfo->name, barInfo->sig, itemWidth,
itemHeight);
if (settings->trackerAlwaysFirst
&& strcasecmp(barInfo->sig, kTrackerSignature) == 0) {
AddItem(item, 0);
} else
AddItem(item);
if (fFirstBuild && fVertical && settings->expandNewTeams)
item->ToggleExpandState(true);
} else {
// existing team, update info and add it
TTeamMenuItem* item = iter->second;
item->SetIcon(barInfo->icon);
item->SetOverrideWidth(itemWidth);
item->SetOverrideHeight(itemHeight);
if (settings->trackerAlwaysFirst
&& strcasecmp(barInfo->sig, kTrackerSignature) == 0) {
AddItem(item, 0);
} else
AddItem(item);
// add window items back
int32 index = itemList.IndexOf(item);
TWindowMenuItem* windowItem;
TWindowMenu* submenu = dynamic_cast<TWindowMenu*>(item->Submenu());
bool hasWindowItems = false;
while ((windowItem = dynamic_cast<TWindowMenuItem*>(
(BMenuItem*)(itemList.ItemAt(++index)))) != NULL) {
if (fVertical)
AddItem(windowItem);
else {
delete windowItem;
hasWindowItems = submenu != NULL;
}
}
// unexpand if turn off show team expander
if (fVertical && !settings->superExpando && item->IsExpanded())
item->ToggleExpandState(false);
if (hasWindowItems) {
// add (new) window items in submenu
submenu->SetExpanded(false, 0);
submenu->AttachedToWindow();
}
}
}
if (CountItems() == 0) {
// If we're empty, BMenuBar::AttachedToWindow() resizes us to some
// weird value - we just override it again
ResizeTo(itemWidth, 0);
}
//.........这里部分代码省略.........