X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d2c70414cc0c6b93147d0c0cc963f217fcb2023..b3ecee8d120ac8af59cbf82b00d4c7da9f648f53:/samples/propgrid/propgrid.cpp diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 83002fb868..431199b249 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -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)")); @@ -1657,7 +1646,7 @@ void FormMain::PopulateWithExamples () mdc.DrawLine(0, 0, 60, 15); mdc.SelectObject(wxNullBitmap); pg->SetPropertyImage( wxT("StringPropertyWithBitmap"), myTestBitmap ); - + // this value array would be optional if values matched string indexes //long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX, wxMAXIMIZE_BOX }; @@ -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;