]> git.saurik.com Git - wxWidgets.git/blob - utils/configtool/src/mainframe.h
Added first cut wxWindows Configuration Tool
[wxWidgets.git] / utils / configtool / src / mainframe.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mainframe.h
3 // Purpose: Main frame class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2002-09-04
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence:
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _AP_MAINFRAME_H_
13 #define _AP_MAINFRAME_H_
14
15 #include "wx/imaglist.h"
16 #include "wx/docview.h"
17
18 class WXDLLEXPORT wxHtmlWindow;
19 class WXDLLEXPORT wxSplitterWindow;
20 class WXDLLEXPORT wxNotebookEvent;
21
22 class ctConfigTreeCtrl;
23 class ctPropertyEditor;
24 class ctOutputWindow;
25
26 /*!
27 * \brief The main window of the application.
28 */
29
30 class ctMainFrame: public wxDocParentFrame
31 {
32 DECLARE_CLASS(ctMainFrame)
33 public:
34 /// Constructor.
35 ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
36
37 // Event handlers
38
39 /// Handles the close window event.
40 void OnCloseWindow(wxCloseEvent& event);
41
42 /// Handles the About menu event.
43 void OnAbout(wxCommandEvent& event);
44
45 /// Handles the frame activation event.
46 void OnActivate(wxActivateEvent& event);
47
48 /// Handles the File Open menu event.
49 void OnOpen(wxCommandEvent& event);
50
51 /// Handles the File New menu event.
52 void OnNew(wxCommandEvent& event);
53
54 /// Handles the Exit menu event.
55 void OnExit(wxCommandEvent& event);
56
57 /// Handles the Settings menu event.
58 void OnSettings(wxCommandEvent& event);
59
60 /// Handles the Show Toolbar menu event.
61 void OnShowToolbar(wxCommandEvent& event);
62
63 /// Handles the Help Contents menu event.
64 void OnHelp(wxCommandEvent& event);
65
66 /// Handles context help
67 void OnContextHelp(wxCommandEvent& event);
68
69 /// Handles the Help Contents menu event for the reference manual.
70 void OnReferenceHelp(wxCommandEvent& event);
71
72 /// General disabler
73 void OnUpdateDisable(wxUpdateUIEvent& event);
74
75 // Operations
76
77 /// Creates the main frame subwindows.
78 bool CreateWindows(wxWindow* parent);
79
80 /// Initialises the toolbar.
81 void InitToolBar(wxToolBar* toolbar);
82
83 /// Creates the menubar.
84 wxMenuBar* CreateMenuBar();
85
86 /// Resizes the main frame according to the
87 /// state of the toolbar
88 void ResizeFrame();
89
90 /// Update the frame title.
91 void UpdateFrameTitle();
92
93 // Accessors
94
95 /// Returns the tree control.
96 ctConfigTreeCtrl* GetConfigTreeCtrl() const { return m_configTreeCtrl; }
97
98 /// Returns the property editor window.
99 ctPropertyEditor* GetPropertyEditor() const { return m_propertyEditor; }
100
101 /// Returns the document for this frame.
102 ctConfigToolDoc* GetDocument() const { return m_document; }
103
104 /// Sets the document for this frame.
105 void SetDocument(ctConfigToolDoc* doc) { m_document = doc; }
106
107 /// Returns the edit menu.
108 wxMenu* GetEditMenu() const { return m_editMenu; }
109
110 /// Returns the setup page window
111 ctOutputWindow* GetSetupPage() const { return m_setupPage; }
112
113 /// Returns the configure page window
114 ctOutputWindow* GetConfigurePage() const { return m_configurePage; }
115
116 /// Returns the main notebook containing editor and text tabs
117 wxNotebook* GetMainNotebook() const { return m_mainNotebook; }
118
119 DECLARE_EVENT_TABLE()
120
121 protected:
122 wxImageList m_imageList;
123
124 /// The splitter between the tree and the property window.
125 wxSplitterWindow* m_treeSplitterWindow;
126
127 /// The config tree window.
128 ctConfigTreeCtrl* m_configTreeCtrl;
129
130 /// The property editor window.
131 ctPropertyEditor* m_propertyEditor;
132
133 /// The document for this frame.
134 ctConfigToolDoc* m_document;
135
136 /// The edit menu.
137 wxMenu* m_editMenu;
138
139 /// The notebook with property editor and setup.h/configure
140 /// views
141 wxNotebook* m_mainNotebook;
142 ctOutputWindow* m_setupPage;
143 ctOutputWindow* m_configurePage;
144 };
145
146 /*!
147 * ctOutputWindow represents a page showing a setup.h file or config command.
148 */
149
150 class ctOutputWindow: public wxPanel
151 {
152 DECLARE_CLASS(ctOutputWindow)
153 public:
154 ctOutputWindow(wxWindow* parent, wxWindowID id,
155 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
156 ~ctOutputWindow();
157
158 /// Initialise the windows.
159 void CreateWindows();
160
161 /// Copies the text to the clipboard.
162 void OnCopyToClipboard(wxCommandEvent& event);
163 void OnUpdateCopy(wxUpdateUIEvent& event);
164
165 /// Regenerates setup.h/configure command
166 void OnRegenerate(wxCommandEvent& event);
167 void OnUpdateRegenerate(wxUpdateUIEvent& event);
168
169 /// Saves the file.
170 void OnSaveText(wxCommandEvent& event);
171 void OnUpdateSaveText(wxUpdateUIEvent& event);
172
173 /// Sets the code in the text control.
174 void SetText(const wxString& text);
175
176 /// Sets the filename.
177 void SetFilename(const wxString& filename);
178
179 /// Sets the document
180 void SetDocument(ctConfigToolDoc* doc) { m_doc = doc; }
181
182 /// Get text control
183 wxTextCtrl* GetCodeCtrl() const { return m_codeCtrl; }
184
185 /// Get filename control
186 wxTextCtrl* GetFilenameCtrl() const { return m_filenameCtrl; }
187
188 protected:
189 wxTextCtrl* m_codeCtrl;
190 wxTextCtrl* m_filenameCtrl;
191 ctConfigToolDoc* m_doc;
192
193 DECLARE_EVENT_TABLE()
194 };
195
196
197 #endif
198 // _AP_MAINFRAME_H_
199