71 void setEditableText (
bool isEditable);
76 bool isTextEditable()
const noexcept;
99 void addItem (
const String& newItemText,
int newItemId);
104 void addItemList (
const StringArray& items,
int firstItemIdOffset);
121 void addSectionHeading (
const String& headingName);
131 void setItemEnabled (
int itemId,
bool shouldBeEnabled);
134 bool isItemEnabled (
int itemId)
const noexcept;
138 void changeItemText (
int itemId,
const String& newText);
153 int getNumItems()
const noexcept;
159 String getItemText (
int index)
const;
165 int getItemId (
int index)
const noexcept;
170 int indexOfItemId (
int itemId)
const noexcept;
181 int getSelectedId()
const noexcept;
200 void setSelectedId (
int newItemId,
212 int getSelectedItemIndex()
const;
224 void setSelectedItemIndex (
int newItemIndex,
250 void setText (
const String& newText,
264 virtual void showPopup();
300 void addListener (
Listener* listener);
303 void removeListener (
Listener* listener);
313 void setTextWhenNothingSelected (
const String& newMessage);
318 String getTextWhenNothingSelected()
const;
326 void setTextWhenNoChoicesAvailable (
const String& newMessage);
331 String getTextWhenNoChoicesAvailable()
const;
335 void setTooltip (
const String& newTooltip)
override;
341 void setScrollWheelEnabled (
bool enabled)
noexcept;
356 backgroundColourId = 0x1000b00,
357 textColourId = 0x1000a00,
358 outlineColourId = 0x1000c00,
359 buttonColourId = 0x1000d00,
360 arrowColourId = 0x1000e00,
361 focusedOutlineColourId = 0x1000f00
372 virtual void drawComboBox (
Graphics&,
int width,
int height,
bool isButtonDown,
373 int buttonX,
int buttonY,
int buttonW,
int buttonH,
380 virtual void positionComboBoxText (
ComboBox&,
Label& labelToPosition) = 0;
389 void enablementChanged()
override;
391 void colourChanged()
override;
397 void handleAsyncUpdate()
override;
409 void lookAndFeelChanged()
override;
413 void resized()
override;
415 bool keyStateChanged (
bool)
override;
417 bool keyPressed (
const KeyPress&)
override;
421 void parentHierarchyChanged()
override;
428 [[deprecated]]
void clear (
bool);
429 [[deprecated]]
void setSelectedId (
int,
bool);
430 [[deprecated]]
void setSelectedItemIndex (
int,
bool);
431 [[deprecated]]
void setText (
const String&,
bool);
443 PopupMenu currentMenu;
445 int lastCurrentId = 0;
446 bool isButtonDown =
false, menuActive =
false, scrollWheelEnabled =
false;
447 float mouseWheelAccumulator = 0;
448 ListenerList<Listener> listeners;
450 String textWhenNothingSelected, noChoicesMessage;
451 EditableState labelEditableState = editableUnknown;
453 PopupMenu::Item* getItemForId (
int)
const noexcept;
454 PopupMenu::Item* getItemForIndex (
int)
const noexcept;
455 bool selectIfEnabled (
int index);
456 bool nudgeSelectedItem (
int delta);
457 void sendChange (NotificationType);
458 void showPopupIfNotActive();
Has a callback method that is triggered asynchronously.
A class for receiving events from a ComboBox.
virtual ~Listener()=default
Destructor.
virtual void comboBoxChanged(ComboBox *comboBoxThatHasChanged)=0
Called when a ComboBox has its selected item changed.
A component that lets the user choose from a drop-down list of choices.
ColourIds
A set of colour IDs to use to change the colour of various aspects of the combo box.
bool isPopupActive() const noexcept
Returns true if the popup menu is currently being shown.
const PopupMenu * getRootMenu() const noexcept
Returns the PopupMenu object associated with the ComboBox.
Value & getSelectedIdAsValue()
Returns a Value object that can be used to get or set the selected item's ID.
std::function< void()> onChange
You can assign a lambda to this callback object to have it called when the selected ID is changed.
String getTooltip() override
Returns the string that this object wants to show as its tooltip.
PopupMenu * getRootMenu() noexcept
Returns the PopupMenu object associated with the ComboBox.
The base class for all JUCE user-interface objects.
FocusChangeType
Enumeration used by the focusGained() and focusLost() methods.
Represents a particular font, including its size, style, etc.
A graphics context, used for drawing a component or image.
Represents a type of justification to be used when positioning graphical items.
Represents a key press, including any modifier keys that are needed.
A component that displays a text string, and can optionally become a text editor when clicked.
Contains position and status information about a mouse event.
A special array for holding a list of strings.
Receives callbacks when a Value object changes.
Represents a shared variant value.
@ valueChanged
Indicates that the UI element's value has changed.
NotificationType
These enums are used in various classes to indicate whether a notification event should be sent out.
@ sendNotificationAsync
Requests an asynchronous notification.
Contains status information about a mouse wheel event.
This abstract base class is implemented by LookAndFeel classes to provide ComboBox functionality.