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"
23 // #define USE_CONFIG_BROWSER_PAGE
25 class WXDLLEXPORT wxHtmlWindow
;
26 class WXDLLEXPORT wxSplitterWindow
;
27 class WXDLLEXPORT wxNotebookEvent
;
29 class ctConfigTreeCtrl
;
30 class ctPropertyEditor
;
32 class ctFindReplaceDialog
;
33 #ifdef USE_CONFIG_BROWSER_PAGE
34 class ctConfigurationBrowserWindow
;
38 * \brief The main window of the application.
41 class ctMainFrame
: public wxDocParentFrame
43 DECLARE_CLASS(ctMainFrame
)
46 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
50 /// Handles the close window event.
51 void OnCloseWindow(wxCloseEvent
& event
);
53 /// Handles the About menu event.
54 void OnAbout(wxCommandEvent
& event
);
56 /// Handles the frame activation event.
57 void OnActivate(wxActivateEvent
& event
);
59 /// Handles the File Open menu event.
60 void OnOpen(wxCommandEvent
& event
);
62 /// Handles the File New menu event.
63 void OnNew(wxCommandEvent
& event
);
65 /// Handles the Exit menu event.
66 void OnExit(wxCommandEvent
& event
);
68 /// Handles the Settings menu event.
69 void OnSettings(wxCommandEvent
& event
);
71 /// Handles the Show Toolbar menu event.
72 void OnShowToolbar(wxCommandEvent
& event
);
74 /// Handles the Help Contents menu event.
75 void OnHelp(wxCommandEvent
& event
);
77 /// Handles context help
78 void OnContextHelp(wxCommandEvent
& event
);
80 /// Handles the Help Contents menu event for the reference manual.
81 void OnReferenceHelp(wxCommandEvent
& event
);
84 void OnUpdateDisable(wxUpdateUIEvent
& event
);
88 /// Creates the main frame subwindows.
89 bool CreateWindows(wxWindow
* parent
);
91 /// Initialises the toolbar.
92 void InitToolBar(wxToolBar
* toolbar
);
94 /// Creates the menubar.
95 wxMenuBar
* CreateMenuBar();
97 /// Resizes the main frame according to the
98 /// state of the toolbar
101 /// Update the frame title.
102 void UpdateFrameTitle();
106 /// Returns the tree control.
107 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
109 /// Returns the property editor window.
110 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
112 /// Returns the document for this frame.
113 ctConfigToolDoc
* GetDocument() const { return m_document
; }
115 /// Sets the document for this frame.
116 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
118 /// Returns the edit menu.
119 wxMenu
* GetEditMenu() const { return m_editMenu
; }
121 /// Returns the setup page window
122 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
124 /// Returns the configure page window
125 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
127 /// Returns the main notebook containing editor and text tabs
128 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
130 /// Sets the find dialog for future closing
131 void SetFindDialog(ctFindReplaceDialog
* findDialog
) { m_findDialog
= findDialog
; }
133 /// Gets the find dialog
134 ctFindReplaceDialog
* GetFindDialog() const { return m_findDialog
; }
136 DECLARE_EVENT_TABLE()
139 wxImageList m_imageList
;
141 /// The splitter between the tree and the property window.
142 wxSplitterWindow
* m_treeSplitterWindow
;
144 /// The config tree window.
145 ctConfigTreeCtrl
* m_configTreeCtrl
;
147 /// The property editor window.
148 ctPropertyEditor
* m_propertyEditor
;
150 /// The document for this frame.
151 ctConfigToolDoc
* m_document
;
156 /// The notebook with property editor and setup.h/configure
158 wxNotebook
* m_mainNotebook
;
159 ctOutputWindow
* m_setupPage
;
160 ctOutputWindow
* m_configurePage
;
162 // The control panel for browsing, adding and removing
164 #ifdef USE_CONFIG_BROWSER_PAGE
165 ctConfigurationBrowserWindow
* m_configBrowserPage
;
168 ctFindReplaceDialog
* m_findDialog
;
172 * ctOutputWindow represents a page showing a setup.h file or config command.
175 class ctOutputWindow
: public wxPanel
177 DECLARE_CLASS(ctOutputWindow
)
179 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
180 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
183 /// Initialise the windows.
184 void CreateWindows();
186 /// Copies the text to the clipboard.
187 void OnCopyToClipboard(wxCommandEvent
& event
);
188 void OnUpdateCopy(wxUpdateUIEvent
& event
);
190 /// Regenerates setup.h/configure command
191 void OnRegenerate(wxCommandEvent
& event
);
192 void OnUpdateRegenerate(wxUpdateUIEvent
& event
);
195 void OnSaveText(wxCommandEvent
& event
);
196 void OnUpdateSaveText(wxUpdateUIEvent
& event
);
198 /// Sets the code in the text control.
199 void SetText(const wxString
& text
);
201 /// Sets the filename.
202 void SetFilename(const wxString
& filename
);
204 /// Sets the document
205 void SetDocument(ctConfigToolDoc
* doc
) { m_doc
= doc
; }
208 wxTextCtrl
* GetCodeCtrl() const { return m_codeCtrl
; }
210 /// Get filename control
211 wxTextCtrl
* GetFilenameCtrl() const { return m_filenameCtrl
; }
214 wxTextCtrl
* m_codeCtrl
;
215 wxTextCtrl
* m_filenameCtrl
;
216 ctConfigToolDoc
* m_doc
;
218 DECLARE_EVENT_TABLE()