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"
21 #include "wx/notebook.h"
22 #include "wx/textctrl.h"
24 // #define USE_CONFIG_BROWSER_PAGE
26 class WXDLLEXPORT wxHtmlWindow
;
27 class WXDLLEXPORT wxSplitterWindow
;
28 class WXDLLEXPORT wxNotebookEvent
;
30 class ctConfigTreeCtrl
;
31 class ctPropertyEditor
;
33 class ctFindReplaceDialog
;
34 #ifdef USE_CONFIG_BROWSER_PAGE
35 class ctConfigurationBrowserWindow
;
39 * \brief The main window of the application.
42 class ctMainFrame
: public wxDocParentFrame
44 DECLARE_CLASS(ctMainFrame
)
47 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
51 /// Handles the close window event.
52 void OnCloseWindow(wxCloseEvent
& event
);
54 /// Handles the About menu event.
55 void OnAbout(wxCommandEvent
& event
);
57 /// Handles the frame activation event.
58 void OnActivate(wxActivateEvent
& event
);
60 /// Handles the File Open menu event.
61 void OnOpen(wxCommandEvent
& event
);
63 /// Handles the File New menu event.
64 void OnNew(wxCommandEvent
& event
);
66 /// Handles the Exit menu event.
67 void OnExit(wxCommandEvent
& event
);
69 /// Handles the Settings menu event.
70 void OnSettings(wxCommandEvent
& event
);
72 /// Handles the Show Toolbar menu event.
73 void OnShowToolbar(wxCommandEvent
& event
);
75 /// Handles the Help Contents menu event.
76 void OnHelp(wxCommandEvent
& event
);
78 /// Handles context help
79 void OnContextHelp(wxCommandEvent
& event
);
81 /// Handles the Help Contents menu event for the reference manual.
82 void OnReferenceHelp(wxCommandEvent
& event
);
85 void OnUpdateDisable(wxUpdateUIEvent
& event
);
89 /// Creates the main frame subwindows.
90 bool CreateWindows(wxWindow
* parent
);
92 /// Initialises the toolbar.
93 void InitToolBar(wxToolBar
* toolbar
);
95 /// Creates the menubar.
96 wxMenuBar
* CreateMenuBar();
98 /// Resizes the main frame according to the
99 /// state of the toolbar
102 /// Update the frame title.
103 void UpdateFrameTitle();
107 /// Returns the tree control.
108 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
110 /// Returns the property editor window.
111 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
113 /// Returns the document for this frame.
114 ctConfigToolDoc
* GetDocument() const { return m_document
; }
116 /// Sets the document for this frame.
117 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
119 /// Returns the edit menu.
120 wxMenu
* GetEditMenu() const { return m_editMenu
; }
122 /// Returns the setup page window
123 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
125 /// Returns the configure page window
126 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
128 /// Returns the main notebook containing editor and text tabs
129 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
131 /// Sets the find dialog for future closing
132 void SetFindDialog(ctFindReplaceDialog
* findDialog
) { m_findDialog
= findDialog
; }
134 /// Gets the find dialog
135 ctFindReplaceDialog
* GetFindDialog() const { return m_findDialog
; }
137 DECLARE_EVENT_TABLE()
140 wxImageList m_imageList
;
142 /// The splitter between the tree and the property window.
143 wxSplitterWindow
* m_treeSplitterWindow
;
145 /// The config tree window.
146 ctConfigTreeCtrl
* m_configTreeCtrl
;
148 /// The property editor window.
149 ctPropertyEditor
* m_propertyEditor
;
151 /// The document for this frame.
152 ctConfigToolDoc
* m_document
;
157 /// The notebook with property editor and setup.h/configure
159 wxNotebook
* m_mainNotebook
;
160 ctOutputWindow
* m_setupPage
;
161 ctOutputWindow
* m_configurePage
;
163 // The control panel for browsing, adding and removing
165 #ifdef USE_CONFIG_BROWSER_PAGE
166 ctConfigurationBrowserWindow
* m_configBrowserPage
;
169 ctFindReplaceDialog
* m_findDialog
;
173 * ctOutputWindow represents a page showing a setup.h file or config command.
176 class ctOutputWindow
: public wxPanel
178 DECLARE_CLASS(ctOutputWindow
)
180 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
181 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
184 /// Initialise the windows.
185 void CreateWindows();
187 /// Copies the text to the clipboard.
189 void OnCopyToClipboard(wxCommandEvent
& event
);
190 #endif // wxUSE_CLIPBOARD
191 void OnUpdateCopy(wxUpdateUIEvent
& event
);
193 /// Regenerates setup.h/configure command
194 void OnRegenerate(wxCommandEvent
& event
);
195 void OnUpdateRegenerate(wxUpdateUIEvent
& event
);
198 void OnSaveText(wxCommandEvent
& event
);
199 void OnUpdateSaveText(wxUpdateUIEvent
& event
);
201 /// Sets the code in the text control.
202 void SetText(const wxString
& text
);
204 /// Sets the filename.
205 void SetFilename(const wxString
& filename
);
207 /// Sets the document
208 void SetDocument(ctConfigToolDoc
* doc
) { m_doc
= doc
; }
211 wxTextCtrl
* GetCodeCtrl() const { return m_codeCtrl
; }
213 /// Get filename control
214 wxTextCtrl
* GetFilenameCtrl() const { return m_filenameCtrl
; }
217 wxTextCtrl
* m_codeCtrl
;
218 wxTextCtrl
* m_filenameCtrl
;
219 ctConfigToolDoc
* m_doc
;
221 DECLARE_EVENT_TABLE()