JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::PopupMenu::MenuItemIterator Class Reference

Allows you to iterate through the items in a pop-up menu, and examine their properties. More...

#include <juce_PopupMenu.h>

Collaboration diagram for juce::PopupMenu::MenuItemIterator:

Public Member Functions

 MenuItemIterator (const PopupMenu &menu, bool searchRecursively=false)
 Creates an iterator that will scan through the items in the specified menu. More...
 
 ~MenuItemIterator ()
 Destructor. More...
 
ItemgetItem () const
 Returns a reference to the description of the current item. More...
 
bool next ()
 Returns true if there is another item, and sets up all this object's member variables to reflect that item's properties. More...
 

Private Member Functions

MenuItemIteratoroperator= (const MenuItemIterator &)
 

Private Attributes

PopupMenu::ItemcurrentItem = nullptr
 
Array< intindex
 
Array< const PopupMenu * > menus
 
bool searchRecursively
 

Detailed Description

Allows you to iterate through the items in a pop-up menu, and examine their properties.

To use this, just create one and repeatedly call its next() method. When this returns true, all the member variables of the iterator are filled-out with information describing the menu item. When it returns false, the end of the list has been reached.

Constructor & Destructor Documentation

◆ MenuItemIterator()

juce::PopupMenu::MenuItemIterator::MenuItemIterator ( const PopupMenu menu,
bool  searchRecursively = false 
)

Creates an iterator that will scan through the items in the specified menu.

Be careful not to add any items to a menu while it is being iterated, or things could get out of step.

Parameters
menuthe menu that needs to be scanned
searchRecursivelyif true, all submenus will be recursed into to do an exhaustive search

◆ ~MenuItemIterator()

juce::PopupMenu::MenuItemIterator::~MenuItemIterator ( )

Destructor.

Member Function Documentation

◆ getItem()

Item& juce::PopupMenu::MenuItemIterator::getItem ( ) const

Returns a reference to the description of the current item.

It is only valid to call this after next() has returned true!

◆ next()

bool juce::PopupMenu::MenuItemIterator::next ( )

Returns true if there is another item, and sets up all this object's member variables to reflect that item's properties.

◆ operator=()

MenuItemIterator& juce::PopupMenu::MenuItemIterator::operator= ( const MenuItemIterator )
private

Member Data Documentation

◆ currentItem

PopupMenu::Item* juce::PopupMenu::MenuItemIterator::currentItem = nullptr
private

◆ index

Array<int> juce::PopupMenu::MenuItemIterator::index
private

◆ menus

Array<const PopupMenu*> juce::PopupMenu::MenuItemIterator::menus
private

◆ searchRecursively

bool juce::PopupMenu::MenuItemIterator::searchRecursively
private

The documentation for this class was generated from the following file: