1 /////////////////////////////////////////////////////////////////////////////
2 // Purpose: XML resources editor
3 // Author: Vaclav Slavik
6 // Copyright: (c) 2000 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma interface "editor.h"
19 #include "wx/treectrl.h"
20 #include "wx/imaglist.h"
21 #include "wx/listctrl.h"
23 class WXDLLEXPORT wxXmlNode
;
24 class WXDLLEXPORT wxTreeCtrl
;
25 class WXDLLEXPORT wxScrolledWindow
;
26 class WXDLLEXPORT wxSplitterWindow
;
28 class WXDLLEXPORT wxXmlNode
;
29 class WXDLLEXPORT wxXmlDocument
;
31 class WXDLLEXPORT wxTreeCtrl
;
32 class WXDLLEXPORT wxListCtrl
;
33 class WXDLLEXPORT wxTreeItemId
;
34 class WXDLLEXPORT wxImageList
;
35 class WXDLLEXPORT wxTreeEvent
;
36 class WXDLLEXPORT wxListEvent
;
42 CHANGED_TREE_SELECTED
= 2,
43 CHANGED_TREE_SELECTED_ICON
= 4,
45 CHANGED_PROPS_PANEL
= 16,
46 CHANGED_EVERYTHING
= CHANGED_TREE
| CHANGED_PROPS
| CHANGED_PROPS_PANEL
,
50 class EditorFrame
: public wxFrame
53 friend class EditorTreeCtrl
;
55 EditorFrame(wxFrame
*parent
, const wxString
& filename
);
58 void LoadFile(const wxString
& filename
);
60 void SaveFile(const wxString
& filename
);
63 void RefreshPreview(wxXmlNode
*node
);
64 void RefreshProps(wxXmlNode
*node
);
65 void RefreshPropsEdit();
66 bool SelectNode(wxXmlNode
*node
, wxTreeItemId
*root
= NULL
);
68 wxTreeItemId
CreateTreeNode(wxTreeCtrl
*treectrl
, wxTreeItemId parent
, wxXmlNode
*node
);
69 void CreatePropsList(wxListCtrl
*listctrl
, wxXmlNode
*node
);
71 void NotifyChanged(int change_type
);
73 void RegisterHandlers(const wxString
& dir
);
75 NodeHandler
*FindHandler(wxXmlNode
*node
);
77 static EditorFrame
*Get() { return ms_Instance
; }
80 static EditorFrame
*ms_Instance
;
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
;
93 wxXmlNode
*m_SelectedNode
;
96 wxXmlDocument
*m_Resource
;
100 void OnTreeSel(wxTreeEvent
& event
);
101 void OnToolbar(wxCommandEvent
& event
);
102 void OnNew(wxCommandEvent
& event
);
103 void OnXMLIDEdit(wxCommandEvent
& event
);
104 void OnXMLIDPick(wxCommandEvent
& event
);
105 void OnEditCode(wxCommandEvent
& event
);
106 void OnClearProp(wxCommandEvent
& event
);
107 void OnPropSel(wxListEvent
& event
);
108 void OnNewNode(wxCommandEvent
& event
);
109 void OnRightClickTree(wxPoint pos
);