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


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

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


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

示例1: floor

void
WorkspacesWindow::Zoom(BPoint origin, float width, float height)
{
	BScreen screen;
	float screenWidth = screen.Frame().Width();
	float screenHeight = screen.Frame().Height();
	float aspectRatio = screenWidth / screenHeight;

	uint32 columns, rows;
	BPrivate::get_workspaces_layout(&columns, &rows);

	float workspaceWidth = screenWidth / 10;
	float workspaceHeight = workspaceWidth / aspectRatio;

	width = floor(workspaceWidth * columns);
	height = floor(workspaceHeight * rows);

	float tabHeight = Frame().top - DecoratorFrame().top;

	while (width + 2 * kScreenBorderOffset > screenWidth
		|| height + 2 * kScreenBorderOffset + tabHeight > screenHeight) {
		width = floor(0.95 * width);
		height = floor(0.95 * height);
	}

	ResizeTo(width, height);

	origin = screen.Frame().RightBottom();
	origin.x -= kScreenBorderOffset + width;
	origin.y -= kScreenBorderOffset + height;

	MoveTo(origin);
}
开发者ID:mmanley,项目名称:Antares,代码行数:33,代码来源:Workspaces.cpp

示例2: WorkspacesChanged

void Win::WorkspacesChanged(uint32 oldws, uint32 newws) 
{
	//we don't really care what workspace we're running in, however, we need to
	//reset the size limits to match.
	BScreen Screen;
	SetSizeLimits(300,Screen.Frame().right,200,Screen.Frame().bottom);
}
开发者ID:svn2github,项目名称:Themis,代码行数:7,代码来源:win.cpp

示例3: MessageReceived

void PrefKeys::MessageReceived(BMessage *msg){
	char s[255];
	int32 i, index;
	BScreen screen;
	BPoint p;
	BListItem *it = NULL;

	switch(msg->what){
	case SELECT:
		index = list->FullListCurrentSelection();
		if(index < 0){
			break; // nothign selected 
		}
		it = list->FullListItemAt(index);
		if (it){
			i = ((KeyItem*)it)->GetID();				// needed to convert the outline numbers, they are inverted !
			if (i>0){
				sprintf(s, "item: %s", KeyBind.GetID(i));
				p.x =  (screen.Frame().left+screen.Frame().right)/2;
				p.y =  (screen.Frame().top+screen.Frame().bottom)/2;
				m_index = index;
				(new SetKeyWindow(p, i, this));
			}
		}
		break;

	default:
		BView::MessageReceived(msg);
		break;   
	}
}
开发者ID:HaikuArchives,项目名称:BeAE,代码行数:31,代码来源:PrefKeys.cpp

示例4: instantiate_deskbar_item

BView* instantiate_deskbar_item()
{
	// Calculate the correct size of the Deskbar replicant first
	
	BScreen screen;
	float screenWidth = screen.Frame().Width();
	float screenHeight = screen.Frame().Height();
	float aspectRatio = screenWidth / screenHeight;
	uint32 columns, rows;
	BPrivate::get_workspaces_layout(&columns, &rows);

	// ╔═╤═╕ A Deskbar replicant can be 16px tall and 129px wide at most.
	// ║ │ │ We use 1px for the top and left borders (shown as double)
	// ╟─┼─┤ and divide the remainder equally. However, we keep in mind
	// ║ │ │ that the actual width and height of each workspace is smaller
	// ╙─┴─┘ by 1px, because of bottom/right borders (shown as single).
	// When calculating workspace width, we must ensure that the assumed
	// actual workspace height is not negative. Zero is OK.

	float height = 16;
	float rowHeight = floor((height - 1) / rows);
	if (rowHeight < 1)
		rowHeight = 1;

	float columnWidth = floor((rowHeight - 1) * aspectRatio) + 1;

	float width = columnWidth * columns + 1;
	if (width > 129)
		width = 129;

	return new WorkspacesView(BRect (0, 0, width - 1, height - 1), false);
}
开发者ID:MaddTheSane,项目名称:haiku,代码行数:32,代码来源:Workspaces.cpp

示例5: frame

