40 jassert (newComponent !=
nullptr);
42 if (newComponent !=
custom)
67 listBox.addMouseListener (
this,
true);
76 model->removeListener (
this);
81 if (newModel !=
model)
84 model->removeListener (
this);
89 model->addListener (
this);
107 if (
model !=
nullptr)
109 auto menuBarNames =
model->getMenuBarNames();
111 for (
auto menuIdx = 0; menuIdx < menuBarNames.size(); ++menuIdx)
114 menuItem.text = menuBarNames[menuIdx];
117 auto menu =
model->getMenuForIndex (menuIdx,
ignore);
129 auto& item = it.getItem();
131 if (item.isSeparator)
137 rows.add (
Row {
false, menuIdx, it.getItem()});
156 auto row = (rowIndex <
rows.size() ?
rows.getReference (rowIndex)
157 :
Row { true, 0, {} });
161 if (
row.isMenuHeader)
163 lf.drawPopupMenuSectionHeader (
g,
r.reduced (20, 0),
row.item.text);
165 g.fillRect (
r.withHeight (1));
169 auto& item = row.item;
170 auto* colour = item.colour != Colour() ? &item.colour :
nullptr;
172 if (item.customComponent ==
nullptr)
173 lf.drawPopupMenuItem (
g,
r.reduced (20, 0),
180 item.shortcutKeyDescription,
193 auto row = rowIndex <
rows.size() ?
rows.getReference (rowIndex)
194 :
Row {
true, 0, {} };
196 if (!
row.isMenuHeader)
205 auto row = rowIndex <
rows.size() ?
rows.getReference (rowIndex)
206 :
Row {
true, 0, {} };
208 auto hasCustomComponent = (
row.item.customComponent !=
nullptr);
210 if (
existing ==
nullptr && hasCustomComponent)
216 jassert (componentToUpdate !=
nullptr);
218 if (hasCustomComponent && componentToUpdate !=
nullptr)
220 row.item.customComponent->setHighlighted (isRowSelected);
221 componentToUpdate->update (
row.item.customComponent);
249 auto rowIndex =
listBox.getSelectedRow();
254 auto&
row =
rows.getReference (rowIndex);
256 if (!
row.isMenuHeader)
264 auto& item =
row.item;
266 if (
auto* managerOfChosenCommand = item.commandManager)
271 managerOfChosenCommand->invoke (
info,
true);
281 if (
model !=
nullptr)
#define noexcept
Definition DistrhoDefines.h:72
void setInterceptsMouseClicks(bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
Definition juce_Component.cpp:1420
int getHeight() const noexcept
Definition juce_Component.h:274
void addAndMakeVisible(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1554
void postCommandMessage(int commandId)
Definition juce_Component.cpp:2361
Component() noexcept
Definition juce_Component.cpp:517
void removeChildComponent(Component *childToRemove)
Definition juce_Component.cpp:1569
int getWidth() const noexcept
Definition juce_Component.h:271
LookAndFeel & getLookAndFeel() const noexcept
Definition juce_Component.cpp:2173
Rectangle< int > getLocalBounds() const noexcept
Definition juce_Component.cpp:2283
Definition juce_GraphicsContext.h:45
Definition juce_MouseEvent.h:39
MouseInputSource source
Definition juce_MouseEvent.h:191
Definition juce_Rectangle.h:67
Definition juce_ReferenceCountedObject.h:247
Definition juce_String.h:53
* e
Definition inflate.c:1404
UINT_D64 w
Definition inflate.c:942
int g
Definition inflate.c:1573
static bool ignore
Definition pugl.h:1696
struct backing_store_struct * info
Definition jmemsys.h:183
const Colour grey
Definition juce_Colours.h:93
Definition carla_juce.cpp:31
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
@ menuItem
Definition juce_AccessibilityRole.h:47
@ menuBar
Definition juce_AccessibilityRole.h:48
@ row
Definition juce_AccessibilityRole.h:53
Definition juce_ApplicationCommandTarget.h:61
@ fromMenu
Definition juce_ApplicationCommandTarget.h:80
int r
Definition crypt.c:458
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
existing
Definition fileio.c:1978
#define const
Definition zconf.h:137