.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Button: Button ====== **Inherits:** :ref:`BaseButton` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`OptionButton`, :ref:`ColorPickerButton`, :ref:`CheckButton`, :ref:`MenuButton`, :ref:`ToolButton`, :ref:`CheckBox` **Category:** Core Brief Description ----------------- Standard themed Button. Member Functions ---------------- +--------------------------------+----------------------------------------------------------------------------------------------------------+ | :ref:`Texture` | :ref:`get_button_icon` **(** **)** const | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_clip_text` **(** **)** const | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_text` **(** **)** const | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_text_align` **(** **)** const | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_flat` **(** **)** const | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_button_icon` **(** :ref:`Texture` texture **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_clip_text` **(** :ref:`bool` enabled **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_flat` **(** :ref:`bool` enabled **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_text` **(** :ref:`String` text **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------+ | void | :ref:`set_text_align` **(** :ref:`int` align **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------+ Member Variables ---------------- - :ref:`int` **align** - :ref:`bool` **clip_text** - :ref:`bool` **flat** - :ref:`Texture` **icon** - :ref:`String` **text** Numeric Constants ----------------- - **ALIGN_LEFT** = **0** --- Align the text to the left. - **ALIGN_CENTER** = **1** --- Center the text. - **ALIGN_RIGHT** = **2** --- Align the text to the right. Description ----------- Button is the standard themed button. It can contain text and an icon, and will display them according to the current :ref:`Theme`. Member Function Description --------------------------- .. _class_Button_get_button_icon: - :ref:`Texture` **get_button_icon** **(** **)** const Return the button icon. .. _class_Button_get_clip_text: - :ref:`bool` **get_clip_text** **(** **)** const Return the state of the *clip_text* property (see :ref:`set_clip_text`) .. _class_Button_get_text: - :ref:`String` **get_text** **(** **)** const Return the button text. .. _class_Button_get_text_align: - :ref:`int` **get_text_align** **(** **)** const Return the text alignment policy. .. _class_Button_is_flat: - :ref:`bool` **is_flat** **(** **)** const Return the state of the *flat* property (see :ref:`set_flat`). .. _class_Button_set_button_icon: - void **set_button_icon** **(** :ref:`Texture` texture **)** Set the icon that will be displayed next to the text inside the button area. .. _class_Button_set_clip_text: - void **set_clip_text** **(** :ref:`bool` enabled **)** Set the *clip_text* property of a Button. When this property is enabled, text that is too large to fit the button is clipped, when disabled (default) the Button will always be wide enough to hold the text. .. _class_Button_set_flat: - void **set_flat** **(** :ref:`bool` enabled **)** Set the *flat* property of a Button. Flat buttons don't display decoration unless hovered or pressed. .. _class_Button_set_text: - void **set_text** **(** :ref:`String` text **)** Set the button text, which will be displayed inside the button area. .. _class_Button_set_text_align: - void **set_text_align** **(** :ref:`int` align **)** Set the text alignment policy, using one of the ALIGN\_\* constants.