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

A ComboBox-like TextButton with some extra components used for the SampleBrowser UI/UX. More...

#include <SampleBrowserButton.h>

Inheritance diagram for krotos::SampleBrowserButton:

Public Member Functions

 SampleBrowserButton (const String &buttonText)
 Creates a SampleBrowserButton, which is a essentially just a TextButton with some extra components on top of it such as forward / next sample buttons, and a display of the current sample index.
 
void paintButton (Graphics &g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
 
void resized () override
 
void setSampleIndex (int index)
 Sets the number of the sample counter indicator e.g. "<index> of 10".
 
void setSampleCount (size_t count)
 Sets the number of samples loaded in the sampler to display in the sample counter e.g. "0 of <count>".
 
Label & getSampleCounter ()
 
DrawableButton & getPreviousButton ()
 
DrawableButton & getNextButton ()
 

Public Attributes

std::function< void()> onNextButtonClick
 Callback for when the "next" sample button is clicked.
 
std::function< void()> onPreviousButtonClick
 Callback for when the "previous" sample button is clicked.
 

Private Member Functions

void updateSampleCounter ()
 

Private Attributes

const int m_nextPrevButtonSize {16}
 
const int m_iconWidth {12}
 
const int m_margin {8}
 
const int m_textXOffset {23}
 
const int m_sampleCounterLabelWidth {50}
 
int m_sampleIndex {0}
 
size_t m_sampleCount {0}
 
std::unique_ptr< Drawable > m_dropdownIcon
 
std::unique_ptr< Drawable > m_leftArrow
 
std::unique_ptr< Drawable > m_rightArrow
 
DrawableButton m_previousButton
 
DrawableButton m_nextButton
 
Label m_sampleCounter
 
Rectangle< int > m_dropdownIconBounds
 
Component m_mouseBlocker
 

Detailed Description

A ComboBox-like TextButton with some extra components used for the SampleBrowser UI/UX.

Constructor & Destructor Documentation

◆ SampleBrowserButton()

krotos::SampleBrowserButton::SampleBrowserButton ( const String & buttonText)

Creates a SampleBrowserButton, which is a essentially just a TextButton with some extra components on top of it such as forward / next sample buttons, and a display of the current sample index.

Parameters
buttonTextThe initial text to display in the browser.

Member Function Documentation

◆ getNextButton()

DrawableButton & krotos::SampleBrowserButton::getNextButton ( )
inline

Get next button

◆ getPreviousButton()

DrawableButton & krotos::SampleBrowserButton::getPreviousButton ( )
inline

Get previous button

◆ getSampleCounter()

Label & krotos::SampleBrowserButton::getSampleCounter ( )
inline

Get sample counter label

◆ paintButton()

void krotos::SampleBrowserButton::paintButton ( Graphics & g,
bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown )
override

◆ resized()

void krotos::SampleBrowserButton::resized ( )
override

◆ setSampleCount()

void krotos::SampleBrowserButton::setSampleCount ( size_t count)

Sets the number of samples loaded in the sampler to display in the sample counter e.g. "0 of <count>".

Parameters
countThe total number of samples in the sampler

◆ setSampleIndex()

void krotos::SampleBrowserButton::setSampleIndex ( int index)

Sets the number of the sample counter indicator e.g. "<index> of 10".

Parameters
indexThe index of the current sample

◆ updateSampleCounter()

void krotos::SampleBrowserButton::updateSampleCounter ( )
private

Member Data Documentation

◆ m_dropdownIcon

std::unique_ptr<Drawable> krotos::SampleBrowserButton::m_dropdownIcon
private

◆ m_dropdownIconBounds

Rectangle<int> krotos::SampleBrowserButton::m_dropdownIconBounds
private

◆ m_iconWidth

const int krotos::SampleBrowserButton::m_iconWidth {12}
private

◆ m_leftArrow

std::unique_ptr<Drawable> krotos::SampleBrowserButton::m_leftArrow
private

◆ m_margin

const int krotos::SampleBrowserButton::m_margin {8}
private

◆ m_mouseBlocker

Component krotos::SampleBrowserButton::m_mouseBlocker
private

◆ m_nextButton

DrawableButton krotos::SampleBrowserButton::m_nextButton
private

◆ m_nextPrevButtonSize

const int krotos::SampleBrowserButton::m_nextPrevButtonSize {16}
private

◆ m_previousButton

DrawableButton krotos::SampleBrowserButton::m_previousButton
private

◆ m_rightArrow

std::unique_ptr<Drawable> krotos::SampleBrowserButton::m_rightArrow
private

◆ m_sampleCount

size_t krotos::SampleBrowserButton::m_sampleCount {0}
private

◆ m_sampleCounter

Label krotos::SampleBrowserButton::m_sampleCounter
private

◆ m_sampleCounterLabelWidth

const int krotos::SampleBrowserButton::m_sampleCounterLabelWidth {50}
private

◆ m_sampleIndex

int krotos::SampleBrowserButton::m_sampleIndex {0}
private

◆ m_textXOffset

const int krotos::SampleBrowserButton::m_textXOffset {23}
private

◆ onNextButtonClick

std::function<void()> krotos::SampleBrowserButton::onNextButtonClick

Callback for when the "next" sample button is clicked.

◆ onPreviousButtonClick

std::function<void()> krotos::SampleBrowserButton::onPreviousButtonClick

Callback for when the "previous" sample button is clicked.


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