コード例 #1
0
ファイル: BeMenu.cpp プロジェクト: mmanley/Antares
bool
TBeMenu::AddStandardBeMenuItems()
{
	bool dragging = false;
	if (fBarView)
		dragging = fBarView->Dragging();

	BMenuItem* item = new BMenuItem(
#ifdef ANTARES_DISTRO_COMPATIBILITY_OFFICIAL
	"About Antares"
#else
	"About this system"
#endif
		B_UTF8_ELLIPSIS, new BMessage(kShowSplash));
	item->SetEnabled(!dragging);
	AddItem(item);

#ifdef SHOW_RECENT_FIND_ITEMS
	item = new BMenuItem(TrackerBuildRecentFindItemsMenu("Find"B_UTF8_ELLIPSIS),
		new BMessage(kFindButton));
#else
 	item = new BMenuItem("Find"B_UTF8_ELLIPSIS, new BMessage(kFindButton));
#endif
	item->SetEnabled(!dragging);
	AddItem(item);

	item = new BMenuItem("Show replicants", new BMessage(kToggleDraggers));
	item->SetEnabled(!dragging);
	item->SetMarked(BDragger::AreDraggersDrawn());
	AddItem(item);

#ifdef MOUNT_MENU_IN_DESKBAR
	DeskbarMountMenu* mountMenu = new DeskbarMountMenu("Mount");
	mountMenu->SetEnabled(!dragging);
	AddItem(mountMenu);
#endif

	item = new BMenuItem("Deskbar preferences" B_UTF8_ELLIPSIS,
		new BMessage(kConfigShow));
 	item->SetTarget(be_app);
	AddItem(item);

	AddSeparatorItem();

	BMenu* shutdownMenu = new BMenu("Shutdown" B_UTF8_ELLIPSIS);

	item = new BMenuItem("Restart system", new BMessage(kRebootSystem));
	item->SetEnabled(!dragging);
	shutdownMenu->AddItem(item);

#ifdef APM_SUPPORT
	if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
		item = new BMenuItem("Suspend", new BMessage(kSuspendSystem));
		item->SetEnabled(!dragging);
		shutdownMenu->AddItem(item);
	}
#endif

	item = new BMenuItem("Power off", new BMessage(kShutdownSystem));
	item->SetEnabled(!dragging);
	shutdownMenu->AddItem(item);
	shutdownMenu->SetFont(be_plain_font);

	shutdownMenu->SetTargetForItems(be_app);
	BMessage* message = new BMessage(kShutdownSystem);
	message->AddBool("confirm", true);
	AddItem(new BMenuItem(shutdownMenu, message));

	fAddState = kAddingRecents;

	return true;
}
コード例 #2
0
ファイル: DeskbarMenu.cpp プロジェクト: AmirAbrams/haiku
bool
TDeskbarMenu::AddStandardDeskbarMenuItems()
{
	bool dragging = false;
	if (fBarView)
		dragging = fBarView->Dragging();

	BMenuItem* item;

// One of them is used if HAIKU_DISTRO_COMPATIBILITY_OFFICIAL, and the other if
// not. However, we want both of them to end up in the catalog, so we have to
// make them visible to collectcatkeys in either case.
B_TRANSLATE_MARK_VOID("About Haiku")
B_TRANSLATE_MARK_VOID("About this system")

	item = new BMenuItem(
#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
	B_TRANSLATE_NOCOLLECT("About Haiku")
#else
	B_TRANSLATE_NOCOLLECT("About this system")
#endif
		, new BMessage(kShowSplash));
	item->SetEnabled(!dragging);
	AddItem(item);

	static const char* kFindMenuItemStr
		= B_TRANSLATE_MARK("Find" B_UTF8_ELLIPSIS);

#ifdef SHOW_RECENT_FIND_ITEMS
	item = new BMenuItem(
		TrackerBuildRecentFindItemsMenu(kFindMenuItemStr),
		new BMessage(kFindButton));
#else
	item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kFindMenuItemStr),
		new BMessage(kFindButton));
#endif
	item->SetEnabled(!dragging);
	AddItem(item);

	item = new BMenuItem(B_TRANSLATE("Show replicants"),
		new BMessage(kToggleDraggers));
	item->SetEnabled(!dragging);
	item->SetMarked(BDragger::AreDraggersDrawn());
	AddItem(item);

	static const char* kMountMenuStr = B_TRANSLATE_MARK("Mount");

#ifdef MOUNT_MENU_IN_DESKBAR
	DeskbarMountMenu* mountMenu = new DeskbarMountMenu(
		B_TRANSLATE_NOCOLLECT(kMountMenuStr));
	mountMenu->SetEnabled(!dragging);
	AddItem(mountMenu);
