1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Main frame class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _AP_MAINFRAME_H_
13 #define _AP_MAINFRAME_H_
15 #include "wx/imaglist.h"
16 #include "wx/docview.h"
18 class WXDLLEXPORT wxHtmlWindow
;
19 class WXDLLEXPORT wxSplitterWindow
;
20 class WXDLLEXPORT wxNotebookEvent
;
22 class ctConfigTreeCtrl
;
23 class ctPropertyEditor
;
27 * \brief The main window of the application.
30 class ctMainFrame
: public wxDocParentFrame
32 DECLARE_CLASS(ctMainFrame
)
35 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
39 /// Handles the close window event.
40 void OnCloseWindow(wxCloseEvent
& event
);
42 /// Handles the About menu event.
43 void OnAbout(wxCommandEvent
& event
);
45 /// Handles the frame activation event.
46 void OnActivate(wxActivateEvent
& event
);
48 /// Handles the File Open menu event.
49 void OnOpen(wxCommandEvent
& event
);
51 /// Handles the File New menu event.
52 void OnNew(wxCommandEvent
& event
);
54 /// Handles the Exit menu event.
55 void OnExit(wxCommandEvent
& event
);
57 /// Handles the Settings menu event.
58 void OnSettings(wxCommandEvent
& event
);
60 /// Handles the Show Toolbar menu event.
61 void OnShowToolbar(wxCommandEvent
& event
);
63 /// Handles the Help Contents menu event.
64 void OnHelp(wxCommandEvent
& event
);
66 /// Handles context help
67 void OnContextHelp(wxCommandEvent
& event
);
69 /// Handles the Help Contents menu event for the reference manual.
70 void OnReferenceHelp(wxCommandEvent
& event
);
73 void OnUpdateDisable(wxUpdateUIEvent
& event
);
77 /// Creates the main frame subwindows.
78 bool CreateWindows(wxWindow
* parent
);
80 /// Initialises the toolbar.
81 void InitToolBar(wxToolBar
* toolbar
);
83 /// Creates the menubar.
84 wxMenuBar
* CreateMenuBar();
86 /// Resizes the main frame according to the
87 /// state of the toolbar
90 /// Update the frame title.
91 void UpdateFrameTitle();
95 /// Returns the tree control.
96 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
98 /// Returns the property editor window.
99 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
101 /// Returns the document for this frame.
102 ctConfigToolDoc
* GetDocument() const { return m_document
; }
104 /// Sets the document for this frame.
105 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
107 /// Returns the edit menu.
108 wxMenu
* GetEditMenu() const { return m_editMenu
; }
110 /// Returns the setup page window
111 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
113 /// Returns the configure page window
114 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
116 /// Returns the main notebook containing editor and text tabs
117 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
119 DECLARE_EVENT_TABLE()
122 wxImageList m_imageList
;
124 /// The splitter between the tree and the property window.
125 wxSplitterWindow
* m_treeSplitterWindow
;
127 /// The config tree window.
128 ctConfigTreeCtrl
* m_configTreeCtrl
;
130 /// The property editor window.
131 ctPropertyEditor
* m_propertyEditor
;
133 /// The document for this frame.
134 ctConfigToolDoc
* m_document
;
139 /// The notebook with property editor and setup.h/configure
141 wxNotebook
* m_mainNotebook
;
142 ctOutputWindow
* m_setupPage
;
143 ctOutputWindow
* m_configurePage
;
147 * ctOutputWindow represents a page showing a setup.h file or config command.
150 class ctOutputWindow
: public wxPanel
152 DECLARE_CLASS(ctOutputWindow
)
154 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
155 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
158 /// Initialise the windows.
159 void CreateWindows();
161 /// Copies the text to the clipboard.
162 void OnCopyToClipboard(wxCommandEvent
& event
);
163 void OnUpdateCopy(wxUpdateUIEvent
& event
);
165 /// Regenerates setup.h/configure command
166 void OnRegenerate(wxCommandEvent
& event
);
167 void OnUpdateRegenerate(wxUpdateUIEvent
& event
);
170 void OnSaveText(wxCommandEvent
& event
);
171 void OnUpdateSaveText(wxUpdateUIEvent
& event
);
173 /// Sets the code in the text control.
174 void SetText(const wxString
& text
);
176 /// Sets the filename.
177 void SetFilename(const wxString
& filename
);
179 /// Sets the document
180 void SetDocument(ctConfigToolDoc
* doc
) { m_doc
= doc
; }
183 wxTextCtrl
* GetCodeCtrl() const { return m_codeCtrl
; }
185 /// Get filename control
186 wxTextCtrl
* GetFilenameCtrl() const { return m_filenameCtrl
; }
189 wxTextCtrl
* m_codeCtrl
;
190 wxTextCtrl
* m_filenameCtrl
;
191 ctConfigToolDoc
* m_doc
;
193 DECLARE_EVENT_TABLE()