mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
Added method ComponentPeer::setRepresentedFile() (and used this in the introjucer app)
This commit is contained in:
parent
f3abe0b246
commit
a50977e2f9
4 changed files with 25 additions and 0 deletions
|
|
@ -496,19 +496,25 @@ void ProjectContentComponent::updateMainWindowTitle()
|
|||
if (MainWindow* mw = findParentComponentOfClass<MainWindow>())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -559,6 +559,10 @@ bool ComponentPeer::setDocumentEditedStatus (bool)
|
|||
return false;
|
||||
}
|
||||
|
||||
void ComponentPeer::setRepresentedFile (const File&)
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void ComponentPeer::clearMaskedRegion()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue