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
;
31 * \brief The main window of the application.
34 class ctMainFrame
: public wxDocParentFrame
36 DECLARE_CLASS(ctMainFrame
)
39 ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
43 /// Handles the close window event.
44 void OnCloseWindow(wxCloseEvent
& event
);
46 /// Handles the About menu event.
47 void OnAbout(wxCommandEvent
& event
);
49 /// Handles the frame activation event.
50 void OnActivate(wxActivateEvent
& event
);
52 /// Handles the File Open menu event.
53 void OnOpen(wxCommandEvent
& event
);
55 /// Handles the File New menu event.
56 void OnNew(wxCommandEvent
& event
);
58 /// Handles the Exit menu event.
59 void OnExit(wxCommandEvent
& event
);
61 /// Handles the Settings menu event.
62 void OnSettings(wxCommandEvent
& event
);
64 /// Handles the Show Toolbar menu event.
65 void OnShowToolbar(wxCommandEvent
& event
);
67 /// Handles the Help Contents menu event.
68 void OnHelp(wxCommandEvent
& event
);
70 /// Handles context help
71 void OnContextHelp(wxCommandEvent
& event
);
73 /// Handles the Help Contents menu event for the reference manual.
74 void OnReferenceHelp(wxCommandEvent
& event
);
77 void OnUpdateDisable(wxUpdateUIEvent
& event
);
81 /// Creates the main frame subwindows.
82 bool CreateWindows(wxWindow
* parent
);
84 /// Initialises the toolbar.
85 void InitToolBar(wxToolBar
* toolbar
);
87 /// Creates the menubar.
88 wxMenuBar
* CreateMenuBar();
90 /// Resizes the main frame according to the
91 /// state of the toolbar
94 /// Update the frame title.
95 void UpdateFrameTitle();
99 /// Returns the tree control.
100 ctConfigTreeCtrl
* GetConfigTreeCtrl() const { return m_configTreeCtrl
; }
102 /// Returns the property editor window.
103 ctPropertyEditor
* GetPropertyEditor() const { return m_propertyEditor
; }
105 /// Returns the document for this frame.
106 ctConfigToolDoc
* GetDocument() const { return m_document
; }
108 /// Sets the document for this frame.
109 void SetDocument(ctConfigToolDoc
* doc
) { m_document
= doc
; }
111 /// Returns the edit menu.
112 wxMenu
* GetEditMenu() const { return m_editMenu
; }
114 /// Returns the setup page window
115 ctOutputWindow
* GetSetupPage() const { return m_setupPage
; }
117 /// Returns the configure page window
118 ctOutputWindow
* GetConfigurePage() const { return m_configurePage
; }
120 /// Returns the main notebook containing editor and text tabs
121 wxNotebook
* GetMainNotebook() const { return m_mainNotebook
; }
123 DECLARE_EVENT_TABLE()
126 wxImageList m_imageList
;
128 /// The splitter between the tree and the property window.
129 wxSplitterWindow
* m_treeSplitterWindow
;
131 /// The config tree window.
132 ctConfigTreeCtrl
* m_configTreeCtrl
;
134 /// The property editor window.
135 ctPropertyEditor
* m_propertyEditor
;
137 /// The document for this frame.
138 ctConfigToolDoc
* m_document
;
143 /// The notebook with property editor and setup.h/configure
145 wxNotebook
* m_mainNotebook
;
146 ctOutputWindow
* m_setupPage
;
147 ctOutputWindow
* m_configurePage
;
151 * ctOutputWindow represents a page showing a setup.h file or config command.
154 class ctOutputWindow
: public wxPanel
156 DECLARE_CLASS(ctOutputWindow
)
158 ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
159 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0);
162 /// Initialise the windows.
163 void CreateWindows();
165 /// Copies the text to the clipboard.
166 void OnCopyToClipboard(wxCommandEvent
& event
);
167 void OnUpdateCopy(wxUpdateUIEvent
& event
);
169 /// Regenerates setup.h/configure command
170 void OnRegenerate(wxCommandEvent
& event
);
171 void OnUpdateRegenerate(wxUpdateUIEvent
& event
);
174 void OnSaveText(wxCommandEvent
& event
);
175 void OnUpdateSaveText(wxUpdateUIEvent
& event
);
177 /// Sets the code in the text control.
178 void SetText(const wxString
& text
);
180 /// Sets the filename.
181 void SetFilename(const wxString
& filename
);
183 /// Sets the document
184 void SetDocument(ctConfigToolDoc
* doc
) { m_doc
= doc
; }
187 wxTextCtrl
* GetCodeCtrl() const { return m_codeCtrl
; }
189 /// Get filename control
190 wxTextCtrl
* GetFilenameCtrl() const { return m_filenameCtrl
; }
193 wxTextCtrl
* m_codeCtrl
;
194 wxTextCtrl
* m_filenameCtrl
;
195 ctConfigToolDoc
* m_doc
;
197 DECLARE_EVENT_TABLE()