]>
Commit | Line | Data |
---|---|---|
56d2f750 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Purpose: XML resources editor | |
3 | // Author: Vaclav Slavik | |
4 | // Created: 2000/05/05 | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) 2000 Vaclav Slavik | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifdef __GNUG__ | |
11 | #pragma interface "editor.h" | |
12 | #endif | |
13 | ||
14 | #ifndef _EDITOR_H_ | |
15 | #define _EDITOR_H_ | |
16 | ||
17 | ||
56d2f750 | 18 | #include "wx/frame.h" |
031dfec8 JS |
19 | #include "wx/treectrl.h" |
20 | #include "wx/imaglist.h" | |
21 | #include "wx/listctrl.h" | |
56d2f750 | 22 | |
1ad83f6b VS |
23 | class WXDLLEXPORT wxXmlNode; |
24 | class WXDLLEXPORT wxTreeCtrl; | |
25 | class WXDLLEXPORT wxScrolledWindow; | |
26 | class WXDLLEXPORT wxSplitterWindow; | |
56d2f750 | 27 | class NodeHandler; |
1ad83f6b VS |
28 | class WXDLLEXPORT wxXmlNode; |
29 | class WXDLLEXPORT wxXmlDocument; | |
56d2f750 | 30 | class EditorTreeCtrl; |
1ad83f6b VS |
31 | class WXDLLEXPORT wxTreeCtrl; |
32 | class WXDLLEXPORT wxListCtrl; | |
33 | class WXDLLEXPORT wxTreeItemId; | |
34 | class WXDLLEXPORT wxImageList; | |
35 | class WXDLLEXPORT wxTreeEvent; | |
36 | class WXDLLEXPORT wxListEvent; | |
56d2f750 VS |
37 | |
38 | enum ChangeType | |
39 | { | |
40 | CHANGED_NOTHING = 0, | |
41 | CHANGED_TREE = 1, | |
42 | CHANGED_TREE_SELECTED = 2, | |
43 | CHANGED_TREE_SELECTED_ICON = 4, | |
44 | CHANGED_PROPS = 8, | |
45 | CHANGED_PROPS_PANEL = 16, | |
46 | CHANGED_EVERYTHING = CHANGED_TREE | CHANGED_PROPS | CHANGED_PROPS_PANEL, | |
47 | }; | |
48 | ||
49 | ||
50 | class EditorFrame : public wxFrame | |
51 | { | |
52 | public: | |
53 | friend class EditorTreeCtrl; | |
54 | ||
55 | EditorFrame(wxFrame *parent, const wxString& filename); | |
56 | ~EditorFrame(); | |
57 | ||
58 | void LoadFile(const wxString& filename); | |
59 | void NewFile(); | |
60 | void SaveFile(const wxString& filename); | |
61 | ||
62 | void RefreshTree(); | |
63 | void RefreshPreview(wxXmlNode *node); | |
64 | void RefreshProps(wxXmlNode *node); | |
65 | void RefreshPropsEdit(); | |
66 | bool SelectNode(wxXmlNode *node, wxTreeItemId *root = NULL); | |
67 | ||
68 | wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, wxXmlNode *node); | |
69 | void CreatePropsList(wxListCtrl *listctrl, wxXmlNode *node); | |
70 | ||
71 | void NotifyChanged(int change_type); | |
72 | ||
73 | void RegisterHandlers(const wxString& dir); | |
74 | ||
75 | NodeHandler *FindHandler(wxXmlNode *node); | |
76 | ||
77 | static EditorFrame *Get() { return ms_Instance; } | |
78 | ||
79 | private: | |
80 | static EditorFrame *ms_Instance; | |
81 | ||
82 | wxTreeCtrl *m_TreeCtrl; | |
83 | wxTextCtrl *m_XMLIDCtrl; | |
84 | wxImageList *m_ImgList, *m_ImgListProp; | |
85 | wxPanel *m_PropsPanel; | |
86 | wxScrolledWindow *m_PropsEditPanel; | |
87 | wxSplitterWindow *m_Splitter, *m_Splitter2; | |
88 | wxListCtrl *m_PropsList; | |
89 | int m_SelectedProp; | |
90 | ||
91 | wxList m_Handlers; | |
92 | ||
93 | wxXmlNode *m_SelectedNode; | |
2ada7c65 VS |
94 | |
95 | wxXmlNode *m_Clipboard; | |
56d2f750 VS |
96 | |
97 | wxString m_FileName; | |
98 | wxXmlDocument *m_Resource; | |
99 | wxWindow *m_Preview; | |
100 | ||
101 | DECLARE_EVENT_TABLE() | |
102 | void OnTreeSel(wxTreeEvent& event); | |
103 | void OnToolbar(wxCommandEvent& event); | |
104 | void OnNew(wxCommandEvent& event); | |
105 | void OnXMLIDEdit(wxCommandEvent& event); | |
106 | void OnXMLIDPick(wxCommandEvent& event); | |
107 | void OnEditCode(wxCommandEvent& event); | |
108 | void OnClearProp(wxCommandEvent& event); | |
109 | void OnPropSel(wxListEvent& event); | |
110 | void OnNewNode(wxCommandEvent& event); | |
111 | void OnRightClickTree(wxPoint pos); | |
2ada7c65 VS |
112 | void OnClipboardAction(wxCommandEvent& event); |
113 | ||
114 | void DeleteSelectedNode(); | |
56d2f750 VS |
115 | }; |
116 | ||
117 | ||
118 | #endif |