openshot-audio  0.1.7
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
MenuBarModel::Listener
Definition: juce_MenuBarModel.h:76
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Component::keyPressed
virtual bool keyPressed(const KeyPress &key)
Definition: juce_Component.cpp:3004
Component::mouseDown
virtual void mouseDown(const MouseEvent &event) override
Definition: juce_Component.cpp:2251
Timer::timerCallback
virtual void timerCallback()=0
JUCE_API
#define JUCE_API
Definition: juce_StandardHeader.h:139
Graphics
Definition: juce_GraphicsContext.h:42
noexcept
#define noexcept
Definition: juce_CompilerSupport.h:141
Timer
Definition: juce_Timer.h:52
Array< int >
ApplicationCommandTarget::InvocationInfo
Definition: juce_ApplicationCommandTarget.h:58
Component::mouseMove
virtual void mouseMove(const MouseEvent &event) override
Definition: juce_Component.cpp:2254
KeyPress
Definition: juce_KeyPress.h:37
Component::mouseExit
virtual void mouseExit(const MouseEvent &event) override
Definition: juce_Component.cpp:2250
MenuBarComponent
Definition: juce_MenuBarComponent.h:35
Component::mouseUp
virtual void mouseUp(const MouseEvent &event) override
Definition: juce_Component.cpp:2252
MenuBarModel::Listener::menuCommandInvoked
virtual void menuCommandInvoked(MenuBarModel *menuBarModel, const ApplicationCommandTarget::InvocationInfo &info)=0
Component
Definition: juce_Component.h:33
MenuBarModel
Definition: juce_MenuBarModel.h:38
Component::mouseDrag
virtual void mouseDrag(const MouseEvent &event) override
Definition: juce_Component.cpp:2253
Component::resized
virtual void resized()
Definition: juce_Component.cpp:2272
Point< int >
Component::handleCommandMessage
virtual void handleCommandMessage(int commandId)
Definition: juce_Component.cpp:2334
Component::mouseEnter
virtual void mouseEnter(const MouseEvent &event) override
Definition: juce_Component.cpp:2249
Component::paint
virtual void paint(Graphics &g)
Definition: juce_Component.cpp:1929
MouseEvent
Definition: juce_MouseEvent.h:36
StringArray
Definition: juce_StringArray.h:39
MenuBarModel::Listener::menuBarItemsChanged
virtual void menuBarItemsChanged(MenuBarModel *menuBarModel)=0