Prepare wxPG to build successfully when wxUSE_LONGLONG or wxUSE_DATETIME is disabled.

Make the code ready to build even when wxLongLong and wxDateTime types are not available.
This commit is contained in:
Artur Wieczorek
2015-04-03 21:12:19 +02:00
parent cc575a7a89
commit 7c6943175b
6 changed files with 145 additions and 59 deletions

View File

@@ -656,10 +656,13 @@ template<> inline wxVariant WXVARIANT( const wxColour& value )
#define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
#define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
#define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
#if wxUSE_DATETIME
#define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
#endif
#if wxUSE_LONGLONG
#define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong")
#define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong")
#endif
#endif // !SWIG
// -----------------------------------------------------------------------

View File

@@ -555,7 +555,7 @@ public:
return value.GetArrayString();
}
#ifdef wxLongLong_t
#if defined(wxLongLong_t) && wxUSE_LONGLONG
wxLongLong_t GetPropertyValueAsLongLong( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
@@ -1217,19 +1217,19 @@ public:
SetPropVal( id, v );
}
#ifdef wxLongLong_t
#if wxUSE_LONGLONG
/** Sets value (wxLongLong&) of a property.
*/
void SetPropertyValue( wxPGPropArg id, wxLongLong_t value )
void SetPropertyValue( wxPGPropArg id, wxLongLong value )
{
wxVariant v = WXVARIANT(wxLongLong(value));
wxVariant v = WXVARIANT(value);
SetPropVal( id, v );
}
/** Sets value (wxULongLong&) of a property.
*/
void SetPropertyValue( wxPGPropArg id, wxULongLong_t value )
void SetPropertyValue( wxPGPropArg id, wxULongLong value )
{
wxVariant v = WXVARIANT(wxULongLong(value));
wxVariant v = WXVARIANT(value);
SetPropVal( id, v );
}
#endif

View File

@@ -192,7 +192,7 @@ public:
@code
wxLongLong value;
wxVariant variant = property->GetValue();
if ( variant.GetType() == "longlong" )
if ( variant.IsType("longlong") )
value = variant.GetLongLong();
else
value = variant.GetLong();
@@ -223,9 +223,11 @@ public:
long value = 0 );
virtual ~wxIntProperty();
#if wxUSE_LONGLONG
wxIntProperty( const wxString& label,
const wxString& name,
const wxLongLong& value );
#endif
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
virtual bool StringToValue( wxVariant& variant,
const wxString& text,
@@ -238,13 +240,20 @@ public:
static wxValidator* GetClassValidator();
virtual wxValidator* DoGetValidator() const;
/** Validation helper.
/** Validation helpers.
*/
#if defined(wxLongLong_t) && wxUSE_LONGLONG
static bool DoValidation( const wxPGProperty* property,
wxLongLong_t& value,
wxPGValidationInfo* pValidationInfo,
int mode =
wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
#endif
static bool DoValidation(const wxPGProperty* property,
long& value,
wxPGValidationInfo* pValidationInfo,
int mode =
wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
protected:
};
@@ -277,9 +286,11 @@ public:
const wxString& name = wxPG_LABEL,
unsigned long value = 0 );
virtual ~wxUIntProperty();
#if wxUSE_LONGLONG
wxUIntProperty( const wxString& label,
const wxString& name,
const wxULongLong& value );
#endif
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
virtual bool StringToValue( wxVariant& variant,
const wxString& text,
@@ -291,12 +302,25 @@ public:
virtual bool IntToValue( wxVariant& variant,
int number,
int argFlags = 0 ) const;
protected:
wxByte m_base;
wxByte m_realBase; // translated to 8,16,etc.
wxByte m_prefix;
private:
void Init();
// Validation helpers.
#if defined(wxULongLong_t) && wxUSE_LONGLONG
static bool DoValidation(const wxPGProperty* property,
wxULongLong_t& value,
wxPGValidationInfo* pValidationInfo,
int mode =wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
#endif
static bool DoValidation(const wxPGProperty* property,
long& value,
wxPGValidationInfo* pValidationInfo,
int mode = wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
};
// -----------------------------------------------------------------------