Cosmetic change for the border around the screenshot preview, as suggested in #3367.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30593 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre 2009-05-02 22:58:04 +00:00
parent 338299319e
commit f3d5fb8624
5 changed files with 60 additions and 12 deletions

View File

@ -6,6 +6,7 @@ UsePrivateHeaders interface ;
Application Screenshot :
main.cpp
PNGDump.cpp
PreviewView.cpp
Screenshot.cpp
ScreenshotWindow.cpp
: be tracker translation libpng.so libz.so

View File

@ -0,0 +1,27 @@
/*
* Copyright 2009, Philippe Saint-Pierre, stpere@gmail.com
* Distributed under the terms of the MIT License.
*/
#include "PreviewView.h"
#include <ControlLook.h>
PreviewView::PreviewView()
: BView("preview", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE)
{
}
PreviewView::~PreviewView()
{
}
void
PreviewView::Draw(BRect updateRect)
{
BRect rect = Frame();
be_control_look->DrawTextControlBorder(this, rect, rect,
ui_color(B_PANEL_BACKGROUND_COLOR));
}

View File

@ -0,0 +1,22 @@
/*
* Copyright 2009, Philippe Saint-Pierre, stpere@gmail.com
* Distributed under the terms of the MIT License.
*/
#ifndef PREVIEW_VIEW_H
#define PREVIEW_VIEW_H
#include <View.h>
class PreviewView : public BView {
public:
PreviewView();
~PreviewView();
protected:
virtual void Draw(BRect updateRect);
};
#endif /* PREVIEW_VIEW_H */

View File

@ -7,7 +7,6 @@
#include "PNGDump.h"
#include <Alert.h>
#include <Application.h>
#include <Bitmap.h>
@ -324,9 +323,7 @@ ScreenshotWindow::_SetupFirstLayoutItem(BCardLayout* layout)
void
ScreenshotWindow::_SetupSecondLayoutItem(BCardLayout* layout)
{
fPreviewBox = new BBox(BRect(0.0, 0.0, 200.0, 150.0));
fPreviewBox->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET));
fPreviewBox->SetFlags(fPreviewBox->Flags() | B_FULL_UPDATE_ON_RESIZE);
fPreview = new PreviewView();
fNameControl = new BTextControl("", "Name:", "screenshot1", NULL);
@ -354,7 +351,7 @@ ScreenshotWindow::_SetupSecondLayoutItem(BCardLayout* layout)
layout->AddView(1, BGroupLayoutBuilder(B_VERTICAL)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10.0)
.Add(fPreviewBox)
.Add(fPreview)
.AddGroup(B_VERTICAL)
.Add(gridLayout->View())
.AddGlue()
@ -514,13 +511,13 @@ ScreenshotWindow::_UpdatePreviewPanel()
fScreenshot->Bounds().Width()) * width;
}
fPreviewBox->SetExplicitMinSize(BSize(width, height));
fPreviewBox->SetExplicitMaxSize(BSize(width, height));
fPreviewBox->ClearViewBitmap();
fPreviewBox->SetViewBitmap(fScreenshot, fScreenshot->Bounds(),
fPreviewBox->Bounds(), B_FOLLOW_ALL, 0);
fPreview->SetExplicitMinSize(BSize(width, height));
fPreview->SetExplicitMaxSize(BSize(width, height));
fPreview->ClearViewBitmap();
fPreview->SetViewBitmap(fScreenshot, fScreenshot->Bounds(),
fPreview->Bounds(), B_FOLLOW_ALL, 0);
BCardLayout* layout = dynamic_cast<BCardLayout*> (GetLayout());
if (layout)
layout->SetVisibleItem(1L);

View File

@ -5,6 +5,7 @@
#include <String.h>
#include <Window.h>
#include "PreviewView.h"
class BBitmap;
class BBox;
@ -57,7 +58,7 @@ private:
void _SaveScreenshotSilent() const;
private:
BBox* fPreviewBox;
PreviewView* fPreview;
BRadioButton* fActiveWindow;
BRadioButton* fWholeDesktop;
BTextControl* fDelayControl;