July 30th Thursday (七月 三十日 木曜日)
2009-07-16 16:23
337 查看
wxDocTemplate
The wxDocTemplate class is used to model the relationship between a document class and a view class. The application creates a document template
object for each document/view pair. The list of document templates managed by the wxDocManager instance is used to create documents and views.
Each document template knows what file filters and default extension are appropriate for a document/view combination, and how to create a document
or view.
For example, you might write a small doodling application that can load and save lists of line segments. If you had two views of the data -- graphical,
and a list of the segments -- then you would create one document class DoodleDocument, and two view classes (DoodleGraphicView and DoodleListView).
You would also need two document templates, one for the graphical view and another for the list view. You would pass the same document class and default
file extension to both document templates, but each would be passed a different view class. When the user clicks on the Open menu item, the file selector
is displayed with a list of possible file filters -- one for each wxDocTemplate. Selecting the filter selects the wxDocTemplate, and when a file is
selected, that template will be used for creating a document and view.
For the case where an application has one document type and one view type, a single document template is constructed, and dialogs will be appropriately
simplified.
wxDocTemplate is part of the document/view framework supported by wxWidgets, and cooperates with the wxView, wxDocument and wxDocManager classes.
To use the wxDocTemplate class, you do not need to derive a new class. Just pass relevant information to the constructor including CLASSINFO(YourDocumentClass)
and CLASSINFO(YourViewClass) to allow dynamic instance creation. If you do not wish to use the wxWidgets method of creating document objects dynamically,
you must override wxDocTemplate::CreateDocument and wxDocTemplate::CreateView to return instances of the appropriate class.
NOTE: the document template has nothing to do with the C++ template construct.
The wxDocTemplate class is used to model the relationship between a document class and a view class. The application creates a document template
object for each document/view pair. The list of document templates managed by the wxDocManager instance is used to create documents and views.
Each document template knows what file filters and default extension are appropriate for a document/view combination, and how to create a document
or view.
For example, you might write a small doodling application that can load and save lists of line segments. If you had two views of the data -- graphical,
and a list of the segments -- then you would create one document class DoodleDocument, and two view classes (DoodleGraphicView and DoodleListView).
You would also need two document templates, one for the graphical view and another for the list view. You would pass the same document class and default
file extension to both document templates, but each would be passed a different view class. When the user clicks on the Open menu item, the file selector
is displayed with a list of possible file filters -- one for each wxDocTemplate. Selecting the filter selects the wxDocTemplate, and when a file is
selected, that template will be used for creating a document and view.
For the case where an application has one document type and one view type, a single document template is constructed, and dialogs will be appropriately
simplified.
wxDocTemplate is part of the document/view framework supported by wxWidgets, and cooperates with the wxView, wxDocument and wxDocManager classes.
To use the wxDocTemplate class, you do not need to derive a new class. Just pass relevant information to the constructor including CLASSINFO(YourDocumentClass)
and CLASSINFO(YourViewClass) to allow dynamic instance creation. If you do not wish to use the wxWidgets method of creating document objects dynamically,
you must override wxDocTemplate::CreateDocument and wxDocTemplate::CreateView to return instances of the appropriate class.
NOTE: the document template has nothing to do with the C++ template construct.
相关文章推荐
- 2008 July 30th Wednesday (七月 三十日 水曜日)
- July 12th Thursday (七月 十二日 木曜日)
- 2008 July 17th Thursday (七月 十七日 木曜日)
- July 26th Thursday (七月 二十六日 木曜日)
- 2008 October 30th Thursday (十月 三十日 木曜日)
- July 2nd Thursday (七月 二日 木曜日)
- August 30th Thursday (八月 三十日 木曜日)
- 2008 July 31th Thursday (七月 三十一日 木曜日)
- July 16th Thursday (七月 十六日 木曜日)
- July 5th Thursday (七月 五日 木曜日)
- July 30th Monday (七月 三十日 月曜日)
- 2008 July 10th Thursday (七月 十日 木曜日)
- July 9th Thursday (七月 九日 木曜日)
- July 19th Thursday (七月 十九日 木曜日)
- April 30th Thursday (四月 三十日 木曜日)
- 2008 July 3th Thursday (七月 三日 木曜日)
- 2008 July 24th Thursday (七月 二十四日 木曜日)
- July 23th Thursday (七月 二十三日 木曜日)
- March 8th Thursday (三月 八日 木曜日)
- Aprial 26th Thursday (四月 二十六日 木曜日)