Code cleanup: Define wxPGProperty and wxPropertyGridPageState functions in their own class files

Having definitions of several wxPGProperty and wxPropertyGridPageState functions in wxPropertyGrid header is misleading so they should be moved to the files with their own classes definitions for the sake of clarity.
This commit is contained in:
Artur Wieczorek
2019-05-26 01:13:08 +02:00
parent d8f04a7bb1
commit 908342e3ad
5 changed files with 63 additions and 68 deletions

View File

@@ -2824,6 +2824,54 @@ void wxPGProperty::SubPropsChanged( int oldSelInd )
}
}
wxString wxPGProperty::GetHintText() const
{
wxVariant vHintText = GetAttribute(wxPG_ATTR_HINT);
#if wxPG_COMPATIBILITY_1_4
// Try the old, deprecated "InlineHelp"
if ( vHintText.IsNull() )
vHintText = GetAttribute(wxPG_ATTR_INLINE_HELP);
#endif
if ( !vHintText.IsNull() )
return vHintText.GetString();
return wxEmptyString;
}
int wxPGProperty::GetDisplayedCommonValueCount() const
{
if ( HasFlag(wxPG_PROP_USES_COMMON_VALUE) )
{
wxPropertyGrid* pg = GetGrid();
if ( pg )
return (int)pg->GetCommonValueCount();
}
return 0;
}
void wxPGProperty::SetDefaultValue(wxVariant& value)
{
SetAttribute(wxPG_ATTR_DEFAULT_VALUE, value);
}
void wxPGProperty::SetEditor(const wxString& editorName)
{
m_customEditor = wxPropertyGridInterface::GetEditorByName(editorName);
}
bool wxPGProperty::SetMaxLength(int maxLen)
{
const wxPGEditor* editorClass = GetEditorClass();
if ( editorClass != wxPGEditor_TextCtrl &&
editorClass != wxPGEditor_TextCtrlAndButton )
return false;
m_maxLen = wxMax(maxLen, 0); // shouldn't be a nagative value
return true;
}
// -----------------------------------------------------------------------
// wxPGRootProperty
// -----------------------------------------------------------------------

View File

@@ -2105,6 +2105,16 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
VirtualHeightChanged();
}
bool wxPropertyGridPageState::IsDisplayed() const
{
return (this == m_pPropGrid->GetState());
}
unsigned int wxPropertyGridPageState::GetActualVirtualHeight() const
{
return DoGetRoot()->GetChildrenHeight(GetGrid()->GetRowHeight());
}
// -----------------------------------------------------------------------
#endif // wxUSE_PROPGRID