38static const RGB888 ThemeColors[16] = {
59 RGB888 accent, accentDark, bloom2, bloom1, desktop;
64static const AccentShades Accents[] = {
66 {
RGB888(255, 170, 0),
RGB888(170, 85, 0),
RGB888(85, 0, 0),
RGB888(0, 0, 0),
RGB888(0, 0, 0) },
67 {
RGB888( 0, 170, 255),
RGB888( 0, 85, 170),
RGB888( 0, 85, 85),
RGB888(0, 0, 0),
RGB888(0, 0, 0) },
68 {
RGB888(170, 85, 255),
RGB888( 85, 0, 170),
RGB888(85, 0, 85),
RGB888(0, 0, 0),
RGB888(0, 0, 0) },
69 {
RGB888( 85, 255, 85),
RGB888( 0, 170, 85),
RGB888( 0, 85, 0),
RGB888(0, 0, 0),
RGB888(0, 0, 0) },
83static const uint8_t Ink4Slot[16] = {
104static const RGB888 Default4Palette[4] = {
RGB888(0, 0, 0),
RGB888(0, 0, 255),
RGB888(0, 255, 0),
RGB888(255, 255, 255) };
108int uiDarkTheme::preparePalette(
int colors)
110 m_paletteSize = colors >= 16 ? 16 : 4;
111 for (
int i = 0; i < 16; ++i)
112 m_ink[i] = m_paletteSize == 16 ? RGB888((
Color) i) : Default4Palette[Ink4Slot[i]];
114 return m_paletteSize;
118RGB888 uiDarkTheme::paletteColor(
int slot)
120 if (m_paletteSize == 16)
133 auto const & a = Accents[(int) m_accent];
140 default:
return ThemeColors[(int) value];
163 auto const & t =
object->objectType();
165 auto title = ((
uiFrame *)
object)->title();
170 if (t.uiLabel || t.uiStaticLabel)
174 if (t.uiCustomComboBox)
180 if (t.uiCustomListBox)
192 if (t.uiToggleSwitch)
200 if (t.uiTileSelector)
204 if (t.uiPianoKeyboard)
210 if (t.uiSegmentDisplay)
218void uiDarkTheme::setBorder(
uiWindow * window,
int size,
RGB888 color,
RGB888 focusedColor,
int cornerRadius)
222 s.focusedBorderSize = size;
223 s.borderColor =
color;
224 s.activeBorderColor =
color;
225 s.focusedBorderColor = focusedColor;
226 s.cornerRadius = cornerRadius;
230void uiDarkTheme::setScrollBars(uiScrollableControl * control)
232 auto & s = control->scrollableControlStyle();
236 s.scrollBarSize = 10;
245 setScrollBars(listBox);
248 s.focusedBackgroundColor = background;
264 s.mouseOverBackgroundColor = background;
265 s.focusedBackgroundColor = background;
271void uiDarkTheme::setButton(
uiButton * button, uint32_t styleClassID)
275 switch (styleClassID) {
290 s.backgroundColor = background;
316void uiDarkTheme::setFrame(
uiFrame * frame, uint32_t styleClassID,
bool keepBorderSize)
330 s.titleSeparatorSize = 1;
344void uiDarkTheme::setLabel(
uiObject *
object, uint32_t styleClassID)
347 styleClassID == uiThemeStyle::LabelTitle ?
titleFont() :
355 auto & s = ((uiStaticLabel *) object)->labelStyle();
358 s.backgroundColor = background;
360 auto & s = ((uiLabel *) object)->labelStyle();
363 s.backgroundColor = background;
364 s.textAlign = styleClassID == uiThemeStyle::LabelValue ? uiHAlign::Right : uiHAlign::Left;
371 auto & s = comboBox->comboBoxStyle();
372 s.buttonBackgroundColor = comboBox->parentBackgroundColor();
374 auto listBox = comboBox->listBoxControl();
379 auto edit = comboBox->editControl();
381 setEdit((uiTextEdit *) edit);
390 bool byType = styleClassID == 0;
394 auto const & type =
object->objectType();
396 switch (styleClassID) {
402 setFrame((
uiFrame *)
object, styleClassID, byType);
407 auto frame = (
uiFrame *)
object;
419 auto panel = (
uiPanel *)
object;
431 setLabel(
object, styleClassID);
438 setButton((
uiButton *)
object, styleClassID);
447 if (type.uiCustomListBox)
454 if (type.uiComboBox || type.uiSplitButton || type.uiColorComboBox)
459 if (type.uiCheckBox) {
463 int size = imin(checkBox->size().width, checkBox->size().height);
464 RGB888 background = checkBox->parentBackgroundColor();
466 auto & s = checkBox->checkBoxStyle();
468 s.backgroundColor = background;
469 s.checkedBackgroundColor = background;
480 slider->windowStyle().focusedBorderSize = 1;
481 auto & s = slider->sliderStyle();
482 s.backgroundColor = slider->parentBackgroundColor();
492 if (type.uiProgressBar) {
495 auto & s = bar->progressBarStyle();
504 if (type.uiPaintBox) {
507 setScrollBars(paintBox);
514 auto knob = (
uiKnob *)
object;
516 knob->windowStyle().focusedBorderSize = 1;
517 auto & s = knob->knobStyle();
518 s.backgroundColor = knob->parentBackgroundColor();
533 if (type.uiToggleSwitch) {
536 sw->windowStyle().focusedBorderSize = 1;
537 auto & s = sw->toggleSwitchStyle();
538 s.backgroundColor = sw->parentBackgroundColor();
549 if (type.uiLevelBar) {
552 bar->windowStyle().focusedBorderSize = 1;
553 bar->levelBarProps().segmentGap = 1;
554 auto & s = bar->levelBarStyle();
555 s.backgroundColor = bar->parentBackgroundColor();
567 auto & s = ((
uiLedBar *)
object)->ledBarStyle();
568 s.backgroundColor = ((
uiWindow *)
object)->parentBackgroundColor();
577 if (type.uiStepper) {
579 RGB888 background = stepper->parentBackgroundColor();
581 auto & s = stepper->stepperStyle();
582 s.backgroundColor = background;
583 s.buttonBackgroundColor = background;
594 if (type.uiTileSelector) {
597 tiles->windowStyle().focusedBorderSize = 1;
598 auto & s = tiles->tileSelectorStyle();
599 s.backgroundColor = tiles->parentBackgroundColor();
611 auto graph = (
uiGraph *)
object;
613 auto & s = graph->graphStyle();
622 if (type.uiPianoKeyboard) {
625 piano->windowStyle().focusedBorderSize = 1;
626 auto & s = piano->pianoKeyboardStyle();
646 auto fader = (
uiFader *)
object;
648 auto & s = fader->faderStyle();
649 s.backgroundColor = fader->parentBackgroundColor();
662 auto pad = (
uiPad *)
object;
664 auto & s = pad->padStyle();
665 s.backgroundColor = pad->parentBackgroundColor();
682 if (type.uiSegmentDisplay) {
687 ((
uiSegmentDisplay *)
object)->segmentDisplayProps().showOffSegments =
false;
692 if (type.uiStepGrid) {
695 auto & s = grid->stepGridStyle();
696 s.backgroundColor = grid->parentBackgroundColor();
uiAppProps & appProps()
Sets or gets application properties.
uiFrame * rootWindow()
Gets a pointer to the root window.
void setStyle(uiStyle *value)
Sets the style of the application controls.
Represents the whole application base class.
Represents a checkbox or a radiobutton.
This is a combination of a listbox and another component, base of all combobox components.
uiListBoxStyle & listBoxStyle()
Sets or gets listbox style.
Base class for list controls that display a list of selectable items.
uiDarkTheme(uiThemeAccent accent=uiThemeAccent::Orange)
Creates the theme.
RGB888 color(uiThemeInk value)
Gets the actual RGB value of a theme color.
static FontInfo const * normalFont()
static FontInfo const * bigFont()
uint32_t defaultStyleClass(uiObject *object)
Gets the style class used for an element created without style class.
void apply(uiApp *app)
Applies the theme to an application.
uiThemeAccent accent()
Determines the accent color.
static FontInfo const * smallFont()
void setStyle(uiObject *object, uint32_t styleClassID)
Configures a UI element (called by the library).
RGB888 ink(uiThemeInk value)
Gets the color to use with the Canvas and the styles to obtain a theme color.
static FontInfo const * titleFont()
A linear fader, like the level controls of a mixing console.
uiFrameProps & frameProps()
Sets or gets frame properties.
uiFrameStyle & frameStyle()
Sets or gets frame style.
A frame is a window with a title bar, maximize/minimize/close buttons and that is resizable or movabl...
Plots a sequence of values as a curve (waveforms, envelopes, frequency responses.....
A rotary knob. The value changes dragging the mouse up and down, with the mouse wheel or with the key...
A row of leds. Each led has a state (0 = off, 1..3 = on with different colors).
A horizontal segmented bar, like a led level meter. It can show a level or let the user set it.
uiObjectType & objectType()
Determines the object type.
Base class of all UI elements like windows and controls.
A momentary button that reacts when pressed, like the pads and the buttons of the drum machines.
A paintbox control allows applications to perform custom drawings providing uiPaintBox....
A panel is used to contain and to group some controls.
An on-screen piano keyboard, played with the mouse (dragging slides between notes) or by the applicat...
A progress bar shows a completion percentage using a colored bar.
A seven segment led display, like the ones of the vintage instruments.
A slider or track bar is a graphical control element with which a user may set a value by moving an i...
A grid of cells for step sequencers: one row for each instrument (or note), one column for each step.
A text between "previous" and "next" arrow buttons, to step through values (for example an octave).
uiTextEditStyle & textEditStyle()
Sets or gets text edit style.
Represents a text edit control.
A row of selectable tiles. The content of each tile is painted by the application (onPaintTile).
An on/off switch: a track with a sliding thumb, and an optional text on its left.
uiWindowStyle & windowStyle()
Sets or gets window style.
RGB888 parentBackgroundColor()
Determines the background color behind this window.
Base class for all visible UI elements (Frames and Controls).
uiThemeInk
Colors of uiDarkTheme. Each one is a slot of the 16 color palette (see uiDarkTheme::setupPalette()).
uiThemeAccent
Accent colors of uiDarkTheme.
Represents a 24-bit RGB color.
Represents a 24-bit RGB color.
uiDialogStyleClasses dialogStyleClasses
RGB888 focusedBackgroundColor
bool applyToUnstyled
When true setStyle() is called also for the UI elements created without a style class (styleClassID =...
This file contains uiDarkTheme, a ready to use dark theme for the GUI (fabui.h).