openshot-audio  0.1.2
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) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_TOOLBARITEMCOMPONENT_H_INCLUDED
26 #define JUCE_TOOLBARITEMCOMPONENT_H_INCLUDED
27 
28 
29 //==============================================================================
48 {
49 public:
50  //==============================================================================
60  ToolbarItemComponent (int itemId,
61  const String& labelText,
62  bool isBeingUsedAsAButton);
63 
66 
67  //==============================================================================
71  int getItemId() const noexcept { return itemId; }
72 
76  Toolbar* getToolbar() const;
77 
81  bool isToolbarVertical() const;
82 
88  Toolbar::ToolbarItemStyle getStyle() const noexcept { return toolbarStyle; }
89 
97  virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
98 
107  const Rectangle<int>& getContentArea() const noexcept { return contentArea; }
108 
109  //==============================================================================
127  virtual bool getToolbarItemSizes (int toolbarThickness,
128  bool isToolbarVertical,
129  int& preferredSize,
130  int& minSize,
131  int& maxSize) = 0;
132 
141  virtual void paintButtonArea (Graphics& g,
142  int width, int height,
143  bool isMouseOver, bool isMouseDown) = 0;
144 
152  virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
153 
154 
155  //==============================================================================
160  {
161  normalMode = 0,
162  editableOnToolbar,
164  editableOnPalette
166  };
167 
173  void setEditingMode (const ToolbarEditingMode newMode);
174 
180  ToolbarEditingMode getEditingMode() const noexcept { return mode; }
181 
182 
183  //==============================================================================
185  void paintButton (Graphics&, bool isMouseOver, bool isMouseDown) override;
187  void resized() override;
188 
189 private:
190  friend class Toolbar;
192  friend class ItemDragAndDropOverlayComponent;
193  const int itemId;
194  ToolbarEditingMode mode;
195  Toolbar::ToolbarItemStyle toolbarStyle;
196  ScopedPointer <Component> overlayComp;
197  int dragOffsetX, dragOffsetY;
198  bool isActive, isBeingDragged, isBeingUsedAsAButton;
199  Rectangle<int> contentArea;
200 
202 };
203 
204 
205 #endif // JUCE_TOOLBARITEMCOMPONENT_H_INCLUDED
const Rectangle< int > & getContentArea() const noexcept
Definition: juce_ToolbarItemComponent.h:107
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_Button.h:39
int getItemId() const noexcept
Definition: juce_ToolbarItemComponent.h:71
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_Rectangle.h:36
virtual void resized()
Definition: juce_Component.cpp:2272
Definition: juce_Toolbar.h:49
Toolbar::ToolbarItemStyle getStyle() const noexcept
Definition: juce_ToolbarItemComponent.h:88
Definition: juce_ToolbarItemComponent.h:47
ToolbarEditingMode
Definition: juce_ToolbarItemComponent.h:159
Definition: juce_ToolbarItemComponent.cpp:29
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_GraphicsContext.h:42
ToolbarItemStyle
Definition: juce_Toolbar.h:165
ToolbarEditingMode getEditingMode() const noexcept
Definition: juce_ToolbarItemComponent.h:180
virtual void paintButton(Graphics &g, bool isMouseOverButton, bool isButtonDown)=0