openshot-audio  0.1.5
juce_DocumentWindow.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_DOCUMENTWINDOW_H_INCLUDED
26 #define JUCE_DOCUMENTWINDOW_H_INCLUDED
27 
28 
29 //==============================================================================
53 {
54 public:
55  //==============================================================================
61  {
62  minimiseButton = 1,
63  maximiseButton = 2,
64  closeButton = 4,
65 
67  allButtons = 7
68  };
69 
70  //==============================================================================
87  DocumentWindow (const String& name,
88  Colour backgroundColour,
89  int requiredButtons,
90  bool addToDesktop = true);
91 
95  ~DocumentWindow();
96 
97  //==============================================================================
103  void setName (const String& newName) override;
104 
111  void setIcon (const Image& imageToUse);
112 
114  void setTitleBarHeight (int newHeight);
115 
117  int getTitleBarHeight() const;
118 
128  void setTitleBarButtonsRequired (int requiredButtons,
129  bool positionTitleBarButtonsOnLeft);
130 
136  void setTitleBarTextCentred (bool textShouldBeCentred);
137 
138  //==============================================================================
150  void setMenuBar (MenuBarModel* menuBarModel,
151  int menuBarHeight = 0);
152 
157  Component* getMenuBarComponent() const noexcept;
158 
162  void setMenuBarComponent (Component* newMenuBarComponent);
163 
164  //==============================================================================
185  virtual void closeButtonPressed();
186 
192  virtual void minimiseButtonPressed();
193 
200  virtual void maximiseButtonPressed();
201 
202  //==============================================================================
204  Button* getCloseButton() const noexcept;
205 
207  Button* getMinimiseButton() const noexcept;
208 
210  Button* getMaximiseButton() const noexcept;
211 
212  //==============================================================================
221  {
222  textColourId = 0x1005701,
224  };
225 
226  //==============================================================================
231  {
232  virtual ~LookAndFeelMethods() {}
233 
234  virtual void drawDocumentWindowTitleBar (DocumentWindow&,
235  Graphics&, int w, int h,
236  int titleSpaceX, int titleSpaceW,
237  const Image* icon,
238  bool drawTitleTextOnLeft) = 0;
239 
240  virtual Button* createDocumentWindowButton (int buttonType) = 0;
241 
242  virtual void positionDocumentWindowButtons (DocumentWindow&,
243  int titleBarX, int titleBarY, int titleBarW, int titleBarH,
244  Button* minimiseButton,
245  Button* maximiseButton,
246  Button* closeButton,
247  bool positionTitleBarButtonsOnLeft) = 0;
248  };
249 
250  //==============================================================================
251  #ifndef DOXYGEN
252 
253  void paint (Graphics&) override;
255  void resized() override;
257  void lookAndFeelChanged() override;
259  BorderSize<int> getBorderThickness() override;
261  BorderSize<int> getContentComponentBorder() override;
263  void mouseDoubleClick (const MouseEvent&) override;
265  void userTriedToCloseWindow() override;
267  void activeWindowStatusChanged() override;
269  int getDesktopWindowStyleFlags() const override;
271  void parentHierarchyChanged() override;
273  Rectangle<int> getTitleBarArea();
274  #endif
275 
276 private:
277  //==============================================================================
278  int titleBarHeight, menuBarHeight, requiredButtons;
279  bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
280  ScopedPointer <Button> titleBarButtons [3];
281  Image titleBarIcon;
283  MenuBarModel* menuBarModel;
284 
287  ScopedPointer<ButtonListenerProxy> buttonListener;
288 
289  void repaintTitleBar();
290 
292 };
293 
294 
295 #endif // JUCE_DOCUMENTWINDOW_H_INCLUDED
virtual ~LookAndFeelMethods()
Definition: juce_DocumentWindow.h:232
Definition: juce_ResizableWindow.h:49
virtual void setName(const String &newName)
Definition: juce_Component.cpp:487
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_MenuBarModel.h:38
Definition: juce_Button.h:39
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_Rectangle.h:36
Definition: juce_Colour.h:35
Definition: juce_DocumentWindow.h:230
Definition: juce_Component.h:33
Definition: juce_ContainerDeletePolicy.h:44
Definition: juce_BorderSize.h:39
Definition: juce_DocumentWindow.h:52
Definition: juce_DocumentWindow.cpp:25
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_GraphicsContext.h:42
Definition: juce_Image.h:54
ColourIds
Definition: juce_DocumentWindow.h:220
Definition: juce_MouseEvent.h:36
TitleBarButtons
Definition: juce_DocumentWindow.h:60