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_ToolbarItemComponent.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//==============================================================================
49class JUCE_API ToolbarItemComponent : public Button
50{
51public:
52 //==============================================================================
62 ToolbarItemComponent (int itemId,
63 const String& labelText,
64 bool isBeingUsedAsAButton);
65
67 ~ToolbarItemComponent() override;
68
69 //==============================================================================
73 int getItemId() const noexcept { return itemId; }
74
78 Toolbar* getToolbar() const;
79
83 bool isToolbarVertical() const;
84
90 Toolbar::ToolbarItemStyle getStyle() const noexcept { return toolbarStyle; }
91
99 virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
100
109 Rectangle<int> getContentArea() const noexcept { return contentArea; }
110
111 //==============================================================================
129 virtual bool getToolbarItemSizes (int toolbarThickness,
130 bool isToolbarVertical,
131 int& preferredSize,
132 int& minSize,
133 int& maxSize) = 0;
134
143 virtual void paintButtonArea (Graphics& g,
144 int width, int height,
145 bool isMouseOver, bool isMouseDown) = 0;
146
154 virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
155
156
157 //==============================================================================
162 {
163 normalMode = 0,
164 editableOnToolbar,
166 editableOnPalette
168 };
169
175 void setEditingMode (ToolbarEditingMode newMode);
176
182 ToolbarEditingMode getEditingMode() const noexcept { return mode; }
183
184
185 //==============================================================================
187 void paintButton (Graphics&, bool isMouseOver, bool isMouseDown) override;
189 void resized() override;
191 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
192
193private:
194 friend class Toolbar;
196
197 const int itemId;
198 ToolbarEditingMode mode;
199 Toolbar::ToolbarItemStyle toolbarStyle;
200 std::unique_ptr<Component> overlayComp;
201 int dragOffsetX, dragOffsetY;
202 bool isActive, isBeingDragged, isBeingUsedAsAButton;
203 Rectangle<int> contentArea;
204
206};
207
208} // namespace juce
A base class for buttons.
Definition juce_Button.h:43
A graphics context, used for drawing a component or image.
Manages a rectangle and allows geometric operations to be performed on it.
The JUCE String class!
Definition juce_String.h:53
A component that can be used as one of the items in a Toolbar.
virtual void contentAreaChanged(const Rectangle< int > &newBounds)=0
Callback to indicate that the content area of this item has changed.
virtual bool getToolbarItemSizes(int toolbarThickness, bool isToolbarVertical, int &preferredSize, int &minSize, int &maxSize)=0
This method must return the size criteria for this item, based on a given toolbar size and orientatio...
virtual void paintButtonArea(Graphics &g, int width, int height, bool isMouseOver, bool isMouseDown)=0
Your subclass should use this method to draw its content area.
int getItemId() const noexcept
Returns the item type ID that this component represents.
Rectangle< int > getContentArea() const noexcept
Returns the area of the component that should be used to display the button image or other contents o...
ToolbarEditingMode getEditingMode() const noexcept
Returns the current editing mode of this component.
Toolbar::ToolbarItemStyle getStyle() const noexcept
Returns the current style setting of this item.
A toolbar component.
ToolbarItemStyle
Options for the way items should be displayed.
#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.