Cleanup wxPropertyGridInterface declarations
Move definitions of GetPropertyValueAs*() functions away from class declaration to avoid polluting the header.
This commit is contained in:
parent
ef20164efb
commit
1a31eef189
@ -433,11 +433,7 @@ public:
|
|||||||
// Returns value as wxVariant. To get wxObject pointer from it,
|
// Returns value as wxVariant. To get wxObject pointer from it,
|
||||||
// you will have to use WX_PG_VARIANT_TO_WXOBJECT(VARIANT,CLASSNAME) macro.
|
// you will have to use WX_PG_VARIANT_TO_WXOBJECT(VARIANT,CLASSNAME) macro.
|
||||||
// If property value is unspecified, wxNullVariant is returned.
|
// If property value is unspecified, wxNullVariant is returned.
|
||||||
wxVariant GetPropertyValue( wxPGPropArg id )
|
wxVariant GetPropertyValue(wxPGPropArg id);
|
||||||
{
|
|
||||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxVariant())
|
|
||||||
return p->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString GetPropertyValueAsString( wxPGPropArg id ) const;
|
wxString GetPropertyValueAsString( wxPGPropArg id ) const;
|
||||||
long GetPropertyValueAsLong( wxPGPropArg id ) const;
|
long GetPropertyValueAsLong( wxPGPropArg id ) const;
|
||||||
@ -450,58 +446,18 @@ public:
|
|||||||
bool GetPropertyValueAsBool( wxPGPropArg id ) const;
|
bool GetPropertyValueAsBool( wxPGPropArg id ) const;
|
||||||
double GetPropertyValueAsDouble( wxPGPropArg id ) const;
|
double GetPropertyValueAsDouble( wxPGPropArg id ) const;
|
||||||
|
|
||||||
#define wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(PGTypeName, DEFVAL) \
|
wxArrayString GetPropertyValueAsArrayString(wxPGPropArg id) const;
|
||||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFVAL) \
|
|
||||||
wxVariant value = p->GetValue(); \
|
|
||||||
if ( !value.IsType(PGTypeName) ) \
|
|
||||||
{ \
|
|
||||||
wxPGGetFailed(p, PGTypeName); \
|
|
||||||
return DEFVAL; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL_WFALLBACK(PGTypeName, DEFVAL) \
|
|
||||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFVAL) \
|
|
||||||
wxVariant value = p->GetValue(); \
|
|
||||||
if ( !value.IsType(PGTypeName) ) \
|
|
||||||
return DEFVAL; \
|
|
||||||
|
|
||||||
wxArrayString GetPropertyValueAsArrayString( wxPGPropArg id ) const
|
|
||||||
{
|
|
||||||
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_ARRSTRING,
|
|
||||||
wxArrayString())
|
|
||||||
return value.GetArrayString();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(wxLongLong_t) && wxUSE_LONGLONG
|
#if defined(wxLongLong_t) && wxUSE_LONGLONG
|
||||||
wxLongLong_t GetPropertyValueAsLongLong( wxPGPropArg id ) const
|
wxLongLong_t GetPropertyValueAsLongLong(wxPGPropArg id) const;
|
||||||
{
|
|
||||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
|
|
||||||
return p->GetValue().GetLongLong().GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxULongLong_t GetPropertyValueAsULongLong( wxPGPropArg id ) const
|
wxULongLong_t GetPropertyValueAsULongLong(wxPGPropArg id) const;
|
||||||
{
|
|
||||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
|
|
||||||
return p->GetValue().GetULongLong().GetValue();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxArrayInt GetPropertyValueAsArrayInt( wxPGPropArg id ) const
|
wxArrayInt GetPropertyValueAsArrayInt(wxPGPropArg id) const;
|
||||||
{
|
|
||||||
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxArrayInt_VariantType,
|
|
||||||
wxArrayInt())
|
|
||||||
wxArrayInt arr;
|
|
||||||
arr << value;
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxUSE_DATETIME
|
#if wxUSE_DATETIME
|
||||||
wxDateTime GetPropertyValueAsDateTime( wxPGPropArg id ) const
|
wxDateTime GetPropertyValueAsDateTime(wxPGPropArg id) const;
|
||||||
{
|
|
||||||
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_DATETIME,
|
|
||||||
wxDateTime())
|
|
||||||
return value.GetDateTime();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Returns a wxVariant list containing wxVariant versions of all
|
// Returns a wxVariant list containing wxVariant versions of all
|
||||||
|
@ -759,17 +759,10 @@ void wxPropertyGridInterface::SetPropertyCell( wxPGPropArg id,
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// GetPropertyValueAsXXX methods
|
// GetPropertyValueAsXXX methods
|
||||||
|
|
||||||
#define IMPLEMENT_GET_VALUE(TRET,PGTypeName,BIGNAME,DEFRETVAL) \
|
wxVariant wxPropertyGridInterface::GetPropertyValue(wxPGPropArg id)
|
||||||
TRET wxPropertyGridInterface::GetPropertyValueAs##BIGNAME( wxPGPropArg id ) const \
|
{
|
||||||
{ \
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxVariant())
|
||||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFRETVAL) \
|
return p->GetValue();
|
||||||
wxVariant value = p->GetValue(); \
|
|
||||||
if ( !value.IsType(PGTypeName) ) \
|
|
||||||
{ \
|
|
||||||
wxPGGetFailed(p, PGTypeName); \
|
|
||||||
return (TRET)DEFRETVAL; \
|
|
||||||
} \
|
|
||||||
return (TRET)value.Get##BIGNAME(); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// String is different from others.
|
// String is different from others.
|
||||||
@ -795,8 +788,62 @@ bool wxPropertyGridInterface::GetPropertyValueAsBool( wxPGPropArg id ) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_GET_VALUE(long,wxPG_VARIANT_TYPE_LONG,Long,0)
|
#define wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(PGTypeName, DEFVAL) \
|
||||||
IMPLEMENT_GET_VALUE(double,wxPG_VARIANT_TYPE_DOUBLE,Double,0.0)
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFVAL) \
|
||||||
|
wxVariant value = p->GetValue(); \
|
||||||
|
if ( !value.IsType(PGTypeName) ) \
|
||||||
|
{ \
|
||||||
|
wxPGGetFailed(p, PGTypeName); \
|
||||||
|
return DEFVAL; \
|
||||||
|
}
|
||||||
|
|
||||||
|
long wxPropertyGridInterface::GetPropertyValueAsLong(wxPGPropArg id) const
|
||||||
|
{
|
||||||
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_LONG, 0L)
|
||||||
|
return value.GetLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
double wxPropertyGridInterface::GetPropertyValueAsDouble(wxPGPropArg id) const
|
||||||
|
{
|
||||||
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_DOUBLE, 0.0)
|
||||||
|
return value.GetDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxArrayString wxPropertyGridInterface::GetPropertyValueAsArrayString(wxPGPropArg id) const
|
||||||
|
{
|
||||||
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_ARRSTRING, wxArrayString())
|
||||||
|
return value.GetArrayString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(wxLongLong_t) && wxUSE_LONGLONG
|
||||||
|
wxLongLong_t wxPropertyGridInterface::GetPropertyValueAsLongLong(wxPGPropArg id) const
|
||||||
|
{
|
||||||
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
|
||||||
|
return p->GetValue().GetLongLong().GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxULongLong_t wxPropertyGridInterface::GetPropertyValueAsULongLong(wxPGPropArg id) const
|
||||||
|
{
|
||||||
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
|
||||||
|
return p->GetValue().GetULongLong().GetValue();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxArrayInt wxPropertyGridInterface::GetPropertyValueAsArrayInt(wxPGPropArg id) const
|
||||||
|
{
|
||||||
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxArrayInt_VariantType, wxArrayInt())
|
||||||
|
wxArrayInt arr;
|
||||||
|
arr << value;
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_DATETIME
|
||||||
|
wxDateTime wxPropertyGridInterface::GetPropertyValueAsDateTime(wxPGPropArg id) const
|
||||||
|
{
|
||||||
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_DATETIME, wxDateTime())
|
||||||
|
return value.GetDateTime();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool wxPropertyGridInterface::IsPropertyExpanded( wxPGPropArg id ) const
|
bool wxPropertyGridInterface::IsPropertyExpanded( wxPGPropArg id ) const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user