# :stopdoc:
# This file is automatically generated by the WXRuby3 documentation 
# generator. Do not alter this file.
# :startdoc:


module Wx

  # This is the base class for a control or "widget".
  # A control is generally a small window which processes user input and/or displays one or more item of data.
  # === Events emitted by this class
  # 
  # The following event-handler methods redirect the events to member method or handler blocks for {Wx::ClipboardTextEvent} events.
  # Event handler methods for events emitted by this class:
  # - {Wx::EvtHandler#evt_text_copy}(id, meth = nil, &block): Some or all of the controls content was copied to the clipboard. 
  # - {Wx::EvtHandler#evt_text_cut}(id, meth = nil, &block): Some or all of the controls content was cut (i.e. copied and deleted). 
  # - {Wx::EvtHandler#evt_text_paste}(id, meth = nil, &block): Clipboard content was pasted into the control. 
  # 
  # === 
  # 
  # Category:  {Wx::Controls}
  # @see Wx::Validator 
  # 
  # 
  class Control < Window
  
    # @overload initialize(parent, id, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::ControlNameStr)
    #   Constructs a control.
    #   @param parent [Wx::Window]  Pointer to a parent window.
    #   @param id [Integer]  Control identifier. If {Wx::StandardID::ID_ANY}, will automatically create an identifier.
    #   @param pos [Array(Integer, Integer), Wx::Point]  Control position. {Wx::DEFAULT_POSITION} indicates that wxWidgets should generate a default position for the control.
    #   @param size [Array(Integer, Integer), Wx::Size]  Control size. {Wx::DEFAULT_SIZE} indicates that wxWidgets should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized.
    #   @param style [Integer]  Control style. For generic window styles, please see {Wx::Window}.
    #   @param validator [Wx::Validator]  Control validator.
    #   @param name [String]  Control name.
    #   @return [Control]
    # @overload initialize()
    #   Default constructor to allow 2-phase creation.
    #   @return [Control]
    def initialize(*args) end
    
    # @param parent [Wx::Window] 
    # @param id [Integer] 
    # @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 [true,false]
    def create(parent, id, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::ControlNameStr) end
    
    # Simulates the effect of the user issuing a command to the item.
    # 
    # @see Wx::CommandEvent 
    # @param event [Wx::CommandEvent] 
    # @return [void]
    def command(event) end
    
    # Returns the control's label, as it was passed to {Wx::Control#set_label}.
    # Note that the returned string may contains mnemonics ("&" characters) if they were passed to the {Wx::Control#set_label} function; use {Wx::Control#get_label_text} if they are undesired.
    # Also note that the returned string is always the string which was passed to {Wx::Control#set_label} but may be different from the string passed to {Wx::Control#set_label_text} (since this last one escapes mnemonic characters).
    # @return [String]
    def get_label; end
    alias_method :label, :get_label
    
    # Returns the control's label without mnemonics.
    # Note that because of the stripping of the mnemonics the returned string may differ from the string which was passed to {Wx::Control#set_label} but should always be the same which was passed to {Wx::Control#set_label_text}.
    # @return [String]
    def get_label_text; end
    alias_method :label_text, :get_label_text
    
    # @overload get_size_from_text_size(xlen, ylen=-1)
    #   Determine the size needed by the control to leave the given area for its text.
    #   This function is mostly useful with control displaying short amounts of text that can be edited by the user, e.g. {Wx::TextCtrl}, {Wx::ComboBox}, {Wx::SearchCtrl} etc. Typically it is used to size these controls for the maximal amount of input they are supposed to contain, for example: 
    #   
    #     // Create a control for post code entry.
    #     wxTextCtrl* postcode = new wxTextCtrl(this, ...);
    #     
    #     // And set its initial and minimal size to be big enough for
    #     // entering 5 digits.
    #     postcode->SetInitialSize(
    #         postcode->GetSizeFromTextSize(
    #             postcode->GetTextExtent("99999")));
    #   
    #   Currently this method is only implemented for {Wx::TextCtrl}, {Wx::ComboBox} and {Wx::Choice} in {Wx::MSW} and {Wx::GTK}.
    #   
    #   The size that the control should have to leave the area of the specified size for its text. May return {Wx::DEFAULT_SIZE} if this method is not implemented for this particular control under the current platform.
    #   @param xlen [Integer]  The horizontal extent of the area to leave for text, in pixels.
    #   @param ylen [Integer]  The vertical extent of the area to leave for text, in pixels. By default -1 meaning that the vertical component of the returned size should be the default height of this control.
    #   @return [Wx::Size]
    # @overload get_size_from_text_size(tsize)
    #   This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
    #   @param tsize [Array(Integer, Integer), Wx::Size] 
    #   @return [Wx::Size]
    def get_size_from_text_size(*args) end
    alias_method :size_from_text_size, :get_size_from_text_size
    
    # Determine the minimum size needed by the control to display the given text.
    # The helper function that uses combination of {Wx::Control#get_size_from_text_size} and {Wx::Control#get_text_extent} which used together pretty often: 
    # 
    #   wxSize GetSizeFromText(const wxString& text) const
    #   {
    #       return GetSizeFromTextSize(GetTextExtent(text).GetWidth());
    #   }
    # 
    # The size that the control should have to leave the area of the specified text. May return {Wx::DEFAULT_SIZE} if this method is not implemented for this particular control under the current platform.
    # @param text [String]  The given text.
    # @return [Wx::Size]
    def get_size_from_text(text) end
    alias_method :size_from_text, :get_size_from_text
    
    # Sets the control's label.
    # All "&" characters in the label are special and indicate that the following character is a mnemonic for this control and can be used to activate it from the keyboard (typically by using Alt key in combination with it). To insert a literal ampersand character, you need to double it, i.e. use "&&". If this behaviour is undesirable, use {Wx::Control#set_label_text} instead.
    # @param label [String] 
    # @return [void]
    def set_label(label) end
    alias_method :label=, :set_label
    
    # Sets the control's label to exactly the given string.
    # Unlike {Wx::Control#set_label}, this function shows exactly the text passed to it in the control, without interpreting ampersands in it in any way. Notice that it means that the control can't have any mnemonic defined for it using this function.
    # @see Wx::Control.escape_mnemonics 
    # @param text [String] 
    # @return [void]
    def set_label_text(text) end
    alias_method :label_text=, :set_label_text
    
    # Sets the controls label to a string using markup.
    # Simple markup supported by this function can be used to apply different fonts or colours to different parts of the control label when supported. If markup is not supported by the control or platform, it is simply stripped and {Wx::Control#set_label} is used with the resulting string.
    # For example, 
    # 
    #   wxStaticText *text;
    #   ...
    #   text->SetLabelMarkup("<b>&amp;Bed</b> &amp;mp; "
    #                        "<span foreground='red'>breakfast</span> "
    #                        "available <big>HERE</big>");
    #  would show the string using bold, red and big for the corresponding words under {Wx::GTK} but will simply show the string "Bed &amp; breakfast
    # available HERE" on the other platforms. In any case, the "B" of "Bed" will be underlined to indicate that it can be used as a mnemonic for this control.
    # The supported tags are: 
    # <b>Tag</b> 
    # <b>Description</b>  
    # 
    # <b> 
    # bold text  
    # 
    # <big> 
    # bigger text  
    # 
    # <i> 
    # italic text  
    # 
    # <s> 
    # strike-through text  
    # 
    # <small> 
    # smaller text  
    # 
    # <tt> 
    # monospaced text  
    # 
    # <u> 
    # underlined text  
    # 
    # <span> 
    # generic formatter tag, see the table below for supported attributes.   
    # 
    # Supported <code><span></code> attributes: 
    # <b>Name</b> 
    # <b>Description</b>  
    # 
    # foreground, fgcolor, color 
    # Foreground text colour, can be a name or RGB value.  
    # 
    # background, bgcolor 
    # Background text colour, can be a name or RGB value.  
    # 
    # font_family, face 
    # Font face name.  
    # 
    # font_weight, weight 
    # Numeric value in 0..900 range or one of "ultralight", "light", "normal" (all meaning non-bold), "bold", "ultrabold" and "heavy" (all meaning bold).  
    # 
    # font_style, style 
    # Either "oblique" or "italic" (both with the same meaning) or "normal".  
    # 
    # size 
    # The font size can be specified either as "smaller" or "larger" relatively to the current font, as a CSS font size name ("xx-small", "x-small", "small", "medium", "large", "x-large" or "xx-large") or as a number giving font size in 1024th parts of a point, i.e. 10240 for a 10pt font.  
    # 
    # This markup language is a strict subset of Pango markup (described at http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html) and any tags and span attributes not documented above can't be used under non-GTK platforms.
    # Also note that you need to escape the following special characters: 
    # <b>Special character</b> 
    # <b>Escape as</b>  
    # 
    # <code>&</code>  
    # <code>&amp</code>; or as <code>&&</code>   
    # 
    # <code>'</code>  
    # <code>&apos</code>;  
    # 
    # <code>"</code>  
    # <code>&quot</code>;  
    # 
    # <code><</code>  
    # <code>&lt</code>;  
    # 
    # <code>></code>  
    # <code>&gt</code>;  
    # 
    # The non-escaped ampersand <code>&</code> characters are interpreted as mnemonics as with {Wx::Control#set_label}.
    # 
    # true if the new label was set (even if markup in it was ignored) or false if we failed to parse the markup. In this case the label remains unchanged.
    # 
    # Currently {Wx::Button} supports markup in all major ports ({Wx::MSW}, {Wx::GTK} and {Wx::OSX}/Cocoa) while {Wx::StaticText} supports it in {Wx::GTK} and {Wx::OSX} and its generic version (which can be used under MSW if markup support is required). Extending support to more controls is planned in the future.
    # @param markup [String]  String containing markup for the label. It may contain markup tags described above and newline characters but currently only {Wx::GTK} and {Wx::OSX} support multiline labels with markup, the generic implementation (also used in {Wx::MSW}) only handles single line markup labels. Notice that the string must be well-formed (e.g. all tags must be correctly closed) and won't be shown at all otherwise.
    # @return [true,false]
    def set_label_markup(markup) end
    alias_method :label_markup=, :set_label_markup
    
    # Returns the given str string without mnemonics ("&" characters).
    # This function is identical to {Wx::Control#get_label_text} and is provided mostly for symmetry with {Wx::Control.escape_mnemonics}.
    # @param str [String] 
    # @return [String]
    def self.remove_mnemonics(str) end
    
    # Escapes the special mnemonics characters ("&") in the given string.
    # This function can be helpful if you need to set the controls label to a user-provided string. If the string contains ampersands, they wouldn't appear on the display but be used instead to indicate that the character following the first of them can be used as a control mnemonic. While this can sometimes be desirable (e.g. to allow the user to configure mnemonics of the controls), more often you will want to use this function before passing a user-defined string to {Wx::Control#set_label}. Alternatively, if the label is entirely user-defined, you can just call {Wx::Control#set_label_text} directly  but this function must be used if the label is a combination of a part defined by program containing the control mnemonics and a user-defined part.
    # 
    # The same string with the ampersands in it doubled.
    # @param text [String]  The string such as it should appear on the display.
    # @return [String]
    def self.escape_mnemonics(text) end
    
    # Replaces parts of the label string with ellipsis, if needed, so that it fits into maxWidth pixels if possible.
    # Note that this function does not guarantee that the returned string will always be shorter than maxWidth; if maxWidth is extremely small, ellipsized text may be larger.
    # @param label [String]  The string to ellipsize
    # @param dc [Wx::DC]  The DC used to retrieve the character widths through the {Wx::DC#get_partial_text_extents} function.
    # @param mode [EllipsizeMode]  The ellipsization mode. This is the setting which determines which part of the string should be replaced by the ellipsis (unless it is {Wx::EllipsizeMode::ELLIPSIZE_NONE} in which case nothing is done). See {Wx::EllipsizeMode} enumeration values for more info.
    # @param maxWidth [Integer]  The maximum width of the returned string in pixels. This argument determines how much characters of the string need to be removed (and replaced by ellipsis).
    # @param flags [Integer]  One or more of the {Wx::EllipsizeFlags} enumeration values combined.
    # @return [String]
    def self.ellipsize(label, dc, mode, maxWidth, flags=Wx::EllipsizeFlags::ELLIPSIZE_FLAGS_DEFAULT) end
    
  end # Control
  

end