]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxTLW::SetModified to allow apps to set the TLW's dirty state. On Mac this gives...
authorKevin Ollivier <kevino@theolliviers.com>
Mon, 7 Dec 2009 01:54:21 +0000 (01:54 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Mon, 7 Dec 2009 01:54:21 +0000 (01:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/cocoa/private.h
include/wx/osx/core/private.h
include/wx/osx/toplevel.h
include/wx/toplevel.h
interface/wx/toplevel.h
src/osx/cocoa/nonownedwnd.mm
src/osx/toplevel_osx.cpp

index caf331cf2a6514927f1d0be38f5c5c55a5d7e5aa..65991e48df83e21948284ebe390c19849fa44517 100644 (file)
@@ -244,6 +244,9 @@ public :
     virtual void WindowToScreen( int *x, int *y );
 
     virtual bool IsActive();
+    
+    virtual void SetModified(bool modified);
+    virtual bool GetModified() const;
 
     wxNonOwnedWindow*   GetWXPeer() { return m_wxPeer; }
 protected :
index 3326b1f1c8180b865989dc6045e09ba6f54b0180..59d4841241f021f03f9c8d033b8b00d03c90e5d9 100644 (file)
@@ -753,6 +753,9 @@ public :
 
     static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
     long style, long extraStyle, const wxString& name  ) ;
+    
+    virtual void SetModified(bool WXUNUSED(modified)) { }
+    virtual bool GetModified() const { return false; }
 
 protected :
     wxNonOwnedWindow*   m_wxPeer;
index 80ccb39ed50ac8b9a5a43ac14952058bcb8d9110..1e7f8644634a4fd2fe81f850a3113e14a5cf0d74 100644 (file)
@@ -75,6 +75,9 @@ public:
     virtual void SetTitle( const wxString& title);
     virtual wxString GetTitle() const;
 
+    virtual void SetModified(bool modified);
+    virtual bool GetModified() const;
+
 protected:
     // common part of all ctors
     void Init();
index 93490abc3c3c43195aac473ed0d4309c0c8bd492..53213dd885d2ab26aa7fb285f056136bba582385 100644 (file)
@@ -256,6 +256,9 @@ public:
     // a different API for SetSizeHints
     virtual void SetMinSize(const wxSize& minSize);
     virtual void SetMaxSize(const wxSize& maxSize);
+    
+    virtual void SetModified(bool modified) { m_modified = modified; }
+    virtual bool GetModified() const { return m_modified; }
 
 protected:
     // the frame client to screen translation should take account of the
@@ -304,6 +307,8 @@ protected:
 
     // a temporary override of m_winDefault, use the latter if NULL
     wxWindowRef m_winTmpDefault;
+    
+    bool m_modified;
 
     wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowBase);
     DECLARE_EVENT_TABLE()
index acb79b1c724a69840a5cac5d38ef183f9a49f593..d712256b500272ed61e70a318e63eb12b74f7bd5 100644 (file)
@@ -439,6 +439,18 @@ public:
         there are any open top level windows.
     */
     virtual bool ShouldPreventAppExit() const;
+    
+    /**
+        This function sets the wxTopLevelWindow's modified state, so that the 
+        wxTopLevelWindow can change its GUI to reflect the current state. (e.g. on 
+        Mac, the close button gets a black dot to reflect that there are unsaved changes)
+    */
+    virtual void SetModified(bool modified);
+    
+    /**
+        Returns the current modified state of the wxTopLevelWindow. 
+    */
+    virtual bool GetModified() const;
 
     /**
         Depending on the value of @a show parameter the window is either shown
index d17540c296f262d518ec92c477945b5f5c2f14f9..10098f74f53f32471c798f445e7929b508cd60dc 100644 (file)
@@ -727,6 +727,16 @@ bool wxNonOwnedWindowCocoaImpl::IsActive()
     return [m_macWindow isKeyWindow];
 }
 
+void wxNonOwnedWindowCocoaImpl::SetModified(bool modified)
+{
+    [m_macWindow setDocumentEdited:modified];
+}
+
+bool wxNonOwnedWindowCocoaImpl::GetModified() const
+{
+    return [m_macWindow isDocumentEdited];
+}
+
 wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
     long style, long extraStyle, const wxString& name )
 {
index 5ad97e65c3940b7e08b1c944bd2684e424bf9bc6..cd91ccb82b91aeb9d0679032f564a845e594151c 100644 (file)
@@ -186,3 +186,13 @@ bool wxTopLevelWindowMac::IsActive()
 {
     return m_nowpeer->IsActive();
 }
+
+void wxTopLevelWindowMac::SetModified(bool modified)
+{
+    m_nowpeer->SetModified(modified);
+}
+
+bool wxTopLevelWindowMac::GetModified() const
+{
+    return m_nowpeer->GetModified();
+}
\ No newline at end of file