JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_ColourSelector.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
40class JUCE_API ColourSelector : public Component,
42{
43public:
44 //==============================================================================
47 {
48 showAlphaChannel = 1 << 0,
50 showColourAtTop = 1 << 1,
51 editableColour = 1 << 2,
52 showSliders = 1 << 3,
53 showColourspace = 1 << 4
54 };
55
56 //==============================================================================
67 ColourSelector (int flags = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
68 int edgeGap = 4,
69 int gapAroundColourSpaceComponent = 7);
70
72 ~ColourSelector() override;
73
74 //==============================================================================
82 Colour getCurrentColour() const;
83
90 void setCurrentColour (Colour newColour, NotificationType notificationType = sendNotification);
91
92 //==============================================================================
99 virtual int getNumSwatches() const;
100
109 virtual Colour getSwatchColour (int index) const;
110
119 virtual void setSwatchColour (int index, const Colour& newColour);
120
121
122 //==============================================================================
131 {
132 backgroundColourId = 0x1007000,
133 labelTextColourId = 0x1007001
134 };
135
136private:
137 //==============================================================================
138 class SwatchComponent;
139 class ColourSpaceView;
140 class HueSelectorComp;
141 class ColourPreviewComp;
142
143 Colour colour;
144 float h, s, v;
145 std::unique_ptr<Slider> sliders[4];
148 std::unique_ptr<ColourPreviewComp> previewComponent;
149 OwnedArray<SwatchComponent> swatchComponents;
150 const int flags;
151 int edgeGap;
152
153 void setHue (float newH);
154 void setSV (float newS, float newV);
155 void updateHSV();
156 void update (NotificationType);
157 void changeColour();
158 void paint (Graphics&) override;
159 void resized() override;
160
162};
163
164} // namespace juce
Holds a list of ChangeListeners, and sends messages to them when instructed.
A component that lets the user choose a colour.
ColourIds
A set of colour IDs to use to change the colour of various aspects of the keyboard.
ColourSelectorOptions
Options for the type of selector to show.
Represents a colour, also including a transparency value.
Definition juce_Colour.h:38
The base class for all JUCE user-interface objects.
A graphics context, used for drawing a component or image.
An array designed for holding objects.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
NotificationType
These enums are used in various classes to indicate whether a notification event should be sent out.