+
+ @section filetype_example MessageParameters class
+
+ One of the most common usages of MIME is to encode an e-mail message.
+ The MIME type of the encoded message is an example of a message parameter.
+ These parameters are found in the message headers ("Content-XXX").
+
+ At the very least, they must specify the MIME type and the version of MIME
+ used, but almost always they provide additional information about the message
+ such as the original file name or the charset (for the text documents).
+ These parameters may be useful to the program used to open, edit, view or
+ print the message, so, for example, an e-mail client program will have to
+ pass them to this program. Because wxFileType itself can not know about
+ these parameters, it uses MessageParameters class to query them.
+
+ The default implementation only requires the caller to provide the file name
+ (always used by the program to be called - it must know which file to open)
+ and the MIME type and supposes that there are no other parameters.
+
+ If you wish to supply additional parameters, you must derive your own class
+ from MessageParameters and override GetParamValue() function, for example:
+
+ @code
+ // provide the message parameters for the MIME type manager
+ class MailMessageParameters : public wxFileType::MessageParameters
+ {
+ public:
+ MailMessageParameters(const wxString& filename,
+ const wxString& mimetype)
+ : wxFileType::MessageParameters(filename, mimetype)
+ {
+ }
+
+ virtual wxString GetParamValue(const wxString& name) const
+ {
+ // parameter names are not case-sensitive
+ if ( name.CmpNoCase("charset") == 0 )
+ return "US-ASCII";
+ else
+ return wxFileType::MessageParameters::GetParamValue(name);
+ }
+ };
+ @endcode
+
+ Now you only need to create an object of this class and pass it to, for example,
+ GetOpenCommand like this:
+
+ @code
+ wxString command;
+ if ( filetype->GetOpenCommand(&command,
+ MailMessageParameters("foo.txt", "text/plain")) )
+ {
+ // the full command for opening the text documents is in 'command'
+ // (it might be "notepad foo.txt" under Windows or "cat foo.txt" under Unix)
+ }
+ else
+ {
+ // we don't know how to handle such files...
+ }
+ @endcode
+
+ Windows: As only the file name is used by the program associated with the
+ given extension anyhow (but no other message parameters), there is no need
+ to ever derive from MessageParameters class for a Windows-only program.
+
+