Use long int literals to represent long constants in propgrid sample
This commit is contained in:
@@ -1063,9 +1063,9 @@ void FormMain::PopulateWithStandardItems ()
|
||||
// (for instance, wxPG_ATTR_MIN, instead of "min").
|
||||
// Using constant may reduce binary size.
|
||||
|
||||
pg->Append( new wxIntProperty("Height",wxPG_LABEL,480) );
|
||||
pg->SetPropertyAttribute("Height", wxPG_ATTR_MIN, (long)10 );
|
||||
pg->SetPropertyAttribute("Height", wxPG_ATTR_MAX, (long)2048 );
|
||||
pg->Append( new wxIntProperty("Height",wxPG_LABEL,480L) );
|
||||
pg->SetPropertyAttribute("Height", wxPG_ATTR_MIN, 10L );
|
||||
pg->SetPropertyAttribute("Height", wxPG_ATTR_MAX, 2048L );
|
||||
pg->SetPropertyAttribute("Height", wxPG_ATTR_UNITS, "Pixels" );
|
||||
|
||||
// Set value to unspecified so that Hint attribute will be demonstrated
|
||||
@@ -1079,9 +1079,9 @@ void FormMain::PopulateWithStandardItems ()
|
||||
pg->SetPropertyHelpString("Height",
|
||||
"This property uses attributes \"Units\" and \"Hint\".");
|
||||
|
||||
pg->Append( new wxIntProperty("Width",wxPG_LABEL,640) );
|
||||
pg->SetPropertyAttribute("Width", wxPG_ATTR_MIN, (long)10 );
|
||||
pg->SetPropertyAttribute("Width", wxPG_ATTR_MAX, (long)2048 );
|
||||
pg->Append( new wxIntProperty("Width",wxPG_LABEL,640L) );
|
||||
pg->SetPropertyAttribute("Width", wxPG_ATTR_MIN, 10L );
|
||||
pg->SetPropertyAttribute("Width", wxPG_ATTR_MAX, 2048L );
|
||||
pg->SetPropertyAttribute("Width", wxPG_ATTR_UNITS, "Pixels" );
|
||||
|
||||
pg->SetPropertyValueUnspecified("Width");
|
||||
@@ -1090,11 +1090,11 @@ void FormMain::PopulateWithStandardItems ()
|
||||
pg->SetPropertyHelpString("Width",
|
||||
"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->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->SetPropertyHelpString("Y", "This property uses \"Units\" attribute.");
|
||||
|
||||
@@ -1140,7 +1140,7 @@ void FormMain::PopulateWithStandardItems ()
|
||||
arrdbl.Add(1.0);
|
||||
|
||||
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",
|
||||
"This demonstrates wxArrayDoubleProperty class defined in this sample app. "
|
||||
"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." );
|
||||
|
||||
#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->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MIN, (long)-10 ); // Use constants instead of string
|
||||
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MAX, (long)16384 ); // for reduced binary size.
|
||||
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_STEP, (long)2 );
|
||||
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MIN, -10L ); // Use constants instead of string
|
||||
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MAX, 16384L ); // for reduced binary size.
|
||||
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_STEP, 2L );
|
||||
pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_MOTION, true );
|
||||
//pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_WRAP, true );
|
||||
|
||||
@@ -1518,7 +1518,7 @@ void FormMain::PopulateWithExamples ()
|
||||
|
||||
pg->AppendIn(carProp, new wxIntProperty("Engine Size (cc)",
|
||||
wxPG_LABEL,
|
||||
5707) );
|
||||
5707L) );
|
||||
|
||||
wxPGProperty* speedsProp = pg->AppendIn(carProp,
|
||||
new wxStringProperty("Speeds",
|
||||
@@ -1526,7 +1526,7 @@ void FormMain::PopulateWithExamples ()
|
||||
"<composed>"));
|
||||
|
||||
pg->AppendIn( speedsProp, new wxIntProperty("Max. Speed (mph)",
|
||||
wxPG_LABEL,290) );
|
||||
wxPG_LABEL,290L) );
|
||||
pg->AppendIn( speedsProp, new wxFloatProperty("0-100 mph (sec)",
|
||||
wxPG_LABEL,3.9) );
|
||||
pg->AppendIn( speedsProp, new wxFloatProperty("1/4 mile (sec)",
|
||||
@@ -1537,7 +1537,7 @@ void FormMain::PopulateWithExamples ()
|
||||
|
||||
pg->AppendIn(carProp, new wxIntProperty("Price ($)",
|
||||
wxPG_LABEL,
|
||||
300000) );
|
||||
300000L) );
|
||||
|
||||
pg->AppendIn(carProp, new wxBoolProperty("Convertible",
|
||||
wxPG_LABEL,
|
||||
@@ -1883,7 +1883,7 @@ void FormMain::PopulateGrid()
|
||||
PopulateWithLibraryConfig();
|
||||
|
||||
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
|
||||
// custom wxPropertyGridPage feature.
|
||||
@@ -3075,7 +3075,7 @@ void FormMain::OnMisc ( wxCommandEvent& event )
|
||||
{
|
||||
wxVariant list;
|
||||
list.NullList();
|
||||
list.Append( wxVariant((long)1234,"VariantLong") );
|
||||
list.Append( wxVariant(1234L,"VariantLong") );
|
||||
list.Append( wxVariant(true,"VariantBool") );
|
||||
list.Append( wxVariant("Test Text","VariantString") );
|
||||
m_pPropGridManager->GetGrid()->SetPropertyValues(list);
|
||||
|
@@ -621,7 +621,7 @@ bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& t
|
||||
// by returning pending value of non-wxArrayDouble type.
|
||||
if ( !ok )
|
||||
{
|
||||
variant = (long)0;
|
||||
variant = 0L;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -950,9 +950,9 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
RT_START_TEST(Attributes)
|
||||
|
||||
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();
|
||||
|
||||
prop->SetAttribute("Dummy Attribute", wxVariant());
|
||||
|
Reference in New Issue
Block a user