X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03647350fc7cd141953c72e0284e928847d30f44..eea4d01c65f9b29baa1193db762b4c6b8144af24:/src/propgrid/propgridiface.cpp diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index c0e9b5e46e..5f66781a81 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -6,7 +6,7 @@ // Created: 2008-08-24 // RCS-ID: $Id$ // Copyright: (c) Jaakko Salli -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -73,10 +73,8 @@ wxPGProperty* wxPGPropArgCls::GetPtr( wxPropertyGridInterface* iface ) const return iface->GetPropertyByNameA(*m_ptr.stringName); else if ( m_flags & IsCharPtr ) return iface->GetPropertyByNameA(m_ptr.charName); -#if wxUSE_WCHAR_T else if ( m_flags & IsWCharPtr ) return iface->GetPropertyByNameA(m_ptr.wcharName); -#endif return NULL; } @@ -166,10 +164,6 @@ wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id ) state->DoDelete( p, false ); - // Mark the property as 'unattached' - p->m_parentState = NULL; - p->m_parent = NULL; - RefreshGrid(state); return p; @@ -216,7 +210,11 @@ wxPGProperty* wxPropertyGridInterface::GetSelection() const bool wxPropertyGridInterface::ClearSelection( bool validation ) { - return DoClearSelection(validation, wxPG_SEL_DONT_SEND_EVENT); + bool res = DoClearSelection(validation, wxPG_SEL_DONT_SEND_EVENT); + wxPropertyGrid* pg = GetPropertyGrid(); + if ( pg ) + pg->Refresh(); + return res; } // ----------------------------------------------------------------------- @@ -266,7 +264,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable ) return false; // If active, Set active Editor. - if ( grid->GetState() == state && p == grid->GetSelection() ) + if ( grid && grid->GetState() == state && p == grid->GetSelection() ) grid->DoSelectProperty( p, wxPG_SEL_FORCE ); } else @@ -275,11 +273,11 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable ) return false; // If active, Disable as active Editor. - if ( grid->GetState() == state && p == grid->GetSelection() ) + if ( grid && grid->GetState() == state && p == grid->GetSelection() ) grid->DoSelectProperty( p, wxPG_SEL_FORCE ); } - state->DoEnableProperty(p, enable); + p->DoEnable(enable); RefreshProperty( p ); @@ -346,6 +344,7 @@ void wxPropertyGridInterface::ClearModifiedStatus() if ( !page ) break; page->DoGetRoot()->SetFlagRecursively(wxPG_PROP_MODIFIED, false); + page->m_anyModified = false; pageIndex++; } @@ -354,6 +353,17 @@ void wxPropertyGridInterface::ClearModifiedStatus() GetPropertyGrid()->RefreshEditor(); } +bool wxPropertyGridInterface::SetColumnProportion( unsigned int column, + int proportion ) +{ + wxCHECK(m_pState, false); + wxPropertyGrid* pg = m_pState->GetGrid(); + wxCHECK(pg, false); + wxCHECK(pg->HasFlag(wxPG_SPLITTER_AUTO_CENTER), false); + m_pState->DoSetColumnProportion(column, proportion); + return true; +} + // ----------------------------------------------------------------------- // wxPropertyGridInterface property value setting and getting // ----------------------------------------------------------------------- @@ -582,8 +592,6 @@ void wxPropertyGridInterface::Sort( int flags ) { wxPropertyGrid* pg = GetPropertyGrid(); - pg->DoClearSelection(); - unsigned int pageIndex = 0; for (;;) @@ -593,6 +601,10 @@ void wxPropertyGridInterface::Sort( int flags ) page->DoSort(flags); pageIndex++; } + + // Fix positions of any open editor controls + if ( pg ) + pg->CorrectEditorWidgetPosY(); } // ----------------------------------------------------------------------- @@ -648,22 +660,22 @@ bool wxPropertyGridInterface::SetPropertyMaxLength( wxPGPropArg id, int maxLen ) void wxPropertyGridInterface::SetPropertyBackgroundColour( wxPGPropArg id, const wxColour& colour, - bool recursively ) + int flags ) { wxPG_PROP_ARG_CALL_PROLOG() - p->SetBackgroundColour( colour, recursively ); - RefreshProperty( p ); + p->SetBackgroundColour(colour, flags); + RefreshProperty(p); } // ----------------------------------------------------------------------- void wxPropertyGridInterface::SetPropertyTextColour( wxPGPropArg id, const wxColour& colour, - bool recursively ) + int flags ) { wxPG_PROP_ARG_CALL_PROLOG() - p->SetTextColour( colour, recursively ); - RefreshProperty( p ); + p->SetTextColour(colour, flags); + RefreshProperty(p); } // ----------------------------------------------------------------------- @@ -687,7 +699,7 @@ void wxPropertyGridInterface::SetPropertyCell( wxPGPropArg id, wxPG_PROP_ARG_CALL_PROLOG() wxPGCell& cell = p->GetCell(column); - if ( text.length() && text != wxPG_LABEL ) + if ( !text.empty() && text != wxPG_LABEL ) cell.SetText(text); if ( bitmap.IsOk() ) cell.SetBitmap(bitmap); @@ -920,7 +932,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const } // Remove last '|' - if ( result.length() ) + if ( !result.empty() ) result.RemoveLast(); return result; @@ -1022,13 +1034,13 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res { if ( pageState->IsDisplayed() ) { - if ( values[0].length() ) + if ( !values[0].empty() ) newSelection = GetPropertyByName(value); pgSelectionSet = true; } else { - if ( values[0].length() ) + if ( !values[0].empty() ) pageState->DoSetSelection(GetPropertyByName(value)); else pageState->DoClearSelection();