当前位置: 首页>>代码示例>>C++>>正文


C++ BDeskbar::IsRunning方法代码示例

本文整理汇总了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;
	}
}
开发者ID:jackburton79,项目名称:bescreencapture,代码行数:40,代码来源:AdvancedOptionsView.cpp

示例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();
}
开发者ID:mtl1979,项目名称:muscle,代码行数:38,代码来源:MuscleAdmin.cpp

示例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();
}
开发者ID:looncraz,项目名称:haiku,代码行数:67,代码来源:NetworkStatus.cpp


注:本文中的BDeskbar::IsRunning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。