diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 2ad91a32ef..18067b3293 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -496,7 +496,11 @@ wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000, /** Indicates that the property is being deleted and should be ignored. */ -wxPG_PROP_BEING_DELETED = 0x00200000 +wxPG_PROP_BEING_DELETED = 0x00200000, + +/** Indicates the bit useable by derived properties. +*/ +wxPG_PROP_CLASS_SPECIFIC_3 = 0x00400000 }; diff --git a/include/wx/propgrid/props.h b/include/wx/propgrid/props.h index 0ff9148bc0..7db2d06900 100644 --- a/include/wx/propgrid/props.h +++ b/include/wx/propgrid/props.h @@ -651,6 +651,9 @@ protected: // ----------------------------------------------------------------------- #define wxPG_PROP_NO_ESCAPE wxPG_PROP_CLASS_SPECIFIC_1 +// Flag used in wxLongStringProperty to mark that edit button +// should be enabled even in the read-only mode. +#define wxPG_PROP_ACTIVE_BTN wxPG_PROP_CLASS_SPECIFIC_3 /** @class wxPGLongStringDialogAdapter diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index f9908ffb1a..94bdce237d 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -2019,7 +2019,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize #endif #endif - if ( selected->HasFlag(wxPG_PROP_READONLY) ) + if ( selected->HasFlag(wxPG_PROP_READONLY) && !selected->HasFlag(wxPG_PROP_ACTIVE_BTN) ) but->Disable(); return but; diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index 8ca54af69f..025d62ff49 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -1764,6 +1764,7 @@ wxDirProperty::wxDirProperty( const wxString& name, const wxString& label, const : wxLongStringProperty(name,label,value) { m_flags |= wxPG_PROP_NO_ESCAPE; + m_flags &= ~wxPG_PROP_ACTIVE_BTN; // Property button enabled only in not read-only mode. } wxDirProperty::~wxDirProperty() { } @@ -2108,6 +2109,7 @@ WX_PG_IMPLEMENT_PROPERTY_CLASS(wxLongStringProperty,wxPGProperty, wxLongStringProperty::wxLongStringProperty( const wxString& label, const wxString& name, const wxString& value ) : wxPGProperty(label,name) { + m_flags |= wxPG_PROP_ACTIVE_BTN; // Property button always enabled. SetValue(value); } @@ -2176,14 +2178,18 @@ bool wxLongStringProperty::DisplayEditorDialog( wxPGProperty* prop, wxPropertyGr #endif wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL ); + long edStyle = wxTE_MULTILINE; + if ( prop->HasFlag(wxPG_PROP_READONLY) ) + edStyle |= wxTE_READONLY; wxTextCtrl* ed = new wxTextCtrl(dlg,11,value, - wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE); + wxDefaultPosition,wxDefaultSize,edStyle); rowsizer->Add( ed, 1, wxEXPAND|wxALL, spacing ); topsizer->Add( rowsizer, 1, wxEXPAND, 0 ); wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer(); - buttonSizer->AddButton(new wxButton(dlg, wxID_OK)); + if ( !prop->HasFlag(wxPG_PROP_READONLY) ) + buttonSizer->AddButton(new wxButton(dlg, wxID_OK)); buttonSizer->AddButton(new wxButton(dlg, wxID_CANCEL)); buttonSizer->Realize(); topsizer->Add( buttonSizer, 0,