LMMS
Loading...
Searching...
No Matches
juce_SidePanel.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//==============================================================================
41class SidePanel : public Component,
42 private ComponentListener,
43 private ChangeListener
44{
45public:
46 //==============================================================================
60 SidePanel (StringRef title, int width, bool positionOnLeft,
61 Component* contentComponent = nullptr,
62 bool deleteComponentWhenNoLongerNeeded = true);
63
65 ~SidePanel() override;
66
67 //==============================================================================
83 void setContent (Component* newContentComponent,
84 bool deleteComponentWhenNoLongerNeeded = true);
85
91
106 void setTitleBarComponent (Component* titleBarComponentToUse,
107 bool keepDismissButton,
108 bool deleteComponentWhenNoLongerNeeded = true);
109
115
124 void showOrHide (bool show);
125
126 //==============================================================================
129
132
134 void setShadowWidth (int newWidth) noexcept { shadowWidth = newWidth; }
135
138
140 void setTitleBarHeight (int newHeight) noexcept { titleBarHeight = newHeight; }
141
144
147
148 //==============================================================================
160
177
178 //==============================================================================
180 std::function<void()> onPanelMove;
181
183 std::function<void (bool)> onPanelShowHide;
184
185 //==============================================================================
187 void moved() override;
189 void resized() override;
191 void paint (Graphics& g) override;
193 void parentHierarchyChanged() override;
195 void mouseDrag (const MouseEvent&) override;
197 void mouseUp (const MouseEvent&) override;
198
199private:
200 //==============================================================================
201 Component* parent = nullptr;
204
207
209
210 bool isOnLeft = false;
211 bool isShowing = false;
212
213 int panelWidth = 0;
214 int shadowWidth = 15;
216
218 bool shouldResize = false;
219 int amountMoved = 0;
220
222
223 //==============================================================================
224 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
225 void lookAndFeelChanged() override;
226 void componentMovedOrResized (Component&, bool wasMoved, bool wasResized) override;
228
231
233
234 //==============================================================================
236};
237
238} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_ChangeBroadcaster.h:35
Definition juce_ChangeListener.h:45
Definition juce_Component.h:36
Component() noexcept
Definition juce_Component.cpp:517
Definition juce_ComponentListener.h:43
Definition juce_Font.h:42
Definition juce_GraphicsContext.h:45
Definition juce_Justification.h:41
Definition juce_Label.h:41
Definition juce_MouseEvent.h:39
Definition juce_OptionalScopedPointer.h:38
Definition juce_Path.h:65
Definition juce_Rectangle.h:67
Definition juce_ShapeButton.h:38
bool isPanelShowing() const noexcept
Definition juce_SidePanel.h:128
std::function< void()> onPanelMove
Definition juce_SidePanel.h:180
int panelWidth
Definition juce_SidePanel.h:213
OptionalScopedPointer< Component > titleBarComponent
Definition juce_SidePanel.h:203
void calculateAndRemoveShadowBounds(Rectangle< int > &bounds)
Definition juce_SidePanel.cpp:279
void setShadowWidth(int newWidth) noexcept
Definition juce_SidePanel.h:134
Rectangle< int > shadowArea
Definition juce_SidePanel.h:208
OptionalScopedPointer< Component > contentComponent
Definition juce_SidePanel.h:202
int titleBarHeight
Definition juce_SidePanel.h:215
void setContent(Component *newContentComponent, bool deleteComponentWhenNoLongerNeeded=true)
Definition juce_SidePanel.cpp:66
Component * getContent() const noexcept
Definition juce_SidePanel.h:90
bool shouldResize
Definition juce_SidePanel.h:218
int shadowWidth
Definition juce_SidePanel.h:214
void setTitleBarHeight(int newHeight) noexcept
Definition juce_SidePanel.h:140
void resized() override
Definition juce_SidePanel.cpp:120
void componentMovedOrResized(Component &, bool wasMoved, bool wasResized) override
Definition juce_SidePanel.cpp:245
int getShadowWidth() const noexcept
Definition juce_SidePanel.h:137
void lookAndFeelChanged() override
Definition juce_SidePanel.cpp:230
Rectangle< int > calculateBoundsInParent(Component &) const
Definition juce_SidePanel.cpp:265
ColourIds
Definition juce_SidePanel.h:169
@ titleTextColour
Definition juce_SidePanel.h:171
@ dismissButtonOverColour
Definition juce_SidePanel.h:174
@ dismissButtonDownColour
Definition juce_SidePanel.h:175
@ shadowBaseColour
Definition juce_SidePanel.h:172
@ backgroundColour
Definition juce_SidePanel.h:170
@ dismissButtonNormalColour
Definition juce_SidePanel.h:173
void paint(Graphics &g) override
Definition juce_SidePanel.cpp:149
Rectangle< int > startingBounds
Definition juce_SidePanel.h:217
ShapeButton dismissButton
Definition juce_SidePanel.h:206
String getTitleText() const noexcept
Definition juce_SidePanel.h:146
Component * parent
Definition juce_SidePanel.h:201
void changeListenerCallback(ChangeBroadcaster *) override
Definition juce_SidePanel.cpp:253
int amountMoved
Definition juce_SidePanel.h:219
void parentHierarchyChanged() override
Definition juce_SidePanel.cpp:166
Component * getTitleBarComponent() const noexcept
Definition juce_SidePanel.h:114
void mouseUp(const MouseEvent &) override
Definition juce_SidePanel.cpp:218
void mouseDrag(const MouseEvent &) override
Definition juce_SidePanel.cpp:180
bool isShowing
Definition juce_SidePanel.h:211
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_SidePanel.cpp:298
int getTitleBarHeight() const noexcept
Definition juce_SidePanel.h:143
Label titleLabel
Definition juce_SidePanel.h:205
std::function< void(bool)> onPanelShowHide
Definition juce_SidePanel.h:183
bool isOnLeft
Definition juce_SidePanel.h:210
void moved() override
Definition juce_SidePanel.cpp:114
bool isPanelOnLeft() const noexcept
Definition juce_SidePanel.h:131
bool isMouseEventInThisOrChildren(Component *)
Definition juce_SidePanel.cpp:285
bool shouldShowDismissButton
Definition juce_SidePanel.h:221
SidePanel(StringRef title, int width, bool positionOnLeft, Component *contentComponent=nullptr, bool deleteComponentWhenNoLongerNeeded=true)
Definition juce_SidePanel.cpp:29
Definition juce_String.h:53
Definition juce_StringRef.h:62
int g
Definition inflate.c:1573
static const char * title
Definition pugl.h:1747
static int width
Definition pugl.h:1593
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
const Colour lightgrey
Definition juce_Colours.h:111
const Colour white
Definition juce_Colours.h:180
Definition carla_juce.cpp:31
Definition juce_SidePanel.h:153
virtual Justification getSidePanelTitleJustification(SidePanel &)=0
virtual Font getSidePanelTitleFont(SidePanel &)=0
virtual Path getSidePanelDismissButtonShape(SidePanel &)=0
#define void
Definition unzip.h:396
#define const
Definition zconf.h:137