-WX_PG_IMPLEMENT_VARIANT_DATA(wxPGVariantDataPoint, wxPoint)
-WX_PG_IMPLEMENT_VARIANT_DATA(wxPGVariantDataSize, wxSize)
-WX_PG_IMPLEMENT_VARIANT_DATA(wxPGVariantDataArrayInt, wxArrayInt)
-WX_PG_IMPLEMENT_VARIANT_DATA(wxPGVariantDataLongLong, wxLongLong)
-WX_PG_IMPLEMENT_VARIANT_DATA(wxPGVariantDataULongLong, wxULongLong)
-
-WX_PG_IMPLEMENT_WXOBJECT_VARIANT_DATA(wxPGVariantDataFont, wxFont)
-
-wxObject* wxPG_VariantToWxObject( const wxVariant& variant, wxClassInfo* classInfo )
-{
- if ( !variant.IsValueKindOf(classInfo) )
- return (wxObject*) NULL;
-
- wxVariantData* vdata = variant.GetData();
-
- wxPGVariantData* pgvdata = wxDynamicCastVariantData(vdata, wxPGVariantData);
- if ( pgvdata )
- return (wxObject*) pgvdata->GetValuePtr();
-
- if ( wxPGIsVariantClassInfo(wxPGVariantDataGetClassInfo(vdata), wxobject) )
- return variant.GetWxObjectPtr();
-
- return (wxObject*) NULL;
-}
-
-// -----------------------------------------------------------------------
-// wxVariant helpers
-// -----------------------------------------------------------------------
-
-long wxPGVariantToInt( const wxVariant& variant, long defVal )
-{
- if ( variant.IsNull() )
- return defVal;
-
- if ( wxPGIsVariantType(variant, long) )
- return variant.GetLong();
-
- if ( wxPGIsVariantType(variant, bool) )
- return variant.GetBool() ? 1 : 0;
-
- if ( typeid(*variant.GetData()) == typeid(wxPGVariantDataLongLong) )
- {
- wxLongLong ll = ((const wxPGVariantDataLongLong&)variant).GetValue();
- if ( ll >= LONG_MAX )
- return LONG_MAX;
- else if ( ll <= LONG_MIN )
- return LONG_MIN;
- return ll.ToLong();
- }
-
- long l = defVal;
-
- if ( wxPGIsVariantType(variant, string) )
- variant.GetString().ToLong(&l, 0);
-
- return l;
-}
-
-// -----------------------------------------------------------------------
-
-bool wxPGVariantToLongLong( const wxVariant& variant, wxLongLong_t* pResult )
-{
- if ( variant.IsNull() )
- return false;
-
- if ( wxPGIsVariantType(variant, long) )
- {
- *pResult = variant.GetLong();
- return true;
- }
-
- if ( typeid(*variant.GetData()) == typeid(wxPGVariantDataLongLong) )
- {
- *pResult = ((const wxPGVariantDataLongLong&)variant).GetValue().GetValue();
- return true;
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-bool wxPGVariantToULongLong( const wxVariant& variant, wxULongLong_t* pResult )
-{
- if ( variant.IsNull() )
- return false;
-
- if ( wxPGIsVariantType(variant, long) )
- {
- *pResult = (unsigned long)variant.GetLong();
- return true;
- }
-
- if ( typeid(*variant.GetData()) == typeid(wxPGVariantDataULongLong) )
- {
- *pResult = ((const wxPGVariantDataULongLong&)variant).GetValue().GetValue();
- return true;
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-bool wxPGVariantToDouble( const wxVariant& variant, double* pResult )
-{
- if ( variant.IsNull() )
- return false;
-
- if ( wxPGIsVariantType(variant, double) )
- {
- *pResult = variant.GetDouble();
- return true;
- }
-
- if ( wxPGIsVariantType(variant, long) )
- {
- *pResult = (double)variant.GetLong();
- return true;
- }
-
- if ( typeid(*variant.GetData()) == typeid(wxPGVariantDataLongLong) )
- {
- wxLongLong ll = ((const wxPGVariantDataLongLong&)variant).GetValue();
- *pResult = ll.ToDouble();
- return true;
- }
-
- if ( wxPGIsVariantType(variant, string) )
- if ( variant.GetString().ToDouble(pResult) )
- return true;
-
- return false;
-}