Move StripeView to libshared
Change-Id: Ib8ff2f731f9d34e04854f1c2ec288a3db1036793 Reviewed-on: https://review.haiku-os.org/c/1458 Reviewed-by: Rene Gollent <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
33fc4f4063
commit
66cb2efaa8
@@ -16,9 +16,12 @@
|
||||
#include <View.h>
|
||||
|
||||
|
||||
class StripeView : public BView {
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class BStripeView : public BView {
|
||||
public:
|
||||
StripeView(BBitmap& icon);
|
||||
BStripeView(BBitmap& icon);
|
||||
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual BSize PreferredSize();
|
||||
@@ -40,4 +43,10 @@ icon_layout_scale()
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
using namespace BPrivate;
|
||||
|
||||
|
||||
#endif /* _STRIPE_VIEW_H */
|
||||
@@ -7,7 +7,6 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src servers package ] ;
|
||||
Application SoftwareUpdater :
|
||||
SoftwareUpdaterApp.cpp
|
||||
SoftwareUpdaterWindow.cpp
|
||||
StripeView.cpp
|
||||
UpdateAction.cpp
|
||||
UpdateManager.cpp
|
||||
CheckAction.cpp
|
||||
@@ -17,7 +16,7 @@ Application SoftwareUpdater :
|
||||
# package_daemon
|
||||
ProblemWindow.cpp
|
||||
|
||||
: be localestub package translation libbnetapi.so [ TargetLibsupc++ ]
|
||||
: be localestub package shared translation libbnetapi.so [ TargetLibsupc++ ]
|
||||
: SoftwareUpdater.rdef
|
||||
;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
|
||||
{
|
||||
// Layout
|
||||
BBitmap icon = GetIcon(32 * icon_layout_scale());
|
||||
fStripeView = new StripeView(icon);
|
||||
fStripeView = new BStripeView(icon);
|
||||
|
||||
fUpdateButton = new BButton(B_TRANSLATE("Update now"),
|
||||
new BMessage(kMsgUpdateConfirmed));
|
||||
|
||||
@@ -175,7 +175,7 @@ private:
|
||||
status_t _ReadSettings(BMessage& settings);
|
||||
|
||||
BRect fDefaultRect;
|
||||
StripeView* fStripeView;
|
||||
BStripeView* fStripeView;
|
||||
BStringView* fHeaderView;
|
||||
BStringView* fDetailView;
|
||||
BButton* fUpdateButton;
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007-2016 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ryan Leavengood <leavengood@gmail.com>
|
||||
* John Scipione <jscipione@gmail.com>
|
||||
* Joseph Groover <looncraz@looncraz.net>
|
||||
* Brian Hill <supernova@tycho.email>
|
||||
*/
|
||||
|
||||
|
||||
#include "StripeView.h"
|
||||
|
||||
#include <LayoutUtils.h>
|
||||
|
||||
|
||||
static const float kTopOffset = 10.0f;
|
||||
static const int kIconStripeWidth = 30;
|
||||
|
||||
|
||||
StripeView::StripeView(BBitmap& icon)
|
||||
:
|
||||
BView("StripeView", B_WILL_DRAW),
|
||||
fIcon(icon),
|
||||
fIconSize(0.0),
|
||||
fPreferredWidth(0.0),
|
||||
fPreferredHeight(0.0)
|
||||
{
|
||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
if (fIcon.IsValid()) {
|
||||
fIconSize = fIcon.Bounds().Width();
|
||||
// Use the same scaling as a BAlert
|
||||
int32 scale = icon_layout_scale();
|
||||
fPreferredWidth = 18 * scale + fIcon.Bounds().Width();
|
||||
fPreferredHeight = 6 * scale + fIcon.Bounds().Height();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StripeView::Draw(BRect updateRect)
|
||||
{
|
||||
if (fIconSize == 0)
|
||||
return;
|
||||
|
||||
SetHighColor(ViewColor());
|
||||
FillRect(updateRect);
|
||||
|
||||
BRect stripeRect = Bounds();
|
||||
int32 iconLayoutScale = icon_layout_scale();
|
||||
stripeRect.right = kIconStripeWidth * iconLayoutScale;
|
||||
SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
|
||||
FillRect(stripeRect);
|
||||
|
||||
SetDrawingMode(B_OP_ALPHA);
|
||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||
DrawBitmapAsync(&fIcon, BPoint(stripeRect.right - (fIconSize / 2.0),
|
||||
6 * iconLayoutScale));
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
StripeView::PreferredSize()
|
||||
{
|
||||
return BSize(fPreferredWidth, B_SIZE_UNSET);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StripeView::GetPreferredSize(float* _width, float* _height)
|
||||
{
|
||||
if (_width != NULL)
|
||||
*_width = fPreferredWidth;
|
||||
|
||||
if (_height != NULL)
|
||||
*_height = fPreferredHeight;
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
StripeView::MaxSize()
|
||||
{
|
||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
|
||||
BSize(fPreferredWidth, B_SIZE_UNLIMITED));
|
||||
}
|
||||
@@ -56,6 +56,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
|
||||
ShakeTrackingFilter.cpp
|
||||
StringForRate.cpp
|
||||
StringForSize.cpp
|
||||
StripeView.cpp
|
||||
TextTable.cpp
|
||||
Thread.cpp
|
||||
ToolBar.cpp
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
static const int kIconStripeWidth = 30;
|
||||
|
||||
|
||||
StripeView::StripeView(BBitmap& icon)
|
||||
BStripeView::BStripeView(BBitmap& icon)
|
||||
:
|
||||
BView("StripeView", B_WILL_DRAW),
|
||||
fIcon(icon),
|
||||
@@ -39,7 +39,7 @@ StripeView::StripeView(BBitmap& icon)
|
||||
|
||||
|
||||
void
|
||||
StripeView::Draw(BRect updateRect)
|
||||
BStripeView::Draw(BRect updateRect)
|
||||
{
|
||||
if (fIconSize == 0)
|
||||
return;
|
||||
@@ -61,14 +61,14 @@ StripeView::Draw(BRect updateRect)
|
||||
|
||||
|
||||
BSize
|
||||
StripeView::PreferredSize()
|
||||
BStripeView::PreferredSize()
|
||||
{
|
||||
return BSize(fPreferredWidth, B_SIZE_UNSET);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StripeView::GetPreferredSize(float* _width, float* _height)
|
||||
BStripeView::GetPreferredSize(float* _width, float* _height)
|
||||
{
|
||||
if (_width != NULL)
|
||||
*_width = fPreferredWidth;
|
||||
@@ -79,7 +79,7 @@ StripeView::GetPreferredSize(float* _width, float* _height)
|
||||
|
||||
|
||||
BSize
|
||||
StripeView::MaxSize()
|
||||
BStripeView::MaxSize()
|
||||
{
|
||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
|
||||
BSize(fPreferredWidth, B_SIZE_UNLIMITED));
|
||||
@@ -42,7 +42,7 @@ AppAccessRequestWindow::AppAccessRequestWindow(const char* keyringName,
|
||||
|
||||
|
||||
BBitmap icon = GetIcon(32 * icon_layout_scale());
|
||||
fStripeView = new StripeView(icon);
|
||||
fStripeView = new BStripeView(icon);
|
||||
|
||||
float inset = ceilf(be_plain_font->Size() * 0.7);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
BButton* fDisallowButton;
|
||||
BButton* fOnceButton;
|
||||
BButton* fAlwaysButton;
|
||||
StripeView* fStripeView;
|
||||
BStripeView* fStripeView;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
SubDir HAIKU_TOP src servers keystore ;
|
||||
|
||||
UsePrivateHeaders app ;
|
||||
UsePrivateHeaders shared ;
|
||||
|
||||
Server keystore_server :
|
||||
AppAccessRequestWindow.cpp
|
||||
KeyRequestWindow.cpp
|
||||
Keyring.cpp
|
||||
KeyStoreServer.cpp
|
||||
StripeView.cpp
|
||||
: be localestub [ TargetLibstdc++ ]
|
||||
: be localestub shared [ TargetLibstdc++ ]
|
||||
: keystore_server.rdef
|
||||
;
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007-2016 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ryan Leavengood <leavengood@gmail.com>
|
||||
* John Scipione <jscipione@gmail.com>
|
||||
* Joseph Groover <looncraz@looncraz.net>
|
||||
* Brian Hill <supernova@tycho.email>
|
||||
*/
|
||||
#ifndef _STRIPE_VIEW_H
|
||||
#define _STRIPE_VIEW_H
|
||||
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <View.h>
|
||||
|
||||
|
||||
class StripeView : public BView {
|
||||
public:
|
||||
StripeView(BBitmap& icon);
|
||||
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual BSize PreferredSize();
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
virtual BSize MaxSize();
|
||||
|
||||
private:
|
||||
BBitmap fIcon;
|
||||
float fIconSize;
|
||||
float fPreferredWidth;
|
||||
float fPreferredHeight;
|
||||
};
|
||||
|
||||
|
||||
static inline int32
|
||||
icon_layout_scale()
|
||||
{
|
||||
return max_c(1, ((int32)be_plain_font->Size() + 15) / 16);
|
||||
}
|
||||
|
||||
|
||||
#endif /* _STRIPE_VIEW_H */
|
||||
Reference in New Issue
Block a user