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 licence
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/propgrid/propgrid.h"
14 #include "wx/propgrid/advprops.h"
16 class MyFrame
: public wxFrame
19 MyFrame(wxWindow
* parent
);
21 void OnAction(wxCommandEvent
& event
);
22 void OnPropertyGridChange(wxPropertyGridEvent
& event
);
23 void OnPropertyGridChanging(wxPropertyGridEvent
& event
);
30 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
31 EVT_MENU(wxID_HIGHEST
+1, MyFrame::OnAction
)
32 EVT_PG_CHANGED( -1, MyFrame::OnPropertyGridChange
)
33 EVT_PG_CHANGING( -1, MyFrame::OnPropertyGridChanging
)
36 MyFrame::MyFrame(wxWindow
* parent
)
37 : wxFrame(parent
, wxID_ANY
, wxT("PropertyGrid Test"))
39 wxMenu
*Menu
= new wxMenu
;
40 Menu
->Append(wxID_HIGHEST
+1, wxT("Action"));
41 wxMenuBar
*MenuBar
= new wxMenuBar();
42 MenuBar
->Append(Menu
, wxT("Action"));
45 wxPropertyGrid
*pg
= new wxPropertyGrid(this,-1,wxDefaultPosition
,wxSize(400,400),
46 wxPG_SPLITTER_AUTO_CENTER
|
50 pg
->Append( new wxStringProperty("String Property", wxPG_LABEL
) );
51 pg
->Append( new wxIntProperty("Int Property", wxPG_LABEL
) );
52 pg
->Append( new wxBoolProperty("Bool Property", wxPG_LABEL
) );
57 void MyFrame::OnPropertyGridChange(wxPropertyGridEvent
&event
)
59 wxPGProperty
* p
= event
.GetProperty();
63 wxLogVerbose("OnPropertyGridChange(%s, value=%s)",
64 p
->GetName().c_str(), p
->GetValueAsString().c_str());
68 wxLogVerbose("OnPropertyGridChange(NULL)");
72 void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent
&event
)
74 wxPGProperty
* p
= event
.GetProperty();
76 wxLogVerbose("OnPropertyGridChanging(%s)", p
->GetName().c_str());
79 void MyFrame::OnAction(wxCommandEvent
&)
83 // Called from propgridsample.cpp
85 void DisplayMinimalFrame(wxWindow
* parent
)
87 MyFrame
*frame
= new MyFrame(parent
);