]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/propgrid.cpp
Large image-loading speedup and small attribute-loading speedup
[wxWidgets.git] / samples / propgrid / propgrid.cpp
index 83002fb868cd18def5e41a1980fc3eeeabce3d93..b81ea3cc3ea8b637bb603695f980376269be0112 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2004-09-25
 // RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 //
@@ -264,11 +264,7 @@ wxAdvImageFileProperty::wxAdvImageFileProperty( const wxString& label,
 wxAdvImageFileProperty::~wxAdvImageFileProperty ()
 {
     // Delete old image
-    if ( m_pImage )
-    {
-        delete m_pImage;
-        m_pImage = (wxImage*) NULL;
-    }
+    wxDELETE(m_pImage);
 }
 
 void wxAdvImageFileProperty::OnSetValue()
@@ -276,11 +272,7 @@ void wxAdvImageFileProperty::OnSetValue()
     wxFileProperty::OnSetValue();
 
     // Delete old image
-    if ( m_pImage )
-    {
-        delete m_pImage;
-        m_pImage = (wxImage*) NULL;
-    }
+    wxDELETE(m_pImage);
 
     wxString imagename = GetValueAsString(0);
 
@@ -398,11 +390,7 @@ void wxAdvImageFileProperty::LoadThumbnails( size_t index )
 
         }
 
-        if ( m_pImage )
-        {
-            delete m_pImage;
-            m_pImage = (wxImage*) NULL;
-        }
+        wxDELETE(m_pImage);
     }
 }
 
@@ -1483,9 +1471,10 @@ void FormMain::PopulateWithExamples ()
     pg->SetPropertyHelpString( wxT("BoolProperty with CheckBox"),
         wxT("Property attribute wxPG_BOOL_USE_CHECKBOX has been set to true.") );
 
-     pid = pg->Append( new wxFloatProperty( wxT("FloatProperty"),
-                                       wxPG_LABEL,
-                                       1234500.23 ) );
+    prop = pg->Append( new wxFloatProperty("FloatProperty",
+                                           wxPG_LABEL,
+                                           1234500.23) );
+    prop->SetAttribute("Min", -100.12);
 
     // A string property that can be edited in a separate editor dialog.
     pg->Append( new wxLongStringProperty( wxT("LongStringProperty"), wxT("LongStringProp"),
@@ -1527,7 +1516,7 @@ void FormMain::PopulateWithExamples ()
     pid = pg->Append( new wxColourProperty(wxT("ColourProperty"),wxPG_LABEL,*wxRED) );
     //pg->SetPropertyAttribute(pid,wxPG_COLOUR_ALLOW_CUSTOM,false);
     pg->SetPropertyEditor( wxT("ColourProperty"), wxPGEditor_ComboBox );
-    pg->GetProperty(wxT("ColourProperty"))->SetFlag(wxPG_PROP_AUTO_UNSPECIFIED);
+    pg->GetProperty(wxT("ColourProperty"))->SetAutoUnspecified(true);
     pg->SetPropertyHelpString( wxT("ColourProperty"),
         wxT("wxPropertyGrid::SetPropertyEditor method has been used to change ")
         wxT("editor of this property to wxPGEditor_ComboBox)"));
@@ -2192,7 +2181,9 @@ void FormMain::CreateGrid( int style, int extraStyle )
 
     pgman->SetExtraStyle(extraStyle);
 
-    m_pPropGridManager->SetValidationFailureBehavior( wxPG_VFB_BEEP | wxPG_VFB_MARK_CELL | wxPG_VFB_SHOW_MESSAGE );
+    // This is the default validation failure behavior
+    m_pPropGridManager->SetValidationFailureBehavior( wxPG_VFB_MARK_CELL |
+                                                      wxPG_VFB_SHOW_MESSAGEBOX );
 
     m_pPropGridManager->GetGrid()->SetVerticalSpacing( 2 );
 
@@ -3059,8 +3050,8 @@ void FormMain::OnCatColours( wxCommandEvent& event )
 
 void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) )
 {
-    int style;
-    int extraStyle;
+    int style = 0;
+    int extraStyle = 0;
 
     {
         wxArrayString chs;