本文整理汇总了C++中BScreen类的典型用法代码示例。如果您正苦于以下问题:C++ BScreen类的具体用法?C++ BScreen怎么用?C++ BScreen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BScreen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TRACE
void PDocument::Init()
{
TRACE();
bool locked = Lock();
allNodes = new BList();
allConnections = new BList();
selected = new BList();
valueChanged = new BList();
// trashed = new BList();
printerSetting = NULL;
documentSetting = new BMessage();
bounds = BRect(0,0,600,800);
printableRect = NULL;
paperRect = NULL;
savePanel = NULL;
width = 600;
height = 800;
dirty = true;
entryRef = NULL;
autoSaveRef = NULL;
modified = false;
editorManager = new PEditorManager(this);
commandManager = new PCommandManager(this);
//** to do.. helpManager = new HelpManager();
BScreen *tmpScreen = new BScreen();
BRect windowRect = tmpScreen->Frame();
windowRect.InsetBy(50,50);
window = new PWindow(windowRect,this);
autoSaver = new BMessageRunner(BMessenger(this),
new BMessage(P_C_AUTO_SAVE),
autoSaveIntervall);
if (locked)
UnlockLooper();
}
示例2: 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);
}
示例3: 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 :)
}
示例4: 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);
}
示例5: PPSize
PPSize
DisplayDevice_Haiku::getDisplayResolution() const
{
BScreen screen;
BRect frame = screen.Frame();
return PPSize(frame.IntegerWidth(), frame.IntegerHeight());
}
示例6: Bounds
// 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 );
}
示例7: Bounds
void
MediaView::InitObject()
{
BScreen screen;
fMediaFile = NULL;
fVideoTrack = NULL;
fAudioTrack = NULL;
fAudioOutput = NULL;
fMediaBar = NULL;
fBitmap = NULL;
fBitmapDepth = screen.ColorSpace();
fCurTime = 0;
fPlayerThread = B_ERROR;
fPlaySem = B_ERROR;
fScrubSem = B_ERROR;
fPlaying = false;
fSnoozing = false;
fAudioDumpingBuffer = NULL;
BRect mediaBarFrame = Bounds();
mediaBarFrame.top = mediaBarFrame.bottom - kMediaBarHeight;
fMediaBar = new _MediaBar_(mediaBarFrame, this);
AddChild(fMediaBar);
SetViewColor(B_TRANSPARENT_32_BIT);
}
示例8: Frame
void
ExpanderWindow::_ExpandListingText()
{
float delta = fLongestLine - fListingText->Frame().Width();
if (delta > 0) {
BScreen screen;
BRect screenFrame = screen.Frame();
if (Frame().right + delta > screenFrame.right)
delta = screenFrame.right - Frame().right - 4.0f;
ResizeBy(delta, 0.0f);
}
float minWidth, maxWidth, minHeight, maxHeight;
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
if (minWidth < Frame().Width() + delta) {
// set the Zoom limit as the minimal required size
SetZoomLimits(Frame().Width() + delta,
min_c(fSizeLimit + fListingText->TextRect().Height()
+ fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f,
maxHeight));
} else {
// set the zoom limit based on minimal window size allowed
SetZoomLimits(minWidth,
min_c(fSizeLimit + fListingText->TextRect().Height()
+ fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f,
maxHeight));
}
}
示例9: 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);
}
示例10: ConvertToScreen
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);
}
示例11: make_sure_frame_is_on_screen
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;
}
示例12:
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());
}
示例13: BScreen
Size2 OS_Haiku::get_screen_size(int p_screen) const {
// TODO: make this work with the p_screen parameter
BScreen *screen = new BScreen(window);
BRect frame = screen->Frame();
delete screen;
return Size2i(frame.IntegerWidth() + 1, frame.IntegerHeight() + 1);
}
示例14: 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);
}
示例15: DisplayHelp
void BubbleHelper::DisplayHelp(char *text, BPoint where)
{
textview->SetText(text);
float height=textview->TextHeight(0,2E6)+0;
float width=0;
int numlines=textview->CountLines();
int linewidth;
for(int i=0;i<numlines;i++)
if((linewidth=int(textview->LineWidth(i)))>width)
width=linewidth;
textwin->ResizeTo(width+2,height);
textview->SetTextRect(BRect(1,0,width+1,height+1));
BScreen screen;
BPoint dest=where+BPoint(0,20);
BRect screenframe=screen.Frame();
if((dest.y+height)>(screenframe.bottom-3))
dest.y=dest.y-(16+height+8);
if((dest.x+width+4)>(screenframe.right))
dest.x=dest.x-((dest.x+width+4)-screenframe.right);
ShowBubble(dest);
}