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