本文整理汇总了C++中BDeskbar::IsRunning方法的典型用法代码示例。如果您正苦于以下问题:C++ BDeskbar::IsRunning方法的具体用法?C++ BDeskbar::IsRunning怎么用?C++ BDeskbar::IsRunning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BDeskbar
的用法示例。
在下文中一共展示了BDeskbar::IsRunning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
AdvancedOptionsView::MessageReceived(BMessage *message)
{
switch (message->what) {
case kLocalUseDirectWindow:
fController->SetUseDirectWindow(fUseDirectWindow->Value() == B_CONTROL_ON);
break;
case kLocalHideDeskbar:
{
bool hide = fHideDeskbarIcon->Value() == B_CONTROL_ON;
BDeskbar deskbar;
if (deskbar.IsRunning()) {
if (hide) {
// Save the current minimize setting, since we are going to override
// it when "hide deskbar" is set
fCurrentMinimizeValue = Settings::Current().MinimizeOnRecording();
fMinimizeOnStart->SetValue(B_CONTROL_ON);
fMinimizeOnStart->SetEnabled(false);
while (deskbar.HasItem(BSC_DESKBAR_VIEW))
deskbar.RemoveItem(BSC_DESKBAR_VIEW);
} else if (!deskbar.HasItem(BSC_DESKBAR_VIEW)) {
fMinimizeOnStart->SetValue(fCurrentMinimizeValue ? B_CONTROL_ON : B_CONTROL_OFF);
fMinimizeOnStart->SetEnabled(true);
deskbar.AddItem(new DeskbarControlView(BRect(0, 0, 15, 15),
BSC_DESKBAR_VIEW));
}
}
}
// Fall through
case kLocalMinimizeOnRecording:
Settings::Current().SetMinimizeOnRecording(fMinimizeOnStart->Value() == B_CONTROL_ON);
break;
default:
BView::MessageReceived(message);
break;
}
}
示例2: BAlert
void
MuscleAdmin::ReadyToRun()
{
bool isInstalled = false;
bool isDeskbarRunning = true;
{
// if the Deskbar is not alive at this point, it might be after having
// acknowledged the requester below
BDeskbar deskbar;
isDeskbarRunning = deskbar.IsRunning();
isInstalled = deskbar.HasItem(kDeskbarItemName);
}
if (isDeskbarRunning && !isInstalled) {
BAlert* alert = new BAlert("",
"You can run MuscleAdmin in a window or install it in the Deskbar."
, "Run in window", "Install in Deskbar", NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
if (alert->Go()) {
image_info info;
entry_ref ref;
if (our_image(info) == B_OK
&& get_ref_for_path(info.name, &ref) == B_OK) {
BDeskbar deskbar;
deskbar.AddItem(&ref);
}
Quit();
return;
}
}
BWindow* window = new MuscleAdminWindow();
window->Show();
}
示例3: BAlert
void
NetworkStatus::ReadyToRun()
{
if (fQuitImmediately) {
// we printed the help message into the Terminal and
// should just quit
Quit();
return;
}
bool isDeskbarRunning = true;
bool isInstalled = false;
{
// if the Deskbar is not alive at this point, it might be after having
// acknowledged the requester below
BDeskbar deskbar;
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
isDeskbarRunning = deskbar.IsRunning();
#endif
isInstalled = deskbar.HasItem(kDeskbarItemName);
}
if (fAutoInstallInDeskbar) {
if (isInstalled) {
Quit();
return;
}
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
// wait up to 10 seconds for Deskbar to become available
// in case it is not running (yet?)
int32 tries = 10;
while (!isDeskbarRunning && --tries) {
BDeskbar deskbar;
if (deskbar.IsRunning()) {
isDeskbarRunning = true;
break;
}
snooze(1000000);
}
#endif
if (!isDeskbarRunning) {
const char* str = B_TRANSLATE("Deskbar is not running, giving up.");
puts(str);
Quit();
return;
}
_InstallReplicantInDeskbar();
return;
}
if (isDeskbarRunning && !isInstalled) {
BAlert* alert = new BAlert("", B_TRANSLATE("You can run NetworkStatus "
"in a window or install it in the Deskbar."),
B_TRANSLATE("Run in window"), B_TRANSLATE("Install in Deskbar"),
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 1) {
_InstallReplicantInDeskbar();
return;
}
}
BWindow* window = new NetworkStatusWindow();
window->Show();
}