Vital
Loading...
Searching...
No Matches
OpenGlSlider Class Reference

An extended JUCE Slider that leverages OpenGL for rendering. More...

#include <synth_slider.h>

Inheritance diagram for OpenGlSlider:
ModulationSelector SynthSlider ControlWheel InvisibleSlider ModulationAmountKnob TempoSelector TextSelector VolumeSlider ModWheel PitchWheel PaintPatternSelector TuningSelector

Public Member Functions

 OpenGlSlider (String name)
 
virtual void resized () override
 Called when the component is resized. Updates colors and display values.
 
virtual void valueChanged () override
 Called when the slider value changes. Redraws the image to reflect the new value.
 
void parentHierarchyChanged () override
 Called when the parent hierarchy changes. Used for retrieving parent sections.
 
void paintToImage (bool paint)
 
bool isText () const
 
bool isTextOrCurve () const
 
bool isModulationKnob () const
 
bool isRotaryQuad () const
 
bool isHorizontalQuad () const
 
bool isVerticalQuad () const
 
OpenGlComponentgetImageComponent ()
 
OpenGlComponentgetQuadComponent ()
 
void setMaxArc (float arc)
 
void setModulationKnob ()
 Marks this slider as a modulation knob.
 
void setModulationAmount (float modulation)
 
float getModulationAmount () const
 
virtual float getKnobSizeScale () const
 
bool isBipolar () const
 
bool isActive () const
 
void setBipolar (bool bipolar=true)
 
void setActive (bool active=true)
 
virtual Colour getModColor () const
 
virtual Colour getBackgroundColor () const
 
virtual Colour getUnselectedColor () const
 
virtual Colour getSelectedColor () const
 
virtual Colour getThumbColor () const
 
int getLinearSliderWidth ()
 
void setSliderDisplayValues ()
 Sets the slider display values (positions, sizes) based on current style.
 
void redoImage (bool skip_image=false)
 
void setColors ()
 Updates internal colors based on the current skin and state.
 
virtual float findValue (Skin::ValueId value_id) const
 
void setAlpha (float alpha, bool reset=false)
 
void setDrawWhenNotVisible (bool draw)
 
SynthSectiongetSectionParent ()
 

Static Public Attributes

static constexpr float kRotaryAngle = 0.8f * vital::kPi
 The default rotary arc angle used for rotary sliders.
 

Protected Attributes

SynthSectionparent_
 The parent SynthSection.
 

Detailed Description

An extended JUCE Slider that leverages OpenGL for rendering.

This slider can be rendered as a rotary knob, a horizontal bar, a vertical bar, or a modulation knob. It integrates with the Vital skin system to determine colors, dimensions, and other style parameters. It can also display an OpenGL-based image component or quad for custom appearances.

Constructor & Destructor Documentation

◆ OpenGlSlider()

OpenGlSlider::OpenGlSlider ( String name)
inline

Constructor.

Parameters
nameThe name of the slider.

Member Function Documentation

◆ findValue()

virtual float OpenGlSlider::findValue ( Skin::ValueId value_id) const
inlinevirtual

Finds a skin value from the parent component.

Parameters
value_idThe skin value ID.
Returns
The retrieved value or 0 if none found.

Reimplemented in SynthSlider.

◆ getBackgroundColor()

virtual Colour OpenGlSlider::getBackgroundColor ( ) const
inlinevirtual

Gets the background color.

Returns
The background color.

◆ getImageComponent()

OpenGlComponent * OpenGlSlider::getImageComponent ( )
inline

Gets the image component (if used).

Returns
The OpenGlComponent for the image.

◆ getKnobSizeScale()

virtual float OpenGlSlider::getKnobSizeScale ( ) const
inlinevirtual

Provides a scaling factor for the knob size.

Returns
The knob size scale factor.

Reimplemented in SynthSlider.

◆ getLinearSliderWidth()

int OpenGlSlider::getLinearSliderWidth ( )

Computes the width of the slider track for linear sliders.

Returns
The linear slider width in pixels.

◆ getModColor()

virtual Colour OpenGlSlider::getModColor ( ) const
inlinevirtual

Gets the color used for modulation displays.

Returns
The modulation color.

◆ getModulationAmount()

float OpenGlSlider::getModulationAmount ( ) const
inline

Gets the current modulation amount.

Returns
The modulation amount.

◆ getQuadComponent()

OpenGlComponent * OpenGlSlider::getQuadComponent ( )
inline

Gets the quad component used for rendering the slider (if used).

Returns
The OpenGlComponent for the quad.

◆ getSectionParent()

SynthSection * OpenGlSlider::getSectionParent ( )
inline

Gets the parent SynthSection if available.

Returns
The parent SynthSection or nullptr.

◆ getSelectedColor()

virtual Colour OpenGlSlider::getSelectedColor ( ) const
inlinevirtual

Gets the color for the selected portion of the slider.

Returns
The selected color.

Reimplemented in ModulationAmountKnob.

