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"
17 #include "wx/notebook.h"
18 #include "wx/textctrl.h"
20 // #define USE_CONFIG_BROWSER_PAGE
22 class WXDLLEXPORT wxHtmlWindow
;
23 class WXDLLEXPORT wxSplitterWindow
;
24 class WXDLLEXPORT wxNotebookEvent
;
26 class ctConfigTreeCtrl
;
27 class ctPropertyEditor
;
29 class ctFindReplaceDialog
;
30 #ifdef USE_CONFIG_BROWSER_PAGE
31 class ctConfigurationBrowserWindow
;
35 * \brief The main window of the application.
38 class ctMainFrame
: public wxDocParentFrame
40 DECLARE_CLASS(ctMainFrame
)
43 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
47 /// Handles the close window event.
48 void OnCloseWindow(wxCloseEvent
& event
);
50 /// Handles the About menu event.
51 void OnAbout(wxCommandEvent
& event
);
53 /// Handles the frame activation event.
54 void OnActivate(wxActivateEvent
& event
);
56 /// Handles the File Open menu event.
57 void OnOpen(wxCommandEvent
& event
);
59 /// Handles the File New menu event.
60 void OnNew(wxCommandEvent
& event
);
62 /// Handles the Exit menu event.
63 void OnExit(wxCommandEvent
& event
);
65 /// Handles the Settings menu event.
66 void OnSettings(wxCommandEvent
& event
);
68 /// Handles the Show Toolbar menu event.
69 void OnShowToolbar(wxCommandEvent
& event
);
71 /// Handles the Help Contents menu event.
72 void OnHelp(wxCommandEvent
& event
);
74 /// Handles context help
75 void OnContextHelp(wxCommandEvent
& event
);
77 /// Handles the Help Contents menu event for the reference manual.
78 void OnReferenceHelp(wxCommandEvent
& event
);
81 void OnUpdateDisable(wxUpdateUIEvent
& event
);
85 /// Creates the main frame subwindows.
86 bool CreateWindows(wxWindow
* parent
);
88 /// Initialises the toolbar.
89 void InitToolBar(wxToolBar
* toolbar
);
91 /// Creates the menubar.
92 wxMenuBar
* CreateMenuBar();
94 /// Resizes the main frame according to the
95 /// state of the toolbar
98 /// Update the frame title.
99 void UpdateFrameTitle();
103 /// Returns the tree control.
104 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
106 /// Returns the property editor window.
107 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
109 /// Returns the document for this frame.
110 ctConfigToolDoc
* GetDocument() const { return m_document
; }
112 /// Sets the document for this frame.
113 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
115 /// Returns the edit menu.
116 wxMenu
* GetEditMenu() const { return m_editMenu
; }
118 /// Returns the setup page window
119 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
121 /// Returns the configure page window
122 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
124 /// Returns the main notebook containing editor and text tabs
125 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
127 /// Sets the find dialog for future closing
128 void SetFindDialog(ctFindReplaceDialog
* findDialog
) { m_findDialog
= findDialog
; }
130 /// Gets the find dialog
131 ctFindReplaceDialog
* GetFindDialog() const { return m_findDialog
; }
133 DECLARE_EVENT_TABLE()
136 wxImageList m_imageList
;
138 /// The splitter between the tree and the property window.
139 wxSplitterWindow
* m_treeSplitterWindow
;
141 /// The config tree window.
142 ctConfigTreeCtrl
* m_configTreeCtrl
;
144 /// The property editor window.
145 ctPropertyEditor
* m_propertyEditor
;
147 /// The document for this frame.
148 ctConfigToolDoc
* m_document
;
153 /// The notebook with property editor and setup.h/configure
155 wxNotebook
* m_mainNotebook
;
156 ctOutputWindow
* m_setupPage
;
157 ctOutputWindow
* m_configurePage
;
159 // The control panel for browsing, adding and removing
161 #ifdef USE_CONFIG_BROWSER_PAGE
162 ctConfigurationBrowserWindow
* m_configBrowserPage
;
165 ctFindReplaceDialog
* m_findDialog
;
169 * ctOutputWindow represents a page showing a setup.h file or config command.
172 class ctOutputWindow
: public wxPanel
174 DECLARE_CLASS(ctOutputWindow
)
176 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
177 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
180 /// Initialise the windows.
181 void CreateWindows();
183 /// Copies the text to the clipboard.
185 void OnCopyToClipboard(wxCommandEvent
& event
);
186 #endif // wxUSE_CLIPBOARD
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()