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


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

本文整理汇总了C++中BDeskbar::AddItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BDeskbar::AddItem方法的具体用法?C++ BDeskbar::AddItem怎么用?C++ BDeskbar::AddItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BDeskbar的用法示例。


在下文中一共展示了BDeskbar::AddItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rect

bool
LoadInDeskbar()
{
	PulseApp *pulseapp = (PulseApp *)be_app;
	BDeskbar *deskbar = new BDeskbar();
	// Don't allow two copies in the Deskbar at once
	if (deskbar->HasItem("DeskbarPulseView")) {
		delete deskbar;
		return false;
	}

	// Must be 16 pixels high, the width is retrieved from the Prefs class
	int width = pulseapp->prefs->deskbar_icon_width;
	int min_width = GetMinimumViewWidth();
	if (width < min_width) {
		pulseapp->prefs->deskbar_icon_width = min_width;
		width = min_width;
	}

	BRect rect(0, 0, width - 1, 15);
	DeskbarPulseView *replicant = new DeskbarPulseView(rect);
	status_t err = deskbar->AddItem(replicant);
	delete replicant;
	delete deskbar;
	if (err != B_OK) {
		BAlert *alert = new BAlert(NULL, strerror(err), "OK");
		alert->Go(NULL);
		return false;
	}

	return true;
}
开发者ID:mmanley,项目名称:Antares,代码行数:32,代码来源:PulseApp.cpp

示例2:

void
move_to_deskbar(BDeskbar& deskbar)
{
	entry_ref ref;
	find_self(ref);

	deskbar.AddItem(&ref);
}
开发者ID:DonCN,项目名称:haiku,代码行数:8,代码来源:Utilities.cpp

示例3:

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

示例4:

/***********************************************************
 * InstallDeskbarIcon
 ***********************************************************/
void
HDaemonApp::InstallDeskbarIcon()
{
	BDeskbar deskbar;

	if(deskbar.HasItem( "scooby_daemon" ) == false)
	{
		BRoster roster;
		entry_ref ref;
		roster.FindApp( APP_SIG , &ref);
		int32 id;
		deskbar.AddItem(&ref, &id);
	}
}
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:17,代码来源:HDaemonApp.cpp

示例5: LoadIcon

int32 LoadIcon(team_id tid)
{
	BDeskbar deskbar;
	int32 id=-1;

	deskbar.AddItem(new DeskbarView(tid),&id);
	
	if(id>0) {
		BMessage msg('_ID_');
		msg.AddInt32("ReplicantID",id);
		SendMessageToReplicant(id,&msg);
	}
	
	return id;	
}
开发者ID:bogdan-voevoda,项目名称:qt4,代码行数:15,代码来源:qsystray.cpp

示例6: entry

