]> git.saurik.com Git - wxWidgets.git/blob - contrib/utils/wxrcedit/editor.h
72333a31432bf6e1c5c9d9d0ea93a707b97272f8
[wxWidgets.git] / contrib / utils / wxrcedit / editor.h
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
18 class wxXmlNode;
19 class wxTreeCtrl;
20 class wxScrolledWindow;
21 class wxSplitterWindow;
22
23 #include "wx/frame.h"
24
25
26
27 class NodeHandler;
28 class wxXmlNode;
29 class wxXmlDocument;
30 class EditorTreeCtrl;
31
32 enum ChangeType
33 {
34 CHANGED_NOTHING = 0,
35 CHANGED_TREE = 1,
36 CHANGED_TREE_SELECTED = 2,
37 CHANGED_TREE_SELECTED_ICON = 4,
38 CHANGED_PROPS = 8,
39 CHANGED_PROPS_PANEL = 16,
40 CHANGED_EVERYTHING = CHANGED_TREE | CHANGED_PROPS | CHANGED_PROPS_PANEL,
41 };
42
43
44 class EditorFrame : public wxFrame
45 {
46 public:
47 friend class EditorTreeCtrl;
48
49 EditorFrame(wxFrame *parent, const wxString& filename);
50 ~EditorFrame();
51
52 void LoadFile(const wxString& filename);
53 void NewFile();
54 void SaveFile(const wxString& filename);
55
56 void RefreshTree();
57 void RefreshPreview(wxXmlNode *node);
58 void RefreshProps(wxXmlNode *node);
59 void RefreshPropsEdit();
60 bool SelectNode(wxXmlNode *node, wxTreeItemId *root = NULL);
61
62 wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, wxXmlNode *node);
63 void CreatePropsList(wxListCtrl *listctrl, wxXmlNode *node);
64
65 void NotifyChanged(int change_type);
66
67 void RegisterHandlers(const wxString& dir);
68
69 NodeHandler *FindHandler(wxXmlNode *node);
70
71 static EditorFrame *Get() { return ms_Instance; }
72
73 private:
74 static EditorFrame *ms_Instance;
75
76 wxTreeCtrl *m_TreeCtrl;
77 wxTextCtrl *m_XMLIDCtrl;
78 wxImageList *m_ImgList, *m_ImgListProp;
79 wxPanel *m_PropsPanel;
80 wxScrolledWindow *m_PropsEditPanel;
81 wxSplitterWindow *m_Splitter, *m_Splitter2;
82 wxListCtrl *m_PropsList;
83 int m_SelectedProp;
84
85 wxList m_Handlers;
86
87 wxXmlNode *m_SelectedNode;
88
89 wxString m_FileName;
90 wxXmlDocument *m_Resource;
91 wxWindow *m_Preview;
92
93 DECLARE_EVENT_TABLE()
94 void OnTreeSel(wxTreeEvent& event);
95 void OnToolbar(wxCommandEvent& event);
96 void OnNew(wxCommandEvent& event);
97 void OnXMLIDEdit(wxCommandEvent& event);
98 void OnXMLIDPick(wxCommandEvent& event);
99 void OnEditCode(wxCommandEvent& event);
100 void OnClearProp(wxCommandEvent& event);
101 void OnPropSel(wxListEvent& event);
102 void OnNewNode(wxCommandEvent& event);
103 void OnRightClickTree(wxPoint pos);
104 };
105
106
107 #endif