From 811cdc0ffc348787ad12dc8c154bdbb79a6f8851 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek <7330332+a-wi@users.noreply.github.com> Date: Wed, 26 Oct 2022 13:11:59 +0200 Subject: [PATCH] Use wxString() rather than wxEmptyString in wxPropertyGrid classes --- include/wx/propgrid/advprops.h | 2 +- include/wx/propgrid/manager.h | 2 +- include/wx/propgrid/propgrid.h | 2 +- include/wx/propgrid/propgridiface.h | 6 +++--- include/wx/propgrid/props.h | 12 ++++++------ interface/wx/propgrid/advprops.h | 2 +- interface/wx/propgrid/manager.h | 2 +- interface/wx/propgrid/property.h | 2 +- interface/wx/propgrid/propgridiface.h | 4 ++-- interface/wx/propgrid/props.h | 12 ++++++------ src/propgrid/advprops.cpp | 2 +- src/propgrid/editors.cpp | 2 +- src/propgrid/manager.cpp | 8 ++++---- src/propgrid/property.cpp | 16 ++++++++-------- src/propgrid/propgrid.cpp | 14 +++++++------- src/propgrid/propgridiface.cpp | 2 +- src/propgrid/props.cpp | 20 ++++++++++---------- 17 files changed, 55 insertions(+), 55 deletions(-) diff --git a/include/wx/propgrid/advprops.h b/include/wx/propgrid/advprops.h index c62425928b..095404ddd5 100644 --- a/include/wx/propgrid/advprops.h +++ b/include/wx/propgrid/advprops.h @@ -287,7 +287,7 @@ public: wxImageFileProperty( const wxString& label= wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString); + const wxString& value = wxString()); virtual ~wxImageFileProperty(); virtual void OnSetValue() override; diff --git a/include/wx/propgrid/manager.h b/include/wx/propgrid/manager.h index 6cadfe771f..dc75d0473f 100644 --- a/include/wx/propgrid/manager.h +++ b/include/wx/propgrid/manager.h @@ -199,7 +199,7 @@ public: // If toolbar is used, it is highly recommended that the pages are // added when the toolbar is not turned off using window style flag // switching. - wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString, + wxPropertyGridPage* AddPage( const wxString& label = wxString(), const wxBitmapBundle& bmp = wxBitmapBundle(), wxPropertyGridPage* pageObj = nullptr ) { diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 40e79029bc..93f3b39628 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -913,7 +913,7 @@ public: static wxPGEditor* RegisterEditorClass( wxPGEditor* editor, bool noDefCheck = false ) { - return DoRegisterEditorClass(editor, wxEmptyString, noDefCheck); + return DoRegisterEditorClass(editor, wxString(), noDefCheck); } static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editorClass, diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h index d077b5fe78..2e09f32bba 100644 --- a/include/wx/propgrid/propgridiface.h +++ b/include/wx/propgrid/propgridiface.h @@ -378,7 +378,7 @@ public: // Returns help string associated with a property. wxString GetPropertyHelpString( wxPGPropArg id ) const { - wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxEmptyString) + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxString()) return p->GetHelpString(); } @@ -456,7 +456,7 @@ public: // Use wxPG_INC_ATTRIBUTES to include property attributes as well. // Each attribute will be stored as list variant named // "@@attr." - wxVariant GetPropertyValues( const wxString& listname = wxEmptyString, + wxVariant GetPropertyValues( const wxString& listname = wxString(), wxPGProperty* baseparent = nullptr, long flags = 0 ) const { return m_pState->DoGetPropertyValues(listname, baseparent, flags); @@ -756,7 +756,7 @@ public: // You can use wxPG_LABEL as text to use default text for column. void SetPropertyCell( wxPGPropArg id, int column, - const wxString& text = wxEmptyString, + const wxString& text = wxString(), const wxBitmapBundle& bitmap = wxBitmapBundle(), const wxColour& fgCol = wxNullColour, const wxColour& bgCol = wxNullColour ); diff --git a/include/wx/propgrid/props.h b/include/wx/propgrid/props.h index 053a16f45f..552227414b 100644 --- a/include/wx/propgrid/props.h +++ b/include/wx/propgrid/props.h @@ -99,7 +99,7 @@ class WXDLLIMPEXP_PROPGRID wxStringProperty : public wxPGProperty public: wxStringProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxStringProperty(); virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; @@ -479,11 +479,11 @@ public: const wxString& name = wxPG_LABEL, const wxArrayString& labels = wxArrayString(), const wxArrayInt& values = wxArrayInt(), - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); wxEditEnumProperty( const wxString& label, const wxString& name, wxPGChoices& choices, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); // Special constructor for caching choices (used by derived class) wxEditEnumProperty( const wxString& label, @@ -605,7 +605,7 @@ public: wxFileProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxFileProperty (); virtual void OnSetValue() override; @@ -645,7 +645,7 @@ public: wxLongStringProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxLongStringProperty(); virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; @@ -667,7 +667,7 @@ class WXDLLIMPEXP_PROPGRID wxDirProperty : public wxEditorDialogProperty public: wxDirProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxDirProperty(); virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const override; diff --git a/interface/wx/propgrid/advprops.h b/interface/wx/propgrid/advprops.h index a9c0be3b56..503ee7b696 100644 --- a/interface/wx/propgrid/advprops.h +++ b/interface/wx/propgrid/advprops.h @@ -240,7 +240,7 @@ public: wxImageFileProperty( const wxString& label= wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString); + const wxString& value = wxString()); virtual ~wxImageFileProperty(); virtual void OnSetValue(); diff --git a/interface/wx/propgrid/manager.h b/interface/wx/propgrid/manager.h index 6ef5afcdb8..de77ca8d4c 100644 --- a/interface/wx/propgrid/manager.h +++ b/interface/wx/propgrid/manager.h @@ -257,7 +257,7 @@ public: added when the toolbar is not turned off using window style flag switching. Otherwise toolbar buttons might not be added properly. */ - wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString, + wxPropertyGridPage* AddPage( const wxString& label = wxString(), const wxBitmapBundle& bmp = wxBitmapBundle(), wxPropertyGridPage* pageObj = nullptr ); diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index 1043e20952..261310db0a 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -817,7 +817,7 @@ wxPG_PROP_CLASS_SPECIFIC_3 = 0x00400000 // use wxPG_LABEL for label and name MyProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ) + const wxString& value = wxString() ) : wxPGProperty(label, name) { // m_value is wxVariant diff --git a/interface/wx/propgrid/propgridiface.h b/interface/wx/propgrid/propgridiface.h index 8c9df342cb..3f5d562175 100644 --- a/interface/wx/propgrid/propgridiface.h +++ b/interface/wx/propgrid/propgridiface.h @@ -557,7 +557,7 @@ public: Each attribute will be stored as list variant named @"@@@@@attr.@" */ - wxVariant GetPropertyValues( const wxString& listname = wxEmptyString, + wxVariant GetPropertyValues( const wxString& listname = wxString(), wxPGProperty* baseparent = nullptr, long flags = 0 ) const; /** @@ -926,7 +926,7 @@ public: */ void SetPropertyCell( wxPGPropArg id, int column, - const wxString& text = wxEmptyString, + const wxString& text = wxString(), const wxBitmapBundle& bitmap = wxBitmapBundle(), const wxColour& fgCol = wxNullColour, const wxColour& bgCol = wxNullColour ); diff --git a/interface/wx/propgrid/props.h b/interface/wx/propgrid/props.h index ca8daf735e..24fb9f602f 100644 --- a/interface/wx/propgrid/props.h +++ b/interface/wx/propgrid/props.h @@ -47,7 +47,7 @@ class wxStringProperty : public wxPGProperty public: wxStringProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxStringProperty(); virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; @@ -458,12 +458,12 @@ public: const wxString& name = wxPG_LABEL, const wxArrayString& labels = wxArrayString(), const wxArrayInt& values = wxArrayInt(), - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); wxEditEnumProperty( const wxString& label, const wxString& name, wxPGChoices& choices, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); // Special constructor for caching choices (used by derived class) wxEditEnumProperty( const wxString& label, @@ -620,7 +620,7 @@ public: wxFileProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxFileProperty (); virtual void OnSetValue(); @@ -664,7 +664,7 @@ public: wxLongStringProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxLongStringProperty(); virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; @@ -690,7 +690,7 @@ class wxDirProperty : public wxEditorDialogProperty public: wxDirProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxString& value = wxEmptyString ); + const wxString& value = wxString() ); virtual ~wxDirProperty(); virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const; diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index e2fbcad6c9..303c924637 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1371,7 +1371,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te if ( colStr.Find(wxS("(")) == 0 ) { // Eliminate whitespace - colStr.Replace(wxS(" "), wxEmptyString); + colStr.Replace(wxS(" "), wxString()); int commaCount = colStr.Freq(wxS(',')); if ( commaCount == 2 ) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index e2d0054889..55348a2bc0 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -1007,7 +1007,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid, #endif cb->Create(ctrlParent, wxID_ANY, - wxEmptyString, + wxString(), po, si, labels, diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 98d11752c0..54d46d1f6d 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -462,7 +462,7 @@ private: { while ( m_columns.size() < count ) { - wxHeaderColumnSimple* colInfo = new wxHeaderColumnSimple(wxEmptyString); + wxHeaderColumnSimple* colInfo = new wxHeaderColumnSimple(wxString()); m_columns.push_back(colInfo); } } @@ -1844,7 +1844,7 @@ void wxPropertyGridManager::RecreateControls() { m_pTxtHelpCaption = new wxStaticText(this, wxID_ANY, - wxEmptyString, + wxString(), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT|wxST_NO_AUTORESIZE); @@ -1855,7 +1855,7 @@ void wxPropertyGridManager::RecreateControls() { m_pTxtHelpContent = new wxStaticText(this, wxID_ANY, - wxEmptyString, + wxString(), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT|wxST_NO_AUTORESIZE); @@ -2049,7 +2049,7 @@ void wxPropertyGridManager::SetDescribedProperty( wxPGProperty* p ) } else { - SetDescription( wxEmptyString, wxEmptyString ); + SetDescription( wxString(), wxString() ); } } } diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index b7bed3f9d6..19ae1b6df6 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -262,7 +262,7 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect, // Add units string? if ( propertyGrid->GetColumnCount() <= 2 ) { - wxString unitsString = property->GetAttribute(wxPG_ATTR_UNITS, wxEmptyString); + wxString unitsString = property->GetAttribute(wxPG_ATTR_UNITS, wxString()); if ( !unitsString.empty() ) text = wxString::Format(wxS("%s %s"), text, unitsString ); } @@ -811,7 +811,7 @@ void wxPGProperty::GetDisplayInfo( unsigned int column, else if ( column == 1 ) *pString = GetDisplayedString(); else if ( column == 2 ) - *pString = GetAttribute(wxPG_ATTR_UNITS, wxEmptyString); + *pString = GetAttribute(wxPG_ATTR_UNITS, wxString()); } } else @@ -858,7 +858,7 @@ wxString wxPGProperty::GetColumnText( unsigned int col, int choiceIndex ) const else if ( col == 1 ) return GetDisplayedString(); else if ( col == 2 ) - return GetAttribute(wxPG_ATTR_UNITS, wxEmptyString); + return GetAttribute(wxPG_ATTR_UNITS, wxString()); } } else @@ -867,7 +867,7 @@ wxString wxPGProperty::GetColumnText( unsigned int col, int choiceIndex ) const return m_choices.GetLabel(choiceIndex); } - return wxEmptyString; + return wxString(); } */ @@ -994,7 +994,7 @@ wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value), int argFlags ) const { wxCHECK_MSG( GetChildCount() > 0, - wxEmptyString, + wxString(), wxS("If user property does not have any children, it must ") wxS("override GetValueAsString") ); @@ -1011,7 +1011,7 @@ wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value), wxString wxPGProperty::GetValueAsString( int argFlags ) const { wxPropertyGrid* pg = GetGrid(); - wxCHECK_MSG( pg, wxEmptyString, + wxCHECK_MSG( pg, wxString(), wxS("Cannot get valid value for detached property") ); if ( IsValueUnspecified() ) @@ -2816,13 +2816,13 @@ wxPropertyCategory::~wxPropertyCategory() wxString wxPropertyCategory::ValueToString( wxVariant& WXUNUSED(value), int WXUNUSED(argFlags) ) const { - return m_value.IsType(wxPG_VARIANT_TYPE_STRING) ? m_value.GetString() : wxEmptyString; + return m_value.IsType(wxPG_VARIANT_TYPE_STRING) ? m_value.GetString() : wxString(); } wxString wxPropertyCategory::GetValueAsString( int argFlags ) const { // Unspecified value is always empty string - return IsValueUnspecified() ? wxEmptyString : wxPGProperty::GetValueAsString(argFlags); + return IsValueUnspecified() ? wxString() : wxPGProperty::GetValueAsString(argFlags); } static int DoGetTextExtent(const wxWindow* wnd, const wxString& label, const wxFont& font) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 4a7b420a89..15d850c9dd 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -3149,7 +3149,7 @@ void wxPropertyGrid::DoHidePropertyError( wxPGProperty* WXUNUSED(property) ) wxStatusBar* pStatusBar = GetStatusBar(); if ( pStatusBar ) { - pStatusBar->SetStatusText(wxEmptyString); + pStatusBar->SetStatusText(wxString()); return; } } @@ -3316,7 +3316,7 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property ) { wxStatusBar* pStatusBar = GetStatusBar(); if ( pStatusBar ) - pStatusBar->SetStatusText(wxEmptyString); + pStatusBar->SetStatusText(wxString()); } } #endif @@ -3852,7 +3852,7 @@ wxPropertyGrid::GetUnspecifiedValueText( int argFlags ) const !(argFlags & wxPG_EDITABLE_VALUE) ) return ua.GetText(); - return wxEmptyString; + return wxString(); } // ----------------------------------------------------------------------- @@ -4328,7 +4328,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) { // Clear help box - but only if it was written // by us at previous time. - statusbar->SetStatusText(wxEmptyString); + statusbar->SetStatusText(wxString()); m_iFlags &= ~(wxPG_FL_STRING_IN_STATUSBAR); } } @@ -5082,7 +5082,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, tipString = m_propHover->GetValueAsString(); if ( GetColumnCount() <= 2 ) { - wxString unitsString = m_propHover->GetAttribute(wxPG_ATTR_UNITS, wxEmptyString); + wxString unitsString = m_propHover->GetAttribute(wxPG_ATTR_UNITS, wxString()); if ( !unitsString.empty() ) tipString = wxString::Format(wxS("%s %s"), tipString, unitsString ); } @@ -5102,12 +5102,12 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, } else { - SetToolTip(wxEmptyString); + SetToolTip(wxString()); } } else { - SetToolTip(wxEmptyString); + SetToolTip(wxString()); } } } diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 5df83813d5..1e81011887 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -757,7 +757,7 @@ wxVariant wxPropertyGridInterface::GetPropertyValue(wxPGPropArg id) // String is different from others. wxString wxPropertyGridInterface::GetPropertyValueAsString( wxPGPropArg id ) const { - wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxEmptyString) + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxString()) return p->GetValueAsString(wxPG_FULL_VALUE); } diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index d396d93f53..b9ca2f70ee 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -390,7 +390,7 @@ wxString wxIntProperty::ValueToString( wxVariant& value, } #endif - return wxEmptyString; + return wxString(); } bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const @@ -680,7 +680,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const return wxString::Format(fmt, ull.GetValue()); } #endif - return wxEmptyString; + return wxString(); } bool wxUIntProperty::StringToValue(wxVariant& variant, const wxString& text, int argFlags) const @@ -1107,7 +1107,7 @@ wxString wxBoolProperty::ValueToString( wxVariant& value, else { if ( argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT ) - return wxEmptyString; + return wxString(); wxString notFmt; if ( wxPGGlobalVars->m_autoGetTranslation ) @@ -1309,7 +1309,7 @@ wxString wxEnumProperty::ValueToString( wxVariant& value, int index = m_choices.Index(value.GetLong()); if ( index < 0 ) - return wxEmptyString; + return wxString(); return m_choices.GetLabel(index); } @@ -2091,11 +2091,11 @@ wxString wxFileProperty::ValueToString( wxVariant& value, wxFileName filename = value.GetString(); if ( !filename.HasName() ) - return wxEmptyString; + return wxString(); wxString fullName = filename.GetFullName(); if ( fullName.empty() ) - return wxEmptyString; + return wxString(); if ( argFlags & wxPG_FULL_VALUE ) { @@ -2561,9 +2561,9 @@ void wxPGArrayEditorDialog::OnEndLabelEdit(wxListEvent& event) // Editable list box doesn't really respect Veto(), but // it recognizes if no text was added, so we simulate // Veto() using it. - event.m_item.SetText(wxEmptyString); + event.m_item.SetText(wxString()); m_elb->GetListCtrl()->SetItemText(m_itemPendingAtIndex, - wxEmptyString); + wxString()); event.Veto(); } @@ -2813,7 +2813,7 @@ bool wxArrayStringProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v strEdDlg->SetCustomButton(m_customBtnText, this); dlg->SetDialogValue( value ); - dlg->Create(pg->GetPanel(), wxEmptyString, + dlg->Create(pg->GetPanel(), wxString(), m_dlgTitle.empty() ? GetLabel() : m_dlgTitle, m_dlgStyle); if ( !wxPropertyGrid::IsSmallScreen() ) @@ -2912,7 +2912,7 @@ bool wxPGInDialogValidator::DoValidate( wxPropertyGrid* propGrid, if ( !tc ) { { - tc = new wxTextCtrl( propGrid, wxID_ANY, wxEmptyString, + tc = new wxTextCtrl( propGrid, wxID_ANY, wxString(), wxPoint(30000,30000)); tc->Hide(); }