wxTEXT_ATTR_FONT_*
values above.
#
TEXT_ATTR_FONT = Wx::TextAttrFlags.new(503316604)
#
#
TEXT_ATTR_ALIGNMENT = Wx::TextAttrFlags.new(128)
#
#
TEXT_ATTR_LEFT_INDENT = Wx::TextAttrFlags.new(256)
#
#
TEXT_ATTR_RIGHT_INDENT = Wx::TextAttrFlags.new(512)
#
#
TEXT_ATTR_TABS = Wx::TextAttrFlags.new(1024)
#
#
TEXT_ATTR_PARA_SPACING_AFTER = Wx::TextAttrFlags.new(2048)
#
#
TEXT_ATTR_PARA_SPACING_BEFORE = Wx::TextAttrFlags.new(4096)
#
#
TEXT_ATTR_LINE_SPACING = Wx::TextAttrFlags.new(8192)
#
#
TEXT_ATTR_CHARACTER_STYLE_NAME = Wx::TextAttrFlags.new(16384)
#
#
TEXT_ATTR_PARAGRAPH_STYLE_NAME = Wx::TextAttrFlags.new(32768)
#
#
TEXT_ATTR_LIST_STYLE_NAME = Wx::TextAttrFlags.new(65536)
#
#
TEXT_ATTR_BULLET_STYLE = Wx::TextAttrFlags.new(131072)
#
#
TEXT_ATTR_BULLET_NUMBER = Wx::TextAttrFlags.new(262144)
#
#
TEXT_ATTR_BULLET_TEXT = Wx::TextAttrFlags.new(524288)
#
#
TEXT_ATTR_BULLET_NAME = Wx::TextAttrFlags.new(1048576)
# Defined as the combination of all wxTEXT_ATTR_BULLET_*
values above.
#
TEXT_ATTR_BULLET = Wx::TextAttrFlags.new(1966080)
#
#
TEXT_ATTR_URL = Wx::TextAttrFlags.new(2097152)
#
#
TEXT_ATTR_PAGE_BREAK = Wx::TextAttrFlags.new(4194304)
#
#
TEXT_ATTR_EFFECTS = Wx::TextAttrFlags.new(8388608)
#
#
TEXT_ATTR_OUTLINE_LEVEL = Wx::TextAttrFlags.new(16777216)
#
#
TEXT_ATTR_AVOID_PAGE_BREAK_BEFORE = Wx::TextAttrFlags.new(536870912)
#
#
TEXT_ATTR_AVOID_PAGE_BREAK_AFTER = Wx::TextAttrFlags.new(1073741824)
# Combines the styles {Wx::TextAttrFlags::TEXT_ATTR_FONT}, {Wx::TextAttrFlags::TEXT_ATTR_EFFECTS}, {Wx::TextAttrFlags::TEXT_ATTR_BACKGROUND_COLOUR}, {Wx::TextAttrFlags::TEXT_ATTR_TEXT_COLOUR}, {Wx::TextAttrFlags::TEXT_ATTR_CHARACTER_STYLE_NAME}, {Wx::TextAttrFlags::TEXT_ATTR_URL}.
#
TEXT_ATTR_CHARACTER = Wx::TextAttrFlags.new(513818751)
# Combines all the styles regarding text paragraphs.
#
TEXT_ATTR_PARAGRAPH = Wx::TextAttrFlags.new(1633664896)
# Combines all previous values.
#
TEXT_ATTR_ALL = Wx::TextAttrFlags.new(2147483647)
end # TextAttrFlags
# Styles for {Wx::TextAttr#set_bullet_style}.
#
# They can be combined together as a bitlist.
#
class TextAttrBulletStyle < Wx::Enum
#
#
TEXT_ATTR_BULLET_STYLE_NONE = Wx::TextAttrBulletStyle.new(0)
#
#
TEXT_ATTR_BULLET_STYLE_ARABIC = Wx::TextAttrBulletStyle.new(1)
#
#
TEXT_ATTR_BULLET_STYLE_LETTERS_UPPER = Wx::TextAttrBulletStyle.new(2)
#
#
TEXT_ATTR_BULLET_STYLE_LETTERS_LOWER = Wx::TextAttrBulletStyle.new(4)
#
#
TEXT_ATTR_BULLET_STYLE_ROMAN_UPPER = Wx::TextAttrBulletStyle.new(8)
#
#
TEXT_ATTR_BULLET_STYLE_ROMAN_LOWER = Wx::TextAttrBulletStyle.new(16)
#
#
TEXT_ATTR_BULLET_STYLE_SYMBOL = Wx::TextAttrBulletStyle.new(32)
# {Wx::TextAttrBulletStyle::TEXT_ATTR_BULLET_STYLE_BITMAP} is unimplemented.
#
TEXT_ATTR_BULLET_STYLE_BITMAP = Wx::TextAttrBulletStyle.new(64)
#
#
TEXT_ATTR_BULLET_STYLE_PARENTHESES = Wx::TextAttrBulletStyle.new(128)
#
#
TEXT_ATTR_BULLET_STYLE_PERIOD = Wx::TextAttrBulletStyle.new(256)
#
#
TEXT_ATTR_BULLET_STYLE_STANDARD = Wx::TextAttrBulletStyle.new(512)
#
#
TEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS = Wx::TextAttrBulletStyle.new(1024)
#
#
TEXT_ATTR_BULLET_STYLE_OUTLINE = Wx::TextAttrBulletStyle.new(2048)
#
#
TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT = Wx::TextAttrBulletStyle.new(0)
#
#
TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT = Wx::TextAttrBulletStyle.new(4096)
#
#
TEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE = Wx::TextAttrBulletStyle.new(8192)
#
#
TEXT_ATTR_BULLET_STYLE_CONTINUATION = Wx::TextAttrBulletStyle.new(16384)
end # TextAttrBulletStyle
# Styles for {Wx::TextAttr#set_text_effects}.
#
# They can be combined together as a bitlist.
# Of these, only {Wx::TextAttrEffects::TEXT_ATTR_EFFECT_CAPITALS}, {Wx::TextAttrEffects::TEXT_ATTR_EFFECT_STRIKETHROUGH}, {Wx::TextAttrEffects::TEXT_ATTR_EFFECT_SUPERSCRIPT} and {Wx::TextAttrEffects::TEXT_ATTR_EFFECT_SUBSCRIPT} are implemented.
#
class TextAttrEffects < Wx::Enum
#
#
TEXT_ATTR_EFFECT_NONE = Wx::TextAttrEffects.new(0)
#
#
TEXT_ATTR_EFFECT_CAPITALS = Wx::TextAttrEffects.new(1)
#
#
TEXT_ATTR_EFFECT_SMALL_CAPITALS = Wx::TextAttrEffects.new(2)
#
#
TEXT_ATTR_EFFECT_STRIKETHROUGH = Wx::TextAttrEffects.new(4)
#
#
TEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH = Wx::TextAttrEffects.new(8)
#
#
TEXT_ATTR_EFFECT_SHADOW = Wx::TextAttrEffects.new(16)
#
#
TEXT_ATTR_EFFECT_EMBOSS = Wx::TextAttrEffects.new(32)
#
#
TEXT_ATTR_EFFECT_OUTLINE = Wx::TextAttrEffects.new(64)
#
#
TEXT_ATTR_EFFECT_ENGRAVE = Wx::TextAttrEffects.new(128)
#
#
TEXT_ATTR_EFFECT_SUPERSCRIPT = Wx::TextAttrEffects.new(256)
#
#
TEXT_ATTR_EFFECT_SUBSCRIPT = Wx::TextAttrEffects.new(512)
#
#
TEXT_ATTR_EFFECT_RTL = Wx::TextAttrEffects.new(1024)
#
#
TEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION = Wx::TextAttrEffects.new(4096)
end # TextAttrEffects
# Convenience line spacing values; see {Wx::TextAttr#set_line_spacing}.
#
#
#
class TextAttrLineSpacing < Wx::Enum
#
#
TEXT_ATTR_LINE_SPACING_NORMAL = Wx::TextAttrLineSpacing.new(10)
#
#
TEXT_ATTR_LINE_SPACING_HALF = Wx::TextAttrLineSpacing.new(15)
#
#
TEXT_ATTR_LINE_SPACING_TWICE = Wx::TextAttrLineSpacing.new(20)
end # TextAttrLineSpacing
# Underline types that can be used in {Wx::TextAttr#set_font_underline}.
#
#
#
class TextAttrUnderlineType < Wx::Enum
#
#
TEXT_ATTR_UNDERLINE_NONE = Wx::TextAttrUnderlineType.new(0)
#
#
TEXT_ATTR_UNDERLINE_SOLID = Wx::TextAttrUnderlineType.new(1)
#
#
TEXT_ATTR_UNDERLINE_DOUBLE = Wx::TextAttrUnderlineType.new(2)
#
#
TEXT_ATTR_UNDERLINE_SPECIAL = Wx::TextAttrUnderlineType.new(3)
end # TextAttrUnderlineType
# Describes the possible return values of {Wx::TextCtrl#hit_test}.
#
# The element names correspond to the relationship between the point asked for and the character returned, e.g. {Wx::TextCtrlHitTestResult::TE_HT_BEFORE} means that the point is before (leftward or upward) it and so on.
#
class TextCtrlHitTestResult < Wx::Enum
# Indicates that {Wx::TextCtrl#hit_test} is not implemented on this platform.
#
TE_HT_UNKNOWN = Wx::TextCtrlHitTestResult.new(-2)
# The point is before the character returned.
#
TE_HT_BEFORE = Wx::TextCtrlHitTestResult.new(-1)
# The point is directly on the character returned.
#
TE_HT_ON_TEXT = Wx::TextCtrlHitTestResult.new(0)
# The point is below the last line of the control.
#
TE_HT_BELOW = Wx::TextCtrlHitTestResult.new(1)
# The point is beyond the end of line containing the character returned.
#
TE_HT_BEYOND = Wx::TextCtrlHitTestResult.new(2)
end # TextCtrlHitTestResult
#
#
EVT_TEXT = 10125
#
#
EVT_TEXT_ENTER = 10126
#
#
EVT_TEXT_URL = 10127
#
#
EVT_TEXT_MAXLEN = 10128
# A text control allows text to be displayed and edited.
#
# It may be single line or multi-line. Notice that a lot of methods of the text controls are found in the base {Wx::TextEntry} class which is a common base class for {Wx::TextCtrl} and other controls using a single line text entry field (e.g. {Wx::ComboBox}).
# ### Styles
#
# This class supports the following styles:
#
# - {Wx::TE_PROCESS_ENTER}: The control will generate the event {Wx::EVT_TEXT_ENTER} that can be handled by the program. Otherwise, i.e. either if this style not specified at all, or it is used, but there is no event handler for this event or the event handler called {Wx::Event#skip} to avoid overriding the default handling, pressing Enter key is either processed internally by the control or used to activate the default button of the dialog, if any.
#
# - {Wx::TE_PROCESS_TAB}: Normally, TAB key is used for keyboard navigation and pressing it in a control switches focus to the next one. With this style, this won't happen and if the TAB is not otherwise processed (e.g. by {Wx::EVT_CHAR} event handler), a literal TAB character is inserted into the control. Notice that this style has no effect for single-line text controls when using WXGTK.
#
# - {Wx::TE_MULTILINE}: The text control allows multiple lines. If this style is not specified, line break characters should not be used in the controls value.
#
# - {Wx::TE_PASSWORD}: The text will be echoed as asterisks.
#
# - {Wx::TE_READONLY}: The text will not be user-editable.
#
# - {Wx::TE_RICH}: Use rich text control under MSW, this allows having more than 64KB of text in the control. This style is ignored under other platforms and it is recommended to use {Wx::TE_RICH2} instead of it under MSW.
#
# - {Wx::TE_RICH2}: Use rich text control version 2.0 or higher under MSW, this style is ignored under other platforms. Note that this style may be turned on automatically even if it is not used explicitly when creating a text control with a long (i.e. much more than 64KiB) initial text, as creating the control would simply fail in this case under MSW if neither this style nor {Wx::TE_RICH} is used.
#
# - {Wx::TE_AUTO_URL}: Highlight the URLs and generate the {Wx::TextUrlEvents} when mouse events occur over them.
#
# - {Wx::TE_NOHIDESEL}: 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.
#
# - {Wx::HSCROLL}: A horizontal scrollbar will be created and used, so that text won't be wrapped.
#
# - {Wx::TE_NO_VSCROLL}: 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 WXMSW but not under WXGTK or WXOSX. Currently not implemented for the other platforms.
#
# - {Wx::TE_LEFT}: The text in the control will be left-justified (default).
#
# - {Wx::TE_CENTRE}: The text in the control will be centered (WXMSW, WXGTK, WXOSX).
#
# - {Wx::TE_RIGHT}: The text in the control will be right-justified (WXMSW, WXGTK, WXOSX).
#
# - {Wx::TE_DONTWRAP}: Same as {Wx::HSCROLL} style: don't wrap at all, show horizontal scrollbar instead.
#
# - {Wx::TE_CHARWRAP}: For multiline controls only: wrap the lines too long to be shown entirely at any position ({Wx::Univ}, WXGTK, WXOSX).
#
# - {Wx::TE_WORDWRAP}: For multiline controls only: wrap the lines too long to be shown entirely at word boundaries ({Wx::Univ}, WXMSW, WXGTK, WXOSX).
#
# - {Wx::TE_BESTWRAP}: For multiline controls only: wrap the lines at word boundaries or at any other character if there are words longer than the window width (this is the default).
#
# - {Wx::TE_CAPITALIZE}: On PocketPC and Smartphone, causes the first letter to be capitalized.
#
# Note that alignment styles ({Wx::TE_LEFT}, {Wx::TE_CENTRE} and {Wx::TE_RIGHT}) can be changed dynamically after control creation on WXMSW, WXGTK and WXOSX. {Wx::TE_READONLY}, {Wx::TE_PASSWORD} and wrapping styles can be dynamically changed under WXGTK but not WXMSW. The other styles can be only set during control creation.
#
# ## wxTextCtrl Text Format
#
# The multiline text controls always store the text as a sequence of lines separated by '\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 {Wx::TextCtrl#get_insertion_point} or {Wx::TextCtrl#get_selection} can not be used as indices into the string returned by {Wx::TextCtrl#get_value} as they're going to be slightly off for platforms using "\\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 {Wx::TextCtrl#get_range}. And the indices themselves can only be passed to other methods, for example {Wx::TextCtrl#set_insertion_point} or {Wx::TextCtrl#set_selection}.
# To summarize: never use the indices returned by (multiline) {Wx::TextCtrl} as indices into the string it contains, but only as arguments to be passed back to the other {Wx::TextCtrl} 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.
#
# ## wxTextCtrl Positions and Coordinates
#
# It is possible to use either linear positions, i.e. roughly (but not always exactly, as explained in the previous section) the index of the character in the text contained in the control or X-Y coordinates, i.e. column and line of the character when working with this class and it provides the functions {Wx::TextCtrl#position_to_xy} and {Wx::TextCtrl#xy_to_position} to convert between the two.
# Additionally, a position in the control can be converted to its coordinates in pixels using {Wx::TextCtrl#position_to_coords} which can be useful to e.g. show a popup menu near the given character. And, in the other direction, {Wx::TextCtrl#hit_test} can be used to find the character under, or near, the given pixel coordinates.
# To be more precise, positions actually refer to the gaps between characters and not the characters themselves. Thus, position 0 is the one before the very first character in the control and so is a valid position even when the control is empty. And if the control contains a single character, it has two valid positions: 0 before this character and 1 after it. This, when the documentation of various functions mentions "invalid position", it doesn't consider the position just after the last character of the line to be invalid, only the positions beyond that one (e.g. 2 and greater in the single character example) are actually invalid.
#
# ## 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 {Wx::TE_RICH} style is required for style support). To use the styles you can either call {Wx::TextCtrl#set_default_style} before inserting the text or call {Wx::TextCtrl#set_style} 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 {Wx::TextCtrl#set_default_style} doesn't change the text foreground colour (which stays red) while the last one doesn't change the background colour (which stays grey):
#
# ```ruby
# text.set_default_style(Wx::TextAttr.new(Wx::RED))
# text.append_text("Red text\n")
# text.set_default_style(Wx::TextAttr.new(Wx::NULL_COLOUR, Wx::LIGHT_GREY))
# text.append_text("Red on grey text\n")
# text.set_default_style(Wx::TextAttr.new(Wx::BLUE))
# text.append_text("Blue on grey text\n")
# ```
#
# ## wxTextCtrl and C++ Streams
#
# This class multiply-inherits from std::streambuf (except for some really old compilers using non-standard iostream library), allowing code such as the following:
#
# ```
# wxTextCtrl *control = new wxTextCtrl(...);
#
# ostream stream(control)
#
# stream << 123.456 << " some text\n";
# stream.flush();
# ```
#
# Note that even if your build of wxWidgets doesn't support this (the symbol {Wx::HAS_TEXT_WINDOW_STREAM} has value of 0 then) you can still use {Wx::TextCtrl} itself in a stream-like manner:
#
# ```
# wxTextCtrl *control = new wxTextCtrl(...);
#
# *control << 123.456 << " some text\n";
# ```
#
# However the possibility to create a std::ostream associated with {Wx::TextCtrl} may be useful if you need to redirect the output of a function taking a std::ostream as parameter to a text control.
# Another commonly requested need is to redirect std::cout to the text control. This may be done in the following way:
#
# ```
# \#include WXMSW Appearance # | WXGTK Appearance # | WXOSX Appearance # |
The horizontal scrollbar ({Wx::HSCROLL} style flag) will only be created for multi-line text controls. Without a horizontal scrollbar, text lines that don't fit in the control's size will be 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. #
#Note that even empty text controls have one line (where the insertion point is), so {Wx::TextCtrl#get_number_of_lines} never returns 0. #
#This is not implemented on non-Windows platforms. #
#