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>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
class StripeView : public BView {
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
|
class BStripeView : public BView {
|
||||||
public:
|
public:
|
||||||
StripeView(BBitmap& icon);
|
BStripeView(BBitmap& icon);
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual BSize PreferredSize();
|
virtual BSize PreferredSize();
|
||||||
@@ -40,4 +43,10 @@ icon_layout_scale()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
using namespace BPrivate;
|
||||||
|
|
||||||
|
|
||||||
#endif /* _STRIPE_VIEW_H */
|
#endif /* _STRIPE_VIEW_H */
|
||||||
@@ -7,7 +7,6 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src servers package ] ;
|
|||||||
Application SoftwareUpdater :
|
Application SoftwareUpdater :
|
||||||
SoftwareUpdaterApp.cpp
|
SoftwareUpdaterApp.cpp
|
||||||
SoftwareUpdaterWindow.cpp
|
SoftwareUpdaterWindow.cpp
|
||||||
StripeView.cpp
|
|
||||||
UpdateAction.cpp
|
UpdateAction.cpp
|
||||||
UpdateManager.cpp
|
UpdateManager.cpp
|
||||||
CheckAction.cpp
|
CheckAction.cpp
|
||||||
@@ -17,7 +16,7 @@ Application SoftwareUpdater :
|
|||||||
# package_daemon
|
# package_daemon
|
||||||
ProblemWindow.cpp
|
ProblemWindow.cpp
|
||||||
|
|
||||||
: be localestub package translation libbnetapi.so [ TargetLibsupc++ ]
|
: be localestub package shared translation libbnetapi.so [ TargetLibsupc++ ]
|
||||||
: SoftwareUpdater.rdef
|
: SoftwareUpdater.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
|
|||||||
{
|
{
|
||||||
// Layout
|
// Layout
|
||||||
BBitmap icon = GetIcon(32 * icon_layout_scale());
|
BBitmap icon = GetIcon(32 * icon_layout_scale());
|
||||||
fStripeView = new StripeView(icon);
|
fStripeView = new BStripeView(icon);
|
||||||
|
|
||||||
fUpdateButton = new BButton(B_TRANSLATE("Update now"),
|
fUpdateButton = new BButton(B_TRANSLATE("Update now"),
|
||||||
new BMessage(kMsgUpdateConfirmed));
|
new BMessage(kMsgUpdateConfirmed));
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ private:
|
|||||||
status_t _ReadSettings(BMessage& settings);
|
status_t _ReadSettings(BMessage& settings);
|
||||||
|
|
||||||
BRect fDefaultRect;
|
BRect fDefaultRect;
|
||||||
StripeView* fStripeView;
|
BStripeView* fStripeView;
|
||||||
BStringView* fHeaderView;
|
BStringView* fHeaderView;
|
||||||
BStringView* fDetailView;
|
BStringView* fDetailView;
|
||||||
BButton* fUpdateButton;
|
BButton* fUpdateButton;
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2007-2016 Haiku, Inc.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Ryan Leavengood <[email protected]>
|
|
||||||
* John Scipione <[email protected]>
|
|
||||||
* Joseph Groover <[email protected]>
|
|
||||||
* Brian Hill <[email protected]>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#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
|
ShakeTrackingFilter.cpp
|
||||||
StringForRate.cpp
|
StringForRate.cpp
|
||||||
StringForSize.cpp
|
StringForSize.cpp
|
||||||
|
StripeView.cpp
|
||||||
TextTable.cpp
|
TextTable.cpp
|
||||||
Thread.cpp
|
Thread.cpp
|
||||||
ToolBar.cpp
|
ToolBar.cpp
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
static const int kIconStripeWidth = 30;
|
static const int kIconStripeWidth = 30;
|
||||||
|
|
||||||
|
|
||||||
StripeView::StripeView(BBitmap& icon)
|
BStripeView::BStripeView(BBitmap& icon)
|
||||||
:
|
:
|
||||||
BView("StripeView", B_WILL_DRAW),
|
BView("StripeView", B_WILL_DRAW),
|
||||||
fIcon(icon),
|
fIcon(icon),
|
||||||
@@ -39,7 +39,7 @@ StripeView::StripeView(BBitmap& icon)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StripeView::Draw(BRect updateRect)
|
BStripeView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
if (fIconSize == 0)
|
if (fIconSize == 0)
|
||||||
return;
|
return;
|
||||||
@@ -61,14 +61,14 @@ StripeView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
|
|
||||||
BSize
|
BSize
|
||||||
StripeView::PreferredSize()
|
BStripeView::PreferredSize()
|
||||||
{
|
{
|
||||||
return BSize(fPreferredWidth, B_SIZE_UNSET);
|
return BSize(fPreferredWidth, B_SIZE_UNSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StripeView::GetPreferredSize(float* _width, float* _height)
|
BStripeView::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
if (_width != NULL)
|
if (_width != NULL)
|
||||||
*_width = fPreferredWidth;
|
*_width = fPreferredWidth;
|
||||||
@@ -79,7 +79,7 @@ StripeView::GetPreferredSize(float* _width, float* _height)
|
|||||||
|
|
||||||
|
|
||||||
BSize
|
BSize
|
||||||
StripeView::MaxSize()
|
BStripeView::MaxSize()
|
||||||
{
|
{
|
||||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
|
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
|
||||||
BSize(fPreferredWidth, B_SIZE_UNLIMITED));
|
BSize(fPreferredWidth, B_SIZE_UNLIMITED));
|
||||||
@@ -42,7 +42,7 @@ AppAccessRequestWindow::AppAccessRequestWindow(const char* keyringName,
|
|||||||
|
|
||||||
|
|
||||||
BBitmap icon = GetIcon(32 * icon_layout_scale());
|
BBitmap icon = GetIcon(32 * icon_layout_scale());
|
||||||
fStripeView = new StripeView(icon);
|
fStripeView = new BStripeView(icon);
|
||||||
|
|
||||||
float inset = ceilf(be_plain_font->Size() * 0.7);
|
float inset = ceilf(be_plain_font->Size() * 0.7);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ private:
|
|||||||
BButton* fDisallowButton;
|
BButton* fDisallowButton;
|
||||||
BButton* fOnceButton;
|
BButton* fOnceButton;
|
||||||
BButton* fAlwaysButton;
|
BButton* fAlwaysButton;
|
||||||
StripeView* fStripeView;
|
BStripeView* fStripeView;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
SubDir HAIKU_TOP src servers keystore ;
|
SubDir HAIKU_TOP src servers keystore ;
|
||||||
|
|
||||||
UsePrivateHeaders app ;
|
UsePrivateHeaders app ;
|
||||||
|
UsePrivateHeaders shared ;
|
||||||
|
|
||||||
Server keystore_server :
|
Server keystore_server :
|
||||||
AppAccessRequestWindow.cpp
|
AppAccessRequestWindow.cpp
|
||||||
KeyRequestWindow.cpp
|
KeyRequestWindow.cpp
|
||||||
Keyring.cpp
|
Keyring.cpp
|
||||||
KeyStoreServer.cpp
|
KeyStoreServer.cpp
|
||||||
StripeView.cpp
|
: be localestub shared [ TargetLibstdc++ ]
|
||||||
: be localestub [ TargetLibstdc++ ]
|
|
||||||
: keystore_server.rdef
|
: keystore_server.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2007-2016 Haiku, Inc.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Ryan Leavengood <[email protected]>
|
|
||||||
* John Scipione <[email protected]>
|
|
||||||
* Joseph Groover <[email protected]>
|
|
||||||
* Brian Hill <[email protected]>
|
|
||||||
*/
|
|
||||||
#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