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


C++ BDeskbar类代码示例

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


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

示例1:

/***********************************************************
 * RemoveDeskbarIcon
 ***********************************************************/
void
HDaemonApp::RemoveDeskbarIcon()
{
	BDeskbar deskbar;
	if( deskbar.HasItem( "scooby_daemon" ))
		deskbar.RemoveItem( "scooby_daemon" );
}
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:10,代码来源:HDaemonApp.cpp

示例2:

void
MailDaemonApp::RemoveDeskbarIcon()
{
	BDeskbar deskbar;
	if (deskbar.HasItem("mail_daemon"))
		deskbar.RemoveItem("mail_daemon");
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: LoadInDeskbar

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

示例4: screen

void
ProjectWindow::ShowErrorWindow(ErrorList *list)
{
	if (fErrorWindow && list)
	{
		BMessage msg;
		list->Flatten(msg);
		msg.what = M_BUILD_WARNINGS;
		fErrorWindow->PostMessage(&msg);
	}
	else
	{
		BRect screen(BScreen().Frame());
		BRect r(screen);
		
		r.left = r.right / 4.0;
		r.right *= .75;
		r.top = r.bottom - 200;
		BDeskbar deskbar;
		if (deskbar.Location() == B_DESKBAR_BOTTOM)
			r.OffsetBy(0,-deskbar.Frame().Height());
		
		fErrorWindow = new ErrorWindow(r,this,list);
		fErrorWindow->Show();
	}
	fStatusBar->SetText("");
}
开发者ID:passick,项目名称:Paladin,代码行数:27,代码来源:ProjectWindow.cpp

示例5: Frame

void
AsciiWindow::Zoom(BPoint, float, float)
{
	if (!fIsZoomed) {
		fLastFrame = Frame();
		BDeskbar deskbar;
		BRect deskbarFrame = deskbar.Frame();
		BRect screenFrame = (BScreen(this)).Frame();

		switch (deskbar.Location()) {
			case B_DESKBAR_TOP:
				MoveTo(std::max(fLastFrame.left, screenFrame.left + 4.0f),
					deskbarFrame.bottom + 28.0f);
				ResizeTo(std::max(fLastFrame.Width(), kWindowWidth),
					screenFrame.bottom - deskbarFrame.Height() - 33.0f);
				break;

			case B_DESKBAR_BOTTOM:
				MoveTo(std::max(fLastFrame.left, screenFrame.left + 4.0f),
					26.0f);
				ResizeTo(std::max(fLastFrame.Width(), kWindowWidth),
					deskbarFrame.top - 33.0f);
				break;

			case B_DESKBAR_LEFT_TOP:
			case B_DESKBAR_LEFT_BOTTOM:
				MoveTo(std::max(fLastFrame.left, deskbarFrame.right + 7.0f),
					26.0f);
				ResizeTo(std::max(fLastFrame.Width(), kWindowWidth),
					screenFrame.bottom - 30.0f);
				break;

			case B_DESKBAR_RIGHT_TOP:
			case B_DESKBAR_RIGHT_BOTTOM:
				ResizeTo(std::max(fLastFrame.Width(), kWindowWidth),
					screenFrame.bottom - 30.0f);
				if (fLastFrame.right + 7.0f > deskbarFrame.left) {
					MoveTo(fLastFrame.left - 7.0f
						- (fLastFrame.right - deskbarFrame.left), 26.0f);
				} else {
					MoveTo(std::max(fLastFrame.left, screenFrame.left + 4.0f),
						26.0f);
				}
				break;

			default:
				MoveTo(std::max(fLastFrame.left, screenFrame.left + 4.0f),
					26.0f);
				ResizeTo(std::max(fLastFrame.Width(), kWindowWidth),
					screenFrame.bottom - 30.0f);
				break;
		}
	} else {
		MoveTo(fLastFrame.LeftTop());
		ResizeTo(fLastFrame.Width(), fLastFrame.Height());
	}

	fIsZoomed = !fIsZoomed;
}
开发者ID:humdingerb,项目名称:Paladin,代码行数:59,代码来源:AsciiWindow.cpp

示例6:

void
NetworkStatusView::_Quit()
{
	if (fInDeskbar) {
		BDeskbar deskbar;
		deskbar.RemoveItem(kDeskbarItemName);
	} else
		be_app->PostMessage(B_QUIT_REQUESTED);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:9,代码来源:NetworkStatusView.cpp

示例7: OnQuitRequested

void WatchView::OnQuitRequested()
{
	// According to the Be Book, we are not allowed to do this
	// since we're a view that's sitting on the Deskbar's shelf.
	// But it works just fine for me, and I see no other way to
	// make a Deskbar replicant quit itself.

	BDeskbar deskbar;
	deskbar.RemoveItem(DESKBAR_ITEM_NAME);
}
开发者ID:DonCN,项目名称:haiku,代码行数:10,代码来源:WatchView.cpp

示例8:

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

示例9: Layout

void
NotificationWindow::SetPosition()
{
	Layout(true);

	BRect bounds = DecoratorFrame();
	float width = Bounds().Width() + 1;
	float height = Bounds().Height() + 1;

	float leftOffset = Frame().left - bounds.left;
	float topOffset = Frame().top - bounds.top + 1;
	float rightOffset = bounds.right - Frame().right;
	float bottomOffset = bounds.bottom - Frame().bottom;
		// Size of the borders around the window
	
	float x = Frame().left, y = Frame().top;
		// If we can't guess, don't move...

	BDeskbar deskbar;
	BRect frame = deskbar.Frame();

	switch (deskbar.Location()) {
		case B_DESKBAR_TOP:
			// Put it just under, top right corner
			y = frame.bottom + topOffset;
			x = frame.right - width + rightOffset;
			break;
		case B_DESKBAR_BOTTOM:
			// Put it just above, lower left corner
			y = frame.top - height - bottomOffset;
			x = frame.right - width + rightOffset;
			break;
		case B_DESKBAR_RIGHT_TOP:
			x = frame.left - width - rightOffset;
			y = frame.top - topOffset;
			break;
		case B_DESKBAR_LEFT_TOP:
			x = frame.right + leftOffset;
			y = frame.top - topOffset;
			break;
		case B_DESKBAR_RIGHT_BOTTOM:
			y = frame.bottom - height + bottomOffset;
			x = frame.left - width - rightOffset;
			break;
		case B_DESKBAR_LEFT_BOTTOM:
			y = frame.bottom - height + bottomOffset;
			x = frame.right + leftOffset;
			break;
		default:
			break;
	}

	MoveTo(x, y);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:54,代码来源:NotificationWindow.cpp

示例10: get_ref_for_path

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

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

示例12: BDeskbar

void DeskbarPulseView::Remove() {
	// Remove ourselves from the deskbar by name
	BDeskbar *deskbar = new BDeskbar();
	status_t err = deskbar->RemoveItem("DeskbarPulseView");
	if (err != B_OK) {
		BString str;
		snprintf(str.LockBuffer(512), 512,
			B_TRANSLATE("Removing from Deskbar failed.\n%s"), strerror(err));
		str.UnlockBuffer();
		BAlert *alert = new BAlert(B_TRANSLATE("Info"), str.String(),
			B_TRANSLATE("OK"));
		alert->SetShortcut(0, B_ESCAPE);
		alert->Go(NULL);
	}
	delete deskbar;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:16,代码来源:DeskbarPulseView.cpp

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

示例14: move_to_deskbar

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

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

示例15: SetViewColor

void DeskbarView::AttachedToWindow()
{
	BView::AttachedToWindow();
	if (Parent())
		SetViewColor(Parent()->ViewColor());
	else
		SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	SetLowColor(ViewColor());

	if (be_roster->IsRunning(B_MAIL_DAEMON_SIGNATURE)) {
		_RefreshMailQuery();
	} else {
		BDeskbar deskbar;
		deskbar.RemoveItem("mail_daemon");
	}
}
开发者ID:kodybrown,项目名称:haiku,代码行数:17,代码来源:DeskbarView.cpp


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