1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/propgrid/propgrid_minimal.cpp
3 // Purpose: Minimal portion of wxPropertyGrid sample
4 // Author: Jaakko Salli
7 // Copyright: (c) Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/propgrid/propgrid.h"
13 #include "wx/propgrid/advprops.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();
62 wxLogVerbose("OnPropertyGridChange(%s, value=%s)",
63 p
->GetName().c_str(), p
->GetValueAsString().c_str());
67 wxLogVerbose("OnPropertyGridChange(NULL)");
71 void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent
&event
)
73 wxPGProperty
* p
= event
.GetProperty();
75 wxLogVerbose("OnPropertyGridChanging(%s)", p
->GetName().c_str());
78 void MyFrame::OnAction(wxCommandEvent
&)
82 // Called from propgridsample.cpp
84 void DisplayMinimalFrame(wxWindow
* parent
)
86 MyFrame
*frame
= new MyFrame(parent
);