wxRichTextFileHandler Class Reference
[Rich Text]

#include <wx/richtext/richtextbuffer.h>

Inheritance diagram for wxRichTextFileHandler:

wxObject wxRichTextHTMLHandler wxRichTextXMLHandler

List of all members.


Detailed Description

This is the base class for file handlers, for loading and/or saving content associated with a wxRichTextBuffer.

Library:  wxRichText

Category:  Rich Text

Public Member Functions

 wxRichTextFileHandler (const wxString &name=wxEmptyString, const wxString &ext=wxEmptyString, int type=0)
virtual bool CanHandle (const wxString &filename) const
virtual bool CanLoad () const
virtual bool CanSave () const
const wxStringGetEncoding () const
wxString GetExtension () const
int GetFlags () const
wxString GetName () const
int GetType () const
virtual bool IsVisible () const
void SetEncoding (const wxString &encoding)
void SetExtension (const wxString &ext)
void SetFlags (int flags)
void SetName (const wxString &name)
void SetType (int type)
virtual void SetVisible (bool visible)
bool LoadFile (wxRichTextBuffer *buffer, wxInputStream &stream)
bool LoadFile (wxRichTextBuffer *buffer, const wxString &filename)
bool SaveFile (wxRichTextBuffer *buffer, wxOutputStream &stream)
bool SaveFile (wxRichTextBuffer *buffer, const wxString &filename)

Protected Member Functions

virtual bool DoLoadFile (wxRichTextBuffer *buffer, wxInputStream &stream)=0
virtual bool DoSaveFile (wxRichTextBuffer *buffer, wxOutputStream &stream)=0

Constructor & Destructor Documentation

wxRichTextFileHandler::wxRichTextFileHandler ( const wxString name = wxEmptyString,
const wxString ext = wxEmptyString,
int  type = 0 
)

Constructor.


Member Function Documentation

virtual bool wxRichTextFileHandler::CanHandle ( const wxString filename  )  const [virtual]

Override this function and return true if this handler can we handle filename.

By default, this function checks the extension.

virtual bool wxRichTextFileHandler::CanLoad (  )  const [virtual]

Override and return true if this handler can load content.

Reimplemented in wxRichTextXMLHandler.

virtual bool wxRichTextFileHandler::CanSave (  )  const [virtual]

Override and return true if this handler can save content.

Reimplemented in wxRichTextXMLHandler.

const wxString& wxRichTextFileHandler::GetEncoding (  )  const

Returns the encoding associated with the handler (if any).

wxString wxRichTextFileHandler::GetExtension (  )  const

Returns the extension associated with the handler.

int wxRichTextFileHandler::GetFlags (  )  const

Returns flags that change the behaviour of loading or saving.

See the documentation for each handler class to see what flags are relevant for each handler.

wxString wxRichTextFileHandler::GetName (  )  const

Returns the name of the handler.

int wxRichTextFileHandler::GetType (  )  const

Returns the type of the handler.

virtual bool wxRichTextFileHandler::IsVisible (  )  const [virtual]

Returns true if this handler should be visible to the user.

bool wxRichTextFileHandler::LoadFile ( wxRichTextBuffer buffer,
wxInputStream stream 
)

Loads content from a stream or file. Not all handlers will implement file loading.

bool wxRichTextFileHandler::LoadFile ( wxRichTextBuffer buffer,
const wxString filename 
)

Loads content from a stream or file. Not all handlers will implement file loading.

bool wxRichTextFileHandler::SaveFile ( wxRichTextBuffer buffer,
wxOutputStream stream 
)

Saves content to a stream or file. Not all handlers will implement file saving.

bool wxRichTextFileHandler::SaveFile ( wxRichTextBuffer buffer,
const wxString filename 
)

Saves content to a stream or file. Not all handlers will implement file saving.

void wxRichTextFileHandler::SetEncoding ( const wxString encoding  ) 

Sets the encoding to use when saving a file. If empty, a suitable encoding is chosen.

void wxRichTextFileHandler::SetExtension ( const wxString ext  ) 

Sets the default extension to recognise.

void wxRichTextFileHandler::SetFlags ( int  flags  ) 

Sets flags that change the behaviour of loading or saving. See the documentation for each handler class to see what flags are relevant for each handler.

You call this function directly if you are using a file handler explicitly (without going through the text control or buffer LoadFile/SaveFile API). Or, you can call the control or buffer's SetHandlerFlags function to set the flags that will be used for subsequent load and save operations.

void wxRichTextFileHandler::SetName ( const wxString name  ) 

Sets the name of the handler.

void wxRichTextFileHandler::SetType ( int  type  ) 

Sets the handler type.

virtual void wxRichTextFileHandler::SetVisible ( bool  visible  )  [virtual]

Sets whether the handler should be visible to the user (via the application's load and save dialogs).

virtual bool wxRichTextFileHandler::DoLoadFile ( wxRichTextBuffer buffer,
wxInputStream stream 
) [protected, pure virtual]

Override to load content from stream into buffer.

Implemented in wxRichTextXMLHandler.

virtual bool wxRichTextFileHandler::DoSaveFile ( wxRichTextBuffer buffer,
wxOutputStream stream 
) [protected, pure virtual]

Override to save content to stream from buffer.

Implemented in wxRichTextHTMLHandler, and wxRichTextXMLHandler.



wxWidgets logo

[ top ]