void
AudioSettingsView::_ShowDeskbarVolumeControl()
{
	BDeskbar deskbar;
	BEntry entry("/bin/desklink", true);
	int32 id;
	entry_ref ref;
	status_t status = entry.GetRef(&ref);
	if (status == B_OK)
		status = deskbar.AddItem(&ref, &id);

	if (status != B_OK) {
		fprintf(stderr, B_TRANSLATE(
			"Couldn't add volume control in Deskbar: %s\n"),
			strerror(status));
	}
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:17,代码来源:MediaViews.cpp

示例7: AddToDeskbar

status_t VBoxGuestDeskbarView::AddToDeskbar(bool force)
{
    BDeskbar deskbar;
    status_t err;

    if (force)
        RemoveFromDeskbar();
    else if (deskbar.HasItem(VIEWNAME))
        return B_OK;

    app_info info;
    err = be_app->GetAppInfo(&info);
    if (err < B_OK)
        return err;

    BPath p(&info.ref);
    return deskbar.AddItem(&info.ref);
}
开发者ID:jbremer,项目名称:virtualbox,代码行数:18,代码来源:VBoxGuestDeskbarView.cpp

示例8: AddDeskbarIcon

void BeGadu::AddDeskbarIcon() {
	DEBUG_TRACE( "BeGadu::AddDeskbarIcon()\n" );
	BDeskbar deskbar;
	if( !deskbar.HasItem( "BGDeskbar" ) ) {
		BRoster roster;
		entry_ref ref;
		status_t status = roster.FindApp( APP_MIME, &ref );
		if( status != B_OK ) {
			fprintf( stderr, _T("Can't find BeGadu running: %s\n"), strerror( status ) );
			return;
		}
		status = deskbar.AddItem( &ref );
		if( status != B_OK ) {
			fprintf( stderr, _T("Can't put BeGadu into Deskbar: %s\n"), strerror( status ) );
			return;
		}
	}
}
开发者ID:louisdem,项目名称:beos-begadu,代码行数:18,代码来源:BeGadu.cpp

示例9: main

int main(int argc, char *argv[]) {
	BDeskbar deskbar;
	app_info info;
	
	new BApplication(APP_SIG);

	// Remove the old instance
	if (deskbar.HasItem(VIEW_NAME) == true) deskbar.RemoveItem(VIEW_NAME);

	if (argc == 1) {
		if (be_app->GetAppInfo(&info) == B_OK) {
			status_t result = deskbar.AddItem(&info.ref, NULL);
			printf("Adding deskbar icon (%s): %s\n", info.ref.name, strerror(result));
		} else {
			printf("Unable to obtain app info\n");
		};
	};
	
	return B_OK;
};
开发者ID:HaikuArchives,项目名称:FeedKit,代码行数:20,代码来源:Main.cpp

示例10: BApplication

WatchApp::WatchApp() : BApplication(APP_SIGNATURE)
{
	B_TRANSLATE_MARK_SYSTEM_NAME_VOID("WebWatch");

	// Here we tell the Deskbar that we want to add a new replicant, and
	// where it can find this replicant (in our app). Because we only run
	// less than a second, there is no need for our title to appear inside
	// the Deskbar. Therefore, the application flags inside our resource
	// file should be set to B_BACKGROUND_APP.

	BDeskbar deskbar;
	if (!deskbar.HasItem(DESKBAR_ITEM_NAME))
	{
		entry_ref ref;
		be_roster->FindApp(APP_SIGNATURE, &ref);
		deskbar.AddItem(&ref);
	}

	PostMessage(B_QUIT_REQUESTED);
}
开发者ID:DonCN,项目名称:haiku,代码行数:20,代码来源:WatchApp.cpp

示例11: 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

示例12: rect

bool
LoadInDeskbar()
{
	PulseApp *pulseapp = (PulseApp *)be_app;
	BDeskbar *deskbar = new BDeskbar();
	// Don't allow two copies in the Deskbar at once
	if (deskbar->HasItem("DeskbarPulseView")) {
		delete deskbar;
		return false;
	}

	// Must be 16 pixels high, the width is retrieved from the Prefs class
	int width = pulseapp->prefs->deskbar_icon_width;
	int min_width = GetMinimumViewWidth();
	if (width < min_width) {
		pulseapp->prefs->deskbar_icon_width = min_width;
		width = min_width;
	}

	float height = deskbar->MaxItemHeight();
	BRect rect(0, 0, width - 1, height - 1);
	DeskbarPulseView *replicant = new DeskbarPulseView(rect);
	status_t err = deskbar->AddItem(replicant);
	delete replicant;
	delete deskbar;
	if (err != B_OK) {
		BString message;
		snprintf(message.LockBuffer(512), 512,
			B_TRANSLATE("Installing in Deskbar failed\n%s"), strerror(err));
		message.UnlockBuffer();
		BAlert *alert = new BAlert(B_TRANSLATE("Error"),
			message.String(), B_TRANSLATE("OK"));
		alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
		alert->Go(NULL);
		return false;
	}

	return true;
}
开发者ID:looncraz,项目名称:haiku,代码行数:39,代码来源:PulseApp.cpp

示例13: 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

示例14: strerror

void
MailDaemonApp::InstallDeskbarIcon()
{
	BDeskbar deskbar;

	if (!deskbar.HasItem("mail_daemon")) {
		BRoster roster;
		entry_ref ref;

		status_t status = roster.FindApp(B_MAIL_DAEMON_SIGNATURE, &ref);
		if (status < B_OK) {
			fprintf(stderr, "Can't find application to tell deskbar: %s\n",
				strerror(status));
			return;
		}

		status = deskbar.AddItem(&ref);
		if (status < B_OK) {
			fprintf(stderr, "Can't add deskbar replicant: %s\n", strerror(status));
			return;
		}
	}
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例15: ChildAt

void
WorkspacesWindow::MessageReceived(BMessage *message)
{
	switch (message->what) {
		case B_SIMPLE_DATA:
		{
			// Drop from Tracker
			entry_ref ref;
			for (int i = 0; (message->FindRef("refs", i, &ref) == B_OK); i++)
				be_roster->Launch(&ref);
			break;
		}

		case B_ABOUT_REQUESTED:
			PostMessage(message, ChildAt(0));
			break;

		case kMsgToggleBorder:
		{
			bool enable = false;
			if (Look() == B_NO_BORDER_WINDOW_LOOK)
				enable = true;

			if (enable)
				if (fSettings->HasTitle())
					SetLook(B_TITLED_WINDOW_LOOK);
				else
					SetLook(B_MODAL_WINDOW_LOOK);
			else
				SetLook(B_NO_BORDER_WINDOW_LOOK);

			fSettings->SetHasBorder(enable);
			break;
		}

		case kMsgToggleTitle:
		{
			bool enable = false;
			if (Look() == B_MODAL_WINDOW_LOOK
				|| Look() == B_NO_BORDER_WINDOW_LOOK)
				enable = true;

			if (enable)
				SetLook(B_TITLED_WINDOW_LOOK);
			else
				SetLook(B_MODAL_WINDOW_LOOK);

			// No matter what the setting for title, 
			// we must force the border on
			fSettings->SetHasBorder(true);
			fSettings->SetHasTitle(enable);
			break;
		}

		case kMsgToggleAutoRaise:
			SetAutoRaise(!IsAutoRaising());
			SetFeel(B_NORMAL_WINDOW_FEEL);
			break;

		case kMsgToggleAlwaysOnTop:
		{
			bool enable = false;
			if (Feel() != B_FLOATING_ALL_WINDOW_FEEL)
				enable = true;

			if (enable)
				SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
			else
				SetFeel(B_NORMAL_WINDOW_FEEL);

			fSettings->SetAlwaysOnTop(enable);
			break;
		}

		case kMsgToggleLiveInDeskbar:
		{
			BDeskbar deskbar;
			if (deskbar.HasItem (kDeskbarItemName))
				deskbar.RemoveItem (kDeskbarItemName);
			else {
				entry_ref ref;
				be_roster->FindApp(kSignature, &ref);
				deskbar.AddItem(&ref);
			}
			break;
		}

		default:
			BWindow::MessageReceived(message);
			break;
	}
}
开发者ID:MaddTheSane,项目名称:haiku,代码行数:92,代码来源:Workspaces.cpp


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