#endif

	item = new BMenuItem(B_TRANSLATE("Deskbar preferences" B_UTF8_ELLIPSIS),
		new BMessage(kConfigShow));
	item->SetTarget(be_app);
	AddItem(item);

	AddSeparatorItem();

	BMenu* shutdownMenu = new BMenu(B_TRANSLATE("Shutdown" B_UTF8_ELLIPSIS));

	item = new BMenuItem(B_TRANSLATE("Restart system"),
		new BMessage(kRebootSystem));
	item->SetEnabled(!dragging);
	shutdownMenu->AddItem(item);

	B_TRANSLATE_MARK_VOID("Suspend");

#ifdef APM_SUPPORT
	if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
		item = new BMenuItem(B_TRANSLATE_NOCOLLECT("Suspend"),
			new BMessage(kSuspendSystem));
		item->SetEnabled(!dragging);
		shutdownMenu->AddItem(item);
	}
#endif

	item = new BMenuItem(B_TRANSLATE("Power off"),
		new BMessage(kShutdownSystem));
	item->SetEnabled(!dragging);
	shutdownMenu->AddItem(item);
	shutdownMenu->SetFont(be_plain_font);

	shutdownMenu->SetTargetForItems(be_app);
	BMessage* message = new BMessage(kShutdownSystem);
	message->AddBool("confirm", true);
	AddItem(new BMenuItem(shutdownMenu, message));

	fAddState = kAddingRecents;

	return true;
}
コード例 #3
0
ファイル: BeMenu.cpp プロジェクト: mariuz/haiku
bool
TBeMenu::AddStandardBeMenuItems()
{
	bool dragging = false;
	if (fBarView)
		dragging = fBarView->Dragging();

	BMenuItem* item;
	BRoster roster;
	if (!roster.IsRunning(kTrackerSignature)) {
		item = new BMenuItem(B_TRANSLATE("Restart Tracker"),
			new BMessage(kRestartTracker));
		AddItem(item);
		AddSeparatorItem();
	}

	static const char* kAboutHaikuMenuItemStr = B_TRANSLATE_MARK(
		"About Haiku" B_UTF8_ELLIPSIS);
	static const char* kAboutThisSystemMenuItemStr = B_TRANSLATE_MARK(
		"About this system" B_UTF8_ELLIPSIS);

	item = new BMenuItem(
#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
	B_TRANSLATE(kAboutHaikuMenuItemStr)
#else
	B_TRANSLATE(kAboutThisSystemMenuItemStr)
#endif
		, new BMessage(kShowSplash));
	item->SetEnabled(!dragging);
	AddItem(item);

	static const char* kFindMenuItemStr =
		B_TRANSLATE_MARK("Find" B_UTF8_ELLIPSIS);

#ifdef SHOW_RECENT_FIND_ITEMS
	item = new BMenuItem(
		TrackerBuildRecentFindItemsMenu(kFindMenuItemStr),
		new BMessage(kFindButton));
#else
 	item = new BMenuItem(B_TRANSLATE(kFindMenuItemStr),
 		new BMessage(kFindButton));
#endif
	item->SetEnabled(!dragging);
	AddItem(item);

	item = new BMenuItem(B_TRANSLATE("Show replicants"),
		new BMessage(kToggleDraggers));
	item->SetEnabled(!dragging);
	item->SetMarked(BDragger::AreDraggersDrawn());
	AddItem(item);

	static const char* kMountMenuStr = B_TRANSLATE_MARK("Mount");

#ifdef MOUNT_MENU_IN_DESKBAR
	DeskbarMountMenu* mountMenu = new DeskbarMountMenu(
		B_TRANSLATE(kMountMenuStr));
	mountMenu->SetEnabled(!dragging);
	AddItem(mountMenu);
#endif

	item = new BMenuItem(B_TRANSLATE("Deskbar preferences" B_UTF8_ELLIPSIS),
		new BMessage(kConfigShow));
 	item->SetTarget(be_app);
	AddItem(item);

	AddSeparatorItem();

	BMenu* shutdownMenu = new BMenu(B_TRANSLATE("Shutdown" B_UTF8_ELLIPSIS));

	item = new BMenuItem(B_TRANSLATE("Restart system"),
		new BMessage(kRebootSystem));
	item->SetEnabled(!dragging);
	shutdownMenu->AddItem(item);

	static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend");

#ifdef APM_SUPPORT
	if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
		item = new BMenuItem(kSuspendMenuItemStr), new BMessage(kSuspendSystem));
		item->SetEnabled(!dragging);
		shutdownMenu->AddItem(item);
	}