LMMS
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//==============================================================================
42{
43public:
44 //==============================================================================
47 {
49
50 showColourAtTop = 1 << 1,
51 editableColour = 1 << 2,
52 showSliders = 1 << 3,
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
136 //==============================================================================
137 // These need to be public otherwise the Projucer's live-build engine will complain
138 class ColourSpaceView;
139 class HueSelectorComp;
140 class ColourPreviewComp;
141
142private:
143 //==============================================================================
144 class SwatchComponent;
145
147 float h, s, v;
148 std::unique_ptr<Slider> sliders[4];
149 std::unique_ptr<ColourSpaceView> colourSpace;
150 std::unique_ptr<HueSelectorComp> hueSelector;
151 std::unique_ptr<ColourPreviewComp> previewComponent;
153 const int flags;
155
156 void setHue (float newH);
157 void setSV (float newS, float newV);
158 void updateHSV();
160 void changeColour();
161 void paint (Graphics&) override;
162 void resized() override;
163
165};
166
167} // namespace juce
ChangeBroadcaster() noexcept
Definition juce_ChangeBroadcaster.cpp:26
Definition juce_Colour.h:38
Definition juce_ColourSelector.h:42
std::unique_ptr< ColourSpaceView > colourSpace
Definition juce_ColourSelector.h:149
std::unique_ptr< Slider > sliders[4]
Definition juce_ColourSelector.h:148
OwnedArray< SwatchComponent > swatchComponents
Definition juce_ColourSelector.h:152
std::unique_ptr< HueSelectorComp > hueSelector
Definition juce_ColourSelector.h:150
std::unique_ptr< ColourPreviewComp > previewComponent
Definition juce_ColourSelector.h:151
void changeColour()
Definition juce_ColourSelector.cpp:621
ColourSelector(int flags=(showAlphaChannel|showColourAtTop|showSliders|showColourspace), int edgeGap=4, int gapAroundColourSpaceComponent=7)
Definition juce_ColourSelector.cpp:384
float v
Definition juce_ColourSelector.h:147
int edgeGap
Definition juce_ColourSelector.h:154
void paint(Graphics &) override
Definition juce_ColourSelector.cpp:512
Colour colour
Definition juce_ColourSelector.h:146
void resized() override
Definition juce_ColourSelector.cpp:532
ColourIds
Definition juce_ColourSelector.h:131
@ backgroundColourId
Definition juce_ColourSelector.h:132
@ labelTextColourId
Definition juce_ColourSelector.h:133
const int flags
Definition juce_ColourSelector.h:153
void updateHSV()
Definition juce_ColourSelector.cpp:480
float h
Definition juce_ColourSelector.h:147
void update(NotificationType)
Definition juce_ColourSelector.cpp:485
void setSV(float newS, float newV)
Definition juce_ColourSelector.cpp:465
ColourSelectorOptions
Definition juce_ColourSelector.h:47
@ showColourAtTop
Definition juce_ColourSelector.h:50
@ editableColour
Definition juce_ColourSelector.h:51
@ showSliders
Definition juce_ColourSelector.h:52
@ showColourspace
Definition juce_ColourSelector.h:53
@ showAlphaChannel
Definition juce_ColourSelector.h:48
void setHue(float newH)
Definition juce_ColourSelector.cpp:453
float s
Definition juce_ColourSelector.h:147
Component() noexcept
Definition juce_Component.cpp:517
Definition juce_GraphicsContext.h:45
Definition juce_OwnedArray.h:51
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
NotificationType
Definition juce_NotificationType.h:32
@ sendNotification
Definition juce_NotificationType.h:34
jack_client_t client jack_client_t client jack_client_t client jack_client_t JackInfoShutdownCallback void arg jack_client_t jack_port_t port void func jack_client_t const char const char unsigned long flags
Definition juce_linux_JackAudio.cpp:69