Krotos Modules 3
Loading...
Searching...
No Matches
Krotos_LookAndFeel.h
Go to the documentation of this file.
1#pragma once
2namespace krotos
3{
11 class Krotos_LookAndFeel : public juce::LookAndFeel_V4
12 {
13 public:
20 {
22 {
23 static const Identifier AlertWidthID;
24 static const Identifier AlertHeightID;
25 };
26
27 // ComboBox Properties
28 struct ComboBox
29 {
33 static const Identifier DisableHover;
34
38 static const Identifier RoundedCornerID;
40 {
41 Bottom = 0, // Bottom left and bottom right
42 Top, // Top left and top right
48 None
49 };
50
54 static const Identifier UseCustomIcon;
58 static const Identifier IconPositionID;
60 {
61 Right = 0,
63 NoIcon
64 };
68 static const Identifier FontSize;
69 };
70 };
71
73
74 // Rotary Sliders
75 void drawRotarySlider(Graphics& g, int x, int y, int width, int height, float sliderPos, float rotaryStartAngle,
76 float rotaryEndAngle, juce::Slider& slider) override;
77
78 // Custom LAF for hyperlink style text button
79 class LinkButtonLAF : public LookAndFeel_V4
80 {
81 public:
83 ~LinkButtonLAF() = default;
84
85 const Colour buttonTextColour{127, 127, 127};
86
87 private:
88 void drawButtonBackground(Graphics&, Button&, const Colour& /*backgroundColour*/,
89 bool /*shouldDrawButtonAsHighlighted*/, bool /*shouldDrawButtonAsDown*/) override
90 {
91 }
92
93 void drawButtonText(Graphics&, TextButton&, bool shouldDrawButtonAsHighlighted,
94 bool shouldDrawButtonAsDown) override;
95 };
96
97 protected:
102 struct Layout
103 {
104 public:
105 // angles
106 /* This is the calulation used to derive the startRadians and endRadians constants from figma design
107 based on a 90 degree chunk taken out of the arc bottom
108 float startDegrees = 180.f + 45.f;
109 float endDegrees = startDegrees + 180.f + 90.f;
110 float startRadians = juce::degreesToRadians(startDegrees);
111 float endRadians = juce::degreesToRadians(endDegrees); */
112 const float startRadians{3.92699075f};
113 const float endRadians{8.63937950f};
114
115 // scalars
116 const float outlineArcInnerProportion{82.f / 86.f};
117 const float trackArcInnerProportion{71.f / 77.f};
118 const float sliderValueMin{0.f};
119 const float sliderValueMax{1.f};
120 const float thumbWidth{2.f};
121 const int maxTextLines{1};
122 const int numDecimalPlaces{2};
123 const float KerningFactor{0.02f};
124
125 // rectangles
126 const juce::Rectangle<float> enclosingSquare{juce::Rectangle<float>(0.f, 0.f, 86.f, 86.f)};
127 const juce::Rectangle<float> enclosingSquareTrack{juce::Rectangle<float>(4.5f, 4.5f, 77.f, 77.f)};
128 const juce::Rectangle<float> enclosingRectangle{juce::Rectangle<float>(0.f, 0.f, 86.f, 96.f)};
129 const juce::Rectangle<float> textRectangle{juce::Rectangle<float>(0.f, 81.f, 86.f, 15.f)};
130
131 // points
132 const juce::Point<float> arcCenter{juce::Point<float>(43.f, 43.f)};
133 const juce::Point<float> thumbEnd{juce::Point<float>(0.f, -37.5f)};
134 const juce::Point<float> thumbStart{juce::Point<float>(0.f, -17.5f)};
135
136 // colours
137 const Colour trackColourInner{0xff37C9DB};
138 const Colour trackColourOuter{0xffffffff};
139 const Colour thumbColour{0xffffffff};
140 const Colour textColour{0xffb2b2b2}; // White x 0.7
141
142 // alphas
143 const float trackAlphaOuterDefault{0.2f};
144 const float trackAlphaOuterClicked{0.3f};
145 const float enabledAlphaEnabled{1.f}; // component active : 100%
147 0.2f}; // component inactive : everything in component as default state with 20 % alpha
148 const float mouseOverAlphaDefault{0.15f}; // default: white 15 %
149 const float mouseOverAlphaOver{0.3f}; // hover, clicked : white 30 %
151
152 private:
154 {
155 const uint32 windowBackground = juce::Colour(48, 63, 70).getARGB();
156 const uint32 widgetBackground = juce::Colour(31, 41, 46).getARGB();
157 const uint32 menuBackground = juce::Colour(48, 63, 70).getARGB();
158 const uint32 outline = juce::Colour(42, 55, 61).getARGB();
159 const uint32 defaultText = juce::Colour(255, 255, 255).getARGB();
160 const uint32 defaultFill = juce::Colour(71, 96, 107).getARGB();
161 const uint32 highlightedText = juce::Colour(255, 255, 255).getARGB();
162 const uint32 highlightedFill = juce::Colour(255, 255, 0).getARGB();
163 const uint32 menuText = juce::Colour(255, 255, 255).getARGB();
164
165 return {windowBackground, widgetBackground, menuBackground, outline, defaultText,
166 defaultFill, highlightedText, highlightedFill, menuText};
167 }
168 };
169} // namespace krotos
Definition Krotos_LookAndFeel.h:12
struct krotos::Krotos_LookAndFeel::Layout layout
ColourScheme getKrotosDefaultColourScheme()
Definition Krotos_LookAndFeel.h:153
void drawRotarySlider(Graphics &g, int x, int y, int width, int height, float sliderPos, float rotaryStartAngle, float rotaryEndAngle, juce::Slider &slider) override
Definition Krotos_LookAndFeel.cpp:88
Krotos_LookAndFeel()
Definition Krotos_LookAndFeel.cpp:14
Definition AirAbsorptionFilter.cpp:2
Definition Krotos_LookAndFeel.h:103
const juce::Rectangle< float > enclosingSquareTrack
Definition Krotos_LookAndFeel.h:127
const float endRadians
Definition Krotos_LookAndFeel.h:113
const float thumbWidth
Definition Krotos_LookAndFeel.h:120
const float trackAlphaOuterDefault
Definition Krotos_LookAndFeel.h:143
const juce::Point< float > thumbStart
Definition Krotos_LookAndFeel.h:134
const juce::Rectangle< float > enclosingSquare
Definition Krotos_LookAndFeel.h:126
const float enabledAlphaEnabled
Definition Krotos_LookAndFeel.h:145
const int maxTextLines
Definition Krotos_LookAndFeel.h:121
const Colour textColour
Definition Krotos_LookAndFeel.h:140
const float sliderValueMax
Definition Krotos_LookAndFeel.h:119
const juce::Rectangle< float > textRectangle
Definition Krotos_LookAndFeel.h:129
const Colour trackColourOuter
Definition Krotos_LookAndFeel.h:138
const float trackAlphaOuterClicked
Definition Krotos_LookAndFeel.h:144
const float enabledAlphaDisabled
Definition Krotos_LookAndFeel.h:146
const juce::Rectangle< float > enclosingRectangle
Definition Krotos_LookAndFeel.h:128
const Colour trackColourInner
Definition Krotos_LookAndFeel.h:137
const float KerningFactor
Definition Krotos_LookAndFeel.h:123
const juce::Point< float > arcCenter
Definition Krotos_LookAndFeel.h:132
const Colour thumbColour
Definition Krotos_LookAndFeel.h:139
const float trackArcInnerProportion
Definition Krotos_LookAndFeel.h:117
const float mouseOverAlphaDefault
Definition Krotos_LookAndFeel.h:148
const float sliderValueMin
Definition Krotos_LookAndFeel.h:118
const juce::Point< float > thumbEnd
Definition Krotos_LookAndFeel.h:133
const float outlineArcInnerProportion
Definition Krotos_LookAndFeel.h:116
const float startRadians
Definition Krotos_LookAndFeel.h:112
const int numDecimalPlaces
Definition Krotos_LookAndFeel.h:122
const float mouseOverAlphaOver
Definition Krotos_LookAndFeel.h:149
Definition Krotos_LookAndFeel.h:22
static const Identifier AlertHeightID
Definition Krotos_LookAndFeel.h:24
static const Identifier AlertWidthID
Definition Krotos_LookAndFeel.h:23
Definition Krotos_LookAndFeel.h:29
static const Identifier RoundedCornerID
Specify which corners to round on a component.
Definition Krotos_LookAndFeel.h:38
RoundedCorner
Definition Krotos_LookAndFeel.h:40
@ BottomRight
Definition Krotos_LookAndFeel.h:46
@ Top
Definition Krotos_LookAndFeel.h:42
@ TopRight
Definition Krotos_LookAndFeel.h:44
@ All
Definition Krotos_LookAndFeel.h:47
@ BottomLeft
Definition Krotos_LookAndFeel.h:45
@ Bottom
Definition Krotos_LookAndFeel.h:41
@ None
Definition Krotos_LookAndFeel.h:48
@ TopLeft
Definition Krotos_LookAndFeel.h:43
static const Identifier IconPositionID
Where to place the icon. This determines how the text is offset.
Definition Krotos_LookAndFeel.h:58
static const Identifier UseCustomIcon
Hide the default dropdown arrow icon, leaving an empty spot to draw a custom icon.
Definition Krotos_LookAndFeel.h:54
static const Identifier DisableHover
Disable Mouse Hover affecting drawing over buttons, etc.
Definition Krotos_LookAndFeel.h:33
static const Identifier FontSize
The size of the font in the ComboBox label.
Definition Krotos_LookAndFeel.h:68
IconPosition
Definition Krotos_LookAndFeel.h:60
@ Right
Definition Krotos_LookAndFeel.h:61
@ NoIcon
Definition Krotos_LookAndFeel.h:63
@ Left
Definition Krotos_LookAndFeel.h:62
Definition Krotos_LookAndFeel.h:20