LMMS
Loading...
Searching...
No Matches
juce_AlertWindow.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
30{
31 #if JUCE_LINUX || JUCE_BSD
32 return 0x2022;
33 #else
34 return 0x25cf;
35 #endif
36}
37
38//==============================================================================
40 const String& message,
41 MessageBoxIconType iconType,
44 alertIconType (iconType),
47{
49
53 accessibleMessageLabel.setInterceptsMouseClicks (false, false);
55
56 if (message.isEmpty())
57 text = " "; // to force an update if the message is empty
58
60
62 constrainer.setMinimumOnscreenAmounts (0x10000, 0x10000, 0x10000, 0x10000);
63}
64
66{
67 // Ensure that the focus does not jump to another TextEditor while we
68 // remove children.
69 for (auto* t : textBoxes)
70 t->setWantsKeyboardFocus (false);
71
72 // Give away focus before removing the editors, so that any TextEditor
73 // with focus has a chance to dismiss native keyboard if shown.
75
77}
78
84
85//==============================================================================
87{
88 auto newMessage = message.substring (0, 2048);
89
90 if (text != newMessage)
91 {
92 text = newMessage;
93
94 auto accessibleText = getName() + ". " + text;
96 setDescription (accessibleText);
97
98 updateLayout (true);
99 repaint();
100 }
101}
102
103//==============================================================================
105{
106 if (auto* parent = button->getParentComponent())
107 parent->exitModalState (button->getCommandID());
108}
109
110//==============================================================================
112 const int returnValue,
113 const KeyPress& shortcutKey1,
114 const KeyPress& shortcutKey2)
115{
116 auto* b = new TextButton (name, {});
117 buttons.add (b);
118
119 b->setWantsKeyboardFocus (true);
120 b->setExplicitFocusOrder (1);
121 b->setMouseClickGrabsKeyboardFocus (false);
122 b->setCommandToTrigger (nullptr, returnValue, false);
123 b->addShortcut (shortcutKey1);
124 b->addShortcut (shortcutKey2);
125 b->onClick = [this, b] { exitAlert (b); };
126
127 Array<TextButton*> buttonsArray (buttons.begin(), buttons.size());
128 auto& lf = getLookAndFeel();
129
130 auto buttonHeight = lf.getAlertWindowButtonHeight();
131 auto buttonWidths = lf.getWidthsForTextButtons (*this, buttonsArray);
132
133 jassert (buttonWidths.size() == buttons.size());
134 int i = 0;
135
136 for (auto* button : buttons)
137 button->setSize (buttonWidths[i++], buttonHeight);
138
139 addAndMakeVisible (b, 0);
140 updateLayout (false);
141}
142
144{
145 return buttons.size();
146}
147
149{
150 for (auto* b : buttons)
151 {
152 if (buttonName == b->getName())
153 {
154 b->triggerClick();
155 break;
156 }
157 }
158}
159
160void AlertWindow::setEscapeKeyCancels (bool shouldEscapeKeyCancel)
161{
162 escapeKeyCancels = shouldEscapeKeyCancel;
163}
164
165//==============================================================================
167 const String& initialContents,
168 const String& onScreenLabel,
169 const bool isPasswordBox)
170{
171 auto* ed = new TextEditor (name, isPasswordBox ? getDefaultPasswordChar() : 0);
172 ed->setSelectAllWhenFocused (true);
173 ed->setEscapeAndReturnKeysConsumed (false);
174 textBoxes.add (ed);
175 allComps.add (ed);
176
178 ed->setFont (getLookAndFeel().getAlertWindowMessageFont());
180 ed->setText (initialContents);
181 ed->setCaretPosition (initialContents.length());
182 textboxNames.add (onScreenLabel);
183
184 updateLayout (false);
185}
186
187TextEditor* AlertWindow::getTextEditor (const String& nameOfTextEditor) const
188{
189 for (auto* tb : textBoxes)
190 if (tb->getName() == nameOfTextEditor)
191 return tb;
192
193 return nullptr;
194}
195
196String AlertWindow::getTextEditorContents (const String& nameOfTextEditor) const
197{
198 if (auto* t = getTextEditor (nameOfTextEditor))
199 return t->getText();
200
201 return {};
202}
203
204
205//==============================================================================
207 const StringArray& items,
208 const String& onScreenLabel)
209{
210 auto* cb = new ComboBox (name);
211 comboBoxes.add (cb);
212 allComps.add (cb);
213
214 cb->addItemList (items, 1);
215
217 cb->setSelectedItemIndex (0);
218
219 comboBoxNames.add (onScreenLabel);
220 updateLayout (false);
221}
222
224{
225 for (auto* cb : comboBoxes)
226 if (cb->getName() == nameOfList)
227 return cb;
228
229 return nullptr;
230}
231
232//==============================================================================
234{
235public:
256
257 void updateLayout (const int width)
258 {
260 s.setJustification (Justification::topLeft);
261 s.append (getText(), getFont());
262
264 text.createLayoutWithBalancedLineLengths (s, (float) width - 8.0f);
265 setSize (width, jmin (width, (int) (text.getHeight() + getFont().getHeight())));
266 }
267
269
271};
272
273void AlertWindow::addTextBlock (const String& textBlock)
274{
275 auto* c = new AlertTextComp (*this, textBlock, getLookAndFeel().getAlertWindowMessageFont());
276 textBlocks.add (c);
277 allComps.add (c);
279
280 updateLayout (false);
281}
282
283//==============================================================================
284void AlertWindow::addProgressBarComponent (double& progressValue)
285{
286 auto* pb = new ProgressBar (progressValue);
287 progressBars.add (pb);
288 allComps.add (pb);
290
291 updateLayout (false);
292}
293
294//==============================================================================
296{
297 customComps.add (component);
298 allComps.add (component);
299 addAndMakeVisible (component);
300
301 updateLayout (false);
302}
303
305Component* AlertWindow::getCustomComponent (int index) const { return customComps [index]; }
306
308{
309 auto* c = getCustomComponent (index);
310
311 if (c != nullptr)
312 {
313 customComps.removeFirstMatchingValue (c);
314 allComps.removeFirstMatchingValue (c);
316
317 updateLayout (false);
318 }
319
320 return c;
321}
322
323//==============================================================================
325{
326 auto& lf = getLookAndFeel();
327 lf.drawAlertBox (g, *this, textArea, textLayout);
328
329 g.setColour (findColour (textColourId));
330 g.setFont (lf.getAlertWindowFont());
331
332 for (int i = textBoxes.size(); --i >= 0;)
333 {
334 auto* te = textBoxes.getUnchecked(i);
335
336 g.drawFittedText (textboxNames[i],
337 te->getX(), te->getY() - 14,
338 te->getWidth(), 14,
340 }
341
342 for (int i = comboBoxNames.size(); --i >= 0;)
343 {
344 auto* cb = comboBoxes.getUnchecked(i);
345
346 g.drawFittedText (comboBoxNames[i],
347 cb->getX(), cb->getY() - 14,
348 cb->getWidth(), 14,
350 }
351
352 for (auto* c : customComps)
353 g.drawFittedText (c->getName(),
354 c->getX(), c->getY() - 14,
355 c->getWidth(), 14,
357}
358
359void AlertWindow::updateLayout (const bool onlyIncreaseSize)
360{
361 const int titleH = 24;
362 const int iconWidth = 80;
363
364 auto& lf = getLookAndFeel();
365 auto messageFont (lf.getAlertWindowMessageFont());
366
367 auto wid = jmax (messageFont.getStringWidth (text),
368 messageFont.getStringWidth (getName()));
369
370 auto sw = (int) std::sqrt (messageFont.getHeight() * (float) wid);
371 auto w = jmin (300 + sw * 2, (int) ((float) getParentWidth() * 0.7f));
372 const int edgeGap = 10;
373 const int labelHeight = 18;
374 int iconSpace = 0;
375
376 AttributedString attributedText;
377 attributedText.append (getName(), lf.getAlertWindowTitleFont());
378
379 if (text.isNotEmpty())
380 attributedText.append ("\n\n" + text, messageFont);
381
382 attributedText.setColour (findColour (textColourId));
383
384 if (alertIconType == NoIcon)
385 {
387 textLayout.createLayoutWithBalancedLineLengths (attributedText, (float) w);
388 }
389 else
390 {
392 textLayout.createLayoutWithBalancedLineLengths (attributedText, (float) w);
393 iconSpace = iconWidth;
394 }
395
396 w = jmax (350, (int) textLayout.getWidth() + iconSpace + edgeGap * 4);
397 w = jmin (w, (int) ((float) getParentWidth() * 0.7f));
398
399 auto textLayoutH = (int) textLayout.getHeight();
400 auto textBottom = 16 + titleH + textLayoutH;
401 int h = textBottom;
402
403 int buttonW = 40;
404
405 for (auto* b : buttons)
406 buttonW += 16 + b->getWidth();
407
408 w = jmax (buttonW, w);
409
410 h += (textBoxes.size() + comboBoxes.size() + progressBars.size()) * 50;
411
412 if (auto* b = buttons[0])
413 h += 20 + b->getHeight();
414
415 for (auto* c : customComps)
416 {
417 w = jmax (w, (c->getWidth() * 100) / 80);
418 h += 10 + c->getHeight();
419
420 if (c->getName().isNotEmpty())
421 h += labelHeight;
422 }
423
424 for (auto* tb : textBlocks)
425 w = jmax (w, static_cast<const AlertTextComp*> (tb)->bestWidth);
426
427 w = jmin (w, (int) ((float) getParentWidth() * 0.7f));
428
429 for (auto* tb : textBlocks)
430 {
431 auto* ac = static_cast<AlertTextComp*> (tb);
432 ac->updateLayout ((int) ((float) w * 0.8f));
433 h += ac->getHeight() + 10;
434 }
435
436 h = jmin (getParentHeight() - 50, h);
437
438 if (onlyIncreaseSize)
439 {
440 w = jmax (w, getWidth());
441 h = jmax (h, getHeight());
442 }
443
444 if (! isVisible())
446 else
447 setBounds (getBounds().withSizeKeepingCentre (w, h));
448
449 textArea.setBounds (edgeGap, edgeGap, w - (edgeGap * 2), h - edgeGap);
451
452 const int spacer = 16;
453 int totalWidth = -spacer;
454
455 for (auto* b : buttons)
456 totalWidth += b->getWidth() + spacer;
457
458 auto x = (w - totalWidth) / 2;
459 auto y = (int) ((float) getHeight() * 0.95f);
460
461 for (auto* c : buttons)
462 {
463 int ny = proportionOfHeight (0.95f) - c->getHeight();
464 c->setTopLeftPosition (x, ny);
465 if (ny < y)
466 y = ny;
467
468 x += c->getWidth() + spacer;
469
470 c->toFront (false);
471 }
472
473 y = textBottom;
474
475 for (auto* c : allComps)
476 {
477 h = 22;
478
479 const int comboIndex = comboBoxes.indexOf (dynamic_cast<ComboBox*> (c));
480 if (comboIndex >= 0 && comboBoxNames [comboIndex].isNotEmpty())
481 y += labelHeight;
482
483 const int tbIndex = textBoxes.indexOf (dynamic_cast<TextEditor*> (c));
484 if (tbIndex >= 0 && textboxNames[tbIndex].isNotEmpty())
485 y += labelHeight;
486
487 if (customComps.contains (c))
488 {
489 if (c->getName().isNotEmpty())
490 y += labelHeight;
491
492 c->setTopLeftPosition (proportionOfWidth (0.1f), y);
493 h = c->getHeight();
494 }
495 else if (textBlocks.contains (c))
496 {
497 c->setTopLeftPosition ((getWidth() - c->getWidth()) / 2, y);
498 h = c->getHeight();
499 }
500 else
501 {
502 c->setBounds (proportionOfWidth (0.1f), y, proportionOfWidth (0.8f), h);
503 }
504
505 y += h + 10;
506 }
507
509}
510
512{
513 return allComps.size() > 0;
514}
515
516//==============================================================================
518{
519 dragger.startDraggingComponent (this, e);
520}
521
523{
524 dragger.dragComponent (this, e, &constrainer);
525}
526
528{
529 for (auto* b : buttons)
530 {
531 if (b->isRegisteredForShortcut (key))
532 {
533 b->triggerClick();
534 return true;
535 }
536 }
537
538 if (key.isKeyCode (KeyPress::escapeKey) && escapeKeyCancels)
539 {
540 exitModalState (0);
541 return true;
542 }
543
544 if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1)
545 {
546 buttons.getUnchecked(0)->triggerClick();
547 return true;
548 }
549
550 return false;
551}
552
554{
555 const int newFlags = getLookAndFeel().getAlertBoxWindowFlags();
556
559 updateLayout (false);
560}
561
563{
564 return getLookAndFeel().getAlertBoxWindowFlags();
565}
566
567enum class Async { no, yes };
568
569//==============================================================================
571{
572public:
574 std::unique_ptr<ModalComponentManager::Callback>&& cb,
575 Async showAsync)
576 : options (opts),
577 callback (std::move (cb)),
578 async (showAsync)
579 {
580 }
581
582 int invoke() const
583 {
584 MessageManager::getInstance()->callFunctionOnMessageThread (showCallback, (void*) this);
585 return returnValue;
586 }
587
588private:
589 static void* showCallback (void* userData)
590 {
591 static_cast<AlertWindowInfo*> (userData)->show();
592 return nullptr;
593 }
594
595 void show()
596 {
597 auto* component = options.getAssociatedComponent();
598
599 auto& lf = (component != nullptr ? component->getLookAndFeel()
601
602 std::unique_ptr<AlertWindow> alertBox (lf.createAlertWindow (options.getTitle(), options.getMessage(),
603 options.getButtonText (0), options.getButtonText (1), options.getButtonText (2),
604 options.getIconType(), options.getNumButtons(), component));
605
606 jassert (alertBox != nullptr); // you have to return one of these!
607
608 alertBox->setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows());
609
610 #if JUCE_MODAL_LOOPS_PERMITTED
611 if (async == Async::no)
612 returnValue = alertBox->runModalLoop();
613 else
614 #endif
615 {
617
618 alertBox->enterModalState (true, callback.release(), true);
619 alertBox.release();
620 }
621 }
622
624 std::unique_ptr<ModalComponentManager::Callback> callback;
626 int returnValue = 0;
627
629};
630
632{
633 using MapFn = int (*) (int);
634
635 static inline int noMapping (int buttonIndex) { return buttonIndex; }
636 static inline int messageBox (int) { return 0; }
637 static inline int okCancel (int buttonIndex) { return buttonIndex == 0 ? 1 : 0; }
638 static inline int yesNoCancel (int buttonIndex) { return buttonIndex == 2 ? 0 : buttonIndex + 1; }
639
640 static std::unique_ptr<ModalComponentManager::Callback> getWrappedCallback (ModalComponentManager::Callback* callbackIn,
641 MapFn mapFn)
642 {
643 jassert (mapFn != nullptr);
644
645 if (callbackIn == nullptr)
646 return nullptr;
647
648 auto wrappedCallback = [innerCallback = rawToUniquePtr (callbackIn), mapFn] (int buttonIndex)
649 {
650 innerCallback->modalStateFinished (mapFn (buttonIndex));
651 };
652
653 return rawToUniquePtr (ModalCallbackFunction::create (std::move (wrappedCallback)));
654 }
655
656}
657
658#if JUCE_MODAL_LOOPS_PERMITTED
659void AlertWindow::showMessageBox (MessageBoxIconType iconType,
660 const String& title,
661 const String& message,
662 const String& buttonText,
663 Component* associatedComponent)
664{
665 show (MessageBoxOptions()
666 .withIconType (iconType)
667 .withTitle (title)
668 .withMessage (message)
669 .withButton (buttonText.isEmpty() ? TRANS("OK") : buttonText)
670 .withAssociatedComponent (associatedComponent));
671}
672
673int AlertWindow::show (const MessageBoxOptions& options)
674{
675 if (LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows())
676 return NativeMessageBox::show (options);
677
678 AlertWindowInfo info (options, nullptr, Async::no);
679 return info.invoke();
680}
681
682bool AlertWindow::showNativeDialogBox (const String& title,
683 const String& bodyText,
684 bool isOkCancel)
685{
686 if (isOkCancel)
687 return NativeMessageBox::showOkCancelBox (AlertWindow::NoIcon, title, bodyText);
688
689 NativeMessageBox::showMessageBox (AlertWindow::NoIcon, title, bodyText);
690 return true;
691}
692#endif
693
695{
696 if (LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows())
697 {
699 }
700 else
701 {
703 info.invoke();
704 }
705}
706
707void AlertWindow::showAsync (const MessageBoxOptions& options, std::function<void (int)> callback)
708{
710}
711
713 const String& title,
714 const String& message,
715 const String& buttonText,
718{
720 .withIconType (iconType)
721 .withTitle (title)
722 .withMessage (message)
723 .withButton (buttonText.isEmpty() ? TRANS("OK") : buttonText)
724 .withAssociatedComponent (associatedComponent),
725 callback);
726}
727
728static int showMaybeAsync (const MessageBoxOptions& options,
731{
732 const auto showAsync = (callbackIn != nullptr ? Async::yes
733 : Async::no);
734
735 auto callback = AlertWindowMappings::getWrappedCallback (callbackIn, mapFn);
736
737 if (LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows())
738 {
739 #if JUCE_MODAL_LOOPS_PERMITTED
740 if (showAsync == Async::no)
741 return mapFn (NativeMessageBox::show (options));
742 #endif
743
744 NativeMessageBox::showAsync (options, callback.release());
745 return false;
746 }
747
748 AlertWindowInfo info (options, std::move (callback), showAsync);
749 return info.invoke();
750}
751
753 const String& title,
754 const String& message,
755 const String& button1Text,
756 const String& button2Text,
759{
761 .withIconType (iconType)
762 .withTitle (title)
763 .withMessage (message)
764 .withButton (button1Text.isEmpty() ? TRANS("OK") : button1Text)
765 .withButton (button2Text.isEmpty() ? TRANS("Cancel") : button2Text)
766 .withAssociatedComponent (associatedComponent),
767 callback,
768 LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows()
771}
772
774 const String& title,
775 const String& message,
776 const String& button1Text,
777 const String& button2Text,
778 const String& button3Text,
781{
783 .withIconType (iconType)
784 .withTitle (title)
785 .withMessage (message)
786 .withButton (button1Text.isEmpty() ? TRANS("Yes") : button1Text)
787 .withButton (button2Text.isEmpty() ? TRANS("No") : button2Text)
788 .withButton (button3Text.isEmpty() ? TRANS("Cancel") : button3Text)
789 .withAssociatedComponent (associatedComponent),
790 callback,
791 LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows()
794}
795
796//==============================================================================
797std::unique_ptr<AccessibilityHandler> AlertWindow::createAccessibilityHandler()
798{
799 return std::make_unique<AccessibilityHandler> (*this, AccessibilityRole::dialogWindow);
800}
801
802} // 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
#define nullptr
Definition DistrhoDefines.h:75
static void message(int level, const char *fmt,...)
Definition adplugdb.cpp:120
Definition String.h:48
bool isEmpty() const noexcept
Definition String.h:238
Definition juce_AlertWindow.cpp:234
AlertTextComp(AlertWindow &owner, const String &message, const Font &font)
Definition juce_AlertWindow.cpp:236
int bestWidth
Definition juce_AlertWindow.cpp:268
void updateLayout(const int width)
Definition juce_AlertWindow.cpp:257
Definition juce_AlertWindow.h:45
void mouseDown(const MouseEvent &) override
Definition juce_AlertWindow.cpp:517
@ textColourId
Definition juce_AlertWindow.h:444
StringArray textboxNames
Definition juce_AlertWindow.h:519
void setEscapeKeyCancels(bool shouldEscapeKeyCancel)
Definition juce_AlertWindow.cpp:160
void addButton(const String &name, int returnValue, const KeyPress &shortcutKey1=KeyPress(), const KeyPress &shortcutKey2=KeyPress())
Definition juce_AlertWindow.cpp:111
ComponentDragger dragger
Definition juce_AlertWindow.h:510
void addComboBox(const String &name, const StringArray &items, const String &onScreenLabel=String())
Definition juce_AlertWindow.cpp:206
static int JUCE_CALLTYPE showYesNoCancelBox(MessageBoxIconType iconType, const String &title, const String &message, const String &button1Text, const String &button2Text, const String &button3Text, Component *associatedComponent, ModalComponentManager::Callback *callback)
Definition juce_AlertWindow.cpp:773
void addTextEditor(const String &name, const String &initialContents, const String &onScreenLabel=String(), bool isPasswordBox=false)
Definition juce_AlertWindow.cpp:166
OwnedArray< TextEditor > textBoxes
Definition juce_AlertWindow.h:513
OwnedArray< ComboBox > comboBoxes
Definition juce_AlertWindow.h:514
OwnedArray< TextButton > buttons
Definition juce_AlertWindow.h:512
StringArray comboBoxNames
Definition juce_AlertWindow.h:519
int getNumButtons() const
Definition juce_AlertWindow.cpp:143
String text
Definition juce_AlertWindow.h:505
static bool JUCE_CALLTYPE showOkCancelBox(MessageBoxIconType iconType, const String &title, const String &message, const String &button1Text, const String &button2Text, Component *associatedComponent, ModalComponentManager::Callback *callback)
Definition juce_AlertWindow.cpp:752
float desktopScale
Definition juce_AlertWindow.h:522
void setMessage(const String &message)
Definition juce_AlertWindow.cpp:86
Rectangle< int > textArea
Definition juce_AlertWindow.h:511
static void JUCE_CALLTYPE showAsync(const MessageBoxOptions &options, ModalComponentManager::Callback *callback)
Definition juce_AlertWindow.cpp:694
void addTextBlock(const String &text)
Definition juce_AlertWindow.cpp:273
Array< Component * > allComps
Definition juce_AlertWindow.h:518
int getNumCustomComponents() const
Definition juce_AlertWindow.cpp:304
void updateLayout(bool onlyIncreaseSize)
Definition juce_AlertWindow.cpp:359
Array< Component * > customComps
Definition juce_AlertWindow.h:516
void lookAndFeelChanged() override
Definition juce_AlertWindow.cpp:553
static constexpr auto NoIcon
Definition juce_AlertWindow.h:479
OwnedArray< Component > textBlocks
Definition juce_AlertWindow.h:517
bool containsAnyExtraComponents() const
Definition juce_AlertWindow.cpp:511
void mouseDrag(const MouseEvent &) override
Definition juce_AlertWindow.cpp:522
void addProgressBarComponent(double &progressValue)
Definition juce_AlertWindow.cpp:284
static void JUCE_CALLTYPE showMessageBoxAsync(MessageBoxIconType iconType, const String &title, const String &message, const String &buttonText=String(), Component *associatedComponent=nullptr, ModalComponentManager::Callback *callback=nullptr)
Definition juce_AlertWindow.cpp:712
int getDesktopWindowStyleFlags() const override
Definition juce_AlertWindow.cpp:562
Component * getCustomComponent(int index) const
Definition juce_AlertWindow.cpp:305
OwnedArray< ProgressBar > progressBars
Definition juce_AlertWindow.h:515
Component *const associatedComponent
Definition juce_AlertWindow.h:520
void exitAlert(Button *button)
Definition juce_AlertWindow.cpp:104
bool escapeKeyCancels
Definition juce_AlertWindow.h:521
MessageBoxIconType alertIconType
Definition juce_AlertWindow.h:508
void paint(Graphics &) override
Definition juce_AlertWindow.cpp:324
TextEditor * getTextEditor(const String &nameOfTextEditor) const
Definition juce_AlertWindow.cpp:187
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_AlertWindow.cpp:797
void triggerButtonClick(const String &buttonName)
Definition juce_AlertWindow.cpp:148
Component * removeCustomComponent(int index)
Definition juce_AlertWindow.cpp:307
void addCustomComponent(Component *component)
Definition juce_AlertWindow.cpp:295
Label accessibleMessageLabel
Definition juce_AlertWindow.h:507
ComponentBoundsConstrainer constrainer
Definition juce_AlertWindow.h:509
AlertWindow(const String &title, const String &message, MessageBoxIconType iconType, Component *associatedComponent=nullptr)
Definition juce_AlertWindow.cpp:39
String getTextEditorContents(const String &nameOfTextEditor) const
Definition juce_AlertWindow.cpp:196
TextLayout textLayout
Definition juce_AlertWindow.h:506
~AlertWindow() override
Definition juce_AlertWindow.cpp:65
bool keyPressed(const KeyPress &) override
Definition juce_AlertWindow.cpp:527
ComboBox * getComboBoxComponent(const String &nameOfList) const
Definition juce_AlertWindow.cpp:223
void userTriedToCloseWindow() override
Definition juce_AlertWindow.cpp:79
Definition juce_AlertWindow.cpp:571
std::unique_ptr< ModalComponentManager::Callback > callback
Definition juce_AlertWindow.cpp:624
int returnValue
Definition juce_AlertWindow.cpp:626
static void * showCallback(void *userData)
Definition juce_AlertWindow.cpp:589
void show()
Definition juce_AlertWindow.cpp:595
AlertWindowInfo(const MessageBoxOptions &opts, std::unique_ptr< ModalComponentManager::Callback > &&cb, Async showAsync)
Definition juce_AlertWindow.cpp:573
const Async async
Definition juce_AlertWindow.cpp:625
MessageBoxOptions options
Definition juce_AlertWindow.cpp:623
int invoke() const
Definition juce_AlertWindow.cpp:582
Definition juce_Array.h:56
Definition juce_AttributedString.h:47
void setColour(Range< int > range, Colour colour)
Definition juce_AttributedString.cpp:243
void append(const String &textToAppend)
Definition juce_AttributedString.cpp:175
void setJustification(Justification newJustification) noexcept
Definition juce_AttributedString.cpp:223
Definition juce_Button.h:43
Definition juce_ComboBox.h:49
@ outlineColourId
Definition juce_ComboBox.h:358
Definition juce_Component.h:36
bool isColourSpecified(int colourID) const
Definition juce_Component.cpp:2231
int proportionOfWidth(float proportion) const noexcept
Definition juce_Component.cpp:1111
void giveAwayKeyboardFocus()
Definition juce_Component.cpp:3029
bool isVisible() const noexcept
Definition juce_Component.h:122
int getNumChildComponents() const noexcept
Definition juce_Component.cpp:1643
int proportionOfHeight(float proportion) const noexcept
Definition juce_Component.cpp:1112
bool isOpaque() const noexcept
Definition juce_Component.cpp:843
int getHeight() const noexcept
Definition juce_Component.h:274
static float JUCE_CALLTYPE getApproximateScaleFactorForComponent(const Component *targetComponent)
Definition juce_Component.cpp:1383
void addAndMakeVisible(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1554
void setAlwaysOnTop(bool shouldStayOnTop)
Definition juce_Component.cpp:1074
void setDescription(const String &newDescription)
Definition juce_Component.cpp:3263
Rectangle< int > getBounds() const noexcept
Definition juce_Component.h:304
void repaint()
Definition juce_Component.cpp:1917
void exitModalState(int returnValue)
Definition juce_Component.cpp:1795
void removeChildComponent(Component *childToRemove)
Definition juce_Component.cpp:1569
void removeAllChildren()
Definition juce_Component.cpp:1631
void setBounds(int x, int y, int width, int height)
Definition juce_Component.cpp:1147
void setSize(int newWidth, int newHeight)
Definition juce_Component.cpp:1262
void setColour(int colourID, Colour newColour)
Definition juce_Component.cpp:2242
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
int getParentWidth() const noexcept
Definition juce_Component.cpp:1114
int getParentHeight() const noexcept
Definition juce_Component.cpp:1120
String getName() const noexcept
Definition juce_Component.h:76
@ windowHasDropShadow
Definition juce_ComponentPeer.h:66
@ windowHasTitleBar
Definition juce_ComponentPeer.h:56
Definition juce_Font.h:42
float getHeight() const noexcept
Definition juce_Font.cpp:735
int getStringWidth(const String &text) const
Definition juce_Font.cpp:742
Definition juce_GraphicsContext.h:45
@ centredLeft
Definition juce_Justification.h:143
@ centredTop
Definition juce_Justification.h:153
@ topLeft
Definition juce_Justification.h:163
Definition juce_KeyPress.h:40
static const int escapeKey
Definition juce_KeyPress.h:190
static const int returnKey
Definition juce_KeyPress.h:191
@ outlineColourId
Definition juce_Label.h:108
@ backgroundColourId
Definition juce_Label.h:106
@ textColourId
Definition juce_Label.h:107
static LookAndFeel & getDefaultLookAndFeel() noexcept
Definition juce_LookAndFeel.cpp:107
Definition juce_MessageBoxOptions.h:63
static MessageManager * getInstance()
Definition juce_MessageManager.cpp:47
static ModalComponentManager::Callback * create(CallbackFn &&fn)
Definition juce_ModalComponentManager.h:174
Definition juce_ModalComponentManager.h:56
Definition juce_MouseEvent.h:39
static void JUCE_CALLTYPE showAsync(const MessageBoxOptions &options, ModalComponentManager::Callback *callback)
Definition juce_linux_Windowing.cpp:928
Definition juce_ProgressBar.h:51
Definition juce_StringArray.h:35
Definition juce_String.h:53
int length() const noexcept
Definition juce_String.cpp:511
bool isEmpty() const noexcept
Definition juce_String.h:310
Definition juce_TextButton.h:39
Definition juce_TextEditor.h:43
void setScrollbarsShown(bool shouldBeEnabled)
Definition juce_TextEditor.cpp:1015
void setMultiLine(bool shouldBeMultiLine, bool shouldWordWrap=true)
Definition juce_TextEditor.cpp:993
@ backgroundColourId
Definition juce_TextEditor.h:209
@ textColourId
Definition juce_TextEditor.h:212
@ outlineColourId
Definition juce_TextEditor.h:223
@ shadowColourId
Definition juce_TextEditor.h:229
const Font & getFont() const noexcept
Definition juce_TextEditor.h:257
void setFont(const Font &newFont)
Definition juce_TextEditor.cpp:1084
void setText(const String &newText, bool sendTextChangeMessage=true)
Definition juce_TextEditor.cpp:1234
void setReadOnly(bool shouldBeReadOnly)
Definition juce_TextEditor.cpp:1024
void lookAndFeelChanged() override
Definition juce_TextEditor.cpp:1120
void setCaretVisible(bool shouldBeVisible)
Definition juce_TextEditor.cpp:1138
TextEditor(const String &componentName=String(), juce_wchar passwordCharacter=0)
Definition juce_TextEditor.cpp:933
String getText() const
Definition juce_TextEditor.cpp:2516
Definition juce_TextLayout.h:41
void centreAroundComponent(Component *componentToCentreAround, int width, int height)
Definition juce_TopLevelWindow.cpp:290
void setDropShadowEnabled(bool useShadow)
Definition juce_TopLevelWindow.cpp:210
TopLevelWindow(const String &name, bool addToDesktop)
Definition juce_TopLevelWindow.cpp:134
void setUsingNativeTitleBar(bool useNativeTitleBar)
Definition juce_TopLevelWindow.cpp:238
* e
Definition inflate.c:1404
UINT_D64 w
Definition inflate.c:942
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
#define pb(v, N)
static const char * title
Definition pugl.h:1747
static const char * name
Definition pugl.h:1582
static int width
Definition pugl.h:1593
static uintptr_t parent
Definition pugl.h:1644
struct backing_store_struct * info
Definition jmemsys.h:183
#define TRANS(stringLiteral)
Definition juce_LocalisedStrings.h:208
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE(className)
#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_AlertWindow.cpp:632
static int messageBox(int)
Definition juce_AlertWindow.cpp:636
static int okCancel(int buttonIndex)
Definition juce_AlertWindow.cpp:637
static int noMapping(int buttonIndex)
Definition juce_AlertWindow.cpp:635
int(*)(int) MapFn
Definition juce_AlertWindow.cpp:633
static int yesNoCancel(int buttonIndex)
Definition juce_AlertWindow.cpp:638
static std::unique_ptr< ModalComponentManager::Callback > getWrappedCallback(ModalComponentManager::Callback *callbackIn, MapFn mapFn)
Definition juce_AlertWindow.cpp:640
const Colour transparentBlack
Definition juce_Colours.h:40
Definition carla_juce.cpp:31
static int showMaybeAsync(const MessageBoxOptions &options, ModalComponentManager::Callback *callbackIn, AlertWindowMappings::MapFn mapFn)
Definition juce_AlertWindow.cpp:728
Async
Definition juce_AlertWindow.cpp:567
@ no
Definition juce_AlertWindow.cpp:567
@ yes
Definition juce_AlertWindow.cpp:567
constexpr Type jmin(Type a, Type b)
Definition juce_MathsFunctions.h:106
MessageBoxIconType
Definition juce_MessageBoxOptions.h:31
static juce_wchar getDefaultPasswordChar() noexcept
Definition juce_AlertWindow.cpp:29
wchar_t juce_wchar
Definition juce_CharacterFunctions.h:42
bool juce_areThereAnyAlwaysOnTopWindows()
Definition juce_linux_Windowing.cpp:31
@ dontSendNotification
Definition juce_NotificationType.h:33
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
@ dialogWindow
Definition juce_AccessibilityRole.h:62
@ button
Definition juce_AccessibilityRole.h:38
std::unique_ptr< T > rawToUniquePtr(T *ptr)
Definition juce_Memory.h:195
Definition juce_Uuid.h:141
#define true
Definition ordinals.h:82
const char * text
Definition swell-functions.h:167
RECT const char void(* callback)(const char *droppath))) SWELL_API_DEFINE(BOOL
Definition swell-functions.h:1004
return c
Definition crypt.c:175
ZCONST char * key
Definition crypt.c:587
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
b
Definition crypt.c:628
typedef int(UZ_EXP MsgFn)()