contents up previous next

wxdoctemplate

the wxdoctemplate class is used to model the relationship between a document class and a view class.

derived from

wxobject

include files

<wx/docview.h>

see also

wxdoctemplate overview, wxdocument, wxview

members

wxdoctemplate::m_defaultext
wxdoctemplate::m_description
wxdoctemplate::m_directory
wxdoctemplate::m_docclassinfo
wxdoctemplate::m_doctypename
wxdoctemplate::m_documentmanager
wxdoctemplate::m_filefilter
wxdoctemplate::m_flags
wxdoctemplate::m_viewclassinfo
wxdoctemplate::m_viewtypename
wxdoctemplate::wxdoctemplate
wxdoctemplate::~wxdoctemplate
wxdoctemplate::createdocument
wxdoctemplate::createview
wxdoctemplate::getdefaultextension
wxdoctemplate::getdescription
wxdoctemplate::getdirectory
wxdoctemplate::getdocumentmanager
wxdoctemplate::getdocumentname
wxdoctemplate::getfilefilter
wxdoctemplate::getflags
wxdoctemplate::getviewname
wxdoctemplate::initdocument
wxdoctemplate::isvisible
wxdoctemplate::setdefaultextension
wxdoctemplate::setdescription
wxdoctemplate::setdirectory
wxdoctemplate::setdocumentmanager
wxdoctemplate::setfilefilter
wxdoctemplate::setflags


wxdoctemplate::m_defaultext

wxstring m_defaultext

the default extension for files of this type.


wxdoctemplate::m_description

wxstring m_description

a short description of this template.


wxdoctemplate::m_directory

wxstring m_directory

the default directory for files of this type.


wxdoctemplate::m_docclassinfo

wxclassinfo* m_docclassinfo

run-time class information that allows document instances to be constructed dynamically.


wxdoctemplate::m_doctypename

wxstring m_doctypename

the named type of the document associated with this template.


wxdoctemplate::m_documentmanager

wxdoctemplate* m_documentmanager

a pointer to the document manager for which this template was created.


wxdoctemplate::m_filefilter

wxstring m_filefilter

the file filter (such as *.txt) to be used in file selector dialogs.


wxdoctemplate::m_flags

long m_flags

the flags passed to the constructor.


wxdoctemplate::m_viewclassinfo

wxclassinfo* m_viewclassinfo

run-time class information that allows view instances to be constructed dynamically.


wxdoctemplate::m_viewtypename

wxstring m_viewtypename

the named type of the view associated with this template.


wxdoctemplate::wxdoctemplate

wxdoctemplate(wxdocmanager* manager, const wxstring& descr, const wxstring& filter, const wxstring& dir, const wxstring& ext, const wxstring& doctypename, const wxstring& viewtypename, wxclassinfo* docclassinfo = null, wxclassinfo* viewclassinfo = null, long flags = wxdefault_template_flags)

constructor. create instances dynamically near the start of your application after creating a wxdocmanager instance, and before doing any document or view operations.

manager is the document manager object which manages this template.

descr is a short description of what the template is for. this string will be displayed in the file filter list of windows file selectors.

filter is an appropriate file filter such as *.txt.

dir is the default directory to use for file selectors.

ext is the default file extension (such as txt).

doctypename is a name that should be unique for a given type of document, used for gathering a list of views relevant to a particular document.

viewtypename is a name that should be unique for a given view.

docclassinfo is a pointer to the run-time document class information as returned by the classinfo macro, e.g. classinfo(mydocumentclass). if this is not supplied, you will need to derive a new wxdoctemplate class and override the createdocument member to return a new document instance on demand.

viewclassinfo is a pointer to the run-time view class information as returned by the classinfo macro, e.g. classinfo(myviewclass). if this is not supplied, you will need to derive a new wxdoctemplate class and override the createview member to return a new view instance on demand.

flags is a bit list of the following:

wxperl note: in wxperl docclassinfo and viewclassinfo can be either wx::classinfo objects or strings which contain the name of the perl packages which are to be used as wx::document and wx::view classes (they must have a constructor named new):


wxdoctemplate::~wxdoctemplate

void ~wxdoctemplate()

destructor.


wxdoctemplate::createdocument

wxdocument * createdocument(const wxstring& path, long flags = 0)

creates a new instance of the associated document class. if you have not supplied a wxclassinfo parameter to the template constructor, you will need to override this function to return an appropriate document instance.

this function calls wxdoctemplate::initdocument which in turns calls wxdocument::oncreate.


wxdoctemplate::createview

wxview * createview(wxdocument *doc, long flags = 0)

creates a new instance of the associated view class. if you have not supplied a wxclassinfo parameter to the template constructor, you will need to override this function to return an appropriate view instance.


wxdoctemplate::getdefaultextension

wxstring getdefaultextension()

returns the default file extension for the document data, as passed to the document template constructor.


wxdoctemplate::getdescription

wxstring getdescription()

returns the text description of this template, as passed to the document template constructor.


wxdoctemplate::getdirectory

wxstring getdirectory()

returns the default directory, as passed to the document template constructor.


wxdoctemplate::getdocumentmanager

wxdocmanager * getdocumentmanager()

returns a pointer to the document manager instance for which this template was created.


wxdoctemplate::getdocumentname

wxstring getdocumentname()

returns the document type name, as passed to the document template constructor.


wxdoctemplate::getfilefilter

wxstring getfilefilter()

returns the file filter, as passed to the document template constructor.


wxdoctemplate::getflags

long getflags()

returns the flags, as passed to the document template constructor.


wxdoctemplate::getviewname

wxstring getviewname()

returns the view type name, as passed to the document template constructor.


wxdoctemplate::initdocument

bool initdocument(wxdocument* doc, const wxstring& path, long flags = 0)

initialises the document, calling wxdocument::oncreate. this is called from wxdoctemplate::createdocument.


wxdoctemplate::isvisible

bool isvisible()

returns true if the document template can be shown in user dialogs, false otherwise.


wxdoctemplate::setdefaultextension

void setdefaultextension(const wxstring& ext)

sets the default file extension.


wxdoctemplate::setdescription

void setdescription(const wxstring& descr)

sets the template description.


wxdoctemplate::setdirectory

void setdirectory(const wxstring& dir)

sets the default directory.


wxdoctemplate::setdocumentmanager

void setdocumentmanager(wxdocmanager *manager)

sets the pointer to the document manager instance for which this template was created. should not be called by the application.


wxdoctemplate::setfilefilter

void setfilefilter(const wxstring& filter)

sets the file filter.


wxdoctemplate::setflags

void setflags(long flags)

sets the internal document template flags (see the constructor description for more details).