if ( name == wxPG_STRING_PASSWORD )
{
m_flags &= ~(wxPG_PROP_PASSWORD);
- if ( wxPGVariantToInt(value) ) m_flags |= wxPG_PROP_PASSWORD;
+ if ( value.GetLong() ) m_flags |= wxPG_PROP_PASSWORD;
RecreateEditor();
return false;
}
{
return wxString::Format(wxS("%li"),value.GetLong());
}
- else if ( value.GetType() == wxLongLong_VariantType )
+ else if ( value.GetType() == wxPG_VARIANT_TYPE_LONGLONG )
{
- wxLongLong ll;
- ll << value;
- return ll.ToString();
+ wxLongLong ll = value.GetLongLong();
+ return ll.ToString();
}
return wxEmptyString;
{
bool doChangeValue = isPrevLong;
- if ( !isPrevLong && variantType == wxLongLong_VariantType )
+ if ( !isPrevLong && variantType == wxPG_VARIANT_TYPE_LONGLONG )
{
- wxLongLong oldValue;
- oldValue << variant;
+ wxLongLong oldValue = variant.GetLongLong();
if ( oldValue.GetValue() != value64 )
doChangeValue = true;
}
if ( doChangeValue )
{
wxLongLong ll(value64);
- variant << ll;
+ variant = ll;
return true;
}
}
variant = property->GetAttribute(wxPGGlobalVars->m_strMin);
if ( !variant.IsNull() )
{
- wxPGVariantToLongLong(variant, &min);
+ min = variant.GetLongLong().GetValue();
minOk = true;
}
variant = property->GetAttribute(wxPGGlobalVars->m_strMax);
if ( !variant.IsNull() )
{
- wxPGVariantToLongLong(variant, &max);
+ max = variant.GetLongLong().GetValue();
maxOk = true;
}
return true;
}
-bool wxIntProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& validationInfo ) const
+bool wxIntProperty::ValidateValue( wxVariant& value,
+ wxPGValidationInfo& validationInfo ) const
{
- wxLongLong_t ll;
- if ( wxPGVariantToLongLong(value, &ll) )
- return DoValidation(this, ll, &validationInfo, wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
- return true;
+ wxLongLong_t ll = value.GetLongLong().GetValue();
+ return DoValidation(this, ll, &validationInfo,
+ wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
}
wxValidator* wxIntProperty::GetClassValidator()
if ( value.GetType() == wxPG_VARIANT_TYPE_LONG )
{
- return wxString::Format(gs_uintTemplates32[index], (unsigned long)value.GetLong());
+ return wxString::Format(gs_uintTemplates32[index],
+ (unsigned long)value.GetLong());
}
- wxULongLong ull;
- ull << value;
+ wxULongLong ull = value.GetULongLong();
return wxString::Format(gs_uintTemplates64[index], ull.GetValue());
}
{
bool doChangeValue = isPrevLong;
- if ( !isPrevLong && variantType == wxULongLong_VariantType )
+ if ( !isPrevLong && variantType == wxPG_VARIANT_TYPE_ULONGLONG )
{
- wxULongLong oldValue;
- oldValue << variant;
+ wxULongLong oldValue = variant.GetULongLong();
if ( oldValue.GetValue() != value64 )
doChangeValue = true;
}
if ( doChangeValue )
{
- wxULongLong ull(value64);
- variant << ull;
+ variant = wxULongLong(value64);
return true;
}
}
bool wxUIntProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& validationInfo ) const
{
// Check for min/max
- wxULongLong_t ll;
- if ( wxPGVariantToULongLong(value, &ll) )
- {
- wxULongLong_t min = 0;
- wxULongLong_t max = wxUINT64_MAX;
- wxVariant variant;
+ wxULongLong_t ll = value.GetULongLong().GetValue();
- variant = GetAttribute(wxPGGlobalVars->m_strMin);
- if ( !variant.IsNull() )
+ wxULongLong_t min = 0;
+ wxULongLong_t max = wxUINT64_MAX;
+ wxVariant variant;
+
+ variant = GetAttribute(wxPGGlobalVars->m_strMin);
+ if ( !variant.IsNull() )
+ {
+ min = variant.GetULongLong().GetValue();
+ if ( ll < min )
{
- wxPGVariantToULongLong(variant, &min);
- if ( ll < min )
- {
- validationInfo.SetFailureMessage(
- wxString::Format(_("Value must be %llu or higher"),min)
- );
- return false;
- }
+ validationInfo.SetFailureMessage(
+ wxString::Format(_("Value must be %llu or higher"),min)
+ );
+ return false;
}
- variant = GetAttribute(wxPGGlobalVars->m_strMax);
- if ( !variant.IsNull() )
+ }
+ variant = GetAttribute(wxPGGlobalVars->m_strMax);
+ if ( !variant.IsNull() )
+ {
+ max = variant.GetULongLong().GetValue();
+ if ( ll > max )
{
- wxPGVariantToULongLong(variant, &max);
- if ( ll > max )
- {
- validationInfo.SetFailureMessage(
- wxString::Format(_("Value must be %llu or less"),max)
- );
- return false;
- }
+ validationInfo.SetFailureMessage(
+ wxString::Format(_("Value must be %llu or less"),max)
+ );
+ return false;
}
}
+
return true;
}
return false;
}
-bool wxFloatProperty::DoValidation( const wxPGProperty* property, double& value, wxPGValidationInfo* pValidationInfo, int mode )
+bool wxFloatProperty::DoValidation( const wxPGProperty* property,
+ double& value,
+ wxPGValidationInfo* pValidationInfo,
+ int mode )
{
// Check for min/max
double min = (double)wxINT64_MIN;
variant = property->GetAttribute(wxPGGlobalVars->m_strMin);
if ( !variant.IsNull() )
{
- wxPGVariantToDouble(variant, &min);
+ min = variant.GetDouble();
minOk = true;
}
variant = property->GetAttribute(wxPGGlobalVars->m_strMax);
if ( !variant.IsNull() )
{
- wxPGVariantToDouble(variant, &max);
+ max = variant.GetDouble();
maxOk = true;
}
if ( maxOk )
{
- wxPGVariantToDouble(variant, &max);
+ max = variant.GetDouble();
if ( value > max )
{
if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE )
return true;
}
-bool wxFloatProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& validationInfo ) const
+bool
+wxFloatProperty::ValidateValue( wxVariant& value,
+ wxPGValidationInfo& validationInfo ) const
{
- double fpv;
- if ( wxPGVariantToDouble(value, &fpv) )
- return DoValidation(this, fpv, &validationInfo, wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
- return true;
+ double fpv = value.GetDouble();
+ return DoValidation(this, fpv, &validationInfo,
+ wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
}
bool wxFloatProperty::DoSetAttribute( const wxString& name, wxVariant& value )
#if wxPG_INCLUDE_CHECKBOX
if ( name == wxPG_BOOL_USE_CHECKBOX )
{
- int ival = wxPGVariantToInt(value);
- if ( ival )
+ if ( value.GetLong() )
m_flags |= wxPG_PROP_USE_CHECKBOX;
else
m_flags &= ~(wxPG_PROP_USE_CHECKBOX);
#endif
if ( name == wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING )
{
- int ival = wxPGVariantToInt(value);
- if ( ival )
+ if ( value.GetLong() )
m_flags |= wxPG_PROP_USE_DCC;
else
m_flags &= ~(wxPG_PROP_USE_DCC);
wxString variantType = m_value.GetType();
if ( variantType == wxPG_VARIANT_TYPE_LONG )
+ {
ValueFromInt_( m_value, m_value.GetLong(), wxPG_FULL_VALUE );
+ }
else if ( variantType == wxPG_VARIANT_TYPE_STRING )
+ {
ValueFromString_( m_value, m_value.GetString(), 0 );
+ }
else
+ {
wxFAIL;
+ }
if ( ms_nextIndex != -2 )
{
m_oldValue = flags;
}
-void wxFlagsProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxFlagsProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
long oldValue = thisValue.GetLong();
long val = childValue.GetLong();
unsigned long vi = m_choices.GetValue(childIndex);
+
if ( val )
- thisValue = (long)(oldValue | vi);
- else
- thisValue = (long)(oldValue & ~(vi));
+ return (long) (oldValue | vi);
+
+ return (long) (oldValue & ~(vi));
}
bool wxFlagsProperty::DoSetAttribute( const wxString& name, wxVariant& value )
wxFileProperty::~wxFileProperty() {}
-#if wxUSE_VALIDATORS
-
wxValidator* wxFileProperty::GetClassValidator()
{
+#if wxUSE_VALIDATORS
WX_PG_DOGETVALIDATOR_ENTRY()
// Atleast wxPython 2.6.2.1 required that the string argument is given
validator->SetExcludes(exChars);
WX_PG_DOGETVALIDATOR_EXIT(validator)
+#else
+ return NULL;
+#endif
}
wxValidator* wxFileProperty::DoGetValidator() const
return GetClassValidator();
}
-#endif
-
void wxFileProperty::OnSetValue()
{
const wxString& fnstr = m_value.GetString();
// stored in m_attributes.
if ( name == wxPG_FILE_SHOW_FULL_PATH )
{
- if ( wxPGVariantToInt(value) )
+ if ( value.GetLong() )
m_flags |= wxPG_PROP_SHOW_FULL_FILENAME;
else
m_flags &= ~(wxPG_PROP_SHOW_FULL_FILENAME);
wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL );
m_edValue = new wxTextCtrl(this,21,wxEmptyString,
wxDefaultPosition,wxDefaultSize,wxTE_PROCESS_ENTER);
+#if wxUSE_VALIDATORS
wxValidator* validator = GetTextCtrlValidator();
if ( validator )
{
m_edValue->SetValidator( *validator );
delete validator;
}
+#endif
rowsizer->Add( m_edValue,
1, wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL|wxALL, spacing );