void TopLevelWindow::setDropShadowEnabled (const bool useShadow) { useDropShadow = useShadow; if (isOnDesktop()) { shadower = nullptr; Component::addToDesktop (getDesktopWindowStyleFlags()); } else { if (useShadow && isOpaque()) { if (shadower == nullptr) { shadower = getLookAndFeel().createDropShadowerForComponent (this); if (shadower != nullptr) shadower->setOwner (this); } } else { shadower = nullptr; } } }
SettingsWindow::SettingsWindow () : DialogWindow (TRANS("Settings"), Colour (192,192,192), true, false) // do not add to desktop yet { SettingsPanel* contentComp = new SettingsPanel; setOpaque (true); //setDropShadowEnabled (false); // iOS doesn't have a native title bar //setUsingNativeTitleBar (true); // must happen AFTER setUsingNativeTitleBar() Component::addToDesktop (getDesktopWindowStyleFlags()); // must happen after addToDesktop() setContentOwned (contentComp, true); centreWithSize (getWidth(), getHeight()); setVisible (true); enterModalState (); }
void TopLevelWindow::recreateDesktopWindow() { if (isOnDesktop()) { Component::addToDesktop (getDesktopWindowStyleFlags()); toFront (true); } }
void TopLevelWindow::addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo) { /* It's not recommended to change the desktop window flags directly for a TopLevelWindow, because this class needs to make sure its layout corresponds with settings like whether it's got a native title bar or not. If you need custom flags for your window, you can override the getDesktopWindowStyleFlags() method. If you do this, it's best to call the base class's getDesktopWindowStyleFlags() method, then add or remove whatever flags are necessary from this value before returning it. */ jassert ((windowStyleFlags & ~ComponentPeer::windowIsSemiTransparent) == (getDesktopWindowStyleFlags() & ~ComponentPeer::windowIsSemiTransparent)); Component::addToDesktop (windowStyleFlags, nativeWindowToAttachTo); if (windowStyleFlags != getDesktopWindowStyleFlags()) sendLookAndFeelChange(); }
void ResizableWindow::lookAndFeelChanged() { resized(); if (isOnDesktop()) { Component::addToDesktop (getDesktopWindowStyleFlags()); updatePeerConstrainer(); } }
//============================================================================== 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); }
void ResizableWindow::lookAndFeelChanged() { resized(); if (isOnDesktop()) { Component::addToDesktop (getDesktopWindowStyleFlags()); if (ComponentPeer* const peer = getPeer()) peer->setConstrainer (constrainer); } }
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); }
void Window::getCommandInfo(const juce::CommandID commandID, juce::ApplicationCommandInfo& result) { switch (commandID) { case CommandIDs::closeWindow: { result.setInfo(TRANS("Close"), TRANS("Close Window"), CommandCategories::windows, 0); result.addDefaultKeypress('w', juce::ModifierKeys::commandModifier); result.setActive(getDesktopWindowStyleFlags() & allButtons || getDesktopWindowStyleFlags() & closeButton); break; } case CommandIDs::minimizeWindow: result.setInfo(TRANS("Minimize"), TRANS("Minimize Window"), CommandCategories::windows, 0); result.setActive(getDesktopWindowStyleFlags() & allButtons || getDesktopWindowStyleFlags() & minimiseButton); break; case CommandIDs::maximizeWindow: result.setInfo(TRANS("Maximize"), TRANS("Maximize Window"), CommandCategories::windows, 0); result.setActive(getDesktopWindowStyleFlags() & allButtons || getDesktopWindowStyleFlags() & maximiseButton); break; default: break; } }