]>
Commit | Line | Data |
---|---|---|
d7463f75 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: configtree.h | |
3 | // Purpose: wxWindows Configuration Tool tree class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2003-06-03 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | ||
13 | #ifndef _CT_CONFIGTREE_H_ | |
14 | #define _CT_CONFIGTREE_H_ | |
15 | ||
71ada1a5 | 16 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
d7463f75 JS |
17 | #pragma interface "configtree.cpp" |
18 | #endif | |
19 | ||
20 | #include "wx/wx.h" | |
21 | #include "wx/treectrl.h" | |
22 | ||
23 | #include "configitem.h" | |
24 | #include "utils.h" | |
25 | ||
26 | /*! | |
27 | * ctTreeItemData | |
28 | * Holds the ctConfigItem for each tree item. | |
29 | */ | |
30 | ||
31 | class ctTreeItemData : public wxTreeItemData | |
32 | { | |
33 | public: | |
34 | ctTreeItemData(ctConfigItem* item) : m_configItem(item) { } | |
35 | ~ctTreeItemData() ; | |
36 | ||
37 | ctConfigItem *GetConfigItem() const { return m_configItem; } | |
38 | void SetConfigItem(ctConfigItem *item) { m_configItem = item; } | |
39 | ||
40 | private: | |
41 | ctConfigItem* m_configItem; | |
42 | }; | |
43 | ||
44 | ||
45 | /*! | |
46 | * ctConfigTreeCtrl | |
47 | * The options hierarchy viewer. | |
48 | */ | |
49 | ||
50 | class ctConfigTreeCtrl: public wxTreeCtrl | |
51 | { | |
52 | DECLARE_CLASS(ctConfigTreeCtrl) | |
53 | public: | |
54 | ctConfigTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition, | |
55 | const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS); | |
56 | ~ctConfigTreeCtrl(); | |
57 | ||
58 | //// Event handlers | |
59 | void OnMouseEvent(wxMouseEvent& event); | |
60 | void OnSelChanged(wxTreeEvent& event); | |
61 | void OnHelp(wxHelpEvent& event); | |
62 | void OnKeyDown(wxKeyEvent& event); | |
63 | ||
64 | //// Accessors | |
65 | ||
66 | /// Get the table of icons | |
67 | wxIconTable& GetIconTable() { return m_iconTable; } | |
68 | ||
69 | /// Get the context menu | |
70 | wxMenu* GetMenu() { return m_contextMenu; } | |
71 | ||
72 | /// Get the item associated with the context menu events | |
73 | ctConfigItem* GetContextItem() { return m_contextItem; } | |
74 | ||
75 | //// Operations | |
76 | ||
77 | /// Loads the icons. | |
78 | void LoadIcons(); | |
79 | ||
80 | protected: | |
81 | wxImageList* m_imageList; | |
82 | wxIconTable m_iconTable; | |
83 | wxMenu* m_contextMenu; | |
84 | // The item associated with the context menu events | |
85 | ctConfigItem* m_contextItem; | |
86 | ||
87 | DECLARE_EVENT_TABLE() | |
88 | }; | |
89 | ||
90 | #endif | |
91 | // _CT_CONFIGTREE_H_ |