本文整理汇总了C++中TTeamMenuItem::SetEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ TTeamMenuItem::SetEnabled方法的具体用法?C++ TTeamMenuItem::SetEnabled怎么用?C++ TTeamMenuItem::SetEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTeamMenuItem
的用法示例。
在下文中一共展示了TTeamMenuItem::SetEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: self
void
TTeamMenu::AttachedToWindow()
{
RemoveItems(0, CountItems(), true);
// remove all items
BMessenger self(this);
BList teamList;
TBarApp::Subscribe(self, &teamList);
TBarView* barview = (dynamic_cast<TBarApp*>(be_app))->BarView();
bool dragging = barview && barview->Dragging();
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
desk_settings* settings = ((TBarApp*)be_app)->Settings();
float width = sMinimumWindowWidth - iconSize - 4;
if (settings->sortRunningApps)
teamList.SortItems(CompareByName);
int32 count = teamList.CountItems();
for (int32 i = 0; i < count; i++) {
// add items back
BarTeamInfo* barInfo = (BarTeamInfo*)teamList.ItemAt(i);
TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams,
barInfo->icon, barInfo->name, barInfo->sig,
width, -1, !settings->hideLabels, true);
if (settings->trackerAlwaysFirst
&& strcmp(barInfo->sig, kTrackerSignature) == 0) {
AddItem(item, 0);
} else
AddItem(item);
if (dragging && item != NULL) {
bool canhandle = (dynamic_cast<TBarApp*>(be_app))->BarView()->
AppCanHandleTypes(item->Signature());
if (item->IsEnabled() != canhandle)
item->SetEnabled(canhandle);
BMenu* menu = item->Submenu();
if (menu)
menu->SetTrackingHook(barview->MenuTrackingHook,
barview->GetTrackingHookData());
}
}
if (CountItems() == 0) {
BMenuItem* item = new BMenuItem("no application running", NULL);
item->SetEnabled(false);
AddItem(item);
}
if (dragging && barview->LockLooper()) {
SetTrackingHook(barview->MenuTrackingHook,
barview->GetTrackingHookData());
barview->DragStart();
barview->UnlockLooper();
}
BMenu::AttachedToWindow();
}