void FileChooserDialogBox::createNewFolderCallback (int result, FileChooserDialogBox* box, Component::SafePointer<AlertWindow> alert) { if (result != 0 && alert != nullptr && box != nullptr) { alert->setVisible (false); box->createNewFolderConfirmed (alert->getTextEditorContents ("name")); } }
static void repaintAndResizeAllComps (Component::SafePointer<Component> c) { if (c->isVisible()) { c->repaint(); c->resized(); for (int i = c->getNumChildComponents(); --i >= 0;) if (c != nullptr) if (Component* child = c->getChildComponent(i)) repaintAndResizeAllComps (child); } }
void HadronLabel::mouseDoubleClick(const MouseEvent& e) { if (use_modal_editor_) { if (isEditableOnDoubleClick() && ! e.mods.isPopupMenu()) { ModalComponentManager::Callback* userCallback = 0; ScopedPointer<ModalComponentManager::Callback> userCallbackDeleter (userCallback); Component::SafePointer<Component> prevFocused (Component::getCurrentlyFocusedComponent()); Component::SafePointer<Component> prevTopLevel ((prevFocused != 0) ? prevFocused->getTopLevelComponent() : 0); ScopedPointer <TextEditor> texteditor (createEditorComponent()); texteditor->setColour(TextEditor::backgroundColourId, Colours::white); texteditor->setWantsKeyboardFocus (true); texteditor->setAlwaysOnTop (true); // Find screen position Rectangle<int> sr (getBounds ()); sr.setPosition (getScreenX(), getScreenY()); int fontheight = static_cast<int>(texteditor->getFont().getHeight()) + 4; if (sr.getHeight() > fontheight) { sr.translate (0, (sr.getHeight() - fontheight)/2); sr.setHeight (fontheight); } texteditor->setBounds(sr); texteditor->setText(getText(),false); texteditor->setHighlightedRegion (Range <int> (0, getText().length ())); texteditor->setVisible (true); texteditor->grabKeyboardFocus(); texteditor->addToDesktop (ComponentPeer::windowIsTemporary, 0); texteditor->addListener (this); texteditor->enterModalState (false); texteditor->grabKeyboardFocus(); texteditor->runModalLoop(); if (prevTopLevel != 0) prevTopLevel->toFront (true); if (prevFocused != 0) prevFocused->grabKeyboardFocus(); } } else { Label::mouseDoubleClick(e); } }
void ModalComponentManager::handleAsyncUpdate() { for (int i = stack.size(); --i >= 0;) { const ModalItem* const item = stack.getUnchecked(i); if (! item->isActive) { ScopedPointer<ModalItem> deleter (stack.removeAndReturn (i)); Component::SafePointer<Component> compToDelete (item->autoDelete ? item->component : nullptr); for (int j = item->callbacks.size(); --j >= 0;) { item->callbacks.getUnchecked(j)->modalStateFinished (item->returnValue); } compToDelete.deleteAndZero(); } } }
static void repaintAndResizeAllComps (Component::SafePointer<Component> c, Array<Component*>& alreadyDone) { if (c->isVisible() && ! alreadyDone.contains (c)) { c->repaint(); c->resized(); for (int i = c->getNumChildComponents(); --i >= 0;) { if (Component* child = c->getChildComponent(i)) { repaintAndResizeAllComps (child, alreadyDone); alreadyDone.add (child); } if (c == nullptr) break; } } }