WxDocTemplate

From WxWiki

Jump to: navigation, search

[edit] wxDocTemplate

The manual seems pretty thin for describing how to use this class. I'm adding a few extra bits as I discover them.

[edit] Constructor

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)

wxDocManager* manager

is the document manager object which manages this template.

const wxString& 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.

const wxString& filter

is an appropriate file filter such as *.txt. For multiple file extensions, separate them with a ";" and do not use spaces. For example: "*.doc;*.xls"

Mac: This is not case sensitive. There is no need to specify ".doc;.DOC". The "*" is optional, but may need to be there for cross platfrom compatibility...

const wxString& dir

is the default directory to use for file selectors.

const wxString& ext

is the default file extension (such as txt).

const wxString& 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.

const wxString& viewTypeName

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

wxClassInfo* 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.
wxClassInfo* 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.

long flags

is a bit list of the following:

* wxTEMPLATE_VISIBLE The template may be displayed to the user in dialogs.
* wxTEMPLATE_INVISIBLE The template may not be displayed to the user in dialogs.
* wxDEFAULT_TEMPLATE_FLAGS Defined as wxTEMPLATE_VISIBLE.

|}

Personal tools