Krotos Modules 3
Loading...
Searching...
No Matches
SampleBrowserButton.h
Go to the documentation of this file.
1namespace krotos
2{
6 class SampleBrowserButton : public TextButton
7 {
8 public:
14 SampleBrowserButton(const String& buttonText);
15
16 void paintButton(Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
17 void resized() override;
18
22 std::function<void()> onNextButtonClick;
23
27 std::function<void()> onPreviousButtonClick;
28
34 void setSampleIndex(int index);
41 void setSampleCount(size_t count);
42
44 Label& getSampleCounter() { return m_sampleCounter; }
45
47 DrawableButton& getPreviousButton() { return m_previousButton; }
48
50 DrawableButton& getNextButton() { return m_nextButton; }
51
52 private:
54
55 const int m_nextPrevButtonSize{16};
56 const int m_iconWidth{12};
57 const int m_margin{8};
58 const int m_textXOffset{23};
60
62 size_t m_sampleCount{0};
63
64 std::unique_ptr<Drawable> m_dropdownIcon, m_leftArrow, m_rightArrow;
67 Rectangle<int> m_dropdownIconBounds;
68
69 Component m_mouseBlocker;
70 };
71
72} // namespace krotos
A ComboBox-like TextButton with some extra components used for the SampleBrowser UI/UX.
Definition SampleBrowserButton.h:7
DrawableButton m_previousButton
Definition SampleBrowserButton.h:65
Component m_mouseBlocker
Definition SampleBrowserButton.h:69
Label & getSampleCounter()
Definition SampleBrowserButton.h:44
SampleBrowserButton(const String &buttonText)
Creates a SampleBrowserButton, which is a essentially just a TextButton with some extra components on...
Definition SampleBrowserButton.cpp:3
void paintButton(Graphics &g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
Definition SampleBrowserButton.cpp:43
const int m_iconWidth
Definition SampleBrowserButton.h:56
std::unique_ptr< Drawable > m_dropdownIcon
Definition SampleBrowserButton.h:64
const int m_nextPrevButtonSize
Definition SampleBrowserButton.h:55
size_t m_sampleCount
Definition SampleBrowserButton.h:62
const int m_sampleCounterLabelWidth
Definition SampleBrowserButton.h:59
const int m_textXOffset
Definition SampleBrowserButton.h:58
DrawableButton & getPreviousButton()
Definition SampleBrowserButton.h:47
void resized() override
Definition SampleBrowserButton.cpp:71
void setSampleIndex(int index)
Sets the number of the sample counter indicator e.g. "<index> of 10".
Definition SampleBrowserButton.cpp:88
DrawableButton & getNextButton()
Definition SampleBrowserButton.h:50
DrawableButton m_nextButton
Definition SampleBrowserButton.h:65
const int m_margin
Definition SampleBrowserButton.h:57
std::function< void()> onNextButtonClick
Callback for when the "next" sample button is clicked.
Definition SampleBrowserButton.h:22
void updateSampleCounter()
Definition SampleBrowserButton.cpp:102
void setSampleCount(size_t count)
Sets the number of samples loaded in the sampler to display in the sample counter e....
Definition SampleBrowserButton.cpp:96
std::unique_ptr< Drawable > m_leftArrow
Definition SampleBrowserButton.h:64
int m_sampleIndex
Definition SampleBrowserButton.h:61
std::function< void()> onPreviousButtonClick
Callback for when the "previous" sample button is clicked.
Definition SampleBrowserButton.h:27
Label m_sampleCounter
Definition SampleBrowserButton.h:66
Rectangle< int > m_dropdownIconBounds
Definition SampleBrowserButton.h:67
std::unique_ptr< Drawable > m_rightArrow
Definition SampleBrowserButton.h:64
Definition AirAbsorptionFilter.cpp:2