]> git.saurik.com Git - wxWidgets.git/blame - samples/treectrl/treetest.h
Added serial code for wxList and wxHashTable to source tree
[wxWidgets.git] / samples / treectrl / treetest.h
CommitLineData
457814b5
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: treetest.h
3// Purpose: wxTreeCtrl sample
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
5a43154b 9// Licence: wxWindows license
457814b5
JS
10/////////////////////////////////////////////////////////////////////////////
11
12// Define a new application type
5a43154b
VZ
13class MyApp : public wxApp
14{
15public:
16 bool OnInit();
17};
457814b5 18
5a43154b
VZ
19class MyTreeItemData : public wxTreeItemData
20{
21public:
22 MyTreeItemData(const wxString& desc) : m_desc(desc) { }
23
24 void ShowInfo(wxTreeCtrl *tree);
25
26private:
27 wxString m_desc;
457814b5
JS
28};
29
5a43154b 30class MyTreeCtrl : public wxTreeCtrl
457814b5
JS
31{
32public:
5a43154b
VZ
33 enum
34 {
add28c55
VZ
35 TreeCtrlIcon_File,
36 TreeCtrlIcon_Folder
5a43154b
VZ
37 };
38
39 MyTreeCtrl(wxWindow *parent, const wxWindowID id,
40 const wxPoint& pos, const wxSize& size,
41 long style);
42 virtual ~MyTreeCtrl();
43
44 void OnBeginDrag(wxTreeEvent& event);
45 void OnBeginRDrag(wxTreeEvent& event);
46 void OnBeginLabelEdit(wxTreeEvent& event);
47 void OnEndLabelEdit(wxTreeEvent& event);
48 void OnDeleteItem(wxTreeEvent& event);
49 void OnGetInfo(wxTreeEvent& event);
50 void OnSetInfo(wxTreeEvent& event);
51 void OnItemExpanded(wxTreeEvent& event);
52 void OnItemExpanding(wxTreeEvent& event);
53 void OnItemCollapsed(wxTreeEvent& event);
54 void OnItemCollapsing(wxTreeEvent& event);
55 void OnSelChanged(wxTreeEvent& event);
56 void OnSelChanging(wxTreeEvent& event);
57 void OnKeyDown(wxTreeEvent& event);
58
ff5bf259
VZ
59 void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
60
61 void AddTestItemsToTree(size_t numChildren,
62 size_t depth);
4832f7c0 63
5a43154b
VZ
64private:
65 void AddItemsRecursively(const wxTreeItemId& idParent,
66 size_t nChildren,
4832f7c0 67 size_t depth,
ff5bf259 68 size_t folder);
5a43154b
VZ
69
70 wxImageList *m_imageListNormal;
71
72 DECLARE_EVENT_TABLE()
457814b5
JS
73};
74
75// Define a new frame type
76class MyFrame: public wxFrame
019bf128
UU
77{
78public:
5a43154b
VZ
79 // ctor and dtor
80 MyFrame(const wxString& title, int x, int y, int w, int h);
81 virtual ~MyFrame();
f135ff73 82
5a43154b
VZ
83 // menu callbacks
84 void OnQuit(wxCommandEvent& event);
85 void OnAbout(wxCommandEvent& event);
4832f7c0 86 void OnDump(wxCommandEvent& event);
ff5bf259
VZ
87 void OnDelete(wxCommandEvent& event);
88 void OnDeleteAll(wxCommandEvent& event);
89 void OnRecreate(wxCommandEvent& event);
f135ff73 90
add28c55
VZ
91 void OnSetBold(wxCommandEvent& event) { DoSetBold(TRUE); }
92 void OnClearBold(wxCommandEvent& event) { DoSetBold(FALSE); }
93
f135ff73 94private:
5a43154b 95 MyTreeCtrl *m_treeCtrl;
457814b5 96
add28c55
VZ
97 void DoSetBold(bool bold = TRUE);
98
5a43154b
VZ
99 DECLARE_EVENT_TABLE()
100};
457814b5 101
5a43154b
VZ
102// menu and control ids
103enum
104{
105 TreeTest_Quit,
106 TreeTest_About,
4832f7c0 107 TreeTest_Dump,
add28c55
VZ
108 TreeTest_Bold,
109 TreeTest_UnBold,
ff5bf259
VZ
110 TreeTest_Delete,
111 TreeTest_DeleteAll,
112 TreeTest_Recreate,
5a43154b
VZ
113 TreeTest_Ctrl = 100
114};
457814b5 115
f135ff73
VZ
116enum
117{
118 TreeCtrlIcon_File,
119 TreeCtrlIcon_Folder
120};