2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: textctrl.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxTextAttr
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
|
|
|
|
/**
|
2009-01-16 20:46:20 +00:00
|
|
|
One of the following values can be passed to wxTextAttr::SetAlignment to determine paragraph alignment.
|
2008-10-04 11:01:50 +00:00
|
|
|
*/
|
|
|
|
enum wxTextAttrAlignment
|
|
|
|
{
|
|
|
|
wxTEXT_ALIGNMENT_DEFAULT,
|
|
|
|
wxTEXT_ALIGNMENT_LEFT,
|
|
|
|
wxTEXT_ALIGNMENT_CENTRE,
|
|
|
|
wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
|
|
|
|
wxTEXT_ALIGNMENT_RIGHT,
|
|
|
|
|
|
|
|
/** wxTEXT_ALIGNMENT_JUSTIFIED is unimplemented.
|
|
|
|
In future justification may be supported when printing or previewing, only. */
|
|
|
|
wxTEXT_ALIGNMENT_JUSTIFIED
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
The following values are passed in a bitlist to wxTextAttr::SetFlags() to
|
|
|
|
determine what attributes will be considered when setting the attributes for a text control.
|
|
|
|
*/
|
|
|
|
enum wxTextAttrFlags
|
|
|
|
{
|
|
|
|
wxTEXT_ATTR_TEXT_COLOUR = 0x00000001,
|
|
|
|
wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002,
|
2009-01-16 20:46:20 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTEXT_ATTR_FONT_FACE = 0x00000004,
|
|
|
|
wxTEXT_ATTR_FONT_SIZE = 0x00000008,
|
|
|
|
wxTEXT_ATTR_FONT_WEIGHT = 0x00000010,
|
|
|
|
wxTEXT_ATTR_FONT_ITALIC = 0x00000020,
|
|
|
|
wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040,
|
|
|
|
wxTEXT_ATTR_FONT_ENCODING = 0x02000000,
|
2009-01-15 09:20:55 +00:00
|
|
|
wxTEXT_ATTR_FONT_FAMILY = 0x04000000,
|
2009-01-16 20:46:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Defined as the combination of all @c wxTEXT_ATTR_FONT_* values above.
|
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTEXT_ATTR_FONT = \
|
|
|
|
( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \
|
2009-01-15 09:20:55 +00:00
|
|
|
wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ),
|
2008-10-04 11:01:50 +00:00
|
|
|
|
|
|
|
wxTEXT_ATTR_ALIGNMENT = 0x00000080,
|
|
|
|
wxTEXT_ATTR_LEFT_INDENT = 0x00000100,
|
|
|
|
wxTEXT_ATTR_RIGHT_INDENT = 0x00000200,
|
|
|
|
wxTEXT_ATTR_TABS = 0x00000400,
|
|
|
|
wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800,
|
|
|
|
wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000,
|
|
|
|
wxTEXT_ATTR_LINE_SPACING = 0x00002000,
|
|
|
|
wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000,
|
|
|
|
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000,
|
|
|
|
wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000,
|
2009-01-16 20:46:20 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTEXT_ATTR_BULLET_STYLE = 0x00020000,
|
|
|
|
wxTEXT_ATTR_BULLET_NUMBER = 0x00040000,
|
|
|
|
wxTEXT_ATTR_BULLET_TEXT = 0x00080000,
|
|
|
|
wxTEXT_ATTR_BULLET_NAME = 0x00100000,
|
2009-01-16 20:46:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Defined as the combination of all @c wxTEXT_ATTR_BULLET_* values above.
|
|
|
|
*/
|
|
|
|
wxTEXT_ATTR_BULLET = \
|
|
|
|
( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \
|
|
|
|
wxTEXT_ATTR_BULLET_NAME ),
|
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTEXT_ATTR_URL = 0x00200000,
|
|
|
|
wxTEXT_ATTR_PAGE_BREAK = 0x00400000,
|
|
|
|
wxTEXT_ATTR_EFFECTS = 0x00800000,
|
|
|
|
wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000,
|
|
|
|
|
|
|
|
/**
|
2009-01-16 20:46:20 +00:00
|
|
|
Combines the styles @c wxTEXT_ATTR_FONT, @c wxTEXT_ATTR_EFFECTS, @c wxTEXT_ATTR_BACKGROUND_COLOUR,
|
|
|
|
@c wxTEXT_ATTR_TEXT_COLOUR, @c wxTEXT_ATTR_CHARACTER_STYLE_NAME, @c wxTEXT_ATTR_URL.
|
2008-10-04 11:01:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
wxTEXT_ATTR_CHARACTER = \
|
2009-01-15 09:20:55 +00:00
|
|
|
(wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL),
|
|
|
|
|
2009-01-16 20:46:20 +00:00
|
|
|
/**
|
|
|
|
Combines all the styles regarding text paragraphs.
|
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTEXT_ATTR_PARAGRAPH = \
|
|
|
|
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
|
|
|
|
wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
|
2009-01-16 20:46:20 +00:00
|
|
|
wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL),
|
2008-10-04 11:01:50 +00:00
|
|
|
|
2009-01-16 20:46:20 +00:00
|
|
|
/**
|
|
|
|
Combines all previous values.
|
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2009-01-16 20:46:20 +00:00
|
|
|
Styles for wxTextAttr::SetBulletStyle. They can be combined together as a bitlist.
|
2008-10-04 11:01:50 +00:00
|
|
|
*/
|
|
|
|
enum wxTextAttrBulletStyle
|
|
|
|
{
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_NONE = 0x00000000,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_ARABIC = 0x00000001,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER = 0x00000002,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER = 0x00000004,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER = 0x00000008,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER = 0x00000010,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_SYMBOL = 0x00000020,
|
|
|
|
|
|
|
|
/** wxTEXT_ATTR_BULLET_STYLE_BITMAP is unimplemented. */
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_BITMAP = 0x00000040,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_PARENTHESES = 0x00000080,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_PERIOD = 0x00000100,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_STANDARD = 0x00000200,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS = 0x00000400,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_OUTLINE = 0x00000800,
|
|
|
|
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT = 0x00000000,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT = 0x00001000,
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE = 0x00002000
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2009-01-16 20:46:20 +00:00
|
|
|
Styles for wxTextAttr::SetTextEffects(). They can be combined together as a bitlist.
|
2008-10-04 11:01:50 +00:00
|
|
|
|
|
|
|
Of these, only wxTEXT_ATTR_EFFECT_CAPITALS and wxTEXT_ATTR_EFFECT_STRIKETHROUGH are implemented.
|
|
|
|
*/
|
|
|
|
enum wxTextAttrEffects
|
|
|
|
{
|
|
|
|
wxTEXT_ATTR_EFFECT_NONE = 0x00000000,
|
|
|
|
wxTEXT_ATTR_EFFECT_CAPITALS = 0x00000001,
|
|
|
|
wxTEXT_ATTR_EFFECT_SMALL_CAPITALS = 0x00000002,
|
|
|
|
wxTEXT_ATTR_EFFECT_STRIKETHROUGH = 0x00000004,
|
|
|
|
wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH = 0x00000008,
|
|
|
|
wxTEXT_ATTR_EFFECT_SHADOW = 0x00000010,
|
|
|
|
wxTEXT_ATTR_EFFECT_EMBOSS = 0x00000020,
|
|
|
|
wxTEXT_ATTR_EFFECT_OUTLINE = 0x00000040,
|
|
|
|
wxTEXT_ATTR_EFFECT_ENGRAVE = 0x00000080,
|
|
|
|
wxTEXT_ATTR_EFFECT_SUPERSCRIPT = 0x00000100,
|
|
|
|
wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2009-01-16 20:46:20 +00:00
|
|
|
Convenience line spacing values; see wxTextAttr::SetLineSpacing().
|
2008-10-04 11:01:50 +00:00
|
|
|
*/
|
|
|
|
enum wxTextAttrLineSpacing
|
|
|
|
{
|
|
|
|
wxTEXT_ATTR_LINE_SPACING_NORMAL = 10,
|
|
|
|
wxTEXT_ATTR_LINE_SPACING_HALF = 15,
|
|
|
|
wxTEXT_ATTR_LINE_SPACING_TWICE = 20
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Describes the possible return values of wxTextCtrl::HitTest().
|
|
|
|
|
|
|
|
The element names correspond to the relationship between the point asked
|
|
|
|
for and the character returned, e.g. @c wxTE_HT_BEFORE means that the point
|
|
|
|
is before (leftward or upward) it and so on.
|
|
|
|
*/
|
|
|
|
enum wxTextCtrlHitTestResult
|
|
|
|
{
|
|
|
|
/// Indicates that wxTextCtrl::HitTest() is not implemented on this
|
|
|
|
/// platform.
|
|
|
|
wxTE_HT_UNKNOWN = -2,
|
|
|
|
|
|
|
|
/// The point is before the character returned.
|
|
|
|
wxTE_HT_BEFORE,
|
|
|
|
|
|
|
|
/// The point is directly on the character returned.
|
|
|
|
wxTE_HT_ON_TEXT,
|
|
|
|
|
|
|
|
/// The point is below the last line of the control.
|
|
|
|
wxTE_HT_BELOW,
|
|
|
|
|
|
|
|
/// The point is beyond the end of line containing the character returned.
|
|
|
|
wxTE_HT_BEYOND
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxTextAttr
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
wxTextAttr represents the character and paragraph attributes, or style,
|
|
|
|
for a range of text in a wxTextCtrl or wxRichTextCtrl.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
When setting up a wxTextAttr object, pass a bitlist mask to
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTextAttr::SetFlags() to indicate which style elements should be changed.
|
|
|
|
As a convenience, when you call a setter such as SetFont, the relevant bit
|
2008-05-11 15:37:37 +00:00
|
|
|
will be set.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{richtext}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxTextCtrl, wxRichTextCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxTextAttr
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Constructors.
|
|
|
|
*/
|
|
|
|
wxTextAttr();
|
2008-03-08 14:43:31 +00:00
|
|
|
wxTextAttr(const wxColour& colText,
|
|
|
|
const wxColour& colBack = wxNullColour,
|
|
|
|
const wxFont& font = wxNullFont,
|
|
|
|
wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
|
|
|
|
wxTextAttr(const wxTextAttr& attr);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Applies the attributes in @a style to the original object, but not those
|
|
|
|
attributes from @a style that are the same as those in @a compareWith (if passed).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool Apply(const wxTextAttr& style,
|
2008-03-09 12:33:59 +00:00
|
|
|
const wxTextAttr* compareWith = NULL);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates a font from the font attributes.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxFont CreateFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2009-01-16 20:46:20 +00:00
|
|
|
/**
|
|
|
|
Copies all defined/valid properties from overlay to current object.
|
|
|
|
*/
|
|
|
|
void Merge(const wxTextAttr& overlay);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates a new @c wxTextAttr which is a merge of @a base and @a overlay.
|
|
|
|
|
|
|
|
Properties defined in @a overlay take precedence over those in @a base.
|
|
|
|
Properties undefined/invalid in both are undefined in the result.
|
|
|
|
*/
|
|
|
|
static wxTextAttr Merge(const wxTextAttr& base,
|
|
|
|
const wxTextAttr& overlay);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@name GetXXX functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
//@{
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Returns the alignment flags.
|
2008-10-04 11:01:50 +00:00
|
|
|
See ::wxTextAttrAlignment for a list of available styles.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxTextAttrAlignment GetAlignment() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the background colour.
|
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
const wxColour& GetBackgroundColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns a string containing the name of the font associated with the bullet symbol.
|
2008-03-08 13:52:38 +00:00
|
|
|
Only valid for attributes with wxTEXT_ATTR_BULLET_SYMBOL.
|
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
const wxString& GetBulletFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the standard bullet name, applicable if the bullet style is
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_STANDARD.
|
2008-10-04 11:01:50 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Currently the following standard bullet names are supported:
|
2008-10-04 11:01:50 +00:00
|
|
|
- @c standard/circle
|
|
|
|
- @c standard/square
|
|
|
|
- @c standard/diamond
|
|
|
|
- @c standard/triangle
|
|
|
|
|
|
|
|
@note
|
2008-03-08 13:52:38 +00:00
|
|
|
For wxRichTextCtrl users only: if you wish your rich text controls to support
|
2008-10-04 11:01:50 +00:00
|
|
|
further bullet graphics, you can derive a class from wxRichTextRenderer or
|
|
|
|
wxRichTextStdRenderer, override @c DrawStandardBullet and @c EnumerateStandardBulletNames,
|
|
|
|
and set an instance of the class using wxRichTextBuffer::SetRenderer.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
const wxString& GetBulletName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the bullet number.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetBulletNumber() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the bullet style.
|
2008-10-04 11:01:50 +00:00
|
|
|
See ::wxTextAttrBulletStyle for a list of available styles.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetBulletStyle() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the bullet text, which could be a symbol, or (for example) cached
|
|
|
|
outline text.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxString& GetBulletText() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the name of the character style.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxString& GetCharacterStyleName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns flags indicating which attributes are applicable.
|
|
|
|
See SetFlags() for a list of available flags.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetFlags() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates and returns a font specified by the font attributes in the wxTextAttr
|
2008-10-04 11:01:50 +00:00
|
|
|
object. Note that wxTextAttr does not store a wxFont object, so this is only
|
|
|
|
a temporary font.
|
|
|
|
|
|
|
|
For greater efficiency, access the font attributes directly.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxFont GetFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the font attributes from the given font, using only the attributes
|
2008-05-11 15:37:37 +00:00
|
|
|
specified by @a flags.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool GetFontAttributes(const wxFont& font,
|
|
|
|
int flags = wxTEXT_ATTR_FONT);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the font encoding.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxFontEncoding GetFontEncoding() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the font face name.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxString& GetFontFaceName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2009-01-15 09:20:55 +00:00
|
|
|
/**
|
|
|
|
Returns the font family.
|
|
|
|
*/
|
2009-01-16 20:46:20 +00:00
|
|
|
wxFontFamily GetFontFamily() const;
|
2009-01-15 09:20:55 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Returns the font size in points.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetFontSize() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the font style.
|
|
|
|
*/
|
2009-01-16 20:46:20 +00:00
|
|
|
wxFontStyle GetFontStyle() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the font is underlined.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool GetFontUnderlined() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the font weight.
|
|
|
|
*/
|
2009-01-16 20:46:20 +00:00
|
|
|
wxFontWeight GetFontWeight() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the left indent in tenths of a millimetre.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetLeftIndent() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the left sub-indent in tenths of a millimetre.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetLeftSubIndent() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns the line spacing value, one of ::wxTextAttrLineSpacing values.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetLineSpacing() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the name of the list style.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxString& GetListStyleName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the outline level.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
int GetOutlineLevel() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the space in tenths of a millimeter after the paragraph.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetParagraphSpacingAfter() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the space in tenths of a millimeter before the paragraph.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetParagraphSpacingBefore() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the name of the paragraph style.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxString& GetParagraphStyleName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the right indent in tenths of a millimeter.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetRightIndent() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns an array of tab stops, each expressed in tenths of a millimeter.
|
|
|
|
|
|
|
|
Each stop is measured from the left margin and therefore each value must
|
|
|
|
be larger than the last.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxArrayInt& GetTabs() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the text foreground colour.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxColour& GetTextColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns the text effect bits of interest.
|
|
|
|
See SetFlags() for further information.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetTextEffectFlags() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns the text effects, a bit list of styles.
|
|
|
|
See SetTextEffects() for details.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetTextEffects() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns the URL for the content.
|
|
|
|
|
|
|
|
Content with @a wxTEXT_ATTR_URL style causes wxRichTextCtrl to show a
|
|
|
|
hand cursor over it, and wxRichTextCtrl generates a wxTextUrlEvent
|
|
|
|
when the content is clicked.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxString& GetURL() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2009-01-16 20:46:20 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@name HasXXX and IsXXX functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
//@{
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies alignment.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasAlignment() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a background colour.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasBackgroundColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a standard bullet name.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasBulletName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a bullet number.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasBulletNumber() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a bullet style.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasBulletStyle() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies bullet text (usually
|
|
|
|
specifying a symbol).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasBulletText() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a character style name.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasCharacterStyleName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Returns @true if the @a flag is present in the attribute object's flag
|
2008-03-08 13:52:38 +00:00
|
|
|
bitlist.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFlag(long flag) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies any font attributes.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies an encoding.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFontEncoding() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a font face name.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFontFaceName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2009-01-15 09:20:55 +00:00
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a font family.
|
|
|
|
*/
|
|
|
|
bool HasFontFamily() const;
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies italic style.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFontItalic() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a font point size.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFontSize() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies either underlining or no
|
|
|
|
underlining.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFontUnderlined() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies font weight (bold, light or
|
|
|
|
normal).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFontWeight() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a left indent.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasLeftIndent() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies line spacing.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasLineSpacing() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a list style name.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasListStyleName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies an outline level.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasOutlineLevel() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a page break before this
|
|
|
|
paragraph.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasPageBreak() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies spacing after a paragraph.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasParagraphSpacingAfter() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies spacing before a paragraph.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasParagraphSpacingBefore() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a paragraph style name.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasParagraphStyleName() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a right indent.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasRightIndent() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies tab stops.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasTabs() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a text foreground colour.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasTextColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies text effects.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasTextEffects() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the attribute object specifies a URL.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasURL() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the object represents a character style, that is,
|
|
|
|
the flags specify a font or a text background or foreground colour.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsCharacterStyle() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @false if we have any attributes set, @true otherwise.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsDefault() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the object represents a paragraph style, that is,
|
|
|
|
the flags specify alignment, indentation, tabs, paragraph spacing, or
|
|
|
|
bullet style.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsParagraphStyle() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2009-01-16 20:46:20 +00:00
|
|
|
//@}
|
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
|
|
|
|
/**
|
2009-01-16 20:46:20 +00:00
|
|
|
@name SetXXX functions
|
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
|
2009-01-16 20:46:20 +00:00
|
|
|
//@{
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Sets the paragraph alignment. See ::wxTextAttrAlignment enumeration values.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
Of these, wxTEXT_ALIGNMENT_JUSTIFIED is unimplemented.
|
|
|
|
In future justification may be supported when printing or previewing, only.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetAlignment(wxTextAttrAlignment alignment);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the background colour.
|
|
|
|
*/
|
|
|
|
void SetBackgroundColour(const wxColour& colBack);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the name of the font associated with the bullet symbol.
|
|
|
|
Only valid for attributes with wxTEXT_ATTR_BULLET_SYMBOL.
|
|
|
|
*/
|
|
|
|
void SetBulletFont(const wxString& font);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the standard bullet name, applicable if the bullet style is
|
|
|
|
wxTEXT_ATTR_BULLET_STYLE_STANDARD.
|
2008-10-04 11:01:50 +00:00
|
|
|
|
|
|
|
See GetBulletName() for a list of supported names, and how
|
|
|
|
to expand the range of supported types.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetBulletName(const wxString& name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the bullet number.
|
|
|
|
*/
|
|
|
|
void SetBulletNumber(int n);
|
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Sets the bullet style.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
The ::wxTextAttrBulletStyle enumeration values are all supported,
|
|
|
|
except for wxTEXT_ATTR_BULLET_STYLE_BITMAP.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetBulletStyle(int style);
|
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Sets the bullet text, which could be a symbol, or (for example) cached
|
|
|
|
outline text.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
void SetBulletText(const wxString& text);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the character style name.
|
|
|
|
*/
|
|
|
|
void SetCharacterStyleName(const wxString& name);
|
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Sets the flags determining which styles are being specified.
|
|
|
|
The ::wxTextAttrFlags values can be passed in a bitlist.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetFlags(long flags);
|
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Sets the attributes for the given font.
|
|
|
|
Note that wxTextAttr does not store an actual wxFont object.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
void SetFont(const wxFont& font, int flags = wxTEXT_ATTR_FONT);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the font encoding.
|
|
|
|
*/
|
|
|
|
void SetFontEncoding(wxFontEncoding encoding);
|
|
|
|
|
|
|
|
/**
|
2009-01-15 09:20:55 +00:00
|
|
|
Sets the font face name.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetFontFaceName(const wxString& faceName);
|
|
|
|
|
2009-01-15 09:20:55 +00:00
|
|
|
/**
|
|
|
|
Sets the font family.
|
|
|
|
*/
|
2009-01-16 20:46:20 +00:00
|
|
|
void SetFontFamily(wxFontFamily family);
|
2009-01-15 09:20:55 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Sets the font size in points.
|
|
|
|
*/
|
|
|
|
void SetFontSize(int pointSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the font style (normal, italic or slanted).
|
|
|
|
*/
|
2009-01-16 20:46:20 +00:00
|
|
|
void SetFontStyle(wxFontStyle fontStyle);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the font underlining.
|
|
|
|
*/
|
|
|
|
void SetFontUnderlined(bool underlined);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the font weight.
|
|
|
|
*/
|
2009-01-16 20:46:20 +00:00
|
|
|
void SetFontWeight(wxFontWeight fontWeight);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the left indent and left subindent in tenths of a millimetre.
|
|
|
|
The sub-indent is an offset from the left of the paragraph, and is used for all
|
2008-10-04 11:01:50 +00:00
|
|
|
but the first line in a paragraph.
|
|
|
|
|
|
|
|
A positive value will cause the first line to appear to the left
|
2008-03-08 13:52:38 +00:00
|
|
|
of the subsequent lines, and a negative value will cause the first line to be
|
2008-10-04 11:01:50 +00:00
|
|
|
indented relative to the subsequent lines.
|
|
|
|
|
|
|
|
wxRichTextBuffer uses indentation to render a bulleted item.
|
|
|
|
The left indent is the distance between the margin and the bullet.
|
|
|
|
The content of the paragraph, including the first line, starts
|
|
|
|
at leftMargin + leftSubIndent.
|
|
|
|
So the distance between the left edge of the bullet and the
|
2008-03-08 13:52:38 +00:00
|
|
|
left of the actual paragraph is leftSubIndent.
|
|
|
|
*/
|
|
|
|
void SetLeftIndent(int indent, int subIndent = 0);
|
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Sets the line spacing. @a spacing is a multiple, where 10 means single-spacing,
|
2008-10-04 11:01:50 +00:00
|
|
|
15 means 1.5 spacing, and 20 means double spacing.
|
|
|
|
The ::wxTextAttrLineSpacing values are defined for convenience.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetLineSpacing(int spacing);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the list style name.
|
|
|
|
*/
|
|
|
|
void SetListStyleName(const wxString& name);
|
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Specifies the outline level. Zero represents normal text.
|
|
|
|
At present, the outline level is not used, but may be used in future for
|
|
|
|
determining list levels and for applications that need to store document
|
|
|
|
structure information.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetOutlineLevel(int level);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Specifies a page break before this paragraph.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
void SetPageBreak(bool pageBreak = true);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the spacing after a paragraph, in tenths of a millimetre.
|
|
|
|
*/
|
|
|
|
void SetParagraphSpacingAfter(int spacing);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the spacing before a paragraph, in tenths of a millimetre.
|
|
|
|
*/
|
|
|
|
void SetParagraphSpacingBefore(int spacing);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the name of the paragraph style.
|
|
|
|
*/
|
|
|
|
void SetParagraphStyleName(const wxString& name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the right indent in tenths of a millimetre.
|
|
|
|
*/
|
|
|
|
void SetRightIndent(int indent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the tab stops, expressed in tenths of a millimetre.
|
|
|
|
Each stop is measured from the left margin and therefore each value must be
|
|
|
|
larger than the last.
|
|
|
|
*/
|
|
|
|
void SetTabs(const wxArrayInt& tabs);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the text foreground colout.
|
|
|
|
*/
|
|
|
|
void SetTextColour(const wxColour& colText);
|
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Sets the text effect bits of interest.
|
|
|
|
|
|
|
|
You should also pass wxTEXT_ATTR_EFFECTS to SetFlags().
|
2008-03-08 13:52:38 +00:00
|
|
|
See SetFlags() for further information.
|
|
|
|
*/
|
|
|
|
void SetTextEffectFlags(int flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the text effects, a bit list of styles.
|
2008-10-04 11:01:50 +00:00
|
|
|
The ::wxTextAttrEffects enumeration values can be used.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Of these, only wxTEXT_ATTR_EFFECT_CAPITALS and wxTEXT_ATTR_EFFECT_STRIKETHROUGH
|
|
|
|
are implemented.
|
2008-10-04 11:01:50 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
wxTEXT_ATTR_EFFECT_CAPITALS capitalises text when displayed (leaving the case
|
2008-10-04 11:01:50 +00:00
|
|
|
of the actual buffer text unchanged), and wxTEXT_ATTR_EFFECT_STRIKETHROUGH draws
|
|
|
|
a line through text.
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
To set effects, you should also pass wxTEXT_ATTR_EFFECTS to SetFlags(), and call
|
2008-10-04 11:01:50 +00:00
|
|
|
SetTextEffectFlags() with the styles (taken from the above set) that you
|
|
|
|
are interested in setting.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetTextEffects(int effects);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the URL for the content. Sets the wxTEXT_ATTR_URL style; content with this
|
2008-10-04 11:01:50 +00:00
|
|
|
style causes wxRichTextCtrl to show a hand cursor over it, and wxRichTextCtrl
|
|
|
|
generates a wxTextUrlEvent when the content is clicked.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
void SetURL(const wxString& url);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2009-01-16 20:46:20 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Assignment from a wxTextAttr object.
|
|
|
|
*/
|
|
|
|
void operator operator=(const wxTextAttr& attr);
|
|
|
|
};
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxTextCtrl
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
A text control allows text to be displayed and edited.
|
|
|
|
|
2009-03-01 12:23:31 +00:00
|
|
|
It may be single line or multi-line. Notice that a lot of methods of the
|
|
|
|
text controls are found in the base wxTextEntry class which is a common
|
|
|
|
base class for wxTextCtrl and other controls using a single line text entry
|
|
|
|
field (e.g. wxComboBox).
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_PROCESS_ENTER}
|
2008-03-08 13:52:38 +00:00
|
|
|
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
|
|
|
|
(otherwise pressing Enter key is either processed internally by the
|
|
|
|
control or used for navigation between dialog controls).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_PROCESS_TAB}
|
2008-03-08 13:52:38 +00:00
|
|
|
The control will receive wxEVT_CHAR events for TAB pressed -
|
|
|
|
normally, TAB is used for passing to the next control in a dialog
|
|
|
|
instead. For the control created with this style, you can still use
|
|
|
|
Ctrl-Enter to pass to the next control from the keyboard.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_MULTILINE}
|
2009-04-14 13:22:09 +00:00
|
|
|
The text control allows multiple lines. If this style is not
|
|
|
|
specified, line break characters should not be used in the controls
|
|
|
|
value.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_PASSWORD}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text will be echoed as asterisks.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_READONLY}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text will not be user-editable.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_RICH}
|
2008-03-08 13:52:38 +00:00
|
|
|
Use rich text control under Win32, this allows to have more than
|
|
|
|
64KB of text in the control even under Win9x. This style is ignored
|
|
|
|
under other platforms.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_RICH2}
|
2008-03-08 13:52:38 +00:00
|
|
|
Use rich text control version 2.0 or 3.0 under Win32, this style is
|
|
|
|
ignored under other platforms
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_AUTO_URL}
|
2008-03-08 13:52:38 +00:00
|
|
|
Highlight the URLs and generate the wxTextUrlEvents when mouse
|
|
|
|
events occur over them. This style is only supported for wxTE_RICH
|
|
|
|
Win32 and multi-line wxGTK2 text controls.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_NOHIDESEL}
|
2008-03-08 13:52:38 +00:00
|
|
|
By default, the Windows text control doesn't show the selection
|
|
|
|
when it doesn't have focus - use this style to force it to always
|
|
|
|
show it. It doesn't do anything under other platforms.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxHSCROLL}
|
2008-03-08 13:52:38 +00:00
|
|
|
A horizontal scrollbar will be created and used, so that text won't
|
|
|
|
be wrapped. No effect under wxGTK1.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_NO_VSCROLL}
|
2008-03-08 13:52:38 +00:00
|
|
|
For multiline controls only: vertical scrollbar will never be
|
|
|
|
created. This limits the amount of text which can be entered into
|
|
|
|
the control to what can be displayed in it under MSW but not under
|
|
|
|
GTK2. Currently not implemented for the other platforms.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_LEFT}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text in the control will be left-justified (default).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_CENTRE}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text in the control will be centered (currently wxMSW and
|
|
|
|
wxGTK2 only).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_RIGHT}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text in the control will be right-justified (currently wxMSW
|
|
|
|
and wxGTK2 only).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_DONTWRAP}
|
2008-03-08 13:52:38 +00:00
|
|
|
Same as wxHSCROLL style: don't wrap at all, show horizontal
|
|
|
|
scrollbar instead.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_CHARWRAP}
|
2008-03-08 13:52:38 +00:00
|
|
|
Wrap the lines too long to be shown entirely at any position
|
|
|
|
(wxUniv and wxGTK2 only).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_WORDWRAP}
|
2008-03-08 13:52:38 +00:00
|
|
|
Wrap the lines too long to be shown entirely at word boundaries
|
|
|
|
(wxUniv and wxGTK2 only).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_BESTWRAP}
|
2008-03-08 13:52:38 +00:00
|
|
|
Wrap the lines at word boundaries or at any other character if
|
|
|
|
there are words longer than the window width (this is the default).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_CAPITALIZE}
|
2008-03-08 13:52:38 +00:00
|
|
|
On PocketPC and Smartphone, causes the first letter to be
|
|
|
|
capitalized.
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
Note that alignment styles (wxTE_LEFT, wxTE_CENTRE and wxTE_RIGHT) can be
|
|
|
|
changed dynamically after control creation on wxMSW and wxGTK. wxTE_READONLY,
|
|
|
|
wxTE_PASSWORD and wrapping styles can be dynamically changed under wxGTK but
|
|
|
|
not wxMSW. The other styles can be only set during control creation.
|
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
|
|
|
|
@section textctrl_text_format wxTextCtrl Text Format
|
|
|
|
|
|
|
|
The multiline text controls always store the text as a sequence of lines
|
|
|
|
separated by @c '\\n' characters, i.e. in the Unix text format even on
|
|
|
|
non-Unix platforms. This allows the user code to ignore the differences
|
|
|
|
between the platforms but at a price: the indices in the control such as
|
|
|
|
those returned by GetInsertionPoint() or GetSelection() can @b not be used
|
|
|
|
as indices into the string returned by GetValue() as they're going to be
|
|
|
|
slightly off for platforms using @c "\\r\\n" as separator (as Windows
|
|
|
|
does).
|
|
|
|
|
|
|
|
Instead, if you need to obtain a substring between the 2 indices obtained
|
|
|
|
from the control with the help of the functions mentioned above, you should
|
|
|
|
use GetRange(). And the indices themselves can only be passed to other
|
|
|
|
methods, for example SetInsertionPoint() or SetSelection().
|
|
|
|
|
|
|
|
To summarize: never use the indices returned by (multiline) wxTextCtrl as
|
|
|
|
indices into the string it contains, but only as arguments to be passed
|
|
|
|
back to the other wxTextCtrl methods. This problem doesn't arise for
|
|
|
|
single-line platforms however where the indices in the control do
|
|
|
|
correspond to the positions in the value string.
|
|
|
|
|
|
|
|
|
|
|
|
@section textctrl_styles wxTextCtrl Styles.
|
|
|
|
|
|
|
|
Multi-line text controls support styling, i.e. provide a possibility to set
|
|
|
|
colours and font for individual characters in it (note that under Windows
|
|
|
|
@c wxTE_RICH style is required for style support). To use the styles you
|
|
|
|
can either call SetDefaultStyle() before inserting the text or call
|
|
|
|
SetStyle() later to change the style of the text already in the control
|
|
|
|
(the first solution is much more efficient).
|
|
|
|
|
|
|
|
In either case, if the style doesn't specify some of the attributes (for
|
|
|
|
example you only want to set the text colour but without changing the font
|
|
|
|
nor the text background), the values of the default style will be used for
|
|
|
|
them. If there is no default style, the attributes of the text control
|
|
|
|
itself are used.
|
|
|
|
|
|
|
|
So the following code correctly describes what it does: the second call to
|
|
|
|
SetDefaultStyle() doesn't change the text foreground colour (which stays
|
|
|
|
red) while the last one doesn't change the background colour (which stays
|
|
|
|
grey):
|
|
|
|
|
|
|
|
@code
|
|
|
|
text->SetDefaultStyle(wxTextAttr(*wxRED));
|
|
|
|
text->AppendText("Red text\n");
|
|
|
|
text->SetDefaultStyle(wxTextAttr(wxNullColour, *wxLIGHT_GREY));
|
|
|
|
text->AppendText("Red on grey text\n");
|
|
|
|
text->SetDefaultStyle(wxTextAttr(*wxBLUE);
|
|
|
|
text->AppendText("Blue on grey text\n");
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
|
|
|
|
@section textctrl_cpp_streams wxTextCtrl and C++ Streams
|
|
|
|
|
|
|
|
This class multiply-inherits from @c std::streambuf (except for some really
|
|
|
|
old compilers using non-standard iostream library), allowing code such as
|
|
|
|
the following:
|
|
|
|
|
|
|
|
@code
|
|
|
|
wxTextCtrl *control = new wxTextCtrl(...);
|
|
|
|
|
|
|
|
ostream stream(control)
|
|
|
|
|
|
|
|
stream << 123.456 << " some text\n";
|
|
|
|
stream.flush();
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
Note that even if your compiler doesn't support this (the symbol
|
|
|
|
@c wxHAS_TEXT_WINDOW_STREAM has value of 0 then) you can still use
|
|
|
|
wxTextCtrl itself in a stream-like manner:
|
|
|
|
|
|
|
|
@code
|
|
|
|
wxTextCtrl *control = new wxTextCtrl(...);
|
|
|
|
|
|
|
|
*control << 123.456 << " some text\n";
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
However the possibility to create an ostream associated with wxTextCtrl may
|
|
|
|
be useful if you need to redirect the output of a function taking an
|
|
|
|
ostream as parameter to a text control.
|
|
|
|
|
|
|
|
Another commonly requested need is to redirect @c std::cout to the text
|
|
|
|
control. This may be done in the following way:
|
|
|
|
|
|
|
|
@code
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
wxTextCtrl *control = new wxTextCtrl(...);
|
|
|
|
|
|
|
|
std::streambuf *sbOld = std::cout.rdbuf();
|
|
|
|
std::cout.rdbuf(control);
|
|
|
|
|
|
|
|
// use cout as usual, the output appears in the text control
|
|
|
|
...
|
|
|
|
|
|
|
|
std::cout.rdbuf(sbOld);
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
But wxWidgets provides a convenient class to make it even simpler so
|
|
|
|
instead you may just do
|
|
|
|
|
|
|
|
@code
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
wxTextCtrl *control = new wxTextCtrl(...);
|
|
|
|
|
|
|
|
wxStreamToTextRedirector redirect(control);
|
|
|
|
|
|
|
|
// all output to cout goes into the text control until the exit from
|
|
|
|
// current scope
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
See wxStreamToTextRedirector for more details.
|
|
|
|
|
|
|
|
|
|
|
|
@section textctrl_event_handling Event Handling.
|
|
|
|
|
|
|
|
The following commands are processed by default event handlers in
|
|
|
|
wxTextCtrl: @c wxID_CUT, @c wxID_COPY, @c wxID_PASTE, @c wxID_UNDO, @c
|
|
|
|
wxID_REDO. The associated UI update events are also processed
|
|
|
|
automatically, when the control has the focus.
|
|
|
|
|
2009-02-18 17:58:51 +00:00
|
|
|
@beginEventEmissionTable{wxCommandEvent}
|
2008-05-11 15:37:37 +00:00
|
|
|
@event{EVT_TEXT(id, func)}
|
|
|
|
Respond to a wxEVT_COMMAND_TEXT_UPDATED event, generated when the text
|
|
|
|
changes. Notice that this event will be sent when the text controls
|
|
|
|
contents changes -- whether this is due to user input or comes from the
|
2008-10-04 11:01:50 +00:00
|
|
|
program itself (for example, if wxTextCtrl::SetValue() is called); see
|
|
|
|
wxTextCtrl::ChangeValue() for a function which does not send this event.
|
|
|
|
This event is however not sent during the control creation.
|
2008-05-11 15:37:37 +00:00
|
|
|
@event{EVT_TEXT_ENTER(id, func)}
|
|
|
|
Respond to a wxEVT_COMMAND_TEXT_ENTER event, generated when enter is
|
|
|
|
pressed in a text control which must have wxTE_PROCESS_ENTER style for
|
|
|
|
this event to be generated.
|
2008-06-14 14:07:41 +00:00
|
|
|
@event{EVT_TEXT_URL(id, func)}
|
2008-05-11 15:37:37 +00:00
|
|
|
A mouse event occurred over an URL in the text control (wxMSW and
|
|
|
|
wxGTK2 only currently).
|
2008-06-14 14:07:41 +00:00
|
|
|
@event{EVT_TEXT_MAXLEN(id, func)}
|
2008-05-11 15:37:37 +00:00
|
|
|
This event is generated when the user tries to enter more text into the
|
2008-10-04 11:01:50 +00:00
|
|
|
control than the limit set by wxTextCtrl::SetMaxLength(), see its description.
|
2008-05-11 15:37:37 +00:00
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2008-10-13 08:05:18 +00:00
|
|
|
@appearance{textctrl.png}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxTextCtrl::Create, wxValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2009-03-01 12:23:31 +00:00
|
|
|
class wxTextCtrl : public wxControl,
|
|
|
|
public wxTextEntry
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-06-14 14:07:41 +00:00
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Default ctor.
|
2008-06-14 14:07:41 +00:00
|
|
|
*/
|
2008-10-04 11:01:50 +00:00
|
|
|
wxTextCtrl();
|
2008-06-14 14:07:41 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a text control.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param parent
|
2008-03-09 12:33:59 +00:00
|
|
|
Parent window. Should not be @NULL.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param id
|
2008-03-09 12:33:59 +00:00
|
|
|
Control identifier. A value of -1 denotes a default value.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param value
|
2008-03-09 12:33:59 +00:00
|
|
|
Default text value.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Text control position.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-03-09 12:33:59 +00:00
|
|
|
Text control size.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
Window style. See wxTextCtrl.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
Window validator.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Window name.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
@remarks
|
|
|
|
The horizontal scrollbar (wxHSCROLL style flag) will only be
|
2008-05-11 15:37:37 +00:00
|
|
|
created for multi-line text controls. Without a horizontal
|
|
|
|
scrollbar, text lines that don't fit in the control's size will be
|
2008-10-04 11:01:50 +00:00
|
|
|
wrapped (but no newline character is inserted).
|
|
|
|
Single line controls don't have a horizontal scrollbar, the text is
|
|
|
|
automatically scrolled so that the insertion point is always visible.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxTextCtrl(wxWindow* parent, wxWindowID id,
|
2009-01-08 16:33:08 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
2008-03-08 14:43:31 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxTextCtrlNameStr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the text control.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxTextCtrl();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
Creates the text control for two-step construction.
|
|
|
|
|
|
|
|
This method should be called if the default constructor was used for
|
|
|
|
the control creation. Its parameters have the same meaning as for the
|
|
|
|
non-default constructor.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-10-28 15:36:26 +00:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxTextCtrlNameStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Copies the selected text to the clipboard and removes the selection.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
virtual void Cut();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
Resets the internal modified flag as if the current changes had been
|
|
|
|
saved.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual void DiscardEdits();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2009-03-01 12:23:31 +00:00
|
|
|
This function inserts into the control the character which would have
|
2008-05-11 15:37:37 +00:00
|
|
|
been inserted if the given key event had occurred in the text control.
|
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
The @a event object should be the same as the one passed to @c EVT_KEY_DOWN
|
|
|
|
handler previously by wxWidgets. Please note that this function doesn't
|
|
|
|
currently work correctly for all keys under any platform but MSW.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
2008-10-04 11:01:50 +00:00
|
|
|
@true if the event resulted in a change to the control, @false otherwise.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool EmulateKeyPress(const wxKeyEvent& event);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the style currently used for the new text.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetDefaultStyle()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
virtual const wxTextAttr& GetDefaultStyle() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
Gets the length of the specified line, not including any trailing
|
|
|
|
newline character(s).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param lineNo
|
2008-03-09 12:33:59 +00:00
|
|
|
Line number (starting from zero).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
The length of the line, or -1 if @a lineNo was invalid.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual int GetLineLength(long lineNo) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the contents of a given line in the text control, not including
|
|
|
|
any trailing newline character(s).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param lineNo
|
2008-03-09 12:33:59 +00:00
|
|
|
The line number, starting from zero.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
The contents of the line.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual wxString GetLineText(long lineNo) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of lines in the text control buffer.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
@remarks
|
|
|
|
Note that even empty text controls have one line (where the
|
|
|
|
insertion point is), so GetNumberOfLines() never returns 0.
|
|
|
|
For wxGTK using GTK+ 1.2.x and earlier, the number of lines in a
|
|
|
|
multi-line text control is calculated by actually counting newline
|
|
|
|
characters in the buffer, i.e. this function returns the number of
|
|
|
|
logical lines and doesn't depend on whether any of them are wrapped.
|
|
|
|
For all the other platforms, the number of physical lines in the
|
|
|
|
control is returned.
|
|
|
|
Also note that you may wish to avoid using functions that work with
|
|
|
|
line numbers if you are working with controls that contain large
|
|
|
|
amounts of text as this function has O(N) complexity for N being
|
|
|
|
the number of lines.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual int GetNumberOfLines() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
Returns the style at this position in the text control.
|
|
|
|
|
|
|
|
Not all platforms support this function.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
@true on success, @false if an error occurred (this may also mean
|
|
|
|
that the styles are not supported under this platform).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetStyle(), wxTextAttr
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool GetStyle(long position, wxTextAttr& style);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
This function finds the character at the specified position expressed
|
|
|
|
in pixels.
|
|
|
|
|
|
|
|
If the return code is not @c wxTE_HT_UNKNOWN the row and column of the
|
|
|
|
character closest to this position are returned in the @a col and @a
|
2008-10-04 11:01:50 +00:00
|
|
|
row parameters (unless the pointers are @NULL which is allowed).
|
|
|
|
Please note that this function is currently only implemented in wxUniv, wxMSW
|
2008-05-11 15:37:37 +00:00
|
|
|
and wxGTK2 ports.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2009-10-18 17:47:01 +00:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this function takes only the @a pt argument and
|
|
|
|
returns a 3-element list (result, col, row).
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see PositionToXY(), XYToPosition()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
|
|
|
|
wxTextCoord col,
|
2008-03-09 16:24:26 +00:00
|
|
|
wxTextCoord row) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
Returns @true if the text has been modified by user.
|
|
|
|
|
|
|
|
Note that calling SetValue() doesn't make the control modified.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see MarkDirty()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool IsModified() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns @true if this is a multi line edit control and @false otherwise.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see IsSingleLine()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsMultiLine() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:01:50 +00:00
|
|
|
Returns @true if this is a single line edit control and @false otherwise.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
@see IsSingleLine(), IsMultiLine()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsSingleLine() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Loads and displays the named file, if it exists.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param filename
|
2008-03-09 12:33:59 +00:00
|
|
|
The filename of the file to load.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param fileType
|
2008-03-09 12:33:59 +00:00
|
|
|
The type of file to load. This is currently ignored in wxTextCtrl.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
@true if successful, @false otherwise.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool LoadFile(const wxString& filename,
|
|
|
|
int fileType = wxTEXT_TYPE_ANY);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Mark text as modified (dirty).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see IsModified()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual void MarkDirty();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
This event handler function implements default drag and drop behaviour,
|
|
|
|
which is to load the first dropped file into the control.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param event
|
2008-03-09 12:33:59 +00:00
|
|
|
The drop files event.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@remarks This is not implemented on non-Windows platforms.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see wxDropFilesEvent
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void OnDropFiles(wxDropFilesEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Converts given position to a zero-based column, line number pair.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Position.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param x
|
2008-03-09 12:33:59 +00:00
|
|
|
Receives zero based column number.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param y
|
2008-03-09 12:33:59 +00:00
|
|
|
Receives zero based line number.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
@true on success, @false on failure (most likely due to a too large
|
|
|
|
position parameter).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2009-10-18 17:47:01 +00:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this function takes only the @a pos argument and
|
|
|
|
returns a 2-element list (x, y).
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see XYToPosition()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool PositionToXY(long pos, long* x, long* y) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Saves the contents of the control in a text file.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param filename
|
2008-03-09 12:33:59 +00:00
|
|
|
The name of the file in which to save the text.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param fileType
|
2008-03-09 12:33:59 +00:00
|
|
|
The type of file to save. This is currently ignored in wxTextCtrl.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
@true if the operation was successful, @false otherwise.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
bool SaveFile(const wxString& filename = wxEmptyString,
|
2008-03-08 13:52:38 +00:00
|
|
|
int fileType = wxTEXT_TYPE_ANY);
|
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
Changes the default style to use for the new text which is going to be
|
|
|
|
added to the control using WriteText() or AppendText().
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
If either of the font, foreground, or background colour is not set in
|
2008-05-11 15:37:37 +00:00
|
|
|
@a style, the values of the previous default style are used for them.
|
|
|
|
If the previous default style didn't set them neither, the global font
|
2008-10-04 11:01:50 +00:00
|
|
|
or colours of the text control itself are used as fall back.
|
|
|
|
|
|
|
|
However if the @a style parameter is the default wxTextAttr, then the default
|
2008-05-11 15:37:37 +00:00
|
|
|
style is just reset (instead of being combined with the new style which
|
2008-03-08 13:52:38 +00:00
|
|
|
wouldn't change it at all).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
The style for the new text.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
@true on success, @false if an error occurred (this may also mean
|
|
|
|
that the styles are not supported under this platform).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetDefaultStyle()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool SetDefaultStyle(const wxTextAttr& style);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Marks the control as being modified by the user or not.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see MarkDirty(), DiscardEdits()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetModified(bool modified);
|
|
|
|
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
Changes the style of the given range.
|
|
|
|
|
|
|
|
If any attribute within @a style is not set, the corresponding
|
|
|
|
attribute from GetDefaultStyle() is used.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param start
|
2008-03-09 12:33:59 +00:00
|
|
|
The start of the range to change.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param end
|
2008-03-09 12:33:59 +00:00
|
|
|
The end of the range to change.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
The new style for the range.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
@true on success, @false if an error occurred (this may also mean
|
|
|
|
that the styles are not supported under this platform).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetStyle(), wxTextAttr
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool SetStyle(long start, long end, const wxTextAttr& style);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Makes the line containing the given position visible.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
The position that should be visible.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual void ShowPosition(long pos);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Converts the given zero based column and line number to a position.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param x
|
2008-03-09 12:33:59 +00:00
|
|
|
The column number.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param y
|
2008-03-09 12:33:59 +00:00
|
|
|
The line number.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 15:37:37 +00:00
|
|
|
@return
|
|
|
|
The position value, or -1 if x or y was invalid.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual long XYToPosition(long x, long y) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-04-28 12:32:32 +00:00
|
|
|
Operator definitions for appending to a text control.
|
2008-05-11 15:37:37 +00:00
|
|
|
|
|
|
|
These operators can be used as with the standard C++ streams, for
|
|
|
|
example:
|
|
|
|
@code
|
|
|
|
wxTextCtrl *wnd = new wxTextCtrl(my_frame);
|
|
|
|
|
|
|
|
(*wnd) << "Welcome to text control number " << 1 << ".\n";
|
|
|
|
@endcode
|
2008-04-28 12:32:32 +00:00
|
|
|
*/
|
2008-05-11 15:37:37 +00:00
|
|
|
|
2008-04-28 12:32:32 +00:00
|
|
|
wxTextCtrl& operator<<(const wxString& s);
|
|
|
|
wxTextCtrl& operator<<(int i);
|
|
|
|
wxTextCtrl& operator<<(long i);
|
|
|
|
wxTextCtrl& operator<<(float f);
|
|
|
|
wxTextCtrl& operator<<(double d);
|
|
|
|
wxTextCtrl& operator<<(char c);
|
|
|
|
wxTextCtrl& operator<<(wchar_t c);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxStreamToTextRedirector
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This class can be used to (temporarily) redirect all output sent to a C++
|
|
|
|
ostream object to a wxTextCtrl instead.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-04 11:01:50 +00:00
|
|
|
@note
|
|
|
|
Some compilers and/or build configurations don't support multiply
|
|
|
|
inheriting wxTextCtrl from @c std::streambuf in which case this class is
|
|
|
|
not compiled in.
|
|
|
|
You also must have @c wxUSE_STD_IOSTREAM option on (i.e. set to 1) in your
|
|
|
|
@c setup.h to be able to use it. Under Unix, specify @c --enable-std_iostreams
|
|
|
|
switch when running configure for this.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Example of usage:
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@code
|
|
|
|
using namespace std;
|
2008-06-27 21:31:56 +00:00
|
|
|
wxTextCtrl* text = new wxTextCtrl(...);
|
|
|
|
{
|
2008-03-08 13:52:38 +00:00
|
|
|
wxStreamToTextRedirector redirect(text);
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
// this goes to the text control
|
2008-06-27 21:31:56 +00:00
|
|
|
cout << "Hello, text!" << endl;
|
|
|
|
}
|
|
|
|
// this goes somewhere else, presumably to stdout
|
|
|
|
cout << "Hello, console!" << endl;
|
2008-03-08 13:52:38 +00:00
|
|
|
@endcode
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{logging}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxTextCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxStreamToTextRedirector
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-11 15:37:37 +00:00
|
|
|
The constructor starts redirecting output sent to @a ostr or @a cout for
|
|
|
|
the default parameter value to the text control @a text.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param text
|
2008-03-09 12:33:59 +00:00
|
|
|
The text control to append output too, must be non-@NULL
|
2008-03-08 14:43:31 +00:00
|
|
|
@param ostr
|
2008-03-09 12:33:59 +00:00
|
|
|
The C++ stream to redirect, cout is used if it is @NULL
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-11-13 21:32:53 +00:00
|
|
|
wxStreamToTextRedirector(wxTextCtrl *text, ostream* ostr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
When a wxStreamToTextRedirector object is destroyed, the redirection is ended
|
|
|
|
and any output sent to the C++ ostream which had been specified at the time of
|
|
|
|
the object construction will go to its original destination.
|
|
|
|
*/
|
|
|
|
~wxStreamToTextRedirector();
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|