1*66cb2efaSAdrien Destugues /* 2*66cb2efaSAdrien Destugues * Copyright 2007-2016 Haiku, Inc. 3*66cb2efaSAdrien Destugues * Distributed under the terms of the MIT License. 4*66cb2efaSAdrien Destugues * 5*66cb2efaSAdrien Destugues * Authors: 6*66cb2efaSAdrien Destugues * Ryan Leavengood <leavengood@gmail.com> 7*66cb2efaSAdrien Destugues * John Scipione <jscipione@gmail.com> 8*66cb2efaSAdrien Destugues * Joseph Groover <looncraz@looncraz.net> 9*66cb2efaSAdrien Destugues * Brian Hill <supernova@tycho.email> 10*66cb2efaSAdrien Destugues */ 11*66cb2efaSAdrien Destugues #ifndef _STRIPE_VIEW_H 12*66cb2efaSAdrien Destugues #define _STRIPE_VIEW_H 13*66cb2efaSAdrien Destugues 14*66cb2efaSAdrien Destugues 15*66cb2efaSAdrien Destugues #include <Bitmap.h> 16*66cb2efaSAdrien Destugues #include <View.h> 17*66cb2efaSAdrien Destugues 18*66cb2efaSAdrien Destugues 19*66cb2efaSAdrien Destugues namespace BPrivate { 20*66cb2efaSAdrien Destugues 21*66cb2efaSAdrien Destugues 22*66cb2efaSAdrien Destugues class BStripeView : public BView { 23*66cb2efaSAdrien Destugues public: 24*66cb2efaSAdrien Destugues BStripeView(BBitmap& icon); 25*66cb2efaSAdrien Destugues 26*66cb2efaSAdrien Destugues virtual void Draw(BRect updateRect); 27*66cb2efaSAdrien Destugues virtual BSize PreferredSize(); 28*66cb2efaSAdrien Destugues virtual void GetPreferredSize(float* _width, float* _height); 29*66cb2efaSAdrien Destugues virtual BSize MaxSize(); 30*66cb2efaSAdrien Destugues 31*66cb2efaSAdrien Destugues private: 32*66cb2efaSAdrien Destugues BBitmap fIcon; 33*66cb2efaSAdrien Destugues float fIconSize; 34*66cb2efaSAdrien Destugues float fPreferredWidth; 35*66cb2efaSAdrien Destugues float fPreferredHeight; 36*66cb2efaSAdrien Destugues }; 37*66cb2efaSAdrien Destugues 38*66cb2efaSAdrien Destugues 39*66cb2efaSAdrien Destugues static inline int32 icon_layout_scale()40*66cb2efaSAdrien Destuguesicon_layout_scale() 41*66cb2efaSAdrien Destugues { 42*66cb2efaSAdrien Destugues return max_c(1, ((int32)be_plain_font->Size() + 15) / 16); 43*66cb2efaSAdrien Destugues } 44*66cb2efaSAdrien Destugues 45*66cb2efaSAdrien Destugues 46*66cb2efaSAdrien Destugues }; 47*66cb2efaSAdrien Destugues 48*66cb2efaSAdrien Destugues 49*66cb2efaSAdrien Destugues using namespace BPrivate; 50*66cb2efaSAdrien Destugues 51*66cb2efaSAdrien Destugues 52*66cb2efaSAdrien Destugues #endif /* _STRIPE_VIEW_H */ 53