diff options
Diffstat (limited to 'libs/dgl/ImageKnob.hpp')
-rw-r--r-- | libs/dgl/ImageKnob.hpp | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/libs/dgl/ImageKnob.hpp b/libs/dgl/ImageKnob.hpp index 057dcaf..a7a7e69 100644 --- a/libs/dgl/ImageKnob.hpp +++ b/libs/dgl/ImageKnob.hpp @@ -41,42 +41,43 @@ public: virtual void imageKnobValueChanged(ImageKnob* imageKnob, float value) = 0; }; - ImageKnob(Window& parent, const Image& image, Orientation orientation = Vertical); - ImageKnob(Widget* widget, const Image& image, Orientation orientation = Vertical); - ImageKnob(const ImageKnob& imageKnob); - - float getValue() const; - - void setOrientation(Orientation orientation); - void setRange(float min, float max); - void setLogScale(bool log = false); - void setStep(float step); - void setValue(float value, bool sendCallback = false); - void setDefault(float value); - void resetDefault(void); - void setRotationAngle(int angle); + explicit ImageKnob(Window& parent, const Image& image, Orientation orientation = Vertical, int id = 0) noexcept; + explicit ImageKnob(Widget* widget, const Image& image, Orientation orientation = Vertical, int id = 0) noexcept; + explicit ImageKnob(const ImageKnob& imageKnob); + ~ImageKnob() override; + + int getId() const noexcept; + void setId(int id) noexcept; + + float getValue() const noexcept; + + void setDefault(float def) noexcept; + void setRange(float min, float max) noexcept; + void setStep(float step) noexcept; + void setValue(float value, bool sendCallback = false) noexcept; + void setUsingLogScale(bool yesNo) noexcept; - void setCallback(Callback* callback); + void setCallback(Callback* callback) noexcept; + void setOrientation(Orientation orientation) noexcept; + void setRotationAngle(int angle); protected: void onDisplay() override; - bool onMouse(int button, bool press, int x, int y) override; - bool onScroll(int x, int y, float dx, float dy) override; - bool onMotion(int x, int y) override; - void onReshape(int width, int height) override; - void onClose() override; - float logscale(float value); - float invlogscale(float value); + bool onMouse(const MouseEvent&) override; + bool onMotion(const MotionEvent&) override; + bool onScroll(const ScrollEvent&) override; private: Image fImage; + int fId; float fMinimum; float fMaximum; float fStep; - bool fLog; float fValue; - float fValueTmp; float fValueDef; + float fValueTmp; + bool fUsingDefault; + bool fUsingLog; Orientation fOrientation; int fRotationAngle; @@ -92,6 +93,9 @@ private: Rectangle<int> fKnobArea; GLuint fTextureId; + float _logscale(float value) const; + float _invlogscale(float value) const; + DISTRHO_LEAK_DETECTOR(ImageKnob) }; |