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 class WXDLLEXPORT wxTreeCtrl
;
20 class WXDLLEXPORT wxScrolledWindow
;
21 class WXDLLEXPORT wxSplitterWindow
;
24 #include "wx/treectrl.h"
25 #include "wx/imaglist.h"
26 #include "wx/listctrl.h"
37 CHANGED_TREE_SELECTED
= 2,
38 CHANGED_TREE_SELECTED_ICON
= 4,
40 CHANGED_PROPS_PANEL
= 16,
41 CHANGED_EVERYTHING
= CHANGED_TREE
| CHANGED_PROPS
| CHANGED_PROPS_PANEL
,
45 class EditorFrame
: public wxFrame
48 friend class EditorTreeCtrl
;
50 EditorFrame(wxFrame
*parent
, const wxString
& filename
);
53 void LoadFile(const wxString
& filename
);
55 void SaveFile(const wxString
& filename
);
58 void RefreshPreview(wxXmlNode
*node
);
59 void RefreshProps(wxXmlNode
*node
);
60 void RefreshPropsEdit();
61 bool SelectNode(wxXmlNode
*node
, wxTreeItemId
*root
= NULL
);
63 wxTreeItemId
CreateTreeNode(wxTreeCtrl
*treectrl
, wxTreeItemId parent
, wxXmlNode
*node
);
64 void CreatePropsList(wxListCtrl
*listctrl
, wxXmlNode
*node
);
66 void NotifyChanged(int change_type
);
68 void RegisterHandlers(const wxString
& dir
);
70 NodeHandler
*FindHandler(wxXmlNode
*node
);
72 static EditorFrame
*Get() { return ms_Instance
; }
75 static EditorFrame
*ms_Instance
;
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
;
88 wxXmlNode
*m_SelectedNode
;
91 wxXmlDocument
*m_Resource
;
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
);