void
LoginApp::ReadyToRun()
{
	BScreen screen;

	if (fEditShelfMode) {
		BAlert* alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can "
			"customize the desktop shown behind the Login application by "
			"dropping replicants onto it.\n\n"
			"When you are finished just quit the application (Cmd-Q)."),
			B_TRANSLATE("OK"));
		alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
		alert->Go(NULL);
	} else {
		BRect frame(0, 0, 450, 150);
		frame.OffsetBySelf(screen.Frame().Width()/2 - frame.Width()/2,
			screen.Frame().Height()/2 - frame.Height()/2);
		fLoginWindow = new LoginWindow(frame);
		fLoginWindow->Show();
	}

	fDesktopWindow = new DesktopWindow(screen.Frame(), fEditShelfMode);
	fDesktopWindow->Show();
	// TODO: add a shelf with Activity Monitor replicant :)
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:25,代码来源:LoginApp.cpp

示例6:

void
WorkspacesWindow::FrameResized(float width, float height)
{
	if (!modifiers() & B_SHIFT_KEY) {
		BWindow::FrameResized(width, height);
		return;
	}

	uint32 columns, rows;
	BPrivate::get_workspaces_layout(&columns, &rows);

	BScreen screen;
	float screenWidth = screen.Frame().Width();
	float screenHeight = screen.Frame().Height();

	float windowAspectRatio
		= (columns * screenWidth) / (rows * screenHeight);

	float newHeight = width / windowAspectRatio;

	if (height != newHeight)
		ResizeTo(width, newHeight);

	fSettings->SetWindowFrame(Frame());
}
开发者ID:mmanley,项目名称:Antares,代码行数:25,代码来源:Workspaces.cpp

示例7: ResizeToImage

// ResizeToImage --  Resizes the window to fit snugly around the image.
//                   Should be called ONLY when there is 1 image loaded
//                   and no more. & only if the window isn't FullScreen
void PictureViewer::ResizeToImage() {
   if (setup->FullScreen()) return;
   if (thePic == NULL) return;
  
  // the window needs to be adjusted by byX and byY points
   float byX = Bounds().Width() - thePic->Bounds().Width() - 3;
   float byY = Bounds().Height() - thePic->Bounds().Height() - 3;
  
  // Now we're going to make sure it's still on the screen.
    // get the coordinates
   BScreen *theScreen = new BScreen();
    float screen_right  = theScreen->Frame().Width();
    float screen_bottom = theScreen->Frame().Height();
   delete theScreen;

  // determine where the new position should be
   float newX = Window()->Frame().right - byX;
   float newY = Window()->Frame().bottom - byY;

  // is the new position greater than the screen width? hmm... fix if so
   if (newX > screen_right)   byX = -(screen_right - Window()->Frame().right) + 5;
   if (newY > screen_bottom)  byY = -(screen_bottom - Window()->Frame().bottom) + 5;

  // finalize
   Window()->ResizeBy( - byX, - byY );
}
开发者ID:HaikuArchives,项目名称:Peek,代码行数:29,代码来源:pictureViewer.cpp

示例8: BWindow

LJAboutWindow::LJAboutWindow()
 : BWindow(BRect(100, 295, 411, 464), "About AliveJournal", B_TITLED_WINDOW, 0, B_CURRENT_WORKSPACE)
{

	MainView = new LJAboutMainView();
	AddChild(MainView);
	SetSizeLimits(0, 1000, 0, 1000);

    char *title = new char[32];
    sprintf( title, "About AliveJournal v%s", VERSION_NUMBER );
    SetTitle( title );
    sprintf( title, "AliveJournal v%s", VERSION_NUMBER );
    MainView->titlestring->SetText( title );
    delete title;

    // Center the about box.
    BScreen *screen = new BScreen(this);
    int x = 0;
    int y = 0;

    x = screen->Frame().IntegerWidth() / 2;
    y = screen->Frame().IntegerHeight() / 2;

    x = x - Frame().IntegerWidth() / 2;
    y = y - Frame().IntegerHeight() / 2;

    MoveTo( x, y );
    
    delete screen;

}
开发者ID:grahams,项目名称:alivejournal,代码行数:31,代码来源:LJAboutWindow.cpp

