August 7th Tuesday (八月 七日 火曜日)
2007-09-10 20:11
423 查看
How to write an application using documnet/view mode in wxWidgets? There are the overall steps
involved in creating an application based on the document/view framework:
1. Define your own document and view classes, overriding a minimal set of member functions e.g.
for input/output, drawing and initialization.
2. Define any subwindows (such as a scrolled window) that are needed for the view(s). You may need
to route some events to views or documents, for example OnPaint needs to be routed to wxView::OnDraw.
3. Decide what style of interface you will use: Microsoft's MDI (multiple document child frames
surrounded by an overall frame), SDI (a separate, unconstrained frame for each document), or single-window
(one document open at a time, as in Windows Write).
4. Use the appropriate wxDocParentFrame and wxDocChildFrame classes. Construct an instance of wxDocParentFrame
in your wxApp::OnInit, and a wxDocChildFrame (if not single-window) when you initialize a view. Create
menus using standard menu ids (such as wxID_OPEN, wxID_PRINT).
5. Construct a single wxDocManager instance at the beginning of your wxApp::OnInit, and then as many
wxDocTemplate instances as necessary to define relationships between documents and views. For a simple
application, there will be just one wxDocTemplate.
If you wish to implement Undo/Redo, you need to derive your own class(es) from wxCommand and use
wxCommandProcessor::Submit instead of directly executing code. The framework will take care of calling
Undo and Do functions as appropriate, so long as the wxID_UNDO and wxID_REDO menu items are defined in
the view menu.
involved in creating an application based on the document/view framework:
1. Define your own document and view classes, overriding a minimal set of member functions e.g.
for input/output, drawing and initialization.
2. Define any subwindows (such as a scrolled window) that are needed for the view(s). You may need
to route some events to views or documents, for example OnPaint needs to be routed to wxView::OnDraw.
3. Decide what style of interface you will use: Microsoft's MDI (multiple document child frames
surrounded by an overall frame), SDI (a separate, unconstrained frame for each document), or single-window
(one document open at a time, as in Windows Write).
4. Use the appropriate wxDocParentFrame and wxDocChildFrame classes. Construct an instance of wxDocParentFrame
in your wxApp::OnInit, and a wxDocChildFrame (if not single-window) when you initialize a view. Create
menus using standard menu ids (such as wxID_OPEN, wxID_PRINT).
5. Construct a single wxDocManager instance at the beginning of your wxApp::OnInit, and then as many
wxDocTemplate instances as necessary to define relationships between documents and views. For a simple
application, there will be just one wxDocTemplate.
If you wish to implement Undo/Redo, you need to derive your own class(es) from wxCommand and use
wxCommandProcessor::Submit instead of directly executing code. The framework will take care of calling
Undo and Do functions as appropriate, so long as the wxID_UNDO and wxID_REDO menu items are defined in
the view menu.
相关文章推荐
- 2008 October 7th Tuesday (十月 七日 火曜日)
- August 14th Tuesday (八月 十四日 火曜日)
- August 28th Tuesday (八月 二十八日 火曜日)
- 2008 August 12th Tuesday (八月 十二日 火曜日)
- 2008 August 5th Tuesday (八月 五日 火曜日)
- 2008 August 19th Tuesday (八月 十九日 火曜日)
- 2008 August 26th Tuesday (八月 二十六日 火曜日)
- April 7th Tuesday (四月 七日 火曜日)
- 2008 August 7th Thursday (八月 七日 木曜日)
- July 7th Tuesday (七月 七日 火曜日)
- August 21th Tuesday (八月 二十一日 火曜日)
- August 15th Wednesday (八月 十五日 水曜日)
- August 24th Friday (八月 二十四日 金曜日)
- December 25th Tuesday (十二月 二十五日 火曜日)
- 2008 January 22th Tuesday (一月 二十二日 火曜日)
- 2008 March 25th Tuesday (三月 二十五日 火曜日)
- 2008 April 29th Tuesday (四月 二十九日 火曜日)
- 2008 July 1st Tuesday (七月 一日 火曜日)
- 2008 August 14th Thursday (八月 十四日 木曜日)
- 2008 August 25th Monday (八月 二十五日 月曜日)