void ResizableWindow::initialise (const bool shouldAddToDesktop) { /* ========================================================================== In accordance with the terms of the JUCE 5 End-Use License Agreement, the JUCE Code in SECTION A cannot be removed, changed or otherwise rendered ineffective unless you have a JUCE Indie or Pro license, or are using JUCE under the GPL v3 license. End User License Agreement: www.juce.com/juce-5-licence ========================================================================== */ // BEGIN SECTION A #if ! JucePlugin_Build_Standalone splashScreen = new JUCESplashScreen (*this); #endif // END SECTION A defaultConstrainer.setMinimumOnscreenAmounts (0x10000, 16, 24, 16); lastNonFullScreenPos.setBounds (50, 50, 256, 256); if (shouldAddToDesktop) addToDesktop(); }
void DiagramToolbar::mouseDrag(const MouseEvent& e) { if (!_parent->isValidComponent()) { delete this; } else { MouseEvent e2 (e.getEventRelativeTo(_parent)); // if the mouse is inside the parent component, we'll make that the // parent - otherwise, we'll put this comp on the desktop. if (e2.x >= 0 && e2.y >= 0 && e2.x < _parent->getWidth() && e2.y < _parent->getHeight()) { // re-add this component to a parent component, which will // remove it from the desktop.. _parent->addChildComponent(this); } else { // add the component to the desktop, which will remove it // from its current parent component.. addToDesktop(ComponentPeer::windowIsTemporary | ComponentPeer::windowHasDropShadow); } _dragger.dragComponent (this, e); } }
void TooltipWindow::displayTip (Point<int> screenPos, const String& tip) { jassert (tip.isNotEmpty()); if (! reentrant) { ScopedValueSetter<bool> setter (reentrant, true, false); if (tipShowing != tip) { tipShowing = tip; repaint(); } if (Component* const parent = getParentComponent()) { updatePosition (tip, parent->getLocalPoint (nullptr, screenPos), parent->getLocalBounds()); } else { updatePosition (tip, screenPos, Desktop::getInstance().getDisplays() .getDisplayContaining (screenPos).userArea); addToDesktop (ComponentPeer::windowHasDropShadow | ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses); } toFront (false); } }
void SplashScreen::show (const String& title, const int width, const int height, const int minimumTimeToDisplayFor, const bool useDropShadow, const bool removeOnMouseClick) { setName (title); setAlwaysOnTop (true); setVisible (true); centreWithSize (width, height); addToDesktop (useDropShadow ? ComponentPeer::windowHasDropShadow : 0); toFront (false); #if JUCE_MODAL_LOOPS_PERMITTED MessageManager::getInstance()->runDispatchLoopUntil (300); #endif repaint(); originalClickCounter = removeOnMouseClick ? Desktop::getMouseButtonClickCounter() : std::numeric_limits<int>::max(); earliestTimeToDelete = Time::getCurrentTime() + RelativeTime::milliseconds (minimumTimeToDisplayFor); startTimer (50); }
void MainWindow::makeVisible() { setVisible (true); restoreWindowPosition(); addToDesktop(); getContentComponent()->grabKeyboardFocus(); }
void MainWindow::showNewProjectWizard() { jassert (currentProject == nullptr); setContentOwned (createNewProjectWizardComponent(), true); centreWithSize (900, 630); setVisible (true); addToDesktop(); getContentComponent()->grabKeyboardFocus(); }
DiagramToolbar::DiagramToolbar() : Component() , _dragger() , _parent() { setSize(60, 220); setOpaque(!Desktop::canUseSemiTransparentWindows()); addToDesktop(ComponentPeer::windowIsTemporary | ComponentPeer::windowHasDropShadow); }
void MainWindow::makeVisible() { restoreWindowPosition(); setVisible (true); addToDesktop(); // (must add before restoring size so that fullscreen will work) restoreWindowPosition(); getContentComponent()->grabKeyboardFocus(); }
void ResizableWindow::initialise (const bool shouldAddToDesktop) { defaultConstrainer.setMinimumOnscreenAmounts (0x10000, 16, 24, 16); lastNonFullScreenPos.setBounds (50, 50, 256, 256); if (shouldAddToDesktop) addToDesktop(); }
BEGIN_JUCE_NAMESPACE #include "juce_SystemTrayIconComponent.h" //============================================================================== SystemTrayIconComponent::SystemTrayIconComponent() { addToDesktop (0); }
void SplashScreen::makeVisible (int w, int h, bool useDropShadow) { clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter(); creationTime = Time::getCurrentTime(); setAlwaysOnTop (true); setVisible (true); centreWithSize (w, h); addToDesktop (useDropShadow ? ComponentPeer::windowHasDropShadow : 0); toFront (false); }
//============================================================================== VstPluginWindow::VstPluginWindow (PluginEditorWindowHolder* owner_, BasePlugin* plugin_) : DialogWindow (String::empty, Colours::beige, true, false), plugin (0), owner (owner_), specialEditor (0), nativeEditor (0), externalEditor (0), content (0) { DBG ("VstPluginWindow::VstPluginWindow"); // add to desktop addToDesktop (getDesktopWindowStyleFlags()); // setup window default values setTitleBarHeight (24); centreWithSize (400, 300); setWantsKeyboardFocus (true); setBackgroundColour (Config::getInstance ()->getColour (T("mainBackground"))); // try to move the window to its old position int oldX = -1, oldY = -1, oldW = -1, oldH = -1, lastPage = 0; if (plugin_) { oldX = plugin_->getIntValue (PROP_WINDOWXPOS, -1); oldY = plugin_->getIntValue (PROP_WINDOWYPOS, -1); oldW = plugin_->getIntValue (PROP_WINDOWWSIZE, -1); oldH = plugin_->getIntValue (PROP_WINDOWHSIZE, -1); lastPage = plugin_->getIntValue (PROP_WINDOWPAGE, 0); } // try to move the window to its old position if (oldX >= 0 && oldY >= 0) setTopLeftPosition (oldX, oldY); // try to set the window to its old size if ((lastPage == 0 && ! externalEditor) || (lastPage == 1 && externalEditor)) { if (oldW >= 0 && oldY >= 0) setSize (oldW, oldH); } // default plugin to open setPlugin (plugin_); // setMenuBar here, after setting the plugin, so the plugin's menu items are there immediately setMenuBar (this, getMenuBarHeight ()); // restore window to front toFront (false); setVisible (true); }
BluetoothMidiSelectorOverlay() { setAlwaysOnTop (true); setVisible (true); addToDesktop (ComponentPeer::windowHasDropShadow); setBounds (0, 0, getParentWidth(), getParentHeight()); toFront (true); addAndMakeVisible (bluetoothDevicesList); enterModalState (true, nullptr, true); }
void TooltipWindow::showFor (const String& tip) { jassert (tip.isNotEmpty()); if (tipShowing != tip) repaint(); tipShowing = tip; Point<int> mousePos (Desktop::getMousePosition()); Rectangle<int> parentArea; if (getParentComponent() != nullptr) { mousePos = getParentComponent()->getLocalPoint (nullptr, mousePos); parentArea = getParentComponent()->getLocalBounds(); } else { parentArea = Desktop::getInstance().getMonitorAreaContaining (mousePos); } int w, h; getLookAndFeel().getTooltipSize (tip, w, h); int x = mousePos.x; if (x > parentArea.getCentreX()) x -= (w + 12); else x += 24; int y = mousePos.y; if (y > parentArea.getCentreY()) y -= (h + 6); else y += 6; x = jlimit (parentArea.getX(), parentArea.getRight() - w, x); y = jlimit (parentArea.getY(), parentArea.getBottom() - h, y); setBounds (x, y, w, h); setVisible (true); if (getParentComponent() == nullptr) { addToDesktop (ComponentPeer::windowHasDropShadow | ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses); } toFront (false); }
ThemesDlg::ThemesDlg(QWidget *parent, const char *name) : QDialog(parent), m_newStuffInitialized(false) { setupUi(this); setObjectName( QLatin1String( name ) ); populateListbox(); connect(buttonAddToDesktop, SIGNAL(clicked()), this, SLOT(addToDesktop())); connect(tableThemes, SIGNAL(selected(int)), this, SLOT(selectionChanged(int))); connect(tableThemes, SIGNAL(itemDropped(QPoint,ThemeWidget*)), this, SLOT(addToDesktop(QPoint,ThemeWidget*))); connect(editSearch, SIGNAL(textChanged(QString)), this, SLOT(search(QString))); connect(comboShow, SIGNAL(activated(QString)), this, SLOT(search(QString))); }
void TooltipWindow::displayTip (Point<int> screenPos, const String& tip) { jassert (tip.isNotEmpty()); if (! reentrant) { ScopedValueSetter<bool> setter (reentrant, true, false); if (tipShowing != tip) { tipShowing = tip; repaint(); } if (auto* parent = getParentComponent()) { updatePosition (tip, parent->getLocalPoint (nullptr, screenPos), parent->getLocalBounds()); } else { updatePosition (tip, screenPos, Desktop::getInstance().getDisplays() .getDisplayContaining (screenPos).userArea); addToDesktop (ComponentPeer::windowHasDropShadow | ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses | ComponentPeer::windowIgnoresMouseClicks); } #if JUCE_DEBUG activeTooltipWindows.addIfNotAlreadyThere (this); for (auto* w : activeTooltipWindows) { if (w != this && w->tipShowing == tipShowing) { // Looks like you have more than one TooltipWindow showing the same tip.. // Be careful not to create more than one instance of this class! jassertfalse; } } #endif toFront (false); } }
ProxyComponent (Component& c) : image (c.createComponentSnapshot (c.getLocalBounds())) { setBounds (c.getBounds()); setTransform (c.getTransform()); setAlpha (c.getAlpha()); setInterceptsMouseClicks (false, false); if (Component* const parent = c.getParentComponent()) parent->addAndMakeVisible (this); else if (c.isOnDesktop() && c.getPeer() != nullptr) addToDesktop (c.getPeer()->getStyleFlags() | ComponentPeer::windowIgnoresKeyPresses); else jassertfalse; // seem to be trying to animate a component that's not visible.. setVisible (true); toBehind (&c); }
ShadowWindow (Component* comp, const DropShadow& ds) : target (comp), shadow (ds) { setVisible (true); setInterceptsMouseClicks (false, false); if (comp->isOnDesktop()) { setSize (1, 1); // to keep the OS happy by not having zero-size windows addToDesktop (ComponentPeer::windowIgnoresMouseClicks | ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses); } else if (Component* const parent = comp->getParentComponent()) { parent->addChildComponent (this); } }
ProxyComponent (Component& component) : image (component.createComponentSnapshot (component.getLocalBounds())) { setBounds (component.getBounds()); setAlpha (component.getAlpha()); setInterceptsMouseClicks (false, false); Component* const parent = component.getParentComponent(); if (parent != 0) parent->addAndMakeVisible (this); else if (component.isOnDesktop() && component.getPeer() != 0) addToDesktop (component.getPeer()->getStyleFlags()); else jassertfalse; // seem to be trying to animate a component that's not visible.. setVisible (true); toBehind (&component); }
void SplashScreen::makeVisible (int w, int h, bool useDropShadow, bool fullscreen) { clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter(); creationTime = Time::getCurrentTime(); const Rectangle<int> screenSize = Desktop::getInstance().getDisplays().getMainDisplay().userArea; const int width = (fullscreen ? screenSize.getWidth() : w); const int height = (fullscreen ? screenSize.getHeight() : h); setAlwaysOnTop (true); setVisible (true); centreWithSize (width, height); addToDesktop (useDropShadow ? ComponentPeer::windowHasDropShadow : 0); if (fullscreen) getPeer()->setFullScreen (true); toFront (false); }
ShadowWindow (Component& comp, const int shadowType, const Image imageSections [12]) : topLeft (imageSections [shadowType * 3]), bottomRight (imageSections [shadowType * 3 + 1]), filler (imageSections [shadowType * 3 + 2]), type (shadowType) { setInterceptsMouseClicks (false, false); if (comp.isOnDesktop()) { setSize (1, 1); // to keep the OS happy by not having zero-size windows addToDesktop (ComponentPeer::windowIgnoresMouseClicks | ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses); } else if (Component* const parent = comp.getParentComponent()) { parent->addChildComponent (this); } }
LoadingWindow::LoadingWindow() : DocumentWindow (String::empty, Colours::lightgrey, 0, false) { loadingComponent = new LoadingComponent(); addToDesktop(getDesktopWindowStyleFlags()); setTitleBarHeight(0); //set loading component to own the content of the loading window setContentOwned(loadingComponent, false); centreWithSize (500, 200); toFront(true); setVisible (true); }
ShadowWindow (Component& owner, const int type_, const Image shadowImageSections [12]) : topLeft (shadowImageSections [type_ * 3]), bottomRight (shadowImageSections [type_ * 3 + 1]), filler (shadowImageSections [type_ * 3 + 2]), type (type_) { setInterceptsMouseClicks (false, false); if (owner.isOnDesktop()) { setSize (1, 1); // to keep the OS happy by not having zero-size windows addToDesktop (ComponentPeer::windowIgnoresMouseClicks | ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses); } else if (owner.getParentComponent() != nullptr) { owner.getParentComponent()->addChildComponent (this); } }
CallOutBox::CallOutBox (Component& c, const Rectangle<int>& area, Component* const parent) : arrowSize (16.0f), content (c), dismissalMouseClicksAreAlwaysConsumed (false) { addAndMakeVisible (content); if (parent != nullptr) { parent->addChildComponent (this); updatePosition (area, parent->getLocalBounds()); setVisible (true); } else { setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows()); updatePosition (area, Desktop::getInstance().getDisplays() .getDisplayContaining (area.getCentre()).userArea); addToDesktop (ComponentPeer::windowIsTemporary); } }
CallOutBox::CallOutBox (Component& c, const Rectangle<int>& area, Component* const parent) : borderSpace (20), arrowSize (16.0f), content (c) { addAndMakeVisible (&content); if (parent != nullptr) { parent->addChildComponent (this); updatePosition (area, parent->getLocalBounds()); setVisible (true); } else { if (! JUCEApplication::isStandaloneApp()) setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level updatePosition (area, Desktop::getInstance().getDisplays() .getDisplayContaining (area.getCentre()).userArea); addToDesktop (ComponentPeer::windowIsTemporary); } }
void TooltipWindow::showFor (const String& tip) { jassert (tip.isNotEmpty()); if (tipShowing != tip) repaint(); tipShowing = tip; Point<int> mousePos (Desktop::getMousePosition()); if (getParentComponent() != 0) mousePos = getParentComponent()->getLocalPoint (0, mousePos); int x, y, w, h; getLookAndFeel().getTooltipSize (tip, w, h); if (mousePos.getX() > getParentWidth() / 2) x = mousePos.getX() - (w + 12); else x = mousePos.getX() + 24; if (mousePos.getY() > getParentHeight() / 2) y = mousePos.getY() - (h + 6); else y = mousePos.getY() + 6; setBounds (x, y, w, h); setVisible (true); if (getParentComponent() == 0) { addToDesktop (ComponentPeer::windowHasDropShadow | ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses); } toFront (false); }
ProxyComponent (Component& c) { setWantsKeyboardFocus (false); setBounds (c.getBounds()); setTransform (c.getTransform()); setAlpha (c.getAlpha()); setInterceptsMouseClicks (false, false); if (Component* const parent = c.getParentComponent()) parent->addAndMakeVisible (this); else if (c.isOnDesktop() && c.getPeer() != nullptr) addToDesktop (c.getPeer()->getStyleFlags() | ComponentPeer::windowIgnoresKeyPresses); else jassertfalse; // seem to be trying to animate a component that's not visible.. const float scale = (float) Desktop::getInstance().getDisplays() .getDisplayContaining (getScreenBounds().getCentre()).scale; image = c.createComponentSnapshot (c.getLocalBounds(), false, scale); setVisible (true); toBehind (&c); }
BEGIN_JUCE_NAMESPACE #include "juce_CallOutBox.h" #include "juce_ComponentPeer.h" #include "../lookandfeel/juce_LookAndFeel.h" #include "../../../application/juce_Application.h" //============================================================================== CallOutBox::CallOutBox (Component& contentComponent, Component& componentToPointTo, Component* const parentComponent) : borderSpace (20), arrowSize (16.0f), content (contentComponent) { addAndMakeVisible (&content); if (parentComponent != 0) { parentComponent->addChildComponent (this); updatePosition (parentComponent->getLocalArea (&componentToPointTo, componentToPointTo.getLocalBounds()), parentComponent->getLocalBounds()); setVisible (true); } else { if (! JUCEApplication::isStandaloneApp()) setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level updatePosition (componentToPointTo.getScreenBounds(), componentToPointTo.getParentMonitorArea()); addToDesktop (ComponentPeer::windowIsTemporary); } }
UploadWindow::UploadWindow() { setSize(96, 96); setOpaque(true); addToDesktop(0); setAlwaysOnTop(true); juce::Rectangle<int> rc = Desktop::getInstance().getDisplays().getMainDisplay().userArea; Settings* settings = Settings::getInstance(); if (settings->x == -1 || settings->y == -1 || !Desktop::getInstance().getDisplays().getTotalBounds(true).contains(settings->x, settings->y)) setTopLeftPosition(rc.getRight() - 96 - 7, rc.getBottom() - 96 - 7); else setTopLeftPosition(settings->x, settings->y); setVisible(true); #if defined (JUCE_WIN32) || defined (JUCE_LINUX) trayIcon = new TrayIcon(this); #endif #ifdef JUCE_MAC MenuBarModel::setMacMainMenu(this); #endif }
SystemTrayIconComponent::SystemTrayIconComponent() { addToDesktop (0); }