◆ getThumbColor()

virtual Colour OpenGlSlider::getThumbColor ( ) const
inlinevirtual

Gets the color for the thumb/handle.

Returns
The thumb color.

Reimplemented in ModulationAmountKnob.

◆ getUnselectedColor()

virtual Colour OpenGlSlider::getUnselectedColor ( ) const
inlinevirtual

Gets the color for the unselected portion of the slider.

Returns
The unselected color.

Reimplemented in ModulationAmountKnob.

◆ isActive()

bool OpenGlSlider::isActive ( ) const
inline

Checks if the slider is active.

Returns
True if active, false otherwise.

◆ isBipolar()

bool OpenGlSlider::isBipolar ( ) const
inline

Checks if the slider is bipolar (centered at zero).

Returns
True if bipolar, false otherwise.

◆ isHorizontalQuad()

bool OpenGlSlider::isHorizontalQuad ( ) const
inline

Checks if the slider should use a horizontal quad OpenGL rendering.

Returns
True if it's a horizontal slider with OpenGL quad rendering.

◆ isModulationKnob()

bool OpenGlSlider::isModulationKnob ( ) const
inline

Checks if the slider is a modulation knob type.

Returns
True if it is a modulation knob.

◆ isRotaryQuad()

bool OpenGlSlider::isRotaryQuad ( ) const
inline

Checks if the slider should use a rotary quad OpenGL rendering.

Returns
True if it's a rotary slider with OpenGL quad rendering enabled.

◆ isText()

bool OpenGlSlider::isText ( ) const
inline

Checks if the slider uses text-based rendering.

Returns
True if a text look-and-feel is used.

◆ isTextOrCurve()

bool OpenGlSlider::isTextOrCurve ( ) const
inline

Checks if the slider uses either text or curve look-and-feel.

Returns
True if using text or curve LAF.

◆ isVerticalQuad()

bool OpenGlSlider::isVerticalQuad ( ) const
inline

Checks if the slider should use a vertical quad OpenGL rendering.

Returns
True if it's a vertical slider with OpenGL quad rendering.

◆ paintToImage()

void OpenGlSlider::paintToImage ( bool paint)
inline

Toggles whether the slider should paint into an image before rendering.

Parameters
paintIf true, paints to an offscreen image; otherwise paints directly.

◆ parentHierarchyChanged()

void OpenGlSlider::parentHierarchyChanged ( )
inlineoverride

Called when the parent hierarchy changes. Used for retrieving parent sections.

◆ redoImage()

void OpenGlSlider::redoImage ( bool skip_image = false)

Redraws the slider image or quad.

Parameters
skip_imageIf true, skips redrawing the image component.

◆ resized()

virtual void OpenGlSlider::resized ( )
inlineoverridevirtual

Called when the component is resized. Updates colors and display values.

◆ setActive()

void OpenGlSlider::setActive ( bool active = true)
inline

Sets the slider as active or inactive.

Parameters
activeTrue if active, false otherwise.

◆ setAlpha()

void OpenGlSlider::setAlpha ( float alpha,
bool reset = false )
inline

Sets an alpha value for the slider quad rendering.

Parameters
alphaThe alpha value.
resetIf true, resets alpha animations.

◆ setBipolar()

void OpenGlSlider::setBipolar ( bool bipolar = true)
inline

Sets the slider to be bipolar.

Parameters
bipolarTrue if the slider should be bipolar.

◆ setColors()

void OpenGlSlider::setColors ( )

Updates internal colors based on the current skin and state.

◆ setDrawWhenNotVisible()

void OpenGlSlider::setDrawWhenNotVisible ( bool draw)
inline

Forces the quad to draw even when not visible.

Parameters
drawTrue to always draw.

◆ setMaxArc()

void OpenGlSlider::setMaxArc ( float arc)
inline

Sets the maximum arc for a rotary slider.

Parameters
arcThe maximum arc in radians.

◆ setModulationAmount()

void OpenGlSlider::setModulationAmount ( float modulation)
inline

Sets the amount of modulation applied to the slider.

Parameters
modulationThe modulation amount.

◆ setModulationKnob()

void OpenGlSlider::setModulationKnob ( )
inline

Marks this slider as a modulation knob.

◆ setSliderDisplayValues()

void OpenGlSlider::setSliderDisplayValues ( )

Sets the slider display values (positions, sizes) based on current style.

◆ valueChanged()

virtual void OpenGlSlider::valueChanged ( )
inlineoverridevirtual

Called when the slider value changes. Redraws the image to reflect the new value.

Reimplemented in SynthSlider, TempoSelector, and TuningSelector.

Member Data Documentation

◆ kRotaryAngle

float OpenGlSlider::kRotaryAngle = 0.8f * vital::kPi
staticconstexpr

The default rotary arc angle used for rotary sliders.

◆ parent_

SynthSection* OpenGlSlider::parent_
protected

The parent SynthSection.


The documentation for this class was generated from the following files: