From 8669431addfb4e91de06493bd708496bc45cbe9e Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Sun, 31 Jan 2010 18:14:24 +0000 Subject: [PATCH] Added command to set wxPG_PROP_READONLY in the propgrid sample git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/propgrid/propgrid.cpp | 17 +++++++++++++++++ samples/propgrid/propgrid.h | 1 + 2 files changed, 18 insertions(+) diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 1762bbfa8a..18a3584628 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -644,6 +644,7 @@ enum ID_INSERTPROP, ID_INSERTCAT, ID_ENABLE, + ID_SETREADONLY, ID_HIDE, ID_DELETE, ID_DELETER, @@ -748,6 +749,7 @@ BEGIN_EVENT_TABLE(FormMain, wxFrame) EVT_MENU( ID_UNSPECIFY, FormMain::OnMisc ) EVT_MENU( ID_DELETEALL, FormMain::OnClearClick ) EVT_MENU( ID_ENABLE, FormMain::OnEnableDisable ) + EVT_MENU( ID_SETREADONLY, FormMain::OnSetReadOnly ) EVT_MENU( ID_HIDE, FormMain::OnHideShow ) EVT_MENU( ID_ITERATE1, FormMain::OnIterate1Click ) @@ -2284,6 +2286,8 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size wxT("Toggles item's enabled state.") ); m_itemEnable->Enable( FALSE ); menuTools1->Append(ID_HIDE, wxT("Hide"), wxT("Shows or hides a property") ); + menuTools1->Append(ID_SETREADONLY, "Set as Read-Only", + "Set property as read-only" ); menuTools2->Append(ID_ITERATE1, wxT("Iterate Over Properties") ); menuTools2->Append(ID_ITERATE2, wxT("Iterate Over Visible Items") ); @@ -2731,6 +2735,19 @@ void FormMain::OnEnableDisable( wxCommandEvent& ) // ----------------------------------------------------------------------- +void FormMain::OnSetReadOnly( wxCommandEvent& WXUNUSED(event) ) +{ + wxPGProperty* p = m_pPropGridManager->GetGrid()->GetSelection(); + if ( !p ) + { + wxMessageBox(wxT("First select a property.")); + return; + } + m_pPropGridManager->SetPropertyReadOnly(p); +} + +// ----------------------------------------------------------------------- + void FormMain::OnHideShow( wxCommandEvent& WXUNUSED(event) ) { wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection(); diff --git a/samples/propgrid/propgrid.h b/samples/propgrid/propgrid.h index 96a79c5af8..3ffb11a7c6 100644 --- a/samples/propgrid/propgrid.h +++ b/samples/propgrid/propgrid.h @@ -185,6 +185,7 @@ public: void OnContextMenu( wxContextMenuEvent& event ); void OnEnableDisable( wxCommandEvent& event ); + void OnSetReadOnly( wxCommandEvent& event ); void OnHideShow( wxCommandEvent& event ); void OnSetBackgroundColour( wxCommandEvent& event ); void OnClearModifyStatusClick( wxCommandEvent& event ); -- 2.45.2