Allow viewing read-only long string wxPropertyGrid properties values.

When wxLongStringProperty is read-only, it should still be possible to view
its value by opening the dialog normally used for editing it, otherwise this
value cannot be seen (nor copied, which is also useful sometimes) at all.

Closes #14945.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76631 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-05-31 14:21:23 +00:00
parent e5f9b9cfad
commit ceb39f4174
4 changed files with 17 additions and 4 deletions

View File

@@ -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
};

View File

@@ -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

View File

@@ -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;

View File

@@ -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,13 +2178,17 @@ 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();
if ( !prop->HasFlag(wxPG_PROP_READONLY) )
buttonSizer->AddButton(new wxButton(dlg, wxID_OK));
buttonSizer->AddButton(new wxButton(dlg, wxID_CANCEL));
buttonSizer->Realize();