Files
hot-step-cpp-ROCm/engine/vendor/vst3sdk/vstgui4/vstgui/lib/controls/cvumeter.h
T
2026-08-16 18:24:52 +07:00

75 lines
2.0 KiB
C++

// This file is part of VSTGUI. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this
// distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
#pragma once
#include "../enumbitset.h"
#include "ccontrol.h"
namespace VSTGUI {
//-----------------------------------------------------------------------------
// CVuMeter Declaration
//!
/// @ingroup controls
//-----------------------------------------------------------------------------
class CVuMeter : public CControl
{
public:
enum class Style : int32_t
{
kHorizontal,
kVertical,
};
CVuMeter (const CRect& size, CBitmap* onBitmap, CBitmap* offBitmap, int32_t nbLed,
Style style = Style::kVertical);
CVuMeter (const CVuMeter& vuMeter);
//-----------------------------------------------------------------------------
/// @name CVuMeter Methods
//-----------------------------------------------------------------------------
//@{
float getDecreaseStepValue () const { return decreaseValue; }
virtual void setDecreaseStepValue (float value) { decreaseValue = value; }
virtual CBitmap* getOnBitmap () const { return getBackground (); }
virtual CBitmap* getOffBitmap () const { return offBitmap; }
virtual void setOnBitmap (CBitmap* bitmap) { setBackground (bitmap); }
virtual void setOffBitmap (CBitmap* bitmap);
int32_t getNbLed () const { return nbLed; }
void setNbLed (int32_t nb) { nbLed = nb; invalid (); }
void setStyle (Style newStyle)
{
style = newStyle;
invalid ();
}
Style getStyle () const { return style; }
//@}
// overrides
void setDirty (bool state) override;
void draw (CDrawContext* pContext) override;
void setViewSize (const CRect& newSize, bool invalid = true) override;
bool sizeToFit () override;
void onIdle () override;
CLASS_METHODS(CVuMeter, CControl)
protected:
~CVuMeter () noexcept override;
CBitmap* offBitmap;
int32_t nbLed;
Style style;
float decreaseValue;
CRect rectOn;
CRect rectOff;
};
} // VSTGUI