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


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

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


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

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

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

示例3: DecoratorFrame

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

示例4: switch

void
NotificationWindow::PopupAnimation(float width, float height)
{
    float x = 0, y = 0, sx, sy;
    float pad = 0;
    BDeskbar deskbar;
    BRect frame = deskbar.Frame();

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

    MoveTo(x, y);

    if (IsHidden() && fViews.size() != 0)
        Show();
    // Activate();// it hides floaters from apps :-(
}
开发者ID:,项目名称:,代码行数:61,代码来源:

示例5: openmsg


//.........这里部分代码省略.........
			{
				// Don't need a selection if there is only one group in the project
				if (fProject->CountGroups() == 1)
					groupItem = fProjectList->ItemForGroup(fProject->GroupAt(0));
			}
			else
			{
				BStringItem *strItem = (BStringItem*)fProjectList->FullListItemAt(selection);
				groupItem = fProjectList->GroupForItem(strItem);
			}
			
			if (!groupItem)
				break;
			
			fProjectList->SortItemsUnder(groupItem,true,compare_source_file_items);
			groupItem->GetData()->Sort();
			fProject->Save();
			
			break;
		}
		case M_TOGGLE_ERROR_WINDOW:
		{
			ToggleErrorWindow(fProject->GetErrorList());
			break;
		}
		case M_SHOW_ERROR_WINDOW:
		{
			ShowErrorWindow(fProject->GetErrorList());
			break;
		}
		case M_SHOW_PROJECT_SETTINGS:
		{
			BRect r(0,0,350,300);
			BRect screen(BScreen().Frame());
			
			r.OffsetTo((screen.Width() - r.Width()) / 2.0,
						(screen.Height() - r.Height()) / 2.0);
			
			ProjectSettingsWindow *win = new ProjectSettingsWindow(r,fProject);
			win->Show();
			break;
		}
		case M_SHOW_RUN_ARGS:
		{
			RunArgsWindow *argwin = new RunArgsWindow(fProject);
			argwin->Show();
			break;
		}
		case M_JUMP_TO_MSG:
		{
			entry_ref ref;
			if (msg->FindRef("refs",&ref) == B_OK)
			{
				msg->what = B_REFS_RECEIVED;
				be_app->PostMessage(msg);
			}
			break;
		}
		case B_ABOUT_REQUESTED:
		{
			be_app->PostMessage(B_ABOUT_REQUESTED);
			break;
		}
		case M_SHOW_OPEN_PROJECT:
		{
			be_app->PostMessage(msg);
开发者ID:passick,项目名称:Paladin,代码行数:67,代码来源:ProjectWindow.cpp

示例6: location

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;
	float y = Frame().top;
		// If we cant guess, don't move...
	BPoint location(x, y);

	BDeskbar deskbar;

	// If notification and deskbar position are same
	// then follow deskbar position
	uint32 position = (is_overlapping(deskbar.Location(), fPosition))
			? B_FOLLOW_DESKBAR
			: fPosition;


	if (position == B_FOLLOW_DESKBAR) {
		BRect frame = deskbar.Frame();
		switch (deskbar.Location()) {
			case B_DESKBAR_TOP:
				// In case of overlapping here or for bottom
				// use user's notification position
				y = frame.bottom + topOffset;
				x = (fPosition == (B_FOLLOW_LEFT | B_FOLLOW_TOP))
					? frame.left + rightOffset
					: frame.right - width + rightOffset;
				break;
			case B_DESKBAR_BOTTOM:
				y = frame.top - height - bottomOffset;
				x = (fPosition == (B_FOLLOW_LEFT | B_FOLLOW_BOTTOM))
					? frame.left + rightOffset
					: frame.right - width + rightOffset;
				break;
			case B_DESKBAR_RIGHT_TOP:
				y = frame.top - topOffset + 1;
				x = frame.left - width - rightOffset;
				break;
			case B_DESKBAR_LEFT_TOP:
				y = frame.top - topOffset + 1;
				x = frame.right + leftOffset;
				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;
		}
		location = BPoint(x, y);
	} else if (position == (B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM)) {
		location = BScreen().Frame().RightBottom();
		location -= BPoint(width, height);
	} else if (position == (B_FOLLOW_LEFT | B_FOLLOW_BOTTOM)) {
		location = BScreen().Frame().LeftBottom();
		location -= BPoint(0, height);
	} else if (position == (B_FOLLOW_RIGHT | B_FOLLOW_TOP)) {
		location = BScreen().Frame().RightTop();
		location -= BPoint(width, 0);
	} else if (position == (B_FOLLOW_LEFT | B_FOLLOW_TOP)) {
		location = BScreen().Frame().LeftTop();
	}

	MoveTo(location);
}
开发者ID:looncraz,项目名称:haiku,代码行数:81,代码来源:NotificationWindow.cpp

示例7: Frame

void
Win::Zoom( BPoint origin, float width, float height )
{
	bool IM = false;
	AppSettings->FindBool( kPrefsIntelligentZoom, &IM );
	
	if( IM == true )
	{
		if( fMaximized == false )
		{
			fOldFrame = Frame();
			
			BScreen screen;
			BDeskbar deskbar;
			BRect dbframe = deskbar.Frame();
		
			switch( deskbar.Location() )
			{
				case B_DESKBAR_TOP :
				{
					origin.y += dbframe.Height() + 2;
					break;
				}
				case B_DESKBAR_BOTTOM :
				{
					height -= dbframe.Height() + 2;
					break;
				}
				case B_DESKBAR_LEFT_BOTTOM :
				{
					origin.x += dbframe.Width() + 2;
					width -= dbframe.right + 2;
					break;
				}
				case B_DESKBAR_RIGHT_BOTTOM :
				{
					width = dbframe.left - origin.x - 7;
					break;
				}
				case B_DESKBAR_LEFT_TOP :
				{
					origin.x += dbframe.Width() + 2;
					width -= dbframe.right + 2;
					break;
				}
				case B_DESKBAR_RIGHT_TOP :
				{
					width = dbframe.left - origin.x - 7;
					break;
				}
			}
						
			fMaximized = true;
			
			BWindow::Zoom( origin, width, height );
		}
		else
		{
			origin = fOldFrame.LeftTop();
			width = fOldFrame.right - fOldFrame.left;
			height = fOldFrame.bottom - fOldFrame.top;
			
			fMaximized = false;
			
			BWindow::Zoom( origin, width, height );
		}
	}
	else
		BWindow::Zoom( origin, width, height );
}
开发者ID:svn2github,项目名称:Themis,代码行数:70,代码来源:win.cpp


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