]>
Commit | Line | Data |
---|---|---|
1c4293cb VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: samples/propgrid/propgrid_minimal.cpp | |
3 | // Purpose: Minimal portion of wxPropertyGrid sample | |
4 | // Author: Jaakko Salli | |
5 | // Modified by: | |
6 | // Created: 2008-08-23 | |
ea5af9c5 | 7 | // RCS-ID: $Id$ |
1c4293cb VZ |
8 | // Copyright: (c) Jaakko Salli |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wx.h" | |
13 | #include "wx/propgrid/propgrid.h" | |
14 | ||
15 | class MyFrame : public wxFrame | |
16 | { | |
17 | public: | |
18 | MyFrame(wxWindow* parent); | |
19 | ||
20 | void OnAction(wxCommandEvent& event); | |
21 | void OnPropertyGridChange(wxPropertyGridEvent& event); | |
22 | ||
23 | private: | |
24 | wxPropertyGrid* m_pg; | |
25 | DECLARE_EVENT_TABLE() | |
26 | }; | |
27 | ||
1c4293cb VZ |
28 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) |
29 | EVT_MENU(wxID_HIGHEST+1, MyFrame::OnAction) | |
30 | EVT_PG_CHANGED( -1, MyFrame::OnPropertyGridChange ) | |
31 | END_EVENT_TABLE() | |
32 | ||
33 | MyFrame::MyFrame(wxWindow* parent) | |
34 | : wxFrame(parent, wxID_ANY, wxT("PropertyGrid Test")) | |
35 | { | |
36 | wxMenu *Menu = new wxMenu; | |
37 | Menu->Append(wxID_HIGHEST+1, wxT("Action")); | |
38 | wxMenuBar *MenuBar = new wxMenuBar(); | |
39 | MenuBar->Append(Menu, wxT("Action")); | |
40 | SetMenuBar(MenuBar); | |
41 | ||
42 | wxPropertyGrid *pg = new wxPropertyGrid(this,-1,wxDefaultPosition,wxSize(400,400), | |
43 | wxPG_SPLITTER_AUTO_CENTER | | |
44 | wxPG_BOLD_MODIFIED ); | |
45 | m_pg = pg; | |
46 | ||
68545f78 JS |
47 | pg->Append( new wxStringProperty("String Property", wxPG_LABEL) ); |
48 | pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) ); | |
49 | pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) ); | |
1c4293cb VZ |
50 | |
51 | SetSize(400, 600); | |
52 | } | |
53 | ||
54 | void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event) | |
55 | { | |
56 | wxPGProperty* p = event.GetProperty(); | |
57 | ||
68545f78 JS |
58 | if ( p ) |
59 | wxLogDebug("OnPropertyGridChange(%s)", p->GetName().c_str()); | |
60 | else | |
61 | wxLogDebug("OnPropertyGridChange(NULL)"); | |
1c4293cb VZ |
62 | } |
63 | ||
64 | void MyFrame::OnAction(wxCommandEvent &) | |
65 | { | |
66 | } | |
68545f78 JS |
67 | |
68 | // Called from propgridsample.cpp | |
69 | // | |
70 | void DisplayMinimalFrame(wxWindow* parent) | |
71 | { | |
72 | MyFrame *frame = new MyFrame(parent); | |
73 | frame->Show(true); | |
74 | } |