/////////////////////////////////////////////////////////////////////////////
// Name: richtext/richtextbuffer.h
-// Purpose: documentation for wxRichTextBuffer class
+// Purpose: interface of wxRichTextBuffer
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/**
@class wxRichTextBuffer
@headerfile richtextbuffer.h wx/richtext/richtextbuffer.h
-
+
This class represents the whole buffer associated with a wxRichTextCtrl.
-
+
@library{wxrichtext}
- @category{FIXME}
-
- @seealso
- wxTextAttr, wxRichTextCtrl
+ @category{richtext}
+
+ @see wxTextAttr, wxRichTextCtrl
*/
-class wxRichTextBuffer
+class wxRichTextBuffer
{
public:
//@{
Default constructors.
*/
wxRichTextBuffer(const wxRichTextBuffer& obj);
- wxRichTextBuffer();
+ wxRichTextBuffer();
//@}
/**
to add more if further notification is required. All handlers are notified
of an event originating from the buffer, such as the replacement of a style
sheet
- during loading. The buffer never deletes any of the event handlers, unless
+ during loading. The buffer never deletes any of the event handlers, unless
RemoveEventHandler() is
called with @true as the second argument.
*/
Returns @true if the buffer is currently collapsing commands into a single
notional command.
*/
- bool BatchingUndo();
+ bool BatchingUndo() const;
/**
Begins using alignment.
Begins collapsing undo/redo commands. Note that this may not work properly
if combining commands that delete or insert content, changing ranges for
subsequent actions.
-
- @e cmdName should be the name of the combined command that will appear
+ @a cmdName should be the name of the combined command that will appear
next to Undo and Redo in the edit menu.
*/
bool BeginBatchUndo(const wxString& cmdName);
bool BeginItalic();
/**
- Begin using @e leftIndent for the left indent, and optionally @e leftSubIndent
+ Begin using @a leftIndent for the left indent, and optionally @a leftSubIndent
for
the sub-indent. Both are expressed in tenths of a millimetre.
-
The sub-indent is an offset from the left of the paragraph, and is used for all
but the
first line in a paragraph. A positive value will cause the first line to appear
Begins using a specified list style. Optionally, you can also pass a level and
a number.
*/
- bool BeginListStyle(const wxString& listStyle, int level=1,
- int number=1);
+ bool BeginListStyle(const wxString& listStyle, int level = 1,
+ int number = 1);
/**
Begins a numbered bullet. This call will be needed for each item in the list,
and the
application should take care of incrementing the numbering.
-
- @e bulletNumber is a number, usually starting with 1.
-
- @e leftIndent and @e leftSubIndent are values in tenths of a millimetre.
-
- @e bulletStyle is a bitlist of the following values:
-
+ @a bulletNumber is a number, usually starting with 1.
+ @a leftIndent and @a leftSubIndent are values in tenths of a millimetre.
+ @a bulletStyle is a bitlist of the following values:
wxRichTextBuffer uses indentation to render a bulleted item. The left indent is
the distance between
/**
Returns @true if content can be pasted from the clipboard.
*/
- bool CanPasteFromClipboard();
+ bool CanPasteFromClipboard() const;
/**
Cleans up the file handlers.
/**
Clears the list style from the given range, clearing list-related attributes
and applying any named paragraph style associated with each paragraph.
-
- @e flags is a bit list of the following:
-
+ @a flags is a bit list of the following:
wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
-
See also SetListStyle(), PromoteList(), NumberList().
*/
bool ClearListStyle(const wxRichTextRange& range,
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
- bool ClearListStyle(const wxRichTextRange& range,
- int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+ bool ClearListStyle(const wxRichTextRange& range,
+ int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
//@}
/**
/**
Clones the object.
*/
- wxRichTextObject* Clone();
+ wxRichTextObject* Clone() const;
/**
Copies the given buffer.
Dumps the contents of the buffer for debugging purposes.
*/
void Dump();
- void Dump(wxTextOutputStream& stream);
+ void Dump(wxTextOutputStream& stream);
//@}
/**
/**
Ends applying a URL.
*/
-#define bool EndURL() /* implementation is private */
+ bool EndURL();
/**
Ends using underline.
Finds a handler by name.
*/
wxRichTextFileHandler* FindHandler(int imageType);
- wxRichTextFileHandler* FindHandler(const wxString& extension,
- int imageType);
- wxRichTextFileHandler* FindHandler(const wxString& name);
+ wxRichTextFileHandler* FindHandler(const wxString& extension,
+ int imageType);
+ wxRichTextFileHandler* FindHandler(const wxString& name);
//@}
/**
Finds a handler by filename or, if supplied, type.
*/
wxRichTextFileHandler* FindHandlerFilenameOrType(const wxString& filename,
- int imageType);
+ int imageType);
/**
Gets the basic (overall) style. This is the style of the whole
only affects the style currently being applied (for example, setting the default
style to bold will cause subsequently inserted text to be bold).
*/
- const wxTextAttr GetBasicStyle();
+ const wxTextAttr GetBasicStyle() const;
/**
Gets the collapsed command.
*/
- wxRichTextCommand* GetBatchedCommand();
+ wxRichTextCommand* GetBatchedCommand() const;
/**
Gets the command processor. A text buffer always creates its own command
processor when it is
initialized.
*/
- wxCommandProcessor* GetCommandProcessor();
+ wxCommandProcessor* GetCommandProcessor() const;
/**
Returns the current default style, affecting the style currently being applied
(for example, setting the default
style to bold will cause subsequently inserted text to be bold).
*/
- const wxTextAttr GetDefaultStyle();
+ const wxTextAttr GetDefaultStyle() const;
/**
- Gets a wildcard incorporating all visible handlers. If @e types is present,
+ Gets a wildcard incorporating all visible handlers. If @a types is present,
it will be filled with the file type corresponding to each filter. This can be
used to determine the type to pass to @ref getextwildcard() LoadFile given a
selected filter.
*/
- wxString GetExtWildcard(bool combine = @false, bool save = @false,
- wxArrayInt* types = @NULL);
+ wxString GetExtWildcard(bool combine = false, bool save = false,
+ wxArrayInt* types = NULL);
/**
Returns the list of file handlers.
/**
Gets the attributes at the given position.
-
This function gets the combined style - that is, the style you see on the
screen as a result
of combining base style, paragraph style and character style attributes. To get
Attributes which have different values within the specified range will not be
included the style
flags.
-
The function is used to get the attributes to display in the formatting dialog:
the user
can edit the attributes common to the selection, and optionally specify the
values of further
attributes to be applied uniformly.
-
To apply the edited attributes, you can use SetStyle() specifying
the wxRICHTEXT_SETSTYLE_OPTIMIZE flag, which will only apply attributes that
are different
/**
Returns the current style sheet associated with the buffer, if any.
*/
- wxRichTextStyleSheet* GetStyleSheet();
+ wxRichTextStyleSheet* GetStyleSheet() const;
/**
Get the size of the style stack, for example to check correct nesting.
*/
- size_t GetStyleStackSize();
+ size_t GetStyleStackSize() const;
/**
Gets the attributes at the given position.
-
This function gets the @e uncombined style - that is, the attributes associated
with the
paragraph or character content, and not necessarily the combined attributes you
see on the
screen. To get the combined attributes, use GetStyle().
-
If you specify (any) paragraph attribute in @e style's flags, this function
will fetch
the paragraph attributes. Otherwise, it will return the character attributes.
bool GetUncombinedStyle(long position, wxTextAttr& style);
/**
- Finds the text position for the given position, putting the position in @e
+ Finds the text position for the given position, putting the position in @a
textPosition if
- one is found. @e pt is in logical units (a zero y position is
+ one is found. @a pt is in logical units (a zero y position is
at the beginning of the buffer).
-
The function returns one of the following values:
*/
int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition);
/**
Returns @true if the buffer has been modified.
*/
- bool IsModified();
+ bool IsModified() const;
//@{
/**
*/
bool LoadFile(wxInputStream& stream,
int type = wxRICHTEXT_TYPE_ANY);
- bool LoadFile(const wxString& filename,
- int type = wxRICHTEXT_TYPE_ANY);
+ bool LoadFile(const wxString& filename,
+ int type = wxRICHTEXT_TYPE_ANY);
//@}
/**
Marks the buffer as modified or unmodified.
*/
- void Modify(bool modify = @true);
+ void Modify(bool modify = true);
//@{
/**
attributes are set.
Either the style definition or the name of the style definition (in the current
sheet) can be passed.
-
- @e flags is a bit list of the following:
-
+ @a flags is a bit list of the following:
wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from @e
startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @e listLevel should be used
+ wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
as the level for all paragraphs, otherwise the current indentation will be used.
-
See also SetListStyle(), PromoteList(), ClearListStyle().
*/
bool NumberList(const wxRichTextRange& range,
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
int startFrom = -1,
int listLevel = -1);
- bool Number(const wxRichTextRange& range,
- const wxString& styleName,
- int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
- int startFrom = -1,
- int listLevel = -1);
+ bool Number(const wxRichTextRange& range,
+ const wxString& styleName,
+ int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
+ int startFrom = -1,
+ int listLevel = -1);
//@}
/**
//@{
/**
- Promotes or demotes the paragraphs in the given range. A positive @e promoteBy
+ Promotes or demotes the paragraphs in the given range. A positive @a promoteBy
produces a smaller indent, and a negative number
produces a larger indent. Pass flags to determine how the attributes are set.
Either the style definition or the name of the style definition (in the current
sheet) can be passed.
-
- @e flags is a bit list of the following:
-
+ @a flags is a bit list of the following:
wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from @e
startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @e listLevel should be used
+ wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
as the level for all paragraphs, otherwise the current indentation will be used.
-
See also SetListStyle(), See also SetListStyle(), ClearListStyle().
*/
bool PromoteList(int promoteBy, const wxRichTextRange& range,
const wxRichTextListStyleDefinition* style,
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
int listLevel = -1);
- bool PromoteList(int promoteBy, const wxRichTextRange& range,
- const wxString& styleName,
- int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
- int listLevel = -1);
+ bool PromoteList(int promoteBy, const wxRichTextRange& range,
+ const wxString& styleName,
+ int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
+ int listLevel = -1);
//@}
/**
Removes an event handler from the buffer's list of handlers, deleting the
- object if @e deleteHandler is @true.
+ object if @a deleteHandler is @true.
*/
bool RemoveEventHandler(wxEvtHandler* handler,
- bool deleteHandler = @false);
+ bool deleteHandler = false);
/**
Removes a handler.
*/
bool SaveFile(wxOutputStream& stream,
int type = wxRICHTEXT_TYPE_ANY);
- bool SaveFile(const wxString& filename,
- int type = wxRICHTEXT_TYPE_ANY);
+ bool SaveFile(const wxString& filename,
+ int type = wxRICHTEXT_TYPE_ANY);
//@}
/**
Sets the default style, affecting the style currently being applied (for
example, setting the default
style to bold will cause subsequently inserted text to be bold).
-
This is not cumulative - setting the default style will replace the previous
default style.
*/
the attributes are set.
Either the style definition or the name of the style definition (in the current
sheet) can be passed.
-
- @e flags is a bit list of the following:
-
+ @a flags is a bit list of the following:
wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from @e
startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @e listLevel should be used
+ wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
as the level for all paragraphs, otherwise the current indentation will be used.
-
See also NumberList(), PromoteList(), ClearListStyle().
*/
bool SetListStyle(const wxRichTextRange& range,
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
int startFrom = -1,
int listLevel = -1);
- bool SetListStyle(const wxRichTextRange& range,
- const wxString& styleName,
- int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
- int startFrom = -1,
- int listLevel = -1);
+ bool SetListStyle(const wxRichTextRange& range,
+ const wxString& styleName,
+ int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
+ int startFrom = -1,
+ int listLevel = -1);
//@}
/**
- Sets @e renderer as the object to be used to render certain aspects of the
+ Sets @a renderer as the object to be used to render certain aspects of the
content, such as bullets.
You can override default rendering by deriving a new class from
wxRichTextRenderer or wxRichTextStdRenderer,
/**
Sets the attributes for the given range. Pass flags to determine how the
attributes are set.
-
The end point of range is specified as the last character position of the span
of text.
So, for example, to set the style for a character at position 5, use the range
(5,5).
This differs from the wxRichTextCtrl API, where you would specify (5,6).
-
- @e flags may contain a bit list of the following values:
-
+ @a flags may contain a bit list of the following values:
wxRICHTEXT_SETSTYLE_NONE: no style flag.
wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be
undoable.
/**
Returns @true if undo suppression is currently on.
*/
- bool SuppressingUndo();
+ bool SuppressingUndo() const;
};
+
/**
@class wxRichTextFileHandler
@headerfile richtextbuffer.h wx/richtext/richtextbuffer.h
-
+
This is the base class for file handlers, for loading and/or saving content
associated with a wxRichTextBuffer.
-
+
@library{wxrichtext}
- @category{FIXME}
+ @category{richtext}
*/
class wxRichTextFileHandler : public wxObject
{
filename. By default,
this function checks the extension.
*/
- bool CanHandle(const wxString& filename);
+ bool CanHandle(const wxString& filename) const;
/**
Override and return @true if this handler can load content.
*/
- bool CanLoad();
+ bool CanLoad() const;
/**
Override and return @true if this handler can save content.
*/
- bool CanSave();
+ bool CanSave() const;
/**
- Override to load content from @e stream into @e buffer.
+ Override to load content from @a stream into @e buffer.
*/
bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
/**
- Override to save content to @e stream from @e buffer.
+ Override to save content to @a stream from @e buffer.
*/
bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
/**
Returns the encoding associated with the handler (if any).
*/
- const wxString GetEncoding();
+ const wxString GetEncoding() const;
/**
Returns the extension associated with the handler.
*/
- wxString GetExtension();
+ wxString GetExtension() 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.
*/
- int GetFlags();
+ int GetFlags() const;
/**
Returns the name of the handler.
*/
- wxString GetName();
+ wxString GetName() const;
/**
Returns the type of the handler.
*/
- int GetType();
+ int GetType() const;
/**
Returns @true if this handler should be visible to the user.
*/
- bool IsVisible();
+ bool IsVisible() const;
//@{
/**
loading.
*/
bool LoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
- bool LoadFile(wxRichTextBuffer* buffer,
- const wxString& filename);
+ bool LoadFile(wxRichTextBuffer* buffer,
+ const wxString& filename);
//@}
//@{
Saves content to a stream or file. Not all handlers will implement file saving.
*/
bool SaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
- bool SaveFile(wxRichTextBuffer* buffer,
- const wxString& filename);
+ bool SaveFile(wxRichTextBuffer* buffer,
+ const wxString& filename);
//@}
/**
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
};
+
/**
@class wxRichTextRange
@headerfile richtextbuffer.h wx/richtext/richtextbuffer.h
-
+
This class stores beginning and end positions for a range of data.
-
+
@library{wxrichtext}
- @category{FIXME}
+ @category{richtext}
*/
-class wxRichTextRange
+class wxRichTextRange
{
public:
//@{
Constructors.
*/
wxRichTextRange(long start, long end);
- wxRichTextRange(const wxRichTextRange& range);
- wxRichTextRange();
+ wxRichTextRange(const wxRichTextRange& range);
+ wxRichTextRange();
//@}
/**
Returns @true if the given position is within this range. Does not
match if the range is empty.
*/
- bool Contains(long pos);
+ bool Contains(long pos) const;
/**
Converts the internal range, which uses the first and last character positions
range.
In other words, one is added to the end position.
*/
- wxRichTextRange FromInternal();
+ wxRichTextRange FromInternal() const;
/**
Returns the end position.
*/
- long GetEnd();
+ long GetEnd() const;
/**
Returns the length of the range.
*/
- long GetLength();
+ long GetLength() const;
/**
Returns the start of the range.
*/
- long GetStart();
+ long GetStart() const;
/**
Returns @true if this range is completely outside @e range.
*/
- bool IsOutside(const wxRichTextRange& range);
+ bool IsOutside(const wxRichTextRange& range) const;
/**
Returns @true if this range is completely within @e range.
*/
- bool IsWithin(const wxRichTextRange& range);
+ bool IsWithin(const wxRichTextRange& range) const;
/**
Limits this range to be within @e range.
range.
In other words, one is subtracted from the end position.
*/
- wxRichTextRange ToInternal();
+ wxRichTextRange ToInternal() const;
/**
- Adds @e range to this range.
+ Adds @a range to this range.
*/
- wxRichTextRange operator+(const wxRichTextRange& range);
+ wxRichTextRange operator+(const wxRichTextRange& range) const;
/**
- Subtracts @e range from this range.
+ Subtracts @a range from this range.
*/
- wxRichTextRange operator-(const wxRichTextRange& range);
+ wxRichTextRange operator-(const wxRichTextRange& range) const;
/**
- Assigns @e range to this range.
+ Assigns @a range to this range.
*/
void operator=(const wxRichTextRange& range);
/**
- Returns @true if @e range is the same as this range.
+ Returns @true if @a range is the same as this range.
*/
- bool operator==(const wxRichTextRange& range);
+ bool operator==(const wxRichTextRange& range) const;
};
+