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:
@@ -496,7 +496,11 @@ wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000,
|
|||||||
|
|
||||||
/** Indicates that the property is being deleted and should be ignored.
|
/** 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
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -651,6 +651,9 @@ protected:
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
#define wxPG_PROP_NO_ESCAPE wxPG_PROP_CLASS_SPECIFIC_1
|
#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
|
/** @class wxPGLongStringDialogAdapter
|
||||||
|
@@ -2019,7 +2019,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( selected->HasFlag(wxPG_PROP_READONLY) )
|
if ( selected->HasFlag(wxPG_PROP_READONLY) && !selected->HasFlag(wxPG_PROP_ACTIVE_BTN) )
|
||||||
but->Disable();
|
but->Disable();
|
||||||
|
|
||||||
return but;
|
return but;
|
||||||
|
@@ -1764,6 +1764,7 @@ wxDirProperty::wxDirProperty( const wxString& name, const wxString& label, const
|
|||||||
: wxLongStringProperty(name,label,value)
|
: wxLongStringProperty(name,label,value)
|
||||||
{
|
{
|
||||||
m_flags |= wxPG_PROP_NO_ESCAPE;
|
m_flags |= wxPG_PROP_NO_ESCAPE;
|
||||||
|
m_flags &= ~wxPG_PROP_ACTIVE_BTN; // Property button enabled only in not read-only mode.
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDirProperty::~wxDirProperty() { }
|
wxDirProperty::~wxDirProperty() { }
|
||||||
@@ -2108,6 +2109,7 @@ WX_PG_IMPLEMENT_PROPERTY_CLASS(wxLongStringProperty,wxPGProperty,
|
|||||||
wxLongStringProperty::wxLongStringProperty( const wxString& label, const wxString& name,
|
wxLongStringProperty::wxLongStringProperty( const wxString& label, const wxString& name,
|
||||||
const wxString& value ) : wxPGProperty(label,name)
|
const wxString& value ) : wxPGProperty(label,name)
|
||||||
{
|
{
|
||||||
|
m_flags |= wxPG_PROP_ACTIVE_BTN; // Property button always enabled.
|
||||||
SetValue(value);
|
SetValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2176,13 +2178,17 @@ bool wxLongStringProperty::DisplayEditorDialog( wxPGProperty* prop, wxPropertyGr
|
|||||||
#endif
|
#endif
|
||||||
wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
|
||||||
wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL );
|
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,
|
wxTextCtrl* ed = new wxTextCtrl(dlg,11,value,
|
||||||
wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE);
|
wxDefaultPosition,wxDefaultSize,edStyle);
|
||||||
|
|
||||||
rowsizer->Add( ed, 1, wxEXPAND|wxALL, spacing );
|
rowsizer->Add( ed, 1, wxEXPAND|wxALL, spacing );
|
||||||
topsizer->Add( rowsizer, 1, wxEXPAND, 0 );
|
topsizer->Add( rowsizer, 1, wxEXPAND, 0 );
|
||||||
|
|
||||||
wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer();
|
||||||
|
if ( !prop->HasFlag(wxPG_PROP_READONLY) )
|
||||||
buttonSizer->AddButton(new wxButton(dlg, wxID_OK));
|
buttonSizer->AddButton(new wxButton(dlg, wxID_OK));
|
||||||
buttonSizer->AddButton(new wxButton(dlg, wxID_CANCEL));
|
buttonSizer->AddButton(new wxButton(dlg, wxID_CANCEL));
|
||||||
buttonSizer->Realize();
|
buttonSizer->Realize();
|
||||||
|
Reference in New Issue
Block a user