本文整理汇总了C++中BAlert::SetWorkspaces方法的典型用法代码示例。如果您正苦于以下问题:C++ BAlert::SetWorkspaces方法的具体用法?C++ BAlert::SetWorkspaces怎么用?C++ BAlert::SetWorkspaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BAlert
的用法示例。
在下文中一共展示了BAlert::SetWorkspaces方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BAlert
void
ShutdownProcess::_WorkerDoShutdown()
{
PRINT(("ShutdownProcess::_WorkerDoShutdown()\n"));
// If we are here, the shutdown process has been initiated successfully,
// that is, if an asynchronous BRoster::Shutdown() was requested, we
// notify the caller at this point.
bool synchronous;
if (fRequest->FindBool("synchronous", &synchronous) == B_OK && !synchronous)
_SendReply(B_OK);
// ask the user to confirm the shutdown, if desired
bool askUser;
if (fHasGUI && fRequest->FindBool("confirm", &askUser) == B_OK && askUser) {
const char* restart = B_TRANSLATE("Restart");
const char* shutdown = B_TRANSLATE("Shut down");
BString title = B_TRANSLATE("%action%?");
title.ReplaceFirst("%action%", fReboot ? restart : shutdown);
const char* text = fReboot
? B_TRANSLATE("Do you really want to restart the system?")
: B_TRANSLATE("Do you really want to shut down the system?");
const char* defaultText = fReboot ? restart : shutdown;
const char* otherText = fReboot ? shutdown : restart;
BAlert* alert = new BAlert(title.String(), text,
B_TRANSLATE("Cancel"), otherText, defaultText,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
// We want the alert to behave more like a regular window...
alert->SetFeel(B_NORMAL_WINDOW_FEEL);
// ...but not quit. Minimizing the alert would prevent the user from
// finding it again, since registrar does not have an entry in the
// Deskbar.
alert->SetFlags(alert->Flags() | B_NOT_MINIMIZABLE);
alert->SetWorkspaces(B_ALL_WORKSPACES);
int32 result = alert->Go();
if (result == 1) {
// Toggle shutdown method
fReboot = !fReboot;
} else if (result < 1)
throw_error(B_SHUTDOWN_CANCELLED);
}
// tell TRoster not to accept new applications anymore
fRoster->SetShuttingDown(true);
fWorkerLock.Lock();
// get a list of all applications to shut down and sort them
status_t status = fRoster->GetShutdownApps(fUserApps, fSystemApps,
fBackgroundApps, fVitalSystemApps);
if (status != B_OK) {
fWorkerLock.Unlock();
fRoster->RemoveWatcher(this);
fRoster->SetShuttingDown(false);
return;
}
fUserApps.Sort(&inverse_compare_by_registration_time);
fSystemApps.Sort(&inverse_compare_by_registration_time);
fWorkerLock.Unlock();
// make the shutdown window ready and show it
_InitShutdownWindow();
_SetShutdownWindowCurrentApp(-1);
_SetShutdownWindowText(B_TRANSLATE("Tidying things up a bit."));
_SetShutdownWindowCancelButtonEnabled(true);
_SetShutdownWindowKillButtonEnabled(false);
_SetShowShutdownWindow(true);
// sync
sync();
// phase 1: terminate the user apps
_SetPhase(USER_APP_TERMINATION_PHASE);
_QuitApps(fUserApps, false);
_WaitForDebuggedTeams();
// phase 2: terminate the system apps
_SetPhase(SYSTEM_APP_TERMINATION_PHASE);
_QuitApps(fSystemApps, true);
_WaitForDebuggedTeams();
// phase 3: terminate the background apps
_SetPhase(BACKGROUND_APP_TERMINATION_PHASE);
_QuitBackgroundApps();
_WaitForDebuggedTeams();
// phase 4: terminate the other processes
_SetPhase(OTHER_PROCESSES_TERMINATION_PHASE);
_QuitNonApps();
_ScheduleTimeoutEvent(kBackgroundAppQuitTimeout, -1);
_WaitForBackgroundApps();
_KillBackgroundApps();
_WaitForDebuggedTeams();
// we're through: do the shutdown
_SetPhase(DONE_PHASE);
//.........这里部分代码省略.........