Browse Source

Added method ComponentPeer::setRepresentedFile() (and used this in the introjucer app)

tags/2021-05-28
jules 13 years ago
parent
commit
a50977e2f9
4 changed files with 25 additions and 0 deletions
  1. +6
    -0
      extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp
  2. +8
    -0
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  3. +4
    -0
      modules/juce_gui_basics/windows/juce_ComponentPeer.cpp
  4. +7
    -0
      modules/juce_gui_basics/windows/juce_ComponentPeer.h

+ 6
- 0
extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp View File

@@ -496,19 +496,25 @@ void ProjectContentComponent::updateMainWindowTitle()
if (MainWindow* mw = findParentComponentOfClass<MainWindow>()) if (MainWindow* mw = findParentComponentOfClass<MainWindow>())
{ {
String title; String title;
File file;
bool edited = false; bool edited = false;
if (currentDocument != nullptr) if (currentDocument != nullptr)
{ {
title = currentDocument->getName(); title = currentDocument->getName();
edited = currentDocument->needsSaving(); edited = currentDocument->needsSaving();
file = currentDocument->getFile();
} }
if (ComponentPeer* peer = mw->getPeer()) if (ComponentPeer* peer = mw->getPeer())
{
if (! peer->setDocumentEditedStatus (edited)) if (! peer->setDocumentEditedStatus (edited))
if (edited) if (edited)
title << "*"; title << "*";
peer->setRepresentedFile (file);
}
mw->updateTitle (title); mw->updateTitle (title);
} }
} }


+ 8
- 0
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -213,6 +213,14 @@ public:
return true; 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) void setPosition (int x, int y)
{ {
setBounds (x, y, component.getWidth(), component.getHeight(), false); setBounds (x, y, component.getWidth(), component.getHeight(), false);


+ 4
- 0
modules/juce_gui_basics/windows/juce_ComponentPeer.cpp View File

@@ -559,6 +559,10 @@ bool ComponentPeer::setDocumentEditedStatus (bool)
return false; return false;
} }
void ComponentPeer::setRepresentedFile (const File&)
{
}
//============================================================================== //==============================================================================
void ComponentPeer::clearMaskedRegion() void ComponentPeer::clearMaskedRegion()
{ {


+ 7
- 0
modules/juce_gui_basics/windows/juce_ComponentPeer.h View File

@@ -127,6 +127,13 @@ public:
*/ */
virtual bool setDocumentEditedStatus (bool edited); 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. /** Moves the window without changing its size.


Loading…
Cancel
Save