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
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

View 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)

View File

@@ -165,7 +165,20 @@ 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
};

View 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);

View 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));

View 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
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).)") );
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,9 +5394,10 @@ void wxPropertyGrid::OnIdle( wxIdleEvent& WXUNUSED(event) )
//
// Check if top-level parent has changed
if ( GetExtraStyle() & wxPG_EX_ENABLE_TLP_TRACKING )
{
wxWindow* tlp = ::wxGetTopLevelParent(this);
if ( tlp != m_tlp )
{
OnTLPChanging(tlp);
}
}