]> git.saurik.com Git - wxWidgets.git/commitdiff
Disabled top-level parent tracking by default (crashes with AUI), must now use wxPG_E...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 29 Aug 2009 08:09:45 +0000 (08:09 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 29 Aug 2009 08:09:45 +0000 (08:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61779 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/doxygen/overviews/propgrid.h
include/wx/propgrid/propgrid.h
interface/wx/propgrid/propgrid.h
samples/propgrid/propgrid.cpp
samples/propgrid/tests.cpp
src/propgrid/propgrid.cpp

index 4029cc907af834a71ab52b358f343e694123da74..c3798068a703f356b511a1dbb12a42fce4fc12f2 100644 (file)
@@ -923,6 +923,10 @@ without warnings or errors.
   - wxPropertyGridInterface::GetExpandedProperties() is removed. You should
     now use wxPropertyGridInterface::GetEditableState() instead.
 
+  - wxPG_EX_DISABLE_TLP_TRACKING is now enabled by default. To get the old
+    behavior (recommended if you don't use a system that reparents the grid
+    on its own), use the wxPG_EX_ENABLE_TLP_TRACKING extra style.
+
   - Extended window style wxPG_EX_LEGACY_VALIDATORS was removed.
 
   - wxPropertyGridManager now has same Get/SetSelection() semantics as
index aa6c9cea1b61bfa4b6836e79b13138992250a969..a46583491e75c66e43bca0b2b3cff1da88cee8f0 100644 (file)
@@ -260,10 +260,27 @@ wxPG_EX_HIDE_PAGE_BUTTONS               = 0x01000000,
     selected). Other useful member functions are ClearSelection(),
     AddToSelection() and RemoveFromSelection().
 */
-wxPG_EX_MULTIPLE_SELECTION              = 0x02000000
+wxPG_EX_MULTIPLE_SELECTION              = 0x02000000,
+
+/**
+    This enables top-level window tracking which allows wxPropertyGrid to
+    notify the application of last-minute property value changes by user.
+
+    This style is not enabled by default because it may cause crashes when
+    wxPropertyGrid is used in with wxAUI or similar system.
+
+    @remarks If you are not in fact using any system that may change
+             wxPropertyGrid's top-level parent window on its own, then you
+             are recommended to enable this style.
+*/
+wxPG_EX_ENABLE_TLP_TRACKING             = 0x04000000
 
 };
 
+#if wxPG_COMPATIBILITY_1_4
+    #define wxPG_EX_DISABLE_TLP_TRACKING    0x00000000
+#endif
+
 /** Combines various styles.
 */
 #define wxPG_DEFAULT_STYLE          (0)
index bfe94e4bc583140b665fffb5cd61c30912745393..622be65cf46e89d6fd8136892a3465ea5cf91c0d 100644 (file)
@@ -165,17 +165,30 @@ wxPG_EX_HIDE_PAGE_BUTTONS               = 0x01000000,
     selected). Other useful member functions are ClearSelection(),
     AddToSelection() and RemoveFromSelection().
 */
-wxPG_EX_MULTIPLE_SELECTION              = 0x02000000
+wxPG_EX_MULTIPLE_SELECTION              = 0x02000000,
+
+/**
+    This enables top-level window tracking which allows wxPropertyGrid to
+    notify the application of last-minute property value changes by user.
+
+    This style is not enabled by default because it may cause crashes when
+    wxPropertyGrid is used in with wxAUI or similar system.
+
+    @remarks If you are not in fact using any system that may change
+             wxPropertyGrid's top-level parent window on its own, then you
+             are recommended to enable this style.
+*/
+wxPG_EX_ENABLE_TLP_TRACKING             = 0x04000000
 
 };
 
 /** Combines various styles.
 */
-#define wxPG_DEFAULT_STYLE             (0)
+#define wxPG_DEFAULT_STYLE          (0)
 
 /** Combines various styles.
 */
-#define wxPGMAN_DEFAULT_STYLE      (0)
+#define wxPGMAN_DEFAULT_STYLE       (0)
 
 /** @}
 */
index c148abf8a15551a1b9733af21c7a572ce1f4e835..d31328837ab0898975118108cb78d2c9d53ff17f 100644 (file)
@@ -2965,6 +2965,7 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) )
         ADD_FLAG(wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES)
         ADD_FLAG(wxPG_EX_HIDE_PAGE_BUTTONS)
         ADD_FLAG(wxPG_EX_MULTIPLE_SELECTION)