示例9:

Settings::Settings()
	:
	fMessage(kMsgDiskProbeSettings),
	fUpdated(false)
{
	float fontSize = be_plain_font->Size();
	int32 windowWidth = DataView::WidthForFontSize(fontSize) + 20;
		// TODO: make scrollbar width variable

	BScreen screen;
	fMessage.AddRect("window_frame", BLayoutUtils::AlignInFrame(screen.Frame(),
		BSize(windowWidth, windowWidth),
		BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER)));
	fMessage.AddInt32("base_type", kHexBase);
	fMessage.AddFloat("font_size", fontSize);
	fMessage.AddBool("case_sensitive", true);
	fMessage.AddInt8("find_mode", kAsciiMode);

	BFile file;
	if (Open(&file, B_READ_ONLY) != B_OK)
		return;

	// TODO: load/save settings as flattened BMessage - but not yet,
	//		since that will break compatibility with R5's DiskProbe

	disk_probe_settings settings;
	if (file.Read(&settings, sizeof(settings)) == sizeof(settings)) {
#if B_HOST_IS_BENDIAN
		// settings are saved in little endian
		settings.window_frame.left = B_LENDIAN_TO_HOST_FLOAT(
			settings.window_frame.left);
		settings.window_frame.top = B_LENDIAN_TO_HOST_FLOAT(
			settings.window_frame.top);
		settings.window_frame.right = B_LENDIAN_TO_HOST_FLOAT(
			settings.window_frame.right);
		settings.window_frame.bottom = B_LENDIAN_TO_HOST_FLOAT(
			settings.window_frame.bottom);
#endif
		// check if the window frame is on screen at all
		BScreen screen;
		if (screen.Frame().Contains(settings.window_frame.LeftTop())
			&& settings.window_frame.Width() < screen.Frame().Width()
			&& settings.window_frame.Height() < screen.Frame().Height())
			fMessage.ReplaceRect("window_frame", settings.window_frame);

		if (settings.base_type == kHexBase
			|| settings.base_type == kDecimalBase)
			fMessage.ReplaceInt32("base_type",
				B_LENDIAN_TO_HOST_INT32(settings.base_type));
		if (settings.font_size >= 0 && settings.font_size <= 72)
			fMessage.ReplaceFloat("font_size",
				float(B_LENDIAN_TO_HOST_INT32(settings.font_size)));

		fMessage.ReplaceBool("case_sensitive",
			settings.flags & kCaseSensitive);
		fMessage.ReplaceInt8("find_mode",
			settings.flags & kHexFindMode ? kHexMode : kAsciiMode);
	}
}
开发者ID:looncraz,项目名称:haiku,代码行数:59,代码来源:DiskProbe.cpp

示例10: NicePosition

BRect CColorPicker::NicePosition()
{
	BRect p(0, 0, 390, 170);
	BScreen s;
	
	p.OffsetBy((s.Frame().Width() - p.Width()) / 2, (s.Frame().Height() - p.Height()) / 3);
	
	return p;
} /* CColorPicker::NicePosition */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:9,代码来源:ColorPicker.cpp

示例11: frame

void
ThemesApp::ReadyToRun()
{
	BScreen s;
	BRect frame(0, 0, 550, 300);
	frame.OffsetBySelf(s.Frame().Width()/2 - frame.Width()/2, 
						s.Frame().Height()/2 - frame.Height()/2);
	BWindow *w = new BWindow(frame, "Themes", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE);
	ThemeInterfaceView *v = new ThemeInterfaceView(w->Bounds());
	w->AddChild(v);
	w->Show();
}
开发者ID:luciang,项目名称:haiku,代码行数:12,代码来源:ThemesApp.cpp

示例12: if

