ASPiK SDK
cvumeter.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __cvumeter__
6 #define __cvumeter__
7 
8 #include "ccontrol.h"
9 
10 namespace VSTGUI {
11 
12 //-----------------------------------------------------------------------------
13 // CVuMeter Declaration
16 //-----------------------------------------------------------------------------
17 class CVuMeter : public CControl
18 {
19 public:
20  CVuMeter (const CRect& size, CBitmap* onBitmap, CBitmap* offBitmap, int32_t nbLed, int32_t style = kVertical);
21  CVuMeter (const CVuMeter& vuMeter);
22 
23  //-----------------------------------------------------------------------------
25  //-----------------------------------------------------------------------------
27  float getDecreaseStepValue () const { return decreaseValue; }
28  virtual void setDecreaseStepValue (float value) { decreaseValue = value; }
29 
30  virtual CBitmap* getOnBitmap () const { return getBackground (); }
31  virtual CBitmap* getOffBitmap () const { return offBitmap; }
32  virtual void setOnBitmap (CBitmap* bitmap) { setBackground (bitmap); }
33  virtual void setOffBitmap (CBitmap* bitmap);
34 
35  int32_t getNbLed () const { return nbLed; }
36  void setNbLed (int32_t nb) { nbLed = nb; invalid (); }
37 
38  void setStyle (int32_t newStyle) { style = newStyle; invalid (); }
39  int32_t getStyle () const { return style; }
41 
42 
43  // overrides
44  void setDirty (bool state) override;
45  void draw (CDrawContext* pContext) override;
46  void setViewSize (const CRect& newSize, bool invalid = true) override;
47  bool sizeToFit () override;
48  void onIdle () override;
49 
50  CLASS_METHODS(CVuMeter, CControl)
51 protected:
52  ~CVuMeter () noexcept override;
53 
54  CBitmap* offBitmap;
55 
56  int32_t nbLed;
57  int32_t style;
58  float decreaseValue;
59 
60  CRect rectOn;
61  CRect rectOff;
62 };
63 
64 } // namespace
65 
66 #endif
Rect structure.
Definition: crect.h:17
void onIdle() override
called on idle when view wants idle
Definition: cvumeter.cpp:103
void setViewSize(const CRect &newSize, bool invalid=true) override
set views size
Definition: cvumeter.cpp:64
A drawing context encapsulates the drawing context of the underlying OS.
Definition: cdrawcontext.h:29
void draw(CDrawContext *pContext) override
called if the view should draw itself
Definition: cvumeter.cpp:110
CBitmap * getBackground() const
get the background image of this view
Definition: cview.cpp:773
Definition: cvumeter.h:17
Encapsulates various platform depended kinds of bitmaps.
Definition: cbitmap.h:21
Definition: customcontrols.cpp:8
bool sizeToFit() override
resize view to optimal size
Definition: cvumeter.cpp:72
base class of all VSTGUI controls
Definition: ccontrol.h:76
virtual void setBackground(CBitmap *background)
set the background image of this view
Definition: cview.cpp:765
virtual void invalid()
mark whole view as invalid
Definition: cview.h:63
void setDirty(bool state) override
set the view to dirty so that it is redrawn in the next idle. Thread Safe !
Definition: cvumeter.cpp:97
CVuMeter(const CRect &size, CBitmap *onBitmap, CBitmap *offBitmap, int32_t nbLed, int32_t style=kVertical)
Definition: cvumeter.cpp:25