The purpose of this patch is to refactor the overall
procedure of creating documents and views from the
actual details of instantiated a document and view object.
wxDocTemplate::CreateDocument and
wxDocTemplate::CreateView provide the overall procedure
for creating document and view objects. This procedure
includes initializing the document, initializing the
view, and associating the document with the view. When
the default method of creating a document or view is
inadequate, you will provide the document template NULL
for the document and view class info objects and
override CreateDocument/CreateView.
The way CreateDocument and CreateView are structured,
you must replace them in their entirety. As a result, a
developer using a custom method of instantiating a
document and/or view object must also replace the
procedure for initializing the document and view as
well as associating the document and view together.
With this patch, I propose the addition of two virtual
methods, DoCreateDocument and DoCreateView. The purpose
of these methods is to provide the developer functions
to override to replace only the creation of a document
or view object. The remainder of the procedure will
remain intact and will not need to be reproduced.
CreateDocument and CreateView will be modified to call
DoCreateDocument and DoCreateView. The default
implementation of these methods will be to create the
document and view from their class info objects or
return NULL if class info objects are not provided.
Therefore, the default behavior of the framework
remains unchanged.
To replace only the functionality of creating an
instance of a document or view object, a developer can
override DoCreateDocument or DoCreateView without
having to copy and paste the code in
CreateDocument/CreateView to deal with initialization
and associations.
This change will make wxWidgets Doc/View model more
flexible while maintain its current default behavior.
Issue migrated from trac ticket # 6734
priority: normal
2004-07-01 19:55:44: rick_brice created the issue
The purpose of this patch is to refactor the overall procedure of creating documents and views from the actual details of instantiated a document and view object.
wxDocTemplate::CreateDocument and wxDocTemplate::CreateView provide the overall procedure for creating document and view objects. This procedure includes initializing the document, initializing the view, and associating the document with the view. When the default method of creating a document or view is inadequate, you will provide the document template NULL for the document and view class info objects and override CreateDocument/CreateView.
The way CreateDocument and CreateView are structured, you must replace them in their entirety. As a result, a developer using a custom method of instantiating a document and/or view object must also replace the procedure for initializing the document and view as well as associating the document and view together.
With this patch, I propose the addition of two virtual methods, DoCreateDocument and DoCreateView. The purpose of these methods is to provide the developer functions to override to replace only the creation of a document or view object. The remainder of the procedure will remain intact and will not need to be reproduced.
CreateDocument and CreateView will be modified to call DoCreateDocument and DoCreateView. The default implementation of these methods will be to create the document and view from their class info objects or return NULL if class info objects are not provided. Therefore, the default behavior of the framework remains unchanged.
To replace only the functionality of creating an instance of a document or view object, a developer can override DoCreateDocument or DoCreateView without having to copy and paste the code in CreateDocument/CreateView to deal with initialization and associations.
This change will make wxWidgets Doc/View model more flexible while maintain its current default behavior.