|
LMMS
|
#include <juce_BurgerMenuComponent.h>
Classes | |
| struct | Row |
Static Private Member Functions | |
| static bool | hasSubMenu (const PopupMenu::Item &) |
Private Attributes | |
| MenuBarModel * | model = nullptr |
| ListBox | listBox {"BurgerMenuListBox", this} |
| Array< Row > | rows |
| int | lastRowClicked = -1 |
| int | inputSourceIndexOfLastClick = -1 |
| int | topLevelIndexClicked = -1 |
A component which lists all menu items and groups them into categories by their respective parent menus. This kind of component is often used for so-called "burger" menus in mobile apps.
@tags{GUI}
| juce::BurgerMenuComponent::BurgerMenuComponent | ( | MenuBarModel * | model = nullptr | ) |
Creates a burger menu component.
| model | the model object to use to control this burger menu. You can set the parameter or pass nullptr into this if you like, and set the model later using the setModel() method. |
|
override |
Destructor.
|
overrideprivatevirtual |
Override this method to return a custom AccessibilityHandler for this component.
The default implementation creates and returns a AccessibilityHandler object with an unspecified role, meaning that it will be visible to accessibility clients but without a specific role, action callbacks or interfaces. To control how accessibility clients see and interact with your component subclass AccessibilityHandler, implement the desired behaviours, and return an instance of it from this method in your component subclass.
The accessibility handler you return here is guaranteed to be destroyed before its Component, so it's safe to store and use a reference back to the Component inside the AccessibilityHandler if necessary.
Reimplemented from juce::Component.
|
noexcept |
Returns the current burger menu model being used.
|
overrideprivatevirtual |
This has to return the number of items in the list.
Implements juce::ListBoxModel.
Called to handle a command that was sent by postCommandMessage().
This is called by the message thread when a command message arrives, and the component can override this method to process it in any way it needs to.
Reimplemented from juce::Component.
|
staticprivate |
|
overrideprivatevirtual |
This can be overridden to react to the user clicking on a row.
Reimplemented from juce::ListBoxModel.
|
overridevirtual |
Called to let the component react to a change in the look-and-feel setting.
When the look-and-feel is changed for a component, this will be called in all its child components, recursively.
It can also be triggered manually by the sendLookAndFeelChange() method, in case an application uses a LookAndFeel class that might have changed internally.
Reimplemented from juce::Component.
|
overrideprivatevirtual |
This callback is made when items are changed in the menu bar model.
Implements juce::MenuBarModel::Listener.
|
overrideprivatevirtual |
This callback is made when an application command is invoked that is represented by one of the items in the menu bar model.
Implements juce::MenuBarModel::Listener.
|
overrideprivatevirtual |
Called when a mouse button is released.
A mouseUp callback is sent to the component in which a button was pressed even if the mouse is actually over a different component when the button is released.
The MouseEvent object passed in contains lots of methods for finding out which buttons were down just before they were released.
| Event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from juce::MouseListener.
Components can override this method to draw their content.
The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.
Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.
If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In JUCE (and almost all modern UI frameworks), you never redraw something synchronously.
You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().
| g | the graphics context that must be used to do the drawing operations. |
Reimplemented from juce::Component.
|
overrideprivatevirtual |
This method must be implemented to draw a row of the list. Note that the rowNumber value may be greater than the number of rows in your list, so be careful that you don't assume it's less than getNumRows().
Implements juce::ListBoxModel.
|
private |
|
overrideprivatevirtual |
This is used to create or update a custom component to go in a row of the list.
Any row may contain a custom component, or can just be drawn with the paintListBoxItem() method and handle mouse clicks with listBoxItemClicked().
This method will be called whenever a custom component might need to be updated - e.g. when the list is changed, or ListBox::updateContent() is called.
If you don't need a custom component for the specified row, then return nullptr. (Bear in mind that even if you're not creating a new component, you may still need to delete existingComponentToUpdate if it's non-null).
If you do want a custom component, and the existingComponentToUpdate is null, then this method must create a suitable new component and return it.
If the existingComponentToUpdate is non-null, it will be a pointer to a component previously created by this method. In this case, the method must either update it to make sure it's correctly representing the given row (which may be different from the one that the component was created for), or it can delete this component and return a new one.
The component that your method returns will be deleted by the ListBox when it is no longer needed.
Bear in mind that if you put a custom component inside the row but still want the listbox to automatically handle clicking, selection, etc, then you'll need to make sure your custom component doesn't intercept all the mouse events that land on it, e.g by using Component::setInterceptsMouseClicks().
Reimplemented from juce::ListBoxModel.
|
overrideprivatevirtual |
Called when this component's size has been changed.
A component can implement this method to do things such as laying out its child components when its width or height changes.
The method is called synchronously as a result of the setBounds or setSize methods, so repeatedly changing a components size will repeatedly call its resized method (unlike things like repainting, where multiple calls to repaint are coalesced together).
If the component is a top-level window on the desktop, its size could also be changed by operating-system factors beyond the application's control.
Reimplemented from juce::Component.
| void juce::BurgerMenuComponent::setModel | ( | MenuBarModel * | newModel | ) |
Changes the model object to use to control the burger menu.
This can be a nullptr, in which case the bar will be empty. This object will not be owned by the BurgerMenuComponent so it is up to you to manage its lifetime. Don't delete the object that is passed-in while it's still being used by this MenuBar. Any submenus in your MenuBarModel will be recursively flattened and added to the top-level burger menu section.
|
private |
|
private |
|
private |
|
private |
|
private |