本文整理汇总了C++中BDeskbar::HasItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BDeskbar::HasItem方法的具体用法?C++ BDeskbar::HasItem怎么用?C++ BDeskbar::HasItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BDeskbar
的用法示例。
在下文中一共展示了BDeskbar::HasItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MemoryBarMenuItem
//.........这里部分代码省略.........
if (infos[m].team_info.team >= 0) {
MemoryBarMenuItem* memoryItem =
new MemoryBarMenuItem(infos[m].team_name,
infos[m].team_info.team, infos[m].team_icon, false, NULL);
MemoryPopup->AddItem(memoryItem);
memoryItem->UpdateSituation(commitedMemory);
}
}
addtopbottom(MemoryPopup);
// CPU Load section
TeamBarMenu* CPUPopup = new TeamBarMenu(B_TRANSLATE("Threads and CPU "
"usage"), infos, systemInfo.used_teams);
for (m = 0; m < systemInfo.used_teams; m++) {
if (infos[m].team_info.team >= 0) {
ThreadBarMenu* TeamPopup = new ThreadBarMenu(infos[m].team_name,
infos[m].team_info.team, infos[m].team_info.thread_count);
BMessage* kill_team = new BMessage('KlTm');
kill_team->AddInt32("team", infos[m].team_info.team);
TeamBarMenuItem* item = new TeamBarMenuItem(TeamPopup, kill_team,
infos[m].team_info.team, infos[m].team_icon, false);
item->SetTarget(gPCView);
CPUPopup->AddItem(item);
}
}
addtopbottom(CPUPopup);
addtopbottom(new BSeparatorItem());
// CPU on/off section
if (gCPUcount > 1) {
for (int i = 0; i < gCPUcount; i++) {
char item_name[32];
sprintf (item_name, B_TRANSLATE("Processor %d"), i + 1);
BMessage* m = new BMessage ('CPU ');
m->AddInt32 ("cpu", i);
item = new IconMenuItem (gPCView->fProcessorIcon, item_name, m);
if (_kern_cpu_enabled(i))
item->SetMarked (true);
item->SetTarget(gPCView);
addtopbottom(item);
}
addtopbottom (new BSeparatorItem ());
}
if (!be_roster->IsRunning(kTrackerSig)) {
item = new IconMenuItem(gPCView->fTrackerIcon,
B_TRANSLATE("Restart Tracker"), new BMessage('Trac'));
item->SetTarget(gPCView);
addtopbottom(item);
}
if (!be_roster->IsRunning(kDeskbarSig)) {
item = new IconMenuItem(gPCView->fDeskbarIcon,
B_TRANSLATE("Restart Deskbar"), new BMessage('Dbar'));
item->SetTarget(gPCView);
addtopbottom(item);
}
item = new IconMenuItem(gPCView->fTerminalIcon,
B_TRANSLATE("New Terminal"), new BMessage('Term'));
item->SetTarget(gPCView);
addtopbottom(item);
addtopbottom(new BSeparatorItem());
if (be_roster->IsRunning(kDeskbarSig)) {
item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"),
new BMessage('AlDb'));
BDeskbar deskbar;
item->SetMarked(gInDeskbar || deskbar.HasItem(kDeskbarItemName));
item->SetTarget(gPCView);
addtopbottom(item);
addtopbottom(new BSeparatorItem ());
}
item = new IconMenuItem(gPCView->fProcessControllerIcon,
B_TRANSLATE("About ProcessController"B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED));
item->SetTarget(gPCView);
addtopbottom(item);
param->where.x -= 5;
param->where.y -= 8;
popup->Go(param->where, true, true, param->clickToOpenRect);
delete popup;
for (m = 0; m < systemInfo.used_teams; m++) {
if (infos[m].team_info.team >= 0) {
delete[] infos[m].thread_info;
delete infos[m].team_icon;
}
}
delete[] infos;
delete param;
atomic_add (&gPopupFlag, -1);
gPopupThreadID = 0;
return B_OK;
}
示例2: if
//.........这里部分代码省略.........
B_TRANSLATE("Are you sure you want "
"to kill the thread \"%s\"?"), thinfo.name);
alert = new BAlert(B_TRANSLATE("Please confirm"), question,
B_TRANSLATE("Cancel"), B_TRANSLATE("Kill this thread!"),
NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
#define KILL 1
#endif
alert->SetShortcut(0, B_ESCAPE);
int r = alert->Go();
if (r == KILL)
kill_thread(thread);
#if DEBUG_THREADS
else if (r == 1) {
Tdebug_thead_param* param = new Tdebug_thead_param;
param->thread = thread;
if (thinfo.state == B_THREAD_WAITING)
param->sem = thinfo.sem;
else
param->sem = -1;
param->totalTime = thinfo.user_time+thinfo.kernel_time;
resume_thread(spawn_thread(thread_debug_thread,
B_TRANSLATE("Debug thread"), B_NORMAL_PRIORITY, param));
}
#endif
} else {
alert = new BAlert(B_TRANSLATE("Info"),
B_TRANSLATE("This thread is already gone"B_UTF8_ELLIPSIS),
B_TRANSLATE("Ok!"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
}
}
break;
case 'PrTh':
if (message->FindInt32("thread", &thread) == B_OK) {
long new_priority;
if (message->FindInt32("priority", &new_priority) == B_OK)
set_thread_priority(thread, new_priority);
}
break;
case 'Trac':
launch(kTrackerSig, "/boot/system/Tracker");
break;
case 'Dbar':
launch(kDeskbarSig, "/boot/system/Deskbar");
break;
case 'Term':
launch(kTerminalSig, "/boot/system/apps/Terminal");
break;
case 'AlDb':
{
if (!be_roster->IsRunning(kDeskbarSig))
launch(kDeskbarSig, "/boot/system/Deskbar");
BDeskbar deskbar;
if (gInDeskbar || deskbar.HasItem (kDeskbarItemName))
deskbar.RemoveItem (kDeskbarItemName);
else
move_to_deskbar(deskbar);
break;
}
case 'CPU ':
{
int32 cpu;
if (message->FindInt32 ("cpu", &cpu) == B_OK) {
bool last = true;
for (int p = 0; p < gCPUcount; p++) {
if (p != cpu && _kern_cpu_enabled(p)) {
last = false;
break;
}
}
if (last) {
alert = new BAlert(B_TRANSLATE("Info"),
B_TRANSLATE("This is the last active processor...\n"
"You can't turn it off!"),
B_TRANSLATE("That's no Fun!"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
} else
_kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu));
}
break;
}
case B_ABOUT_REQUESTED:
AboutRequested();
break;
default:
BView::MessageReceived(message);
}
}