wxRuby Documentation Home

# Wx::DocTemplate

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

## Derived from

Object

## See also

DocTemplate overview, Document, View

## Methods

- DocTemplate#m__default_ext
- DocTemplate#m__description
- DocTemplate#m__directory
- DocTemplate#m__doc_class_info
- DocTemplate#m__doc_type_name
- DocTemplate#m__document_manager
- DocTemplate#m__file_filter
- DocTemplate#m__flags
- DocTemplate#m__view_class_info
- DocTemplate#m__view_type_name
- DocTemplate.new
- DocTemplate#create_document
- DocTemplate#create_view
- DocTemplate#get_default_extension
- DocTemplate#get_description
- DocTemplate#get_directory
- DocTemplate#get_document_manager
- DocTemplate#get_document_name
- DocTemplate#get_file_filter
- DocTemplate#get_flags
- DocTemplate#get_view_name
- DocTemplate#init_document
- DocTemplate#is_visible
- DocTemplate#set_default_extension
- DocTemplate#set_description
- DocTemplate#set_directory
- DocTemplate#set_document_manager
- DocTemplate#set_file_filter
- DocTemplate#set_flags

### DocTemplate#m__default_ext

Stringm_defaultExt

The default extension for files of this type.

### DocTemplate#m__description

Stringm_description

A short description of this template.

### DocTemplate#m__directory

Stringm_directory

The default directory for files of this type.

### DocTemplate#m__doc_class_info

ClassInfo* m_docClassInfo

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

### DocTemplate#m__doc_type_name

Stringm_docTypeName

The named type of the document associated with this template.

### DocTemplate#m__document_manager

DocTemplate*m_documentManager

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

### DocTemplate#m__file_filter

Stringm_fileFilter

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

### DocTemplate#m__flags

longm_flags

The flags passed to the constructor.

### DocTemplate#m__view_class_info

ClassInfo*m_viewClassInfo

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

### DocTemplate#m__view_type_name

Stringm_viewTypeName

The named type of the view associated with this template.

### DocTemplate.new

DocTemplate.new(%(arg-type)DocManager% manager, String descr, String filter, String dir, String ext, String docTypeName, String viewTypeName, ClassInfo docClassInfo = nil, ClassInfo viewClassInfo = nil, Integer flags = DEFAULT_TEMPLATE_FLAGS)

Constructor. Create instances dynamically near the start of your application after creating
a DocManager 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. If this is not supplied,
you will need to derive a new DocTemplate 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. If this is not supplied,
you will need to derive a new DocTemplate class and override the CreateView
member to return a new view instance on demand.

flags is a bit list of the following:

- TEMPLATE_VISIBLE The template may be displayed to the user in dialogs.
- TEMPLATE_INVISIBLE The template may not be displayed to the user in dialogs.
- DEFAULT_TEMPLATE_FLAGS Defined as TEMPLATE_VISIBLE.

):

2cm
|Wx::DocTemplate→new( docmgr, descr, filter, dir,ext, docTypeName, viewTypeName, docClassInfo, viewClassInfo, flags)| will construct document and view objects from the class information|
|Wx::DocTemplate→new( docmgr, descr, filter, dir,ext, docTypeName, viewTypeName, docClassName, viewClassName, flags)| will construct document and view objects from perl packages|
|Wx::DocTemplate→new( docmgr, descr, filter, dir,ext, docTypeName, viewTypeName )|`Wx::DocTemplate::CreateDocument()` and@Wx::DocTemplate::CreateView()@ must be overridden|

destructor()

Destructor.

### DocTemplate#create_document

Document create_document(%(arg-type)String% path, Integer flags = 0)

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

This function calls DocTemplate::InitDocument which in turns
calls Document::OnCreate.

### DocTemplate#create_view

View create_view(%(arg-type)Document% doc, Integer flags = 0)

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

### DocTemplate#get_default_extension

String get_default_extension()

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

### DocTemplate#get_description

String get_description()

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

### DocTemplate#get_directory

String get_directory()

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

### DocTemplate#get_document_manager

DocManager get_document_manager()

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

### DocTemplate#get_document_name

String get_document_name()

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

### DocTemplate#get_file_filter

String get_file_filter()

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

### DocTemplate#get_flags

Integer get_flags()

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

### DocTemplate#get_view_name

String get_view_name()

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

### DocTemplate#init_document

Boolean init_document(%(arg-type)Document% doc, String path, Integer flags = 0)

Initialises the document, calling Document::OnCreate. This is called from
DocTemplate::CreateDocument.

### DocTemplate#is_visible

Boolean is_visible()

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

### DocTemplate#set_default_extension

set_default_extension(%(arg-type)String% ext)

Sets the default file extension.

### DocTemplate#set_description

set_description(%(arg-type)String% descr)

Sets the template description.

### DocTemplate#set_directory

set_directory(%(arg-type)String% dir)

Sets the default directory.

### DocTemplate#set_document_manager

set_document_manager(%(arg-type)DocManager% manager)

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

### DocTemplate#set_file_filter

set_file_filter(%(arg-type)String% filter)

Sets the file filter.

### DocTemplate#set_flags

set_flags(%(arg-type)Integer% flags)

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

[This page automatically generated from the Textile source at 2023-06-09 00:45:29 +0000]