Krotos Modules 3
Loading...
Searching...
No Matches
krotos::AttachedSlider Class Reference

This class combines a Slider, Label, and a SliderAttachment to simplify the process of adding knobs to a GUI element. More...

#include <AttachedSlider.h>

Inheritance diagram for krotos::AttachedSlider:

Classes

struct  Layout
 

Public Types

enum class  LabelPosition { Above , Below , Left }
 

Public Member Functions

 AttachedSlider (const String &labelText, bool setLabelVisible=true, const String &dragAndDropDescription=String())
 
void resized () override
 
void paint (Graphics &g) override
 
Label & getLabel ()
 
Slider & getSlider ()
 
Slider & getControlComponent ()
 
std::unique_ptr< SliderParameterAttachment > & getAttachment ()
 
void setDebugColour (Colour newColour)
 
void setDragAndDropDescription (const var &description)
 
LabelPosition getLabelPosition () const
 
void setLabelPosition (LabelPosition position)
 
void mouseMove (const MouseEvent &event) override
 
void mouseExit (const MouseEvent &) override
 
void setValueSuffix (String valueSuffix)
 
void setValueFormat (String valueFormat)
 
void setLabelYPosition (int newPos)
 

Private Member Functions

String panSuffix (double value) const
 
void updateLabel ()
 

Private Attributes

struct krotos::AttachedSlider::Layout m_layout
 
String m_valueFormat {""}
 
String m_valueSuffix {""}
 
bool m_mouseIsOver {false}
 
String m_labelText
 
LabelPosition m_labelPosition
 
DraggableLabel m_label
 
Slider m_slider
 
std::unique_ptr< SliderParameterAttachment > m_attachment
 
int m_labelYPositionOverride {-1}
 

Detailed Description

This class combines a Slider, Label, and a SliderAttachment to simplify the process of adding knobs to a GUI element.

Member Enumeration Documentation

◆ LabelPosition

Enumerator
Above 
Below 
Left 

Constructor & Destructor Documentation

◆ AttachedSlider()

krotos::AttachedSlider::AttachedSlider ( const String & labelText,
bool setLabelVisible = true,
const String & dragAndDropDescription = String() )

Constructs a new slider with specified text for the label and an optional dragAndDropDescription

Member Function Documentation

◆ getAttachment()

std::unique_ptr< SliderParameterAttachment > & krotos::AttachedSlider::getAttachment ( )

Returns reference to the attachment Object.

◆ getControlComponent()

Slider & krotos::AttachedSlider::getControlComponent ( )

Generic function name for getSlider()

◆ getLabel()

Label & krotos::AttachedSlider::getLabel ( )

Returns reference to the label displaying the slider name.

◆ getLabelPosition()

LabelPosition krotos::AttachedSlider::getLabelPosition ( ) const
inline

Getter for the label position

◆ getSlider()

Slider & krotos::AttachedSlider::getSlider ( )

Returns reference to the slider Object.

◆ mouseExit()

void krotos::AttachedSlider::mouseExit ( const MouseEvent & )
override

◆ mouseMove()

void krotos::AttachedSlider::mouseMove ( const MouseEvent & event)
override

◆ paint()

void krotos::AttachedSlider::paint ( Graphics & g)
override

◆ panSuffix()

String krotos::AttachedSlider::panSuffix ( double value) const
private

◆ resized()

void krotos::AttachedSlider::resized ( )
override

◆ setDebugColour()

void krotos::AttachedSlider::setDebugColour ( Colour newColour)

Changes the colour of a slider so that it shows up in GUI

◆ setDragAndDropDescription()

void krotos::AttachedSlider::setDragAndDropDescription ( const var & description)

Set the descriptor for the Label which will be passed to a dragAndDropTarget. Setting this will enable the Label to become draggable

◆ setLabelPosition()

void krotos::AttachedSlider::setLabelPosition ( LabelPosition position)
inline

Setter for the label position

◆ setLabelYPosition()

void krotos::AttachedSlider::setLabelYPosition ( int newPos)

Sets the Y position of the label component

Parameters
[in]newPosThe new Y position of the label

◆ setValueFormat()

void krotos::AttachedSlider::setValueFormat ( String valueFormat)
inline

Setter for the label value format, e.g. how many decimal places

◆ setValueSuffix()

void krotos::AttachedSlider::setValueSuffix ( String valueSuffix)
inline

Setter for the label value suffix, e.g. "dB"

◆ updateLabel()

void krotos::AttachedSlider::updateLabel ( )
private

Member Data Documentation

◆ m_attachment

std::unique_ptr<SliderParameterAttachment> krotos::AttachedSlider::m_attachment
private

◆ m_label

DraggableLabel krotos::AttachedSlider::m_label
private

◆ m_labelPosition

LabelPosition krotos::AttachedSlider::m_labelPosition
private

◆ m_labelText

String krotos::AttachedSlider::m_labelText
private

◆ m_labelYPositionOverride

int krotos::AttachedSlider::m_labelYPositionOverride {-1}
private

◆ m_layout

struct krotos::AttachedSlider::Layout krotos::AttachedSlider::m_layout
private

◆ m_mouseIsOver

bool krotos::AttachedSlider::m_mouseIsOver {false}
private

◆ m_slider

Slider krotos::AttachedSlider::m_slider
private

◆ m_valueFormat

String krotos::AttachedSlider::m_valueFormat {""}
private

◆ m_valueSuffix

String krotos::AttachedSlider::m_valueSuffix {""}
private

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