]>
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 | ||
ab7ce33c | 10 | #if defined(__GNUG__) && !defined(__APPLE__) |
56d2f750 VS |
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 | ||
43ef6d9e VS |
50 | class wxXmlRcEditDocument : public wxXmlDocument |
51 | { | |
52 | // Helper functions for Upgrade() | |
53 | void UpgradeNodeValue(wxXmlNode *node); | |
54 | void UpgradeNode(wxXmlNode *node); | |
55 | ||
56 | public: | |
57 | // Upgrades older versions | |
58 | void Upgrade(); | |
59 | ||
60 | }; | |
61 | ||
56d2f750 VS |
62 | class EditorFrame : public wxFrame |
63 | { | |
64 | public: | |
65 | friend class EditorTreeCtrl; | |
f80ea77b | 66 | |
56d2f750 VS |
67 | EditorFrame(wxFrame *parent, const wxString& filename); |
68 | ~EditorFrame(); | |
69 | ||
70 | void LoadFile(const wxString& filename); | |
71 | void NewFile(); | |
72 | void SaveFile(const wxString& filename); | |
e066e256 | 73 | wxString GetFileName() { return m_FileName; } |
f80ea77b | 74 | |
56d2f750 | 75 | void RefreshTree(); |
26607f41 | 76 | void RefreshTitle(); |
56d2f750 | 77 | bool SelectNode(wxXmlNode *node, wxTreeItemId *root = NULL); |
f80ea77b | 78 | |
56d2f750 | 79 | wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, wxXmlNode *node); |
f80ea77b | 80 | |
56d2f750 | 81 | void NotifyChanged(int change_type); |
f80ea77b | 82 | |
56d2f750 | 83 | static EditorFrame *Get() { return ms_Instance; } |
f80ea77b | 84 | |
56d2f750 VS |
85 | private: |
86 | static EditorFrame *ms_Instance; | |
f80ea77b | 87 | |
56d2f750 | 88 | wxTreeCtrl *m_TreeCtrl; |
f80ea77b | 89 | |
56d2f750 | 90 | wxXmlNode *m_SelectedNode; |
f80ea77b | 91 | |
2ada7c65 | 92 | wxXmlNode *m_Clipboard; |
56d2f750 VS |
93 | |
94 | wxString m_FileName; | |
43ef6d9e | 95 | wxXmlRcEditDocument *m_Resource; |
f80ea77b | 96 | |
26607f41 | 97 | bool m_Modified; |
f80ea77b | 98 | |
26607f41 VS |
99 | bool AskToSave(); |
100 | void DeleteSelectedNode(); | |
56d2f750 VS |
101 | |
102 | DECLARE_EVENT_TABLE() | |
103 | void OnTreeSel(wxTreeEvent& event); | |
104 | void OnToolbar(wxCommandEvent& event); | |
105 | void OnNew(wxCommandEvent& event); | |
56d2f750 VS |
106 | void OnNewNode(wxCommandEvent& event); |
107 | void OnRightClickTree(wxPoint pos); | |
2ada7c65 | 108 | void OnClipboardAction(wxCommandEvent& event); |
26607f41 | 109 | void OnCloseWindow(wxCloseEvent&); |
56d2f750 VS |
110 | }; |
111 | ||
112 | ||
113 | #endif |