-
Notifications
You must be signed in to change notification settings - Fork 3
/
mlrVSTLookAndFeel.h
181 lines (128 loc) · 7.24 KB
/
mlrVSTLookAndFeel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_mlrVSTLookAndFeel_JUCEHEADER__
#define __JUCE_mlrVSTLookAndFeel_JUCEHEADER__
#include "../JuceLibraryCode/JuceHeader.h"
//==============================================================================
/**
The original Juce look-and-feel.
*/
class mlrVSTLookAndFeel : public LookAndFeel
{
public:
//==============================================================================
/** Creates the default JUCE look and feel. */
mlrVSTLookAndFeel();
/** Destructor. */
virtual ~mlrVSTLookAndFeel();
//==============================================================================
/** Draws the background for a standard button. */
virtual void drawButtonBackground (Graphics& g, Button& button,
const Colour& backgroundColour,
bool isMouseOverButton,
bool isButtonDown);
virtual void drawButtonText (Graphics& g, TextButton& button,
bool isMouseOverButton, bool isButtonDown);
/** Draws the contents of a standard ToggleButton. */
virtual void drawToggleButton (Graphics& g, ToggleButton& button,
bool isMouseOverButton,
bool isButtonDown);
virtual void drawLabel(Graphics& g, Label& label);
virtual const Typeface::Ptr getTypefaceForFont(const Font &font );
virtual void drawTickBox (Graphics& g, Component& component,
float x, float y, float w, float h,
bool ticked, bool isEnabled,
bool isMouseOverButton, bool isButtonDown);
//==============================================================================
virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
int width, int height,
double progress, const String& textToShow);
//==============================================================================
virtual void drawScrollbarButton (Graphics& g, ScrollBar& scrollbar,
int width, int height, int buttonDirection,
bool isScrollbarVertical, bool isMouseOverButton,
bool isButtonDown);
virtual void drawScrollbar (Graphics& g, ScrollBar& scrollbar,
int x, int y, int width, int height,
bool isScrollbarVertical, int thumbStartPosition,
int thumbSize, bool isMouseOver, bool isMouseDown);
virtual ImageEffectFilter* getScrollbarEffect();
//==============================================================================
/** Fills the background of a popup menu component. */
virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
virtual void drawMenuBarBackground (Graphics& g, int width, int height,
bool isMouseOverBar, MenuBarComponent& menuBar);
//==============================================================================
virtual void drawComboBox (Graphics& g, int width, int height,
bool isButtonDown,
int buttonX, int buttonY,
int buttonW, int buttonH,
ComboBox& box);
virtual const Font getComboBoxFont(ComboBox& box);
virtual const Font getPopupMenuFont();
//==============================================================================
virtual void drawLinearSlider (Graphics& g,
int x, int y,
int width, int height,
float sliderPos,
float minSliderPos,
float maxSliderPos,
const Slider::SliderStyle style,
Slider& slider);
virtual int getSliderThumbRadius (Slider& slider);
virtual Button* createSliderButton (bool isIncrement);
virtual ImageEffectFilter* getSliderEffect();
//==============================================================================
virtual void drawCornerResizer (Graphics& g,
int w, int h,
bool isMouseOver,
bool isMouseDragging);
virtual Button* createDocumentWindowButton (int buttonType);
virtual void positionDocumentWindowButtons (DocumentWindow& window,
int titleBarX, int titleBarY,
int titleBarW, int titleBarH,
Button* minimiseButton,
Button* maximiseButton,
Button* closeButton,
bool positionTitleBarButtonsOnLeft);
private:
//==============================================================================
DropShadowEffect scrollbarShadow;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (mlrVSTLookAndFeel);
Typeface::Ptr typeSilk;
protected:
const float silkFontSizeSmall, silkFontSizeBig;
};
class menuLookandFeel : public mlrVSTLookAndFeel
{
public:
void drawLabel(Graphics& g, Label& label)
{
g.fillAll (label.findColour(Label::backgroundColourId));
const float alpha = label.isEnabled() ? 1.0f : 0.5f;
g.setColour (label.findColour (Label::textColourId).withMultipliedAlpha (alpha));
g.setFont(silkFontSizeSmall);
g.drawFittedText(label.getText(), 4, 4,
label.getWidth() - 2, label.getHeight() - 8,
Justification::centredLeft, 1,
label.getMinimumHorizontalScale());
g.setColour (label.findColour (Label::outlineColourId).withMultipliedAlpha (alpha));
g.drawRect (0, 0, label.getWidth(), label.getHeight());
}
};
#endif // __JUCE_mlrVSTLookAndFeel_JUCEHEADER__