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_
16 #pragma interface "mainframe.cpp"
19 #include "wx/imaglist.h"
20 #include "wx/docview.h"
22 class WXDLLEXPORT wxHtmlWindow
;
23 class WXDLLEXPORT wxSplitterWindow
;
24 class WXDLLEXPORT wxNotebookEvent
;
26 class ctConfigTreeCtrl
;
27 class ctPropertyEditor
;
29 class ctFindReplaceDialog
;
30 class ctConfigurationBrowserWindow
;
33 * \brief The main window of the application.
36 class ctMainFrame
: public wxDocParentFrame
38 DECLARE_CLASS(ctMainFrame
)
41 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
45 /// Handles the close window event.
46 void OnCloseWindow(wxCloseEvent
& event
);
48 /// Handles the About menu event.
49 void OnAbout(wxCommandEvent
& event
);
51 /// Handles the frame activation event.
52 void OnActivate(wxActivateEvent
& event
);
54 /// Handles the File Open menu event.
55 void OnOpen(wxCommandEvent
& event
);
57 /// Handles the File New menu event.
58 void OnNew(wxCommandEvent
& event
);
60 /// Handles the Exit menu event.
61 void OnExit(wxCommandEvent
& event
);
63 /// Handles the Settings menu event.
64 void OnSettings(wxCommandEvent
& event
);
66 /// Handles the Show Toolbar menu event.
67 void OnShowToolbar(wxCommandEvent
& event
);
69 /// Handles the Help Contents menu event.
70 void OnHelp(wxCommandEvent
& event
);
72 /// Handles context help
73 void OnContextHelp(wxCommandEvent
& event
);
75 /// Handles the Help Contents menu event for the reference manual.
76 void OnReferenceHelp(wxCommandEvent
& event
);
79 void OnUpdateDisable(wxUpdateUIEvent
& event
);
83 /// Creates the main frame subwindows.
84 bool CreateWindows(wxWindow
* parent
);
86 /// Initialises the toolbar.
87 void InitToolBar(wxToolBar
* toolbar
);
89 /// Creates the menubar.
90 wxMenuBar
* CreateMenuBar();
92 /// Resizes the main frame according to the
93 /// state of the toolbar
96 /// Update the frame title.
97 void UpdateFrameTitle();
101 /// Returns the tree control.
102 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
104 /// Returns the property editor window.
105 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
107 /// Returns the document for this frame.
108 ctConfigToolDoc
* GetDocument() const { return m_document
; }
110 /// Sets the document for this frame.
111 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
113 /// Returns the edit menu.
114 wxMenu
* GetEditMenu() const { return m_editMenu
; }
116 /// Returns the setup page window
117 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
119 /// Returns the configure page window
120 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
122 /// Returns the main notebook containing editor and text tabs
123 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
125 /// Sets the find dialog for future closing
126 void SetFindDialog(ctFindReplaceDialog
* findDialog
) { m_findDialog
= findDialog
; }
128 /// Gets the find dialog
129 ctFindReplaceDialog
* GetFindDialog() const { return m_findDialog
; }
131 DECLARE_EVENT_TABLE()
134 wxImageList m_imageList
;
136 /// The splitter between the tree and the property window.
137 wxSplitterWindow
* m_treeSplitterWindow
;
139 /// The config tree window.
140 ctConfigTreeCtrl
* m_configTreeCtrl
;
142 /// The property editor window.
143 ctPropertyEditor
* m_propertyEditor
;
145 /// The document for this frame.
146 ctConfigToolDoc
* m_document
;
151 /// The notebook with property editor and setup.h/configure
153 wxNotebook
* m_mainNotebook
;
154 ctOutputWindow
* m_setupPage
;
155 ctOutputWindow
* m_configurePage
;
157 // The control panel for browsing, adding and removing
159 ctConfigurationBrowserWindow
* m_configBrowserPage
;
161 ctFindReplaceDialog
* m_findDialog
;
165 * ctOutputWindow represents a page showing a setup.h file or config command.
168 class ctOutputWindow
: public wxPanel
170 DECLARE_CLASS(ctOutputWindow
)
172 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
173 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
176 /// Initialise the windows.
177 void CreateWindows();
179 /// Copies the text to the clipboard.
180 void OnCopyToClipboard(wxCommandEvent
& event
);
181 void OnUpdateCopy(wxUpdateUIEvent
& event
);
183 /// Regenerates setup.h/configure command
184 void OnRegenerate(wxCommandEvent
& event
);
185 void OnUpdateRegenerate(wxUpdateUIEvent
& event
);
188 void OnSaveText(wxCommandEvent
& event
);
189 void OnUpdateSaveText(wxUpdateUIEvent
& event
);
191 /// Sets the code in the text control.
192 void SetText(const wxString
& text
);
194 /// Sets the filename.
195 void SetFilename(const wxString
& filename
);
197 /// Sets the document
198 void SetDocument(ctConfigToolDoc
* doc
) { m_doc
= doc
; }
201 wxTextCtrl
* GetCodeCtrl() const { return m_codeCtrl
; }
203 /// Get filename control
204 wxTextCtrl
* GetFilenameCtrl() const { return m_filenameCtrl
; }
207 wxTextCtrl
* m_codeCtrl
;
208 wxTextCtrl
* m_filenameCtrl
;
209 ctConfigToolDoc
* m_doc
;
211 DECLARE_EVENT_TABLE()