Disabled top-level parent tracking by default (crashes with AUI), must now use wxPG_EX_ENABLE_TLP_TRACKING style to enable old behavior.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61779 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-08-29 08:09:45 +00:00
parent ef8f6d9590
commit 08c1613f88
6 changed files with 64 additions and 17 deletions

View File

@@ -923,6 +923,10 @@ without warnings or errors.
- wxPropertyGridInterface::GetExpandedProperties() is removed. You should - wxPropertyGridInterface::GetExpandedProperties() is removed. You should
now use wxPropertyGridInterface::GetEditableState() instead. 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. - Extended window style wxPG_EX_LEGACY_VALIDATORS was removed.
- wxPropertyGridManager now has same Get/SetSelection() semantics as - wxPropertyGridManager now has same Get/SetSelection() semantics as

View File

@@ -260,10 +260,27 @@ wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000,
selected). Other useful member functions are ClearSelection(), selected). Other useful member functions are ClearSelection(),
AddToSelection() and RemoveFromSelection(). 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. /** Combines various styles.
*/ */
#define wxPG_DEFAULT_STYLE (0) #define wxPG_DEFAULT_STYLE (0)

View File

@@ -165,17 +165,30 @@ wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000,
selected). Other useful member functions are ClearSelection(), selected). Other useful member functions are ClearSelection(),
AddToSelection() and RemoveFromSelection(). 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. /** Combines various styles.
*/ */
#define wxPG_DEFAULT_STYLE (0) #define wxPG_DEFAULT_STYLE (0)
/** Combines various styles. /** Combines various styles.
*/ */
#define wxPGMAN_DEFAULT_STYLE (0) #define wxPGMAN_DEFAULT_STYLE (0)
/** @} /** @}
*/ */

View File

@@ -2965,6 +2965,7 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) )
ADD_FLAG(wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES) ADD_FLAG(wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES)
ADD_FLAG(wxPG_EX_HIDE_PAGE_BUTTONS) ADD_FLAG(wxPG_EX_HIDE_PAGE_BUTTONS)
ADD_FLAG(wxPG_EX_MULTIPLE_SELECTION) ADD_FLAG(wxPG_EX_MULTIPLE_SELECTION)
ADD_FLAG(wxPG_EX_ENABLE_TLP_TRACKING)
wxMultiChoiceDialog dlg( this, wxT("Select extra window styles to use"), wxMultiChoiceDialog dlg( this, wxT("Select extra window styles to use"),
wxT("wxPropertyGrid Extra Style"), chs ); wxT("wxPropertyGrid Extra Style"), chs );
dlg.SetSelections(sel); dlg.SetSelections(sel);
@@ -3175,8 +3176,8 @@ bool cxApplication::OnInit()
//wxLocale Locale; //wxLocale Locale;
//Locale.Init(wxLANGUAGE_FINNISH); //Locale.Init(wxLANGUAGE_FINNISH);
FormMain* frame = Form1 = new FormMain( wxT("wxPropertyGrid Sample"), wxPoint(0,0), wxSize(300,500) ); FormMain* frame = Form1 = new FormMain( wxT("wxPropertyGrid Sample"), wxPoint(0,0), wxSize(300,500) );
frame->Show(true); frame->Show(true);
// //
// Parse command-line // Parse command-line
@@ -3195,7 +3196,7 @@ bool cxApplication::OnInit()
} }
} }
return true; return true;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@@ -1237,7 +1237,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxASSERT(wxPG_EX_INIT_NOCAT == 0x00001000); wxASSERT(wxPG_EX_INIT_NOCAT == 0x00001000);
for ( i=12; i<26; i++ ) for ( i=12; i<27; i++ )
{ {
int flag = 1<<i; int flag = 1<<i;
RT_MSG(wxString::Format(wxT("ExStyle: 0x%X"),flag)); RT_MSG(wxString::Format(wxT("ExStyle: 0x%X"),flag));

View File

@@ -555,7 +555,6 @@ void wxPropertyGrid::Init2()
m_tlp = NULL; m_tlp = NULL;
m_tlpClosed = NULL; m_tlpClosed = NULL;
m_tlpClosedTime = 0; m_tlpClosedTime = 0;
OnTLPChanging(::wxGetTopLevelParent(this));
// set virtual size to this window size // set virtual size to this window size
wxSize wndsize = GetSize(); wxSize wndsize = GetSize();
@@ -593,12 +592,16 @@ wxPropertyGrid::~wxPropertyGrid()
m_canvas->ReleaseMouse(); m_canvas->ReleaseMouse();
// Call with NULL to disconnect event handling // Call with NULL to disconnect event handling
OnTLPChanging(NULL); if ( GetExtraStyle() & wxPG_EX_ENABLE_TLP_TRACKING )
{
OnTLPChanging(NULL);
wxASSERT_MSG( !IsEditorsValueModified(), wxASSERT_MSG( !IsEditorsValueModified(),
wxS("Most recent change in property editor was lost!!! ") wxS("Most recent change in property editor was ")
wxS("(if you don't want this to happen, close your frames ") wxS("lost!!! (if you don't want this to happen, ")
wxS("and dialogs using Close(false).)") ); wxS("close your frames and dialogs using ")
wxS("Close(false).)") );
}
#if wxPG_DOUBLE_BUFFER #if wxPG_DOUBLE_BUFFER
if ( m_doubleBuffer ) if ( m_doubleBuffer )
@@ -1061,6 +1064,11 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
void wxPropertyGrid::SetExtraStyle( long exStyle ) 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 ( exStyle & wxPG_EX_NATIVE_DOUBLE_BUFFERING )
{ {
#if defined(__WXMSW__) #if defined(__WXMSW__)
@@ -1131,6 +1139,9 @@ wxSize wxPropertyGrid::DoGetBestSize() const
void wxPropertyGrid::OnTLPChanging( wxWindow* newTLP ) void wxPropertyGrid::OnTLPChanging( wxWindow* newTLP )
{ {
if ( newTLP == m_tlp )
return;
wxLongLong currentTime = ::wxGetLocalTimeMillis(); wxLongLong currentTime = ::wxGetLocalTimeMillis();
// //
@@ -5383,10 +5394,11 @@ void wxPropertyGrid::OnIdle( wxIdleEvent& WXUNUSED(event) )
// //
// Check if top-level parent has changed // Check if top-level parent has changed
wxWindow* tlp = ::wxGetTopLevelParent(this); if ( GetExtraStyle() & wxPG_EX_ENABLE_TLP_TRACKING )
if ( tlp != m_tlp )
{ {
OnTLPChanging(tlp); wxWindow* tlp = ::wxGetTopLevelParent(this);
if ( tlp != m_tlp )
OnTLPChanging(tlp);
} }
} }