# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # TE_NO_VSCROLL = 2 # TE_READONLY = 16 # TE_MULTILINE = 32 # TE_PROCESS_TAB = 64 # TE_LEFT = 0 # TE_CENTER = 256 # TE_RIGHT = 512 # TE_CENTRE = 256 # TE_RICH = 128 # TE_PROCESS_ENTER = 1024 # TE_PASSWORD = 2048 # TE_AUTO_URL = 4096 # TE_NOHIDESEL = 8192 # TE_DONTWRAP = 1073741824 # TE_CHARWRAP = 16384 # TE_WORDWRAP = 1 # TE_BESTWRAP = 0 # TE_RICH2 = 32768 # TEXT_TYPE_ANY = 0 # One of the following values can be passed to {Wx::TextAttr#set_alignment} to determine paragraph alignment. # # # class TextAttrAlignment < Wx::Enum # # TEXT_ALIGNMENT_DEFAULT = Wx::TextAttrAlignment.new(0) # # TEXT_ALIGNMENT_LEFT = Wx::TextAttrAlignment.new(1) # # TEXT_ALIGNMENT_CENTRE = Wx::TextAttrAlignment.new(2) # # TEXT_ALIGNMENT_CENTER = Wx::TextAttrAlignment.new(2) # # TEXT_ALIGNMENT_RIGHT = Wx::TextAttrAlignment.new(3) # {Wx::TextAttrAlignment::TEXT_ALIGNMENT_JUSTIFIED} is unimplemented. # TEXT_ALIGNMENT_JUSTIFIED = Wx::TextAttrAlignment.new(4) end # TextAttrAlignment # The following values are passed in a bitlist to {Wx::TextAttr#set_flags} to determine what attributes will be considered when setting the attributes for a text control. # # # class TextAttrFlags < Wx::Enum # # TEXT_ATTR_TEXT_COLOUR = Wx::TextAttrFlags.new(1) # # TEXT_ATTR_BACKGROUND_COLOUR = Wx::TextAttrFlags.new(2) # # TEXT_ATTR_FONT_FACE = Wx::TextAttrFlags.new(4) # # TEXT_ATTR_FONT_POINT_SIZE = Wx::TextAttrFlags.new(8) # # TEXT_ATTR_FONT_PIXEL_SIZE = Wx::TextAttrFlags.new(268435456) # # TEXT_ATTR_FONT_WEIGHT = Wx::TextAttrFlags.new(16) # # TEXT_ATTR_FONT_ITALIC = Wx::TextAttrFlags.new(32) # # TEXT_ATTR_FONT_UNDERLINE = Wx::TextAttrFlags.new(64) # # TEXT_ATTR_FONT_STRIKETHROUGH = Wx::TextAttrFlags.new(134217728) # # TEXT_ATTR_FONT_ENCODING = Wx::TextAttrFlags.new(33554432) # # TEXT_ATTR_FONT_FAMILY = Wx::TextAttrFlags.new(67108864) # # TEXT_ATTR_FONT_SIZE = Wx::TextAttrFlags.new(268435464) # Defined as the combination of all 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") # ``` # # == Event Handling. # # The following commands are processed by default event handlers in {Wx::TextCtrl}: {Wx::StandardID::ID_CUT}, {Wx::StandardID::ID_COPY}, {Wx::StandardID::ID_PASTE}, {Wx::StandardID::ID_UNDO}, {Wx::StandardID::ID_REDO}. The associated UI update events are also processed automatically, when the control has the focus. # === Events emitted by this class # # The following event-handler methods redirect the events to member method or handler blocks for {Wx::CommandEvent} events. # Event handler methods for events emitted by this class: # # - {Wx::EvtHandler#evt_text}(id, meth = nil, &block): Respond to a {Wx::EVT_TEXT} 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 program itself (for example, if {Wx::TextCtrl#set_value} is called); see {Wx::TextCtrl#change_value} for a function which does not send this event. This event is however not sent during the control creation. # # - {Wx::EvtHandler#evt_text_enter}(id, meth = nil, &block): Respond to a {Wx::EVT_TEXT_ENTER} event, generated when enter is pressed in a text control which must have {Wx::TE_PROCESS_ENTER} style for this event to be generated. # # - {Wx::EvtHandler#evt_text_url}(id, meth = nil, &block): A mouse event occurred over an URL in the text control. # # - {Wx::EvtHandler#evt_text_maxlen}(id, meth = nil, &block): This event is generated when the user tries to enter more text into the control than the limit set by {Wx::TextCtrl#set_max_length}, see its description. # # === # # Category: {Wx::Controls}
Appearance:
wxMSW Appearance # wxGTK Appearance # wxOSX Appearance #
# @see Wx::TextCtrl#create # @see Wx::Validator # # class TextCtrl < Control include Wx::TextEntry # @overload initialize() # Default ctor. # @return [Wx::TextCtrl] # @overload initialize(parent, id, value=(''), pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::TextCtrlNameStr) # Constructor, creating and showing a text control. # 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. # @see Wx::TextCtrl#create # @see Wx::Validator # @param parent [Wx::Window] Parent window. Should not be NULL. # @param id [Integer] Control identifier. A value of -1 denotes a default value. # @param value [String] Default text value. # @param pos [Array(Integer, Integer), Wx::Point] Text control position. # @param size [Array(Integer, Integer), Wx::Size] Text control size. # @param style [Integer] Window style. See {Wx::TextCtrl}. # @param validator [Wx::Validator] Window validator. # @param name [String] Window name. # @return [Wx::TextCtrl] def initialize(*args) end # 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. # @param parent [Wx::Window] # @param id [Integer] # @param value [String] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param style [Integer] # @param validator [Wx::Validator] # @param name [String] # @return [Boolean] def create(parent, id, value=(''), pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::TextCtrlNameStr) end # Resets the internal modified flag as if the current changes had been saved. # @return [void] def discard_edits; end # Delete the undo history. # Currently only implemented in wxMSW (for controls using {Wx::TE_RICH2} style only) and wxOSX (for multiline text controls only), does nothing in the other ports or for the controls not using the appropriate styles. # @return [void] def empty_undo_buffer; end # This function inserts into the control the character which would have been inserted if the given key event had occurred in the text control. # The event object should be the same as the one passed to 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. # true if the event resulted in a change to the control, false otherwise. # @param event [Wx::KeyEvent] # @return [Boolean] def emulate_key_press(event) end # Returns the style currently used for the new text. # # @see Wx::TextCtrl#set_default_style # @return [Wx::TextAttr] def get_default_style; end alias_method :default_style, :get_default_style # Gets the length of the specified line, not including any trailing newline character(s). # The length of the line, or -1 if lineNo was invalid. # @param lineNo [Integer] Line number (starting from zero). # @return [Integer] def get_line_length(lineNo) end alias_method :line_length, :get_line_length # Returns the contents of a given line in the text control, not including any trailing newline character(s). # The contents of the line. # @param lineNo [Integer] The line number, starting from zero. # @return [String] def get_line_text(lineNo) end alias_method :line_text, :get_line_text # Returns the number of lines in the text control buffer. # The returned number is the number of logical lines, i.e. just the count of the number of newline characters in the control + 1, for wxGTK and wxOSX/Cocoa ports while it is the number of physical lines, i.e. the count of lines actually shown in the control, in wxMSW. Because of this discrepancy, it is not recommended to use this function. # Note that even empty text controls have one line (where the insertion point is), so {Wx::TextCtrl#get_number_of_lines} never returns 0. # @return [Integer] def get_number_of_lines; end alias_method :number_of_lines, :get_number_of_lines # Returns the style at this position in the text control. # Not all platforms support this function. # true on success, false if an error occurred (this may also mean that the styles are not supported under this platform). # @see Wx::TextCtrl#set_style # @see Wx::TextAttr # @param position [Integer] # @param style [Wx::TextAttr] # @return [Boolean] def get_style(position, style) end alias_method :style, :get_style # Finds the row and column of the character at the specified point. # If the return code is not {Wx::TextCtrlHitTestResult::TE_HT_UNKNOWN} the row and column of the character closest to this position are returned, otherwise the output parameters are not modified. # Please note that this function is currently only implemented in {Wx::Univ}, wxMSW and wxGTK ports and always returns {Wx::TextCtrlHitTestResult::TE_HT_UNKNOWN} in the other ports. # @see Wx::TextCtrl#position_to_xy # @see Wx::TextCtrl#xy_to_position # @param pt [Array(Integer, Integer), Wx::Point] The position of the point to check, in window device coordinates. # @return [Array(Wx::TextCtrlHitTestResult,Integer,Integer)] def hit_test(pt) end # Returns true if the text has been modified by user. # Note that calling {Wx::TextCtrl#set_value} doesn't make the control modified. # @see Wx::TextCtrl#mark_dirty # @return [Boolean] def is_modified; end alias_method :modified?, :is_modified # Returns true if this is a multi line edit control and false otherwise. # # @see Wx::TextCtrl#is_single_line # @return [Boolean] def is_multi_line; end alias_method :multi_line?, :is_multi_line # Returns true if this is a single line edit control and false otherwise. # # @see Wx::TextCtrl#is_single_line # @see Wx::TextCtrl#is_multi_line # @return [Boolean] def is_single_line; end alias_method :single_line?, :is_single_line # Loads and displays the named file, if it exists. # true if successful, false otherwise. # @param filename [String] The filename of the file to load. # @param fileType [Integer] The type of file to load. This is currently ignored in {Wx::TextCtrl}. # @return [Boolean] def load_file(filename, fileType=Wx::TEXT_TYPE_ANY) end # Mark text as modified (dirty). # # @see Wx::TextCtrl#is_modified # @return [void] def mark_dirty; end # This event handler function implements default drag and drop behaviour, which is to load the first dropped file into the control. # This is not implemented on non-Windows platforms. # @see Wx::DropFilesEvent # @param event [Wx::DropFilesEvent] The drop files event. # @return [void] def on_drop_files(event) end # Converts given position to a zero-based column, line number pair. # true on success, false on failure (most likely due to a too large position parameter). # @see Wx::TextCtrl#xy_to_position # @param pos [Integer] Position. # @return [Array(Integer, Integer), nil] def position_to_xy(pos) end # Converts given text position to client coordinates in pixels. # This function allows finding where is the character at the given position displayed in the text control. # Availability: only available for the wxMSW, wxGTK ports. {Wx::msw},{Wx::gtk} . Additionally, wxGTK only implements this method for multiline controls and {Wx::DEFAULT_POSITION} is always returned for the single line ones. # # On success returns a {Wx::Point} which contains client coordinates for the given position in pixels, otherwise returns {Wx::DEFAULT_POSITION}. # @see Wx::TextCtrl#xy_to_position # @see Wx::TextCtrl#position_to_xy # @param pos [Integer] Text position in 0 to {Wx::TextCtrl#get_last_position} range (inclusive). # @return [Wx::Point] def position_to_coords(pos) end # Saves the contents of the control in a text file. # true if the operation was successful, false otherwise. # @param filename [String] The name of the file in which to save the text. # @param fileType [Integer] The type of file to save. This is currently ignored in {Wx::TextCtrl}. # @return [Boolean] def save_file(filename=(''), fileType=Wx::TEXT_TYPE_ANY) end # Changes the default style to use for the new text which is going to be added to the control. # This applies both to the text added programmatically using {Wx::TextCtrl#write_text} or {Wx::TextCtrl#append_text} and to the text entered by the user interactively. # If either of the font, foreground, or background colour is not set in style, the values of the previous default style are used for them. If the previous default style didn't set them either, the global font or colours of the text control itself are used as fall back. # However if the style parameter is the default {Wx::TextAttr}, then the default style is just reset (instead of being combined with the new style which wouldn't change it at all). # # true on success, false if an error occurred (this may also mean that the styles are not supported under this platform). # @see Wx::TextCtrl#get_default_style # @param style [Wx::TextAttr] The style for the new text. # @return [Boolean] def set_default_style(style) end alias_method :default_style=, :set_default_style # Marks the control as being modified by the user or not. # # @see Wx::TextCtrl#mark_dirty # @see Wx::TextCtrl#discard_edits # @param modified [Boolean] # @return [void] def set_modified(modified) end alias_method :modified=, :set_modified # Changes the style of the given range. # If any attribute within style is not set, the corresponding attribute from {Wx::TextCtrl#get_default_style} is used. # # true on success, false if an error occurred (this may also mean that the styles are not supported under this platform). # @see Wx::TextCtrl#get_style # @see Wx::TextAttr # @param start [Integer] The start of the range to change. # @param end_ [Integer] # @param style [Wx::TextAttr] The new style for the range. # @return [Boolean] def set_style(start, end_, style) end # Makes the line containing the given position visible. # @param pos [Integer] The position that should be visible. # @return [void] def show_position(pos) end # Converts the given zero based column and line number to a position. # The position value, or -1 if x or y was invalid. # @param x [Integer] The column number. # @param y [Integer] The line number. # @return [Integer] def xy_to_position(x, y) end end # TextCtrl end