openshot-audio  0.1.6
juce_MenuBarComponent.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_MENUBARCOMPONENT_H_INCLUDED
26 #define JUCE_MENUBARCOMPONENT_H_INCLUDED
27 
28 
29 //==============================================================================
36  private MenuBarModel::Listener,
37  private Timer
38 {
39 public:
40  //==============================================================================
47  MenuBarComponent (MenuBarModel* model = nullptr);
48 
51 
52  //==============================================================================
58  void setModel (MenuBarModel* newModel);
59 
61  MenuBarModel* getModel() const noexcept;
62 
63  //==============================================================================
69  void showMenu (int menuIndex);
70 
71  //==============================================================================
73  void paint (Graphics&) override;
75  void resized() override;
77  void mouseEnter (const MouseEvent&) override;
79  void mouseExit (const MouseEvent&) override;
81  void mouseDown (const MouseEvent&) override;
83  void mouseDrag (const MouseEvent&) override;
85  void mouseUp (const MouseEvent&) override;
87  void mouseMove (const MouseEvent&) override;
89  void handleCommandMessage (int commandId) override;
91  bool keyPressed (const KeyPress&) override;
93  void menuBarItemsChanged (MenuBarModel*) override;
96 
97 private:
98  //==============================================================================
99  MenuBarModel* model;
100 
101  StringArray menuNames;
102  Array<int> xPositions;
103  Point<int> lastMousePos;
104  int itemUnderMouse, currentPopupIndex, topLevelIndexClicked;
105 
106  int getItemAt (Point<int>);
107  void setItemUnderMouse (int index);
108  void setOpenItem (int index);
109  void updateItemUnderMouse (Point<int>);
110  void timerCallback() override;
111  void repaintMenuItem (int index);
112  void menuDismissed (int topLevelIndex, int itemId);
113  static void menuBarMenuDismissedCallback (int, MenuBarComponent*, int);
114 
116 };
117 
118 #endif // JUCE_MENUBARCOMPONENT_H_INCLUDED
Definition: juce_KeyPress.h:37
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_MenuBarModel.h:38
virtual void mouseMove(const MouseEvent &event) override
Definition: juce_Component.cpp:2254
virtual void mouseDrag(const MouseEvent &event) override
Definition: juce_Component.cpp:2253
virtual void handleCommandMessage(int commandId)
Definition: juce_Component.cpp:2334
virtual void timerCallback()=0
Definition: juce_Point.h:39
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_ApplicationCommandTarget.h:58
virtual void resized()
Definition: juce_Component.cpp:2272
virtual void mouseEnter(const MouseEvent &event) override
Definition: juce_Component.cpp:2249
Definition: juce_MenuBarComponent.h:35
virtual void paint(Graphics &g)
Definition: juce_Component.cpp:1929
Definition: juce_MenuBarModel.h:76
Definition: juce_Component.h:33
virtual void menuBarItemsChanged(MenuBarModel *menuBarModel)=0
Definition: juce_StringArray.h:39
virtual void mouseExit(const MouseEvent &event) override
Definition: juce_Component.cpp:2250
Definition: juce_Array.h:60
virtual void mouseUp(const MouseEvent &event) override
Definition: juce_Component.cpp:2252
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_GraphicsContext.h:42
virtual void mouseDown(const MouseEvent &event) override
Definition: juce_Component.cpp:2251
Definition: juce_Timer.h:52
virtual void menuCommandInvoked(MenuBarModel *menuBarModel, const ApplicationCommandTarget::InvocationInfo &info)=0
Definition: juce_MouseEvent.h:36
virtual bool keyPressed(const KeyPress &key)
Definition: juce_Component.cpp:3004