]> git.saurik.com Git - wxWidgets.git/blob - utils/configtool/src/configtree.h
glibc's vswprintf doesn't nul terminate on truncation.
[wxWidgets.git] / utils / configtool / src / configtree.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: configtree.h
3 // Purpose: wxWidgets 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
16 #include "wx/wx.h"
17 #include "wx/treectrl.h"
18
19 #include "configitem.h"
20 #include "utils.h"
21
22 /*!
23 * ctTreeItemData
24 * Holds the ctConfigItem for each tree item.
25 */
26
27 class ctTreeItemData : public wxTreeItemData
28 {
29 public:
30 ctTreeItemData(ctConfigItem* item) : m_configItem(item) { }
31 ~ctTreeItemData() ;
32
33 ctConfigItem *GetConfigItem() const { return m_configItem; }
34 void SetConfigItem(ctConfigItem *item) { m_configItem = item; }
35
36 private:
37 ctConfigItem* m_configItem;
38 };
39
40
41 /*!
42 * ctConfigTreeCtrl
43 * The options hierarchy viewer.
44 */
45
46 class ctConfigTreeCtrl: public wxTreeCtrl
47 {
48 DECLARE_CLASS(ctConfigTreeCtrl)
49 public:
50 ctConfigTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition,
51 const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
52 ~ctConfigTreeCtrl();
53
54 //// Event handlers
55 void OnMouseEvent(wxMouseEvent& event);
56 void OnSelChanged(wxTreeEvent& event);
57 void OnHelp(wxHelpEvent& event);
58 void OnKeyDown(wxKeyEvent& event);
59
60 //// Accessors
61
62 /// Get the table of icons
63 wxIconTable& GetIconTable() { return m_iconTable; }
64
65 /// Get the context menu
66 wxMenu* GetMenu() { return m_contextMenu; }
67
68 /// Get the item associated with the context menu events
69 ctConfigItem* GetContextItem() { return m_contextItem; }
70
71 //// Operations
72
73 /// Loads the icons.
74 void LoadIcons();
75
76 protected:
77 wxImageList* m_imageList;
78 wxIconTable m_iconTable;
79 wxMenu* m_contextMenu;
80 // The item associated with the context menu events
81 ctConfigItem* m_contextItem;
82
83 DECLARE_EVENT_TABLE()
84 };
85
86 #endif
87 // _CT_CONFIGTREE_H_