+        ADD_FLAG(wxPG_EX_ENABLE_TLP_TRACKING)
         wxMultiChoiceDialog dlg( this, wxT("Select extra window styles to use"),
                                  wxT("wxPropertyGrid Extra Style"), chs );
         dlg.SetSelections(sel);
@@ -3175,8 +3176,8 @@ bool cxApplication::OnInit()
     //wxLocale Locale;
     //Locale.Init(wxLANGUAGE_FINNISH);
 
-       FormMain* frame = Form1 = new FormMain( wxT("wxPropertyGrid Sample"), wxPoint(0,0), wxSize(300,500) );
-       frame->Show(true);
+    FormMain* frame = Form1 = new FormMain( wxT("wxPropertyGrid Sample"), wxPoint(0,0), wxSize(300,500) );
+    frame->Show(true);
 
     //
     // Parse command-line
@@ -3195,7 +3196,7 @@ bool cxApplication::OnInit()
         }
     }
 
-       return true;
+    return true;
 }
 
 // -----------------------------------------------------------------------
index c2b5e5b953bf6891d12390dc5b9421e2610750da..28d553b068f1aaf9b848957c9b62bc9d937b8d46 100644 (file)
@@ -1237,7 +1237,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
 
         wxASSERT(wxPG_EX_INIT_NOCAT == 0x00001000);
 
-        for ( i=12; i<26; i++ )
+        for ( i=12; i<27; i++ )
         {
             int flag = 1<<i;
             RT_MSG(wxString::Format(wxT("ExStyle: 0x%X"),flag));
index fa85a9ae7ee2ebdaa5ea84c9a917aaa3d8cd6770..45fd19645c054381774efaea8268da6926d55049 100644 (file)
@@ -555,7 +555,6 @@ void wxPropertyGrid::Init2()
     m_tlp = NULL;
     m_tlpClosed = NULL;
     m_tlpClosedTime = 0;
-    OnTLPChanging(::wxGetTopLevelParent(this));
 
     // set virtual size to this window size
     wxSize wndsize = GetSize();
@@ -593,12 +592,16 @@ wxPropertyGrid::~wxPropertyGrid()
         m_canvas->ReleaseMouse();
 
     // Call with NULL to disconnect event handling
-    OnTLPChanging(NULL);
+    if ( GetExtraStyle() & wxPG_EX_ENABLE_TLP_TRACKING )
+    {
+        OnTLPChanging(NULL);
 
-    wxASSERT_MSG( !IsEditorsValueModified(),
-                  wxS("Most recent change in property editor was lost!!! ")
-                  wxS("(if you don't want this to happen, close your frames ")
-                  wxS("and dialogs using Close(false).)") );
+        wxASSERT_MSG( !IsEditorsValueModified(),
+                      wxS("Most recent change in property editor was ")
+                      wxS("lost!!! (if you don't want this to happen, ")
+                      wxS("close your frames and dialogs using ")
+                      wxS("Close(false).)") );
+    }
 
 #if wxPG_DOUBLE_BUFFER
     if ( m_doubleBuffer )
@@ -1061,6 +1064,11 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
 
 void wxPropertyGrid::SetExtraStyle( long exStyle )
 {
+    if ( exStyle & wxPG_EX_ENABLE_TLP_TRACKING )
+        OnTLPChanging(::wxGetTopLevelParent(this));
+    else
+        OnTLPChanging(NULL);
+
     if ( exStyle & wxPG_EX_NATIVE_DOUBLE_BUFFERING )
     {
 #if defined(__WXMSW__)
@@ -1131,6 +1139,9 @@ wxSize wxPropertyGrid::DoGetBestSize() const
 
 void wxPropertyGrid::OnTLPChanging( wxWindow* newTLP )
 {
+    if ( newTLP == m_tlp )
+        return;
+
     wxLongLong currentTime = ::wxGetLocalTimeMillis();
 
     //
@@ -5383,10 +5394,11 @@ void wxPropertyGrid::OnIdle( wxIdleEvent& WXUNUSED(event) )
 
     //
     // Check if top-level parent has changed
-    wxWindow* tlp = ::wxGetTopLevelParent(this);
-    if ( tlp != m_tlp )
+    if ( GetExtraStyle() & wxPG_EX_ENABLE_TLP_TRACKING )
     {
-        OnTLPChanging(tlp);
+        wxWindow* tlp = ::wxGetTopLevelParent(this);
+        if ( tlp != m_tlp )
+            OnTLPChanging(tlp);
     }
 }