diff --git a/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp b/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp index 6db164c38a..45c45fad06 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp @@ -496,19 +496,25 @@ void ProjectContentComponent::updateMainWindowTitle() if (MainWindow* mw = findParentComponentOfClass()) { String title; + File file; bool edited = false; if (currentDocument != nullptr) { title = currentDocument->getName(); edited = currentDocument->needsSaving(); + file = currentDocument->getFile(); } if (ComponentPeer* peer = mw->getPeer()) + { if (! peer->setDocumentEditedStatus (edited)) if (edited) title << "*"; + peer->setRepresentedFile (file); + } + mw->updateTitle (title); } } diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 00cd161737..2684c2b297 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -213,6 +213,14 @@ public: return true; } + void setRepresentedFile (const File& file) + { + if (! isSharedWindow) + [window setRepresentedFilename: juceStringToNS (file != File::nonexistent + ? file.getFullPathName() + : String::empty)]; + } + void setPosition (int x, int y) { setBounds (x, y, component.getWidth(), component.getHeight(), false); diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 580d821bf9..f545b5263b 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -559,6 +559,10 @@ bool ComponentPeer::setDocumentEditedStatus (bool) return false; } +void ComponentPeer::setRepresentedFile (const File&) +{ +} + //============================================================================== void ComponentPeer::clearMaskedRegion() { diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.h b/modules/juce_gui_basics/windows/juce_ComponentPeer.h index 98227240dd..76898b4e00 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.h +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.h @@ -127,6 +127,13 @@ public: */ virtual bool setDocumentEditedStatus (bool edited); + /** If this type of window is capable of indicating that it represents a file, then + this lets you set the file. + + E.g. in OSX it'll show an icon for the file in the title bar. + */ + virtual void setRepresentedFile (const File&); + //============================================================================== /** Moves the window without changing its size.