1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/propgrid/propgrid_minimal.cpp
3 // Purpose: Minimal portion of wxPropertyGrid sample
4 // Author: Jaakko Salli
8 // Copyright: (c) Jaakko Salli
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/propgrid/propgrid.h"
15 class MyFrame
: public wxFrame
18 MyFrame(wxWindow
* parent
);
20 void OnAction(wxCommandEvent
& event
);
21 void OnPropertyGridChange(wxPropertyGridEvent
& event
);
22 void OnPropertyGridChanging(wxPropertyGridEvent
& event
);
29 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
30 EVT_MENU(wxID_HIGHEST
+1, MyFrame::OnAction
)
31 EVT_PG_CHANGED( -1, MyFrame::OnPropertyGridChange
)
32 EVT_PG_CHANGING( -1, MyFrame::OnPropertyGridChanging
)
35 MyFrame::MyFrame(wxWindow
* parent
)
36 : wxFrame(parent
, wxID_ANY
, wxT("PropertyGrid Test"))
38 wxMenu
*Menu
= new wxMenu
;
39 Menu
->Append(wxID_HIGHEST
+1, wxT("Action"));
40 wxMenuBar
*MenuBar
= new wxMenuBar();
41 MenuBar
->Append(Menu
, wxT("Action"));
44 wxPropertyGrid
*pg
= new wxPropertyGrid(this,-1,wxDefaultPosition
,wxSize(400,400),
45 wxPG_SPLITTER_AUTO_CENTER
|
49 pg
->Append( new wxStringProperty("String Property", wxPG_LABEL
) );
50 pg
->Append( new wxIntProperty("Int Property", wxPG_LABEL
) );
51 pg
->Append( new wxBoolProperty("Bool Property", wxPG_LABEL
) );
56 void MyFrame::OnPropertyGridChange(wxPropertyGridEvent
&event
)
58 wxPGProperty
* p
= event
.GetProperty();
61 wxLogDebug("OnPropertyGridChange(%s, value=%s)",
62 p
->GetName().c_str(), p
->GetValueAsString().c_str());
64 wxLogDebug("OnPropertyGridChange(NULL)");
67 void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent
&event
)
69 wxPGProperty
* p
= event
.GetProperty();
71 wxLogDebug("OnPropertyGridChanging(%s)", p
->GetName().c_str());
74 void MyFrame::OnAction(wxCommandEvent
&)
78 // Called from propgridsample.cpp
80 void DisplayMinimalFrame(wxWindow
* parent
)
82 MyFrame
*frame
= new MyFrame(parent
);