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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "mainframe.cpp"
19 #include "wx/imaglist.h"
20 #include "wx/docview.h"
22 // #define USE_CONFIG_BROWSER_PAGE
24 class WXDLLEXPORT wxHtmlWindow
;
25 class WXDLLEXPORT wxSplitterWindow
;
26 class WXDLLEXPORT wxNotebookEvent
;
28 class ctConfigTreeCtrl
;
29 class ctPropertyEditor
;
31 class ctFindReplaceDialog
;
32 #ifdef USE_CONFIG_BROWSER_PAGE
33 class ctConfigurationBrowserWindow
;
37 * \brief The main window of the application.
40 class ctMainFrame
: public wxDocParentFrame
42 DECLARE_CLASS(ctMainFrame
)
45 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
49 /// Handles the close window event.
50 void OnCloseWindow(wxCloseEvent
& event
);
52 /// Handles the About menu event.
53 void OnAbout(wxCommandEvent
& event
);
55 /// Handles the frame activation event.
56 void OnActivate(wxActivateEvent
& event
);
58 /// Handles the File Open menu event.
59 void OnOpen(wxCommandEvent
& event
);
61 /// Handles the File New menu event.
62 void OnNew(wxCommandEvent
& event
);
64 /// Handles the Exit menu event.
65 void OnExit(wxCommandEvent
& event
);
67 /// Handles the Settings menu event.
68 void OnSettings(wxCommandEvent
& event
);
70 /// Handles the Show Toolbar menu event.
71 void OnShowToolbar(wxCommandEvent
& event
);
73 /// Handles the Help Contents menu event.
74 void OnHelp(wxCommandEvent
& event
);
76 /// Handles context help
77 void OnContextHelp(wxCommandEvent
& event
);
79 /// Handles the Help Contents menu event for the reference manual.
80 void OnReferenceHelp(wxCommandEvent
& event
);
83 void OnUpdateDisable(wxUpdateUIEvent
& event
);
87 /// Creates the main frame subwindows.
88 bool CreateWindows(wxWindow
* parent
);
90 /// Initialises the toolbar.
91 void InitToolBar(wxToolBar
* toolbar
);
93 /// Creates the menubar.
94 wxMenuBar
* CreateMenuBar();
96 /// Resizes the main frame according to the
97 /// state of the toolbar
100 /// Update the frame title.
101 void UpdateFrameTitle();
105 /// Returns the tree control.
106 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
108 /// Returns the property editor window.
109 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
111 /// Returns the document for this frame.
112 ctConfigToolDoc
* GetDocument() const { return m_document
; }
114 /// Sets the document for this frame.
115 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
117 /// Returns the edit menu.
118 wxMenu
* GetEditMenu() const { return m_editMenu
; }
120 /// Returns the setup page window
121 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
123 /// Returns the configure page window
124 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
126 /// Returns the main notebook containing editor and text tabs
127 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
129 /// Sets the find dialog for future closing
130 void SetFindDialog(ctFindReplaceDialog
* findDialog
) { m_findDialog
= findDialog
; }
132 /// Gets the find dialog
133 ctFindReplaceDialog
* GetFindDialog() const { return m_findDialog
; }
135 DECLARE_EVENT_TABLE()
138 wxImageList m_imageList
;
140 /// The splitter between the tree and the property window.
141 wxSplitterWindow
* m_treeSplitterWindow
;
143 /// The config tree window.
144 ctConfigTreeCtrl
* m_configTreeCtrl
;
146 /// The property editor window.
147 ctPropertyEditor
* m_propertyEditor
;
149 /// The document for this frame.
150 ctConfigToolDoc
* m_document
;
155 /// The notebook with property editor and setup.h/configure
157 wxNotebook
* m_mainNotebook
;
158 ctOutputWindow
* m_setupPage
;
159 ctOutputWindow
* m_configurePage
;
161 // The control panel for browsing, adding and removing
163 #ifdef USE_CONFIG_BROWSER_PAGE
164 ctConfigurationBrowserWindow
* m_configBrowserPage
;
167 ctFindReplaceDialog
* m_findDialog
;
171 * ctOutputWindow represents a page showing a setup.h file or config command.
174 class ctOutputWindow
: public wxPanel
176 DECLARE_CLASS(ctOutputWindow
)
178 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
179 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
182 /// Initialise the windows.
183 void CreateWindows();
185 /// Copies the text to the clipboard.
186 void OnCopyToClipboard(wxCommandEvent
& event
);
187 void OnUpdateCopy(wxUpdateUIEvent
& event
);
189 /// Regenerates setup.h/configure command
190 void OnRegenerate(wxCommandEvent
& event
);
191 void OnUpdateRegenerate(wxUpdateUIEvent
& event
);
194 void OnSaveText(wxCommandEvent
& event
);
195 void OnUpdateSaveText(wxUpdateUIEvent
& event
);
197 /// Sets the code in the text control.
198 void SetText(const wxString
& text
);
200 /// Sets the filename.
201 void SetFilename(const wxString
& filename
);
203 /// Sets the document
204 void SetDocument(ctConfigToolDoc
* doc
) { m_doc
= doc
; }
207 wxTextCtrl
* GetCodeCtrl() const { return m_codeCtrl
; }
209 /// Get filename control
210 wxTextCtrl
* GetFilenameCtrl() const { return m_filenameCtrl
; }
213 wxTextCtrl
* m_codeCtrl
;
214 wxTextCtrl
* m_filenameCtrl
;
215 ctConfigToolDoc
* m_doc
;
217 DECLARE_EVENT_TABLE()