Use long int literals to represent long constants in propgrid sample

This commit is contained in:
Artur Wieczorek
2019-05-26 18:52:43 +02:00
parent a93713f7f8
commit 50330b3a26
3 changed files with 21 additions and 21 deletions

View File

@@ -1063,9 +1063,9 @@ void FormMain::PopulateWithStandardItems ()
// (for instance, wxPG_ATTR_MIN, instead of "min"). // (for instance, wxPG_ATTR_MIN, instead of "min").
// Using constant may reduce binary size. // Using constant may reduce binary size.
pg->Append( new wxIntProperty("Height",wxPG_LABEL,480) ); pg->Append( new wxIntProperty("Height",wxPG_LABEL,480L) );
pg->SetPropertyAttribute("Height", wxPG_ATTR_MIN, (long)10 ); pg->SetPropertyAttribute("Height", wxPG_ATTR_MIN, 10L );
pg->SetPropertyAttribute("Height", wxPG_ATTR_MAX, (long)2048 ); pg->SetPropertyAttribute("Height", wxPG_ATTR_MAX, 2048L );
pg->SetPropertyAttribute("Height", wxPG_ATTR_UNITS, "Pixels" ); pg->SetPropertyAttribute("Height", wxPG_ATTR_UNITS, "Pixels" );
// Set value to unspecified so that Hint attribute will be demonstrated // Set value to unspecified so that Hint attribute will be demonstrated
@@ -1079,9 +1079,9 @@ void FormMain::PopulateWithStandardItems ()
pg->SetPropertyHelpString("Height", pg->SetPropertyHelpString("Height",
"This property uses attributes \"Units\" and \"Hint\"."); "This property uses attributes \"Units\" and \"Hint\".");
pg->Append( new wxIntProperty("Width",wxPG_LABEL,640) ); pg->Append( new wxIntProperty("Width",wxPG_LABEL,640L) );
pg->SetPropertyAttribute("Width", wxPG_ATTR_MIN, (long)10 ); pg->SetPropertyAttribute("Width", wxPG_ATTR_MIN, 10L );
pg->SetPropertyAttribute("Width", wxPG_ATTR_MAX, (long)2048 ); pg->SetPropertyAttribute("Width", wxPG_ATTR_MAX, 2048L );
pg->SetPropertyAttribute("Width", wxPG_ATTR_UNITS, "Pixels" ); pg->SetPropertyAttribute("Width", wxPG_ATTR_UNITS, "Pixels" );
pg->SetPropertyValueUnspecified("Width"); pg->SetPropertyValueUnspecified("Width");
@@ -1090,11 +1090,11 @@ void FormMain::PopulateWithStandardItems ()
pg->SetPropertyHelpString("Width", pg->SetPropertyHelpString("Width",
"This property uses attributes \"Units\" and \"Hint\"."); "This property uses attributes \"Units\" and \"Hint\".");
pg->Append( new wxIntProperty("X",wxPG_LABEL,10) ); pg->Append( new wxIntProperty("X",wxPG_LABEL,10L) );
pg->SetPropertyAttribute("X", wxPG_ATTR_UNITS, "Pixels" ); pg->SetPropertyAttribute("X", wxPG_ATTR_UNITS, "Pixels" );
pg->SetPropertyHelpString("X", "This property uses \"Units\" attribute."); pg->SetPropertyHelpString("X", "This property uses \"Units\" attribute.");
pg->Append( new wxIntProperty("Y",wxPG_LABEL,10) ); pg->Append( new wxIntProperty("Y",wxPG_LABEL,10L) );
pg->SetPropertyAttribute("Y", wxPG_ATTR_UNITS, "Pixels" ); pg->SetPropertyAttribute("Y", wxPG_ATTR_UNITS, "Pixels" );
pg->SetPropertyHelpString("Y", "This property uses \"Units\" attribute."); pg->SetPropertyHelpString("Y", "This property uses \"Units\" attribute.");
@@ -1140,7 +1140,7 @@ void FormMain::PopulateWithStandardItems ()
arrdbl.Add(1.0); arrdbl.Add(1.0);
pg->Append( new wxArrayDoubleProperty("ArrayDoubleProperty",wxPG_LABEL,arrdbl) ); pg->Append( new wxArrayDoubleProperty("ArrayDoubleProperty",wxPG_LABEL,arrdbl) );
//pg->SetPropertyAttribute("ArrayDoubleProperty",wxPG_FLOAT_PRECISION,(long)2); //pg->SetPropertyAttribute("ArrayDoubleProperty",wxPG_FLOAT_PRECISION,2L);
pg->SetPropertyHelpString( "ArrayDoubleProperty", pg->SetPropertyHelpString( "ArrayDoubleProperty",
"This demonstrates wxArrayDoubleProperty class defined in this sample app. " "This demonstrates wxArrayDoubleProperty class defined in this sample app. "
"It is an example of a custom list editor property." "It is an example of a custom list editor property."
@@ -1188,12 +1188,12 @@ void FormMain::PopulateWithExamples ()
//pg->SetPropertyHelpString ( "Examples", "This category has example of (almost) every built-in property class." ); //pg->SetPropertyHelpString ( "Examples", "This category has example of (almost) every built-in property class." );
#if wxUSE_SPINBTN #if wxUSE_SPINBTN
pg->Append( new wxIntProperty ( "SpinCtrl", wxPG_LABEL, 0 ) ); pg->Append( new wxIntProperty ( "SpinCtrl", wxPG_LABEL, 0L ) );
pg->SetPropertyEditor( "SpinCtrl", wxPGEditor_SpinCtrl ); pg->SetPropertyEditor( "SpinCtrl", wxPGEditor_SpinCtrl );
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MIN, (long)-10 ); // Use constants instead of string pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MIN, -10L ); // Use constants instead of string
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MAX, (long)16384 ); // for reduced binary size. pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MAX, 16384L ); // for reduced binary size.
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_STEP, (long)2 ); pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_STEP, 2L );
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_MOTION, true ); pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_MOTION, true );
//pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_WRAP, true ); //pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_WRAP, true );
@@ -1518,7 +1518,7 @@ void FormMain::PopulateWithExamples ()
pg->AppendIn(carProp, new wxIntProperty("Engine Size (cc)", pg->AppendIn(carProp, new wxIntProperty("Engine Size (cc)",
wxPG_LABEL, wxPG_LABEL,
5707) ); 5707L) );
wxPGProperty* speedsProp = pg->AppendIn(carProp, wxPGProperty* speedsProp = pg->AppendIn(carProp,
new wxStringProperty("Speeds", new wxStringProperty("Speeds",
@@ -1526,7 +1526,7 @@ void FormMain::PopulateWithExamples ()
"<composed>")); "<composed>"));
pg->AppendIn( speedsProp, new wxIntProperty("Max. Speed (mph)", pg->AppendIn( speedsProp, new wxIntProperty("Max. Speed (mph)",
wxPG_LABEL,290) ); wxPG_LABEL,290L) );
pg->AppendIn( speedsProp, new wxFloatProperty("0-100 mph (sec)", pg->AppendIn( speedsProp, new wxFloatProperty("0-100 mph (sec)",
wxPG_LABEL,3.9) ); wxPG_LABEL,3.9) );
pg->AppendIn( speedsProp, new wxFloatProperty("1/4 mile (sec)", pg->AppendIn( speedsProp, new wxFloatProperty("1/4 mile (sec)",
@@ -1537,7 +1537,7 @@ void FormMain::PopulateWithExamples ()
pg->AppendIn(carProp, new wxIntProperty("Price ($)", pg->AppendIn(carProp, new wxIntProperty("Price ($)",
wxPG_LABEL, wxPG_LABEL,
300000) ); 300000L) );
pg->AppendIn(carProp, new wxBoolProperty("Convertible", pg->AppendIn(carProp, new wxBoolProperty("Convertible",
wxPG_LABEL, wxPG_LABEL,
@@ -1883,7 +1883,7 @@ void FormMain::PopulateGrid()
PopulateWithLibraryConfig(); PopulateWithLibraryConfig();
wxPropertyGridPage* myPage = new wxMyPropertyGridPage(); wxPropertyGridPage* myPage = new wxMyPropertyGridPage();
myPage->Append( new wxIntProperty ( "IntProperty", wxPG_LABEL, 12345678 ) ); myPage->Append( new wxIntProperty ( "IntProperty", wxPG_LABEL, 12345678L ) );
// Use wxMyPropertyGridPage (see above) to test the // Use wxMyPropertyGridPage (see above) to test the
// custom wxPropertyGridPage feature. // custom wxPropertyGridPage feature.
@@ -3075,7 +3075,7 @@ void FormMain::OnMisc ( wxCommandEvent& event )
{ {
wxVariant list; wxVariant list;
list.NullList(); list.NullList();
list.Append( wxVariant((long)1234,"VariantLong") ); list.Append( wxVariant(1234L,"VariantLong") );
list.Append( wxVariant(true,"VariantBool") ); list.Append( wxVariant(true,"VariantBool") );
list.Append( wxVariant("Test Text","VariantString") ); list.Append( wxVariant("Test Text","VariantString") );
m_pPropGridManager->GetGrid()->SetPropertyValues(list); m_pPropGridManager->GetGrid()->SetPropertyValues(list);

View File

@@ -621,7 +621,7 @@ bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& t
// by returning pending value of non-wxArrayDouble type. // by returning pending value of non-wxArrayDouble type.
if ( !ok ) if ( !ok )
{ {
variant = (long)0; variant = 0L;
return true; return true;
} }

View File

@@ -950,9 +950,9 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(Attributes) RT_START_TEST(Attributes)
wxPGProperty* prop = pgman->GetProperty("StringProperty"); wxPGProperty* prop = pgman->GetProperty("StringProperty");
prop->SetAttribute("Dummy Attribute", (long)15); prop->SetAttribute("Dummy Attribute", 15L);
if ( prop->GetAttribute("Dummy Attribute").GetLong() != 15 ) if ( prop->GetAttribute("Dummy Attribute").GetLong() != 15L )
RT_FAILURE(); RT_FAILURE();
prop->SetAttribute("Dummy Attribute", wxVariant()); prop->SetAttribute("Dummy Attribute", wxVariant());