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
;
32 * \brief The main window of the application.
35 class ctMainFrame
: public wxDocParentFrame
37 DECLARE_CLASS(ctMainFrame
)
40 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
44 /// Handles the close window event.
45 void OnCloseWindow(wxCloseEvent
& event
);
47 /// Handles the About menu event.
48 void OnAbout(wxCommandEvent
& event
);
50 /// Handles the frame activation event.
51 void OnActivate(wxActivateEvent
& event
);
53 /// Handles the File Open menu event.
54 void OnOpen(wxCommandEvent
& event
);
56 /// Handles the File New menu event.
57 void OnNew(wxCommandEvent
& event
);
59 /// Handles the Exit menu event.
60 void OnExit(wxCommandEvent
& event
);
62 /// Handles the Settings menu event.
63 void OnSettings(wxCommandEvent
& event
);
65 /// Handles the Show Toolbar menu event.
66 void OnShowToolbar(wxCommandEvent
& event
);
68 /// Handles the Help Contents menu event.
69 void OnHelp(wxCommandEvent
& event
);
71 /// Handles context help
72 void OnContextHelp(wxCommandEvent
& event
);
74 /// Handles the Help Contents menu event for the reference manual.
75 void OnReferenceHelp(wxCommandEvent
& event
);
78 void OnUpdateDisable(wxUpdateUIEvent
& event
);
82 /// Creates the main frame subwindows.
83 bool CreateWindows(wxWindow
* parent
);
85 /// Initialises the toolbar.
86 void InitToolBar(wxToolBar
* toolbar
);
88 /// Creates the menubar.
89 wxMenuBar
* CreateMenuBar();
91 /// Resizes the main frame according to the
92 /// state of the toolbar
95 /// Update the frame title.
96 void UpdateFrameTitle();
100 /// Returns the tree control.
101 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
103 /// Returns the property editor window.
104 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
106 /// Returns the document for this frame.
107 ctConfigToolDoc
* GetDocument() const { return m_document
; }
109 /// Sets the document for this frame.
110 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
112 /// Returns the edit menu.
113 wxMenu
* GetEditMenu() const { return m_editMenu
; }
115 /// Returns the setup page window
116 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
118 /// Returns the configure page window
119 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
121 /// Returns the main notebook containing editor and text tabs
122 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
124 /// Sets the find dialog for future closing
125 void SetFindDialog(ctFindReplaceDialog
* findDialog
) { m_findDialog
= findDialog
; }
127 /// Gets the find dialog
128 ctFindReplaceDialog
* GetFindDialog() const { return m_findDialog
; }
130 DECLARE_EVENT_TABLE()
133 wxImageList m_imageList
;
135 /// The splitter between the tree and the property window.
136 wxSplitterWindow
* m_treeSplitterWindow
;
138 /// The config tree window.
139 ctConfigTreeCtrl
* m_configTreeCtrl
;
141 /// The property editor window.
142 ctPropertyEditor
* m_propertyEditor
;
144 /// The document for this frame.
145 ctConfigToolDoc
* m_document
;
150 /// The notebook with property editor and setup.h/configure
152 wxNotebook
* m_mainNotebook
;
153 ctOutputWindow
* m_setupPage
;
154 ctOutputWindow
* m_configurePage
;
156 ctFindReplaceDialog
* m_findDialog
;
160 * ctOutputWindow represents a page showing a setup.h file or config command.
163 class ctOutputWindow
: public wxPanel
165 DECLARE_CLASS(ctOutputWindow
)
167 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
168 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
171 /// Initialise the windows.
172 void CreateWindows();
174 /// Copies the text to the clipboard.
175 void OnCopyToClipboard(wxCommandEvent
& event
);
176 void OnUpdateCopy(wxUpdateUIEvent
& event
);
178 /// Regenerates setup.h/configure command
179 void OnRegenerate(wxCommandEvent
& event
);
180 void OnUpdateRegenerate(wxUpdateUIEvent
& event
);
183 void OnSaveText(wxCommandEvent
& event
);
184 void OnUpdateSaveText(wxUpdateUIEvent
& event
);
186 /// Sets the code in the text control.
187 void SetText(const wxString
& text
);
189 /// Sets the filename.
190 void SetFilename(const wxString
& filename
);
192 /// Sets the document
193 void SetDocument(ctConfigToolDoc
* doc
) { m_doc
= doc
; }
196 wxTextCtrl
* GetCodeCtrl() const { return m_codeCtrl
; }
198 /// Get filename control
199 wxTextCtrl
* GetFilenameCtrl() const { return m_filenameCtrl
; }
202 wxTextCtrl
* m_codeCtrl
;
203 wxTextCtrl
* m_filenameCtrl
;
204 ctConfigToolDoc
* m_doc
;
206 DECLARE_EVENT_TABLE()