From 6a0e4ead1ecaba0eda898b0d80a7002654ec4baa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 8 Jan 2012 14:52:47 +0000 Subject: [PATCH] Add wxTopLevelWindow::SetRepresentedFilename(). This currently is only implemented under OS X and sets the proxy icon there but could be implemented to do something useful under the other platforms too in the future. Closes #13797. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/osx/cocoa/private.h | 2 ++ include/wx/osx/core/private.h | 2 ++ include/wx/osx/toplevel.h | 2 ++ include/wx/toplevel.h | 2 ++ interface/wx/toplevel.h | 14 ++++++++++++++ src/osx/cocoa/nonownedwnd.mm | 5 +++++ src/osx/toplevel_osx.cpp | 5 +++++ 8 files changed, 33 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 7bf55bb1f9..c9efccc0d6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -544,6 +544,7 @@ All (GUI): - Allow customization of the locations where persistent settings are stored. - Restore support for reusing ids more than 254 times (Armel Asselin). - Added wxIMAGE_OPTION_ORIGINAL_{WIDTH,HEIGHT} (Catalin Raceanu). +- Add wxTopLevelWindow::SetRepresentedFilename() (Andrej Vodopivec). OSX: diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index a0a929df8d..0e3819505b 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -239,6 +239,8 @@ public : virtual void SetModified(bool modified); virtual bool IsModified() const; + virtual void SetRepresentedFilename(const wxString& filename); + wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } CGWindowLevel GetWindowLevel() const { return m_macWindowLevel; } diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index e9d8430204..7ccc7990b6 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -863,6 +863,8 @@ public : virtual void SetModified(bool WXUNUSED(modified)) { } virtual bool IsModified() const { return false; } + virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } + #if wxOSX_USE_IPHONE virtual CGFloat GetWindowLevel() const { return 0.0; } #else diff --git a/include/wx/osx/toplevel.h b/include/wx/osx/toplevel.h index bfb7a1a95f..58c8b19dc2 100644 --- a/include/wx/osx/toplevel.h +++ b/include/wx/osx/toplevel.h @@ -77,6 +77,8 @@ public: virtual void OSXSetModified(bool modified); virtual bool OSXIsModified() const; + virtual void SetRepresentedFilename(const wxString& filename); + protected: // common part of all ctors void Init(); diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index f57d7b8894..93e0bc9fe2 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -301,6 +301,8 @@ public: virtual void OSXSetModified(bool modified) { m_modified = modified; } virtual bool OSXIsModified() const { return m_modified; } + virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } + protected: // the frame client to screen translation should take account of the // toolbar which may shift the origin of the client area diff --git a/interface/wx/toplevel.h b/interface/wx/toplevel.h index 2656212f0b..d73afcbcbe 100644 --- a/interface/wx/toplevel.h +++ b/interface/wx/toplevel.h @@ -503,6 +503,20 @@ public: */ virtual bool OSXIsModified() const; + /** + Sets the file name represented by this wxTopLevelWindow. + + Under OS X, this file name is used to set the "proxy icon", which + appears in the window title bar near its title, corresponding to this + file name. Under other platforms it currently doesn't do anything but + it is harmless to call it now and it might be implemented to do + something useful in the future so you're encouraged to use it for any + window representing a file-based document. + + @since 2.9.4 + */ + virtual void SetRepresentedFilename(const wxString& filename); + /** Depending on the value of @a show parameter the window is either shown full screen or restored to its normal state. @a style is a bit list diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index f95db4d67a..31c0bad0cb 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -990,6 +990,11 @@ bool wxNonOwnedWindowCocoaImpl::IsModified() const return [m_macWindow isDocumentEdited]; } +void wxNonOwnedWindowCocoaImpl::SetRepresentedFilename(const wxString& filename) +{ + [m_macWindow setRepresentedFilename:wxCFStringRef(filename).AsNSString()]; +} + void wxNonOwnedWindowCocoaImpl::RestoreWindowLevel() { if ( [m_macWindow level] != m_macWindowLevel ) diff --git a/src/osx/toplevel_osx.cpp b/src/osx/toplevel_osx.cpp index 4f3d1a6d3a..b660d8f474 100644 --- a/src/osx/toplevel_osx.cpp +++ b/src/osx/toplevel_osx.cpp @@ -213,3 +213,8 @@ bool wxTopLevelWindowMac::OSXIsModified() const { return m_nowpeer->IsModified(); } + +void wxTopLevelWindowMac::SetRepresentedFilename(const wxString& filename) +{ + m_nowpeer->SetRepresentedFilename(filename); +} -- 2.45.2