A slider-based UI component that displays selectable tabs.
More...
#include <tab_selector.h>
|
static constexpr float | kDefaultFontHeightPercent = 0.26f |
| Default percentage of the font height relative to the component height.
|
|
A slider-based UI component that displays selectable tabs.
The TabSelector uses the slider's value to determine which tab is selected. It displays each tab name horizontally and highlights the currently selected tab. The component can be integrated with custom look-and-feels and supports OpenGL image rendering for efficient drawing.
◆ TabSelector()
TabSelector::TabSelector |
( |
String | name | ) |
|
Constructor.
- Parameters
-
Constructs a TabSelector with a given name. Sets default look-and-feel values and initializes the image component.
◆ getFontHeightPercent()
float TabSelector::getFontHeightPercent |
( |
| ) |
|
|
inline |
Gets the current font height percentage.
- Returns
- The font height percentage.
◆ getImageComponent()
◆ mouseDown()
void TabSelector::mouseDown |
( |
const MouseEvent & | e | ) |
|
|
override |
Called when the mouse button is pressed down on the TabSelector.
- Parameters
-
Called when the mouse button is pressed on the TabSelector.
- Parameters
-
◆ mouseDrag()
void TabSelector::mouseDrag |
( |
const MouseEvent & | e | ) |
|
|
override |
Called when the mouse is dragged while the button is held down on the TabSelector.
- Parameters
-
◆ mouseEvent()
void TabSelector::mouseEvent |
( |
const MouseEvent & | e | ) |
|
Handles mouse events that change the selected tab.
- Parameters
-
Handles mouse events to select a tab based on the mouse position.
- Parameters
-
◆ mouseUp()
void TabSelector::mouseUp |
( |
const MouseEvent & | e | ) |
|
|
override |
Called when the mouse button is released after being pressed on the TabSelector.
- Parameters
-
Called when the mouse button is released on the TabSelector.
- Parameters
-
◆ paint()
void TabSelector::paint |
( |
Graphics & | g | ) |
|
|
override |
Paints the TabSelector, drawing tab names and highlighting the selected tab.
- Parameters
-
g | The JUCE Graphics context. |
Paints the tabs and the highlight for the currently selected tab. Draws a highlight line, tab names, and uses the appropriate colors based on the active state.
◆ redoImage()
void TabSelector::redoImage |
( |
| ) |
|
|
inline |
Redraws the image component.
◆ setActive()
void TabSelector::setActive |
( |
bool | active | ) |
|
|
inline |
Sets whether the TabSelector is active.
- Parameters
-
active | True if active, false otherwise. |
◆ setFontHeightPercent()
void TabSelector::setFontHeightPercent |
( |
float | percent | ) |
|
|
inline |
Sets the font height as a percentage of the component height.
- Parameters
-
percent | The font height percentage. |
◆ setNames()
void TabSelector::setNames |
( |
std::vector< std::string > | names | ) |
|
|
inline |
Sets the names of the tabs.
- Parameters
-
names | A vector of strings representing each tab name. |
◆ valueChanged()
void TabSelector::valueChanged |
( |
| ) |
|
|
inlineoverride |
Called when the slider value changes, triggers a redraw of the image.
◆ kDefaultFontHeightPercent
float TabSelector::kDefaultFontHeightPercent = 0.26f |
|
staticconstexpr |
Default percentage of the font height relative to the component height.
The documentation for this class was generated from the following files:
- /Users/davidvogel/repos/VitalHelp/src/interface/editor_components/tab_selector.h
- /Users/davidvogel/repos/VitalHelp/src/interface/editor_components/tab_selector.cpp