void
CaptureView::MouseMoved(BPoint point, uint32 transit,
	const BMessage* dragMessage)
{
	ConvertToScreen(&point);

	if (fMovedOutWhat != 0 && !fMovedOutFrame.Contains(point))
		_SendMovedOutNotification();

	uint32 modifiers = ::modifiers();
	if ((modifiers & fModifierMask) == 0) {
		_UpdateLast(point);
		return;
	}

	// TODO: we will need to iterate over all existing screens to find the
	// right one!
	BScreen screen;
	BRect screenFrame = screen.Frame();

	uint32 location = kNowhere;
	if (point.x <= screenFrame.left && fLastPoint.x > screenFrame.left)
		location = kLeftEdge;
	else if (point.x >= screenFrame.right && fLastPoint.x < screenFrame.right)
		location = kRightEdge;
	else if (point.y <= screenFrame.top && fLastPoint.y > screenFrame.top)
		location = kTopEdge;
	else if (point.y >= screenFrame.bottom && fLastPoint.y < screenFrame.bottom)
		location = kBottomEdge;

	if (location != kNowhere)
		_Notify(location, fLastTeam);

	_UpdateLast(point);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:35,代码来源:CaptureWindow.cpp

示例13: BScreen

bool
make_sure_frame_is_on_screen(BRect& frame, BWindow* window)
{
	BScreen* screen = window != NULL ? new BScreen(window)
		: new BScreen(B_MAIN_SCREEN_ID);

	bool success = false;
	if (frame.IsValid() && screen->IsValid()) {
		BRect screenFrame = screen->Frame();
		if (!screenFrame.Contains(frame)) {
			// make sure frame fits in the screen
			if (frame.Width() > screenFrame.Width())
				frame.right -= frame.Width() - screenFrame.Width() + 10.0;
			if (frame.Height() > screenFrame.Height())
				frame.bottom -= frame.Height() - screenFrame.Height() + 30.0;
			// frame is now at the most the size of the screen
			if (frame.right > screenFrame.right)
				frame.OffsetBy(-(frame.right - screenFrame.right), 0.0);
			if (frame.bottom > screenFrame.bottom)
				frame.OffsetBy(0.0, -(frame.bottom - screenFrame.bottom));
			if (frame.left < screenFrame.left)
				frame.OffsetBy((screenFrame.left - frame.left), 0.0);
			if (frame.top < screenFrame.top)
				frame.OffsetBy(0.0, (screenFrame.top - frame.top));
		}
		success = true;
	}
	delete screen;
	return success;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:30,代码来源:support.cpp

示例14: tabSpace

void
Utility::_MakeTabSpaceTransparent(BBitmap* screenshot, BRect frame) const
{
	if (!frame.IsValid() || screenshot->ColorSpace() != B_RGBA32)
		return;

	if (!frame.Contains(tabFrame))
		return;

	float tabHeight = tabFrame.bottom - tabFrame.top;

	BRegion tabSpace(frame);
	frame.OffsetBy(0, tabHeight);
	tabSpace.Exclude(frame);
	tabSpace.Exclude(tabFrame);
	frame.OffsetBy(0, -tabHeight);
	tabSpace.OffsetBy(-frame.left, -frame.top);
	BScreen screen;
	BRect screenFrame = screen.Frame();
	tabSpace.OffsetBy(-screenFrame.left, -screenFrame.top);

	BView view(screenshot->Bounds(), "bitmap", B_FOLLOW_ALL_SIDES, 0);
	screenshot->AddChild(&view);
	if (view.Looper() && view.Looper()->Lock()) {
		view.SetDrawingMode(B_OP_COPY);
		view.SetHighColor(B_TRANSPARENT_32_BIT);

		for (int i = 0; i < tabSpace.CountRects(); i++)
			view.FillRect(tabSpace.RectAt(i));

		view.Sync();
		view.Looper()->Unlock();
	}
	screenshot->RemoveChild(&view);
}
开发者ID:mariuz,项目名称:haiku,代码行数:35,代码来源:Utility.cpp

示例15: PPSize

PPSize
DisplayDevice_Haiku::getDisplayResolution() const
{
	BScreen screen;
	BRect frame = screen.Frame();
	return PPSize(frame.IntegerWidth(), frame.IntegerHeight());
}
开发者ID:Fatbag,项目名称:MilkyTracker,代码行数:7,代码来源:DisplayDevice_Haiku.cpp


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