LMMS
Loading...
Searching...
No Matches
juce_Toolbar.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29const char* const Toolbar::toolbarDragDescriptor = "_toolbarItem_";
30
31//==============================================================================
33{
34public:
35 Spacer (int itemID, float sizeToUse, bool shouldDrawBar)
36 : ToolbarItemComponent (itemID, {}, false),
37 fixedSize (sizeToUse),
38 drawBar (shouldDrawBar)
39 {
41 }
42
43 bool getToolbarItemSizes (int toolbarThickness, bool /*isToolbarVertical*/,
44 int& preferredSize, int& minSize, int& maxSize) override
45 {
46 if (fixedSize <= 0)
47 {
48 preferredSize = toolbarThickness * 2;
49 minSize = 4;
50 maxSize = 32768;
51 }
52 else
53 {
54 maxSize = roundToInt ((float) toolbarThickness * fixedSize);
55 minSize = drawBar ? maxSize : jmin (4, maxSize);
56 preferredSize = maxSize;
57
59 preferredSize = maxSize = toolbarThickness / (drawBar ? 3 : 2);
60 }
61
62 return true;
63 }
64
65 void paintButtonArea (Graphics&, int, int, bool, bool) override
66 {
67 }
68
69 void contentAreaChanged (const Rectangle<int>&) override
70 {
71 }
72
74 {
75 return fixedSize <= 0 ? 0 : 1;
76 }
77
78 void paint (Graphics& g) override
79 {
80 auto w = getWidth();
81 auto h = getHeight();
82
83 if (drawBar)
84 {
85 g.setColour (findColour (Toolbar::separatorColourId, true));
86
87 auto thickness = 0.2f;
88
90 g.fillRect ((float) w * 0.1f, (float) h * (0.5f - thickness * 0.5f), (float) w * 0.8f, (float) h * thickness);
91 else
92 g.fillRect ((float) w * (0.5f - thickness * 0.5f), (float) h * 0.1f, (float) w * thickness, (float) h * 0.8f);
93 }
94
95 if (getEditingMode() != normalMode && ! drawBar)
96 {
97 g.setColour (findColour (Toolbar::separatorColourId, true));
98
99 auto indentX = jmin (2, (w - 3) / 2);
100 auto indentY = jmin (2, (h - 3) / 2);
101 g.drawRect (indentX, indentY, w - indentX * 2, h - indentY * 2, 1);
102
103 if (fixedSize <= 0)
104 {
105 float x1, y1, x2, y2, x3, y3, x4, y4, hw, hl;
106
107 if (isToolbarVertical())
108 {
109 x1 = (float) w * 0.5f;
110 y1 = (float) h * 0.4f;
111 x2 = x1;
112 y2 = (float) indentX * 2.0f;
113
114 x3 = x1;
115 y3 = (float) h * 0.6f;
116 x4 = x1;
117 y4 = (float) h - y2;
118
119 hw = (float) w * 0.15f;
120 hl = (float) w * 0.2f;
121 }
122 else
123 {
124 x1 = (float) w * 0.4f;
125 y1 = (float) h * 0.5f;
126 x2 = (float) indentX * 2.0f;
127 y2 = y1;
128
129 x3 = (float) w * 0.6f;
130 y3 = y1;
131 x4 = (float) w - x2;
132 y4 = y1;
133
134 hw = (float) h * 0.15f;
135 hl = (float) h * 0.2f;
136 }
137
138 Path p;
139 p.addArrow ({ x1, y1, x2, y2 }, 1.5f, hw, hl);
140 p.addArrow ({ x3, y3, x4, y4 }, 1.5f, hw, hl);
141 g.fillPath (p);
142 }
143 }
144 }
145
146private:
147 const float fixedSize;
148 const bool drawBar;
149
151};
152
153//==============================================================================
155{
156public:
159 owner (&bar),
160 height (h)
161 {
162 for (int i = bar.items.size(); --i >= 0;)
163 {
164 auto* tc = bar.items.getUnchecked(i);
165
166 if (tc != nullptr && dynamic_cast<Spacer*> (tc) == nullptr && ! tc->isVisible())
167 {
168 oldIndexes.insert (0, i);
169 addAndMakeVisible (tc, 0);
170 }
171 }
172
173 layout (400);
174 }
175
177 {
178 if (owner != nullptr)
179 {
180 for (int i = 0; i < getNumChildComponents(); ++i)
181 {
182 if (auto* tc = dynamic_cast<ToolbarItemComponent*> (getChildComponent (i)))
183 {
184 tc->setVisible (false);
185 auto index = oldIndexes.removeAndReturn (i);
186 owner->addChildComponent (tc, index);
187 --i;
188 }
189 }
190
191 owner->resized();
192 }
193 }
194
195 void layout (const int preferredWidth)
196 {
197 const int indent = 8;
198 auto x = indent;
199 auto y = indent;
200 int maxX = 0;
201
202 for (auto* c : getChildren())
203 {
204 if (auto* tc = dynamic_cast<ToolbarItemComponent*> (c))
205 {
206 int preferredSize = 1, minSize = 1, maxSize = 1;
207
208 if (tc->getToolbarItemSizes (height, false, preferredSize, minSize, maxSize))
209 {
210 if (x + preferredSize > preferredWidth && x > indent)
211 {
212 x = indent;
213 y += height;
214 }
215
216 tc->setBounds (x, y, preferredSize, height);
217
218 x += preferredSize;
219 maxX = jmax (maxX, x);
220 }
221 }
222 }
223
224 setSize (maxX + 8, y + height + 8);
225 }
226
227 void getIdealSize (int& idealWidth, int& idealHeight) override
228 {
229 idealWidth = getWidth();
230 idealHeight = getHeight();
231 }
232
233private:
235 const int height;
237
239};
240
241
242//==============================================================================
248
250{
251 items.clear();
252}
253
254void Toolbar::setVertical (const bool shouldBeVertical)
255{
256 if (vertical != shouldBeVertical)
257 {
258 vertical = shouldBeVertical;
259 resized();
260 }
261}
262
264{
265 items.clear();
266 resized();
267}
268
270{
271 if (itemId == ToolbarItemFactory::separatorBarId) return new Spacer (itemId, 0.1f, true);
272 if (itemId == ToolbarItemFactory::spacerId) return new Spacer (itemId, 0.5f, false);
273 if (itemId == ToolbarItemFactory::flexibleSpacerId) return new Spacer (itemId, 0.0f, false);
274
275 return factory.createItem (itemId);
276}
277
279 const int itemId,
280 const int insertIndex)
281{
282 // An ID can't be zero - this might indicate a mistake somewhere?
283 jassert (itemId != 0);
284
285 if (auto* tc = createItem (factory, itemId))
286 {
287 #if JUCE_DEBUG
288 Array<int> allowedIds;
289 factory.getAllToolbarItemIds (allowedIds);
290
291 // If your factory can create an item for a given ID, it must also return
292 // that ID from its getAllToolbarItemIds() method!
293 jassert (allowedIds.contains (itemId));
294 #endif
295
296 items.insert (insertIndex, tc);
297 addAndMakeVisible (tc, insertIndex);
298 }
299}
300
301void Toolbar::addItem (ToolbarItemFactory& factory, int itemId, int insertIndex)
302{
303 addItemInternal (factory, itemId, insertIndex);
304 resized();
305}
306
308{
309 Array<int> ids;
310 factoryToUse.getDefaultItemSet (ids);
311
312 clear();
313
314 for (auto i : ids)
315 addItemInternal (factoryToUse, i, -1);
316
317 resized();
318}
319
320void Toolbar::removeToolbarItem (const int itemIndex)
321{
322 items.remove (itemIndex);
323 resized();
324}
325
327{
328 if (auto* tc = items.removeAndReturn (itemIndex))
329 {
331 resized();
332 return tc;
333 }
334
335 return nullptr;
336}
337
339{
340 return items.size();
341}
342
343int Toolbar::getItemId (const int itemIndex) const noexcept
344{
345 if (auto* tc = getItemComponent (itemIndex))
346 return tc->getItemId();
347
348 return 0;
349}
350
351ToolbarItemComponent* Toolbar::getItemComponent (const int itemIndex) const noexcept
352{
353 return items[itemIndex];
354}
355
356ToolbarItemComponent* Toolbar::getNextActiveComponent (int index, const int delta) const
357{
358 for (;;)
359 {
360 index += delta;
361
362 if (auto* tc = getItemComponent (index))
363 {
364 if (tc->isActive)
365 return tc;
366 }
367 else
368 {
369 return nullptr;
370 }
371 }
372}
373
375{
376 if (toolbarStyle != newStyle)
377 {
378 toolbarStyle = newStyle;
380 }
381}
382
384{
385 String s ("TB:");
386
387 for (int i = 0; i < getNumItems(); ++i)
388 s << getItemId(i) << ' ';
389
390 return s.trimEnd();
391}
392
394 const String& savedVersion)
395{
396 if (! savedVersion.startsWith ("TB:"))
397 return false;
398
399 StringArray tokens;
400 tokens.addTokens (savedVersion.substring (3), false);
401
402 clear();
403
404 for (auto& t : tokens)
405 addItemInternal (factoryToUse, t.getIntValue(), -1);
406
407 resized();
408 return true;
409}
410
412{
413 getLookAndFeel().paintToolbarBackground (g, getWidth(), getHeight(), *this);
414}
415
417{
418 return vertical ? getWidth() : getHeight();
419}
420
422{
423 return vertical ? getHeight() : getWidth();
424}
425
426void Toolbar::setEditingActive (const bool active)
427{
428 if (isEditingActive != active)
429 {
430 isEditingActive = active;
432 }
433}
434
435//==============================================================================
437{
439}
440
442{
443 if (getWidth() > 0 && getHeight() > 0)
444 {
446
447 for (auto* tc : items)
448 {
451
452 tc->setStyle (toolbarStyle);
453
454 auto* spacer = dynamic_cast<Spacer*> (tc);
455
456 int preferredSize = 1, minSize = 1, maxSize = 1;
457
458 if (tc->getToolbarItemSizes (getThickness(), isVertical(),
459 preferredSize, minSize, maxSize))
460 {
461 tc->isActive = true;
462 resizer.addItem (preferredSize, minSize, maxSize,
463 spacer != nullptr ? spacer->getResizeOrder() : 2);
464 }
465 else
466 {
467 tc->isActive = false;
468 tc->setVisible (false);
469 }
470 }
471
472 resizer.resizeToFit (getLength());
473
474 int totalLength = 0;
475
476 for (int i = 0; i < resizer.getNumItems(); ++i)
477 totalLength += (int) resizer.getItemSize (i);
478
479 const bool itemsOffTheEnd = totalLength > getLength();
480
481 auto extrasButtonSize = getThickness() / 2;
482 missingItemsButton->setSize (extrasButtonSize, extrasButtonSize);
483 missingItemsButton->setVisible (itemsOffTheEnd);
484 missingItemsButton->setEnabled (! isEditingActive);
485
486 if (vertical)
487 missingItemsButton->setCentrePosition (getWidth() / 2,
488 getHeight() - 4 - extrasButtonSize / 2);
489 else
490 missingItemsButton->setCentrePosition (getWidth() - 4 - extrasButtonSize / 2,
491 getHeight() / 2);
492
493 auto maxLength = itemsOffTheEnd ? (vertical ? missingItemsButton->getY()
494 : missingItemsButton->getX()) - 4
495 : getLength();
496
497 int pos = 0, activeIndex = 0;
498
499 for (auto* tc : items)
500 {
501 if (tc->isActive)
502 {
503 auto size = (int) resizer.getItemSize (activeIndex++);
504
505 Rectangle<int> newBounds;
506
507 if (vertical)
508 newBounds.setBounds (0, pos, getWidth(), size);
509 else
510 newBounds.setBounds (pos, 0, size, getHeight());
511
512 auto& animator = Desktop::getInstance().getAnimator();
513
514 if (animate)
515 {
516 animator.animateComponent (tc, newBounds, 1.0f, 200, false, 3.0, 0.0);
517 }
518 else
519 {
520 animator.cancelAnimation (tc, false);
521 tc->setBounds (newBounds);
522 }
523
524 pos += size;
525 tc->setVisible (pos <= maxLength
526 && ((! tc->isBeingDragged)
527 || tc->getEditingMode() == ToolbarItemComponent::editableOnPalette));
528 }
529 }
530 }
531}
532
533//==============================================================================
535{
536 if (missingItemsButton == nullptr)
537 return;
538
540 missingItemsButton->setAlwaysOnTop (true);
541 missingItemsButton->onClick = [this] { showMissingItems(); };
542}
543
545{
546 jassert (missingItemsButton->isShowing());
547
548 if (missingItemsButton->isShowing())
549 {
550 PopupMenu m;
551 auto comp = std::make_unique<MissingItemsComponent> (*this, getThickness());
552 m.addCustomItem (1, std::move (comp), nullptr, TRANS ("Additional Items"));
553 m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton.get()));
554 }
555}
556
557//==============================================================================
559{
560 return dragSourceDetails.description == toolbarDragDescriptor && isEditingActive;
561}
562
563void Toolbar::itemDragMove (const SourceDetails& dragSourceDetails)
564{
565 if (auto* tc = dynamic_cast<ToolbarItemComponent*> (dragSourceDetails.sourceComponent.get()))
566 {
567 if (! items.contains (tc))
568 {
569 if (tc->getEditingMode() == ToolbarItemComponent::editableOnPalette)
570 {
571 if (auto* palette = tc->findParentComponentOfClass<ToolbarItemPalette>())
572 palette->replaceComponent (*tc);
573 }
574 else
575 {
576 jassert (tc->getEditingMode() == ToolbarItemComponent::editableOnToolbar);
577 }
578
579 items.add (tc);
582 }
583
584 auto& animator = Desktop::getInstance().getAnimator();
585
586 for (int i = getNumItems(); --i >= 0;)
587 {
588 auto currentIndex = items.indexOf (tc);
589 auto newIndex = currentIndex;
590
591 auto dragObjectLeft = vertical ? (dragSourceDetails.localPosition.getY() - tc->dragOffsetY)
592 : (dragSourceDetails.localPosition.getX() - tc->dragOffsetX);
593 auto dragObjectRight = dragObjectLeft + (vertical ? tc->getHeight() : tc->getWidth());
594
595 auto current = animator.getComponentDestination (getChildComponent (newIndex));
596
597 if (auto* prev = getNextActiveComponent (newIndex, -1))
598 {
599 auto previousPos = animator.getComponentDestination (prev);
600
601 if (std::abs (dragObjectLeft - (vertical ? previousPos.getY() : previousPos.getX()))
602 < std::abs (dragObjectRight - (vertical ? current.getBottom() : current.getRight())))
603 {
604 newIndex = getIndexOfChildComponent (prev);
605 }
606 }
607
608 if (auto* next = getNextActiveComponent (newIndex, 1))
609 {
610 auto nextPos = animator.getComponentDestination (next);
611
612 if (std::abs (dragObjectLeft - (vertical ? current.getY() : current.getX()))
613 > std::abs (dragObjectRight - (vertical ? nextPos.getBottom() : nextPos.getRight())))
614 {
615 newIndex = getIndexOfChildComponent (next) + 1;
616 }
617 }
618
619 if (newIndex == currentIndex)
620 break;
621
622 items.removeObject (tc, false);
624 addChildComponent (tc, newIndex);
625 items.insert (newIndex, tc);
627 }
628 }
629}
630
631void Toolbar::itemDragExit (const SourceDetails& dragSourceDetails)
632{
633 if (auto* tc = dynamic_cast<ToolbarItemComponent*> (dragSourceDetails.sourceComponent.get()))
634 {
635 if (isParentOf (tc))
636 {
637 items.removeObject (tc, false);
640 }
641 }
642}
643
644void Toolbar::itemDropped (const SourceDetails& dragSourceDetails)
645{
646 if (auto* tc = dynamic_cast<ToolbarItemComponent*> (dragSourceDetails.sourceComponent.get()))
647 tc->setState (Button::buttonNormal);
648}
649
651{
652 missingItemsButton.reset (getLookAndFeel().createToolbarMissingItemsButton (*this));
654}
655
657
658//==============================================================================
660{
661public:
662 CustomisationDialog (ToolbarItemFactory& factory, Toolbar& bar, int optionFlags)
663 : DialogWindow (TRANS("Add/remove items from toolbar"), Colours::white, true, true),
664 toolbar (bar)
665 {
666 setContentOwned (new CustomiserPanel (factory, toolbar, optionFlags), true);
667 setResizable (true, true);
668 setResizeLimits (400, 300, 1500, 1000);
670 }
671
673 {
674 toolbar.setEditingActive (false);
675 }
676
677 void closeButtonPressed() override
678 {
679 setVisible (false);
680 }
681
683 {
684 return toolbar.isParentOf (comp)
685 || dynamic_cast<const ToolbarItemComponent::ItemDragAndDropOverlayComponent*> (comp) != nullptr;
686 }
687
689 {
690 auto screenSize = toolbar.getParentMonitorArea();
691 auto pos = toolbar.getScreenPosition();
692 const int gap = 8;
693
694 if (toolbar.isVertical())
695 {
696 if (pos.x > screenSize.getCentreX())
697 pos.x -= getWidth() - gap;
698 else
699 pos.x += toolbar.getWidth() + gap;
700 }
701 else
702 {
703 pos.x += (toolbar.getWidth() - getWidth()) / 2;
704
705 if (pos.y > screenSize.getCentreY())
706 pos.y -= getHeight() - gap;
707 else
708 pos.y += toolbar.getHeight() + gap;
709 }
710
711 setTopLeftPosition (pos);
712 }
713
714private:
716
718 {
719 public:
720 CustomiserPanel (ToolbarItemFactory& tbf, Toolbar& bar, int optionFlags)
721 : factory (tbf), toolbar (bar), palette (tbf, bar),
722 instructions ({}, TRANS ("You can drag the items above and drop them onto a toolbar to add them.")
723 + "\n\n"
724 + TRANS ("Items on the toolbar can also be dragged around to change their order, or dragged off the edge to delete them.")),
725 defaultButton (TRANS ("Restore to default set of items"))
726 {
727 addAndMakeVisible (palette);
728
729 if ((optionFlags & (Toolbar::allowIconsOnlyChoice
732 {
733 addAndMakeVisible (styleBox);
734 styleBox.setEditableText (false);
735
736 if ((optionFlags & Toolbar::allowIconsOnlyChoice) != 0) styleBox.addItem (TRANS("Show icons only"), 1);
737 if ((optionFlags & Toolbar::allowIconsWithTextChoice) != 0) styleBox.addItem (TRANS("Show icons and descriptions"), 2);
738 if ((optionFlags & Toolbar::allowTextOnlyChoice) != 0) styleBox.addItem (TRANS("Show descriptions only"), 3);
739
740 int selectedStyle = 0;
741 switch (bar.getStyle())
742 {
743 case Toolbar::iconsOnly: selectedStyle = 1; break;
744 case Toolbar::iconsWithText: selectedStyle = 2; break;
745 case Toolbar::textOnly: selectedStyle = 3; break;
746 default: break;
747 }
748
749 styleBox.setSelectedId (selectedStyle);
750
751 styleBox.onChange = [this] { updateStyle(); };
752 }
753
754 if ((optionFlags & Toolbar::showResetToDefaultsButton) != 0)
755 {
756 addAndMakeVisible (defaultButton);
757 defaultButton.onClick = [this] { toolbar.addDefaultItems (factory); };
758 }
759
760 addAndMakeVisible (instructions);
761 instructions.setFont (Font (13.0f));
762
763 setSize (500, 300);
764 }
765
767 {
768 switch (styleBox.getSelectedId())
769 {
770 case 1: toolbar.setStyle (Toolbar::iconsOnly); break;
771 case 2: toolbar.setStyle (Toolbar::iconsWithText); break;
772 case 3: toolbar.setStyle (Toolbar::textOnly); break;
773 default: break;
774 }
775
776 palette.resized(); // to make it update the styles
777 }
778
779 void paint (Graphics& g) override
780 {
781 Colour background;
782
784 background = dw->getBackgroundColour();
785
786 g.setColour (background.contrasting().withAlpha (0.3f));
787 g.fillRect (palette.getX(), palette.getBottom() - 1, palette.getWidth(), 1);
788 }
789
790 void resized() override
791 {
792 palette.setBounds (0, 0, getWidth(), getHeight() - 120);
793 styleBox.setBounds (10, getHeight() - 110, 200, 22);
794
795 defaultButton.changeWidthToFitText (22);
796 defaultButton.setTopLeftPosition (240, getHeight() - 110);
797
798 instructions.setBounds (10, getHeight() - 80, getWidth() - 20, 80);
799 }
800
801 private:
804
809 };
810};
811
812void Toolbar::showCustomisationDialog (ToolbarItemFactory& factory, const int optionFlags)
813{
814 setEditingActive (true);
815
816 (new CustomisationDialog (factory, *this, optionFlags))
817 ->enterModalState (true, nullptr, true);
818}
819
820//==============================================================================
821std::unique_ptr<AccessibilityHandler> Toolbar::createAccessibilityHandler()
822{
823 return std::make_unique<AccessibilityHandler> (*this, AccessibilityRole::group);
824}
825
826} // namespace juce
Type jmin(const Type a, const Type b)
Definition MathsFunctions.h:60
Type jmax(const Type a, const Type b)
Definition MathsFunctions.h:48
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_Array.h:56
bool contains(ParameterType elementToLookFor) const
Definition juce_Array.h:400
@ buttonNormal
Definition juce_Button.h:369
Definition juce_Colour.h:38
Colour withAlpha(uint8 newAlpha) const noexcept
Definition juce_Colour.cpp:317
JUCE_NODISCARD Colour contrasting(float amount=1.0f) const noexcept
Definition juce_Colour.cpp:491
Definition juce_ComboBox.h:49
Definition juce_Component.h:2287
Definition juce_Component.h:36
int getNumChildComponents() const noexcept
Definition juce_Component.cpp:1643
int getIndexOfChildComponent(const Component *child) const noexcept
Definition juce_Component.cpp:1653
int getHeight() const noexcept
Definition juce_Component.h:274
void addAndMakeVisible(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1554
Component() noexcept
Definition juce_Component.cpp:517
void removeChildComponent(Component *childToRemove)
Definition juce_Component.cpp:1569
Component * getChildComponent(int index) const noexcept
Definition juce_Component.cpp:1648
bool isParentOf(const Component *possibleChild) const noexcept
Definition juce_Component.cpp:1677
void setSize(int newWidth, int newHeight)
Definition juce_Component.cpp:1262
TargetClass * findParentComponentOfClass() const
Definition juce_Component.h:813
void enterModalState(bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false)
Definition juce_Component.cpp:1764
void setWantsKeyboardFocus(bool wantsFocus) noexcept
Definition juce_Component.cpp:2842
Colour findColour(int colourID, bool inheritFromParent=false) const
Definition juce_Component.cpp:2219
int getWidth() const noexcept
Definition juce_Component.h:271
LookAndFeel & getLookAndFeel() const noexcept
Definition juce_Component.cpp:2173
void setTopLeftPosition(int x, int y)
Definition juce_Component.cpp:1264
void addChildComponent(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1548
const Array< Component * > & getChildren() const noexcept
Definition juce_Component.h:685
virtual void setVisible(bool shouldBeVisible)
Definition juce_Component.cpp:575
static Desktop &JUCE_CALLTYPE getInstance()
Definition juce_Desktop.cpp:50
DialogWindow(const String &name, Colour backgroundColour, bool escapeKeyTriggersCloseButton, bool addToDesktop=true, float desktopScale=1.0f)
Definition juce_DialogWindow.cpp:29
Definition juce_DragAndDropTarget.h:54
Point< int > localPosition
Definition juce_DragAndDropTarget.h:70
WeakReference< Component > sourceComponent
Definition juce_DragAndDropTarget.h:65
var description
Definition juce_DragAndDropTarget.h:62
Definition juce_GraphicsContext.h:45
Definition juce_Label.h:41
Definition juce_MouseEvent.h:39
Definition juce_Path.h:65
constexpr ValueType getX() const noexcept
Definition juce_Point.h:67
constexpr ValueType getY() const noexcept
Definition juce_Point.h:70
Definition juce_PopupMenu.h:829
friend PopupMenu
Definition juce_PopupMenu.h:885
CustomComponent()
Definition juce_PopupMenu.cpp:2270
Definition juce_PopupMenu.h:457
Definition juce_PopupMenu.h:80
Definition juce_Rectangle.h:67
void setBounds(ValueType newX, ValueType newY, ValueType newWidth, ValueType newHeight) noexcept
Definition juce_Rectangle.h:191
void setResizable(bool shouldBeResizable, bool useBottomRightCornerResizer)
Definition juce_ResizableWindow.cpp:245
void setResizeLimits(int newMinimumWidth, int newMinimumHeight, int newMaximumWidth, int newMaximumHeight) noexcept
Definition juce_ResizableWindow.cpp:291
void setContentOwned(Component *newContentComponent, bool resizeToFitWhenContentChangesSize)
Definition juce_ResizableWindow.cpp:114
Definition juce_StretchableObjectResizer.h:47
void addItem(double currentSize, double minSize, double maxSize, int order=0)
Definition juce_StretchableObjectResizer.cpp:32
double getItemSize(int index) const noexcept
Definition juce_StretchableObjectResizer.cpp:48
int getNumItems() const noexcept
Definition juce_StretchableObjectResizer.h:81
void resizeToFit(double targetSize)
Definition juce_StretchableObjectResizer.cpp:54
Definition juce_StringArray.h:35
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Definition juce_StringArray.cpp:329
Definition juce_String.h:53
bool startsWith(StringRef text) const noexcept
Definition juce_String.cpp:1393
String substring(int startIndex, int endIndex) const
Definition juce_String.cpp:1498
Definition juce_TextButton.h:39
ToolbarItemFactory & factory
Definition juce_Toolbar.cpp:802
ToolbarItemPalette palette
Definition juce_Toolbar.cpp:805
void paint(Graphics &g) override
Definition juce_Toolbar.cpp:779
ComboBox styleBox
Definition juce_Toolbar.cpp:807
Toolbar & toolbar
Definition juce_Toolbar.cpp:803
void resized() override
Definition juce_Toolbar.cpp:790
TextButton defaultButton
Definition juce_Toolbar.cpp:808
Label instructions
Definition juce_Toolbar.cpp:806
void updateStyle()
Definition juce_Toolbar.cpp:766
CustomiserPanel(ToolbarItemFactory &tbf, Toolbar &bar, int optionFlags)
Definition juce_Toolbar.cpp:720
Definition juce_Toolbar.cpp:660
~CustomisationDialog() override
Definition juce_Toolbar.cpp:672
void closeButtonPressed() override
Definition juce_Toolbar.cpp:677
Toolbar & toolbar
Definition juce_Toolbar.cpp:715
CustomisationDialog(ToolbarItemFactory &factory, Toolbar &bar, int optionFlags)
Definition juce_Toolbar.cpp:662
bool canModalEventBeSentToComponent(const Component *comp) override
Definition juce_Toolbar.cpp:682
void positionNearBar()
Definition juce_Toolbar.cpp:688
Definition juce_Toolbar.cpp:155
void layout(const int preferredWidth)
Definition juce_Toolbar.cpp:195
const int height
Definition juce_Toolbar.cpp:235
Component::SafePointer< Toolbar > owner
Definition juce_Toolbar.cpp:234
~MissingItemsComponent() override
Definition juce_Toolbar.cpp:176
Array< int > oldIndexes
Definition juce_Toolbar.cpp:236
MissingItemsComponent(Toolbar &bar, int h)
Definition juce_Toolbar.cpp:157
void getIdealSize(int &idealWidth, int &idealHeight) override
Definition juce_Toolbar.cpp:227
Definition juce_Toolbar.cpp:33
void paint(Graphics &g) override
Definition juce_Toolbar.cpp:78
Spacer(int itemID, float sizeToUse, bool shouldDrawBar)
Definition juce_Toolbar.cpp:35
int getResizeOrder() const noexcept
Definition juce_Toolbar.cpp:73
const bool drawBar
Definition juce_Toolbar.cpp:148
bool getToolbarItemSizes(int toolbarThickness, bool, int &preferredSize, int &minSize, int &maxSize) override
Definition juce_Toolbar.cpp:43
const float fixedSize
Definition juce_Toolbar.cpp:147
void contentAreaChanged(const Rectangle< int > &) override
Definition juce_Toolbar.cpp:69
void paintButtonArea(Graphics &, int, int, bool, bool) override
Definition juce_Toolbar.cpp:65
@ separatorColourId
Definition juce_Toolbar.h:239
void lookAndFeelChanged() override
Definition juce_Toolbar.cpp:650
ToolbarItemComponent * getNextActiveComponent(int index, int delta) const
Definition juce_Toolbar.cpp:356
void clear()
Definition juce_Toolbar.cpp:263
Toolbar()
Definition juce_Toolbar.cpp:243
int getNumItems() const noexcept
Definition juce_Toolbar.cpp:338
bool isInterestedInDragSource(const SourceDetails &) override
Definition juce_Toolbar.cpp:558
bool isEditingActive
Definition juce_Toolbar.h:317
void showMissingItems()
Definition juce_Toolbar.cpp:544
void setEditingActive(bool editingEnabled)
Definition juce_Toolbar.cpp:426
String toString() const
Definition juce_Toolbar.cpp:383
static const char *const toolbarDragDescriptor
Definition juce_Toolbar.h:312
void addItem(ToolbarItemFactory &factory, int itemId, int insertIndex=-1)
Definition juce_Toolbar.cpp:301
void removeToolbarItem(int itemIndex)
Definition juce_Toolbar.cpp:320
void addDefaultItems(ToolbarItemFactory &factoryToUse)
Definition juce_Toolbar.cpp:307
ToolbarItemStyle
Definition juce_Toolbar.h:168
@ textOnly
Definition juce_Toolbar.h:171
@ iconsWithText
Definition juce_Toolbar.h:170
@ iconsOnly
Definition juce_Toolbar.h:169
int getThickness() const noexcept
Definition juce_Toolbar.cpp:416
~Toolbar() override
Definition juce_Toolbar.cpp:249
OwnedArray< ToolbarItemComponent > items
Definition juce_Toolbar.h:321
void itemDragExit(const SourceDetails &) override
Definition juce_Toolbar.cpp:631
void itemDropped(const SourceDetails &) override
Definition juce_Toolbar.cpp:644
void setVertical(bool shouldBeVertical)
Definition juce_Toolbar.cpp:254
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_Toolbar.cpp:821
void setStyle(const ToolbarItemStyle &newStyle)
Definition juce_Toolbar.cpp:374
int getLength() const noexcept
Definition juce_Toolbar.cpp:421
ToolbarItemComponent * getItemComponent(int itemIndex) const noexcept
Definition juce_Toolbar.cpp:351
void showCustomisationDialog(ToolbarItemFactory &factory, int optionFlags=allCustomisationOptionsEnabled)
Definition juce_Toolbar.cpp:812
bool restoreFromString(ToolbarItemFactory &factoryToUse, const String &savedVersion)
Definition juce_Toolbar.cpp:393
int getItemId(int itemIndex) const noexcept
Definition juce_Toolbar.cpp:343
void addItemInternal(ToolbarItemFactory &factory, int itemId, int insertIndex)
Definition juce_Toolbar.cpp:278
void resized() override
Definition juce_Toolbar.cpp:436
ToolbarItemStyle toolbarStyle
Definition juce_Toolbar.h:318
std::unique_ptr< Button > missingItemsButton
Definition juce_Toolbar.h:316
void initMissingItemButton()
Definition juce_Toolbar.cpp:534
@ allowIconsWithTextChoice
Definition juce_Toolbar.h:190
@ allowIconsOnlyChoice
Definition juce_Toolbar.h:188
@ allowTextOnlyChoice
Definition juce_Toolbar.h:192
bool vertical
Definition juce_Toolbar.h:317
void mouseDown(const MouseEvent &) override
Definition juce_Toolbar.cpp:656
static ToolbarItemComponent * createItem(ToolbarItemFactory &, int itemId)
Definition juce_Toolbar.cpp:269
void paint(Graphics &) override
Definition juce_Toolbar.cpp:411
bool isVertical() const noexcept
Definition juce_Toolbar.h:84
void updateAllItemPositions(bool animate)
Definition juce_Toolbar.cpp:441
void itemDragMove(const SourceDetails &) override
Definition juce_Toolbar.cpp:563
ToolbarItemComponent * removeAndReturnItem(int itemIndex)
Definition juce_Toolbar.cpp:326
Definition juce_ToolbarItemComponent.cpp:34
Definition juce_ToolbarItemComponent.h:50
@ editableOnToolbar
Definition juce_ToolbarItemComponent.h:164
@ normalMode
Definition juce_ToolbarItemComponent.h:163
@ editableOnPalette
Definition juce_ToolbarItemComponent.h:166
ToolbarItemComponent(int itemId, const String &labelText, bool isBeingUsedAsAButton)
Definition juce_ToolbarItemComponent.cpp:124
ToolbarEditingMode getEditingMode() const noexcept
Definition juce_ToolbarItemComponent.h:182
bool isToolbarVertical() const
Definition juce_ToolbarItemComponent.cpp:151
Definition juce_ToolbarItemFactory.h:45
virtual void getAllToolbarItemIds(Array< int > &ids)=0
@ flexibleSpacerId
Definition juce_ToolbarItemFactory.h:62
@ separatorBarId
Definition juce_ToolbarItemFactory.h:58
@ spacerId
Definition juce_ToolbarItemFactory.h:60
virtual void getDefaultItemSet(Array< int > &ids)=0
virtual ToolbarItemComponent * createItem(int itemId)=0
Definition juce_ToolbarItemPalette.h:43
UINT_D64 w
Definition inflate.c:942
unsigned * m
Definition inflate.c:1559
struct huft * t
Definition inflate.c:943
int y
Definition inflate.c:1588
int g
Definition inflate.c:1573
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
unsigned x[BMAX+1]
Definition inflate.c:1586
static int int int maxX
Definition pugl.h:1628
#define TRANS(stringLiteral)
Definition juce_LocalisedStrings.h:208
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
static int JUCE_CDECL comp(const void *a, const void *b)
Definition lsp.c:298
Definition juce_Colours.h:38
Definition carla_juce.cpp:31
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
@ group
Definition juce_AccessibilityRole.h:61
#define true
Definition ordinals.h:82
uch * p
Definition crypt.c:594
return c
Definition crypt.c:175
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
ulg size
Definition extract.c:2350
typedef int(UZ_EXP MsgFn)()
#define const
Definition zconf.h:137