:github_url: hide .. meta:: :keywords: expandable, collapsible, collapse, accordion, details .. _class_FoldableContainer: FoldableContainer ================= **Наследует:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` Контейнер, который можно развернуть/свернуть. .. rst-class:: classref-introduction-group Описание ---------------- A container that can be expanded/collapsed, with a title that can be filled with controls, such as buttons. This is also called an accordion. The title can be positioned at the top or bottom of the container. The container can be expanded or collapsed by clicking the title or by pressing ``ui_accept`` when focused. Child control nodes are hidden when the container is collapsed. Ignores non-control children. A FoldableContainer can be grouped with other FoldableContainers so that only one of them can be opened at a time; see :ref:`foldable_group` and :ref:`FoldableGroup`. .. rst-class:: classref-reftable-group Свойства ---------------- .. table:: :widths: auto +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`FocusMode` | focus_mode | ``2`` (overrides :ref:`Control`) | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`FoldableGroup` | :ref:`foldable_group` | | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`bool` | :ref:`folded` | ``false`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`String` | :ref:`language` | ``""`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`MouseFilter` | mouse_filter | ``0`` (overrides :ref:`Control`) | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`String` | :ref:`title` | ``""`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`HorizontalAlignment` | :ref:`title_alignment` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`TitlePosition` | :ref:`title_position` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`TextDirection` | :ref:`title_text_direction` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`OverrunBehavior` | :ref:`title_text_overrun_behavior` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Методы ------------ .. table:: :widths: auto +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_title_bar_control`\ (\ control\: :ref:`Control`\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`expand`\ (\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`fold`\ (\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`remove_title_bar_control`\ (\ control\: :ref:`Control`\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Свойства темы -------------------------- .. table:: :widths: auto +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`collapsed_font_color` | ``Color(1, 1, 1, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`font_color` | ``Color(0.875, 0.875, 0.875, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`font_outline_color` | ``Color(1, 1, 1, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`hover_font_color` | ``Color(0.95, 0.95, 0.95, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`h_separation` | ``2`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`outline_size` | ``0`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Font` | :ref:`font` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`font_size` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`expanded_arrow` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`expanded_arrow_mirrored` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`folded_arrow` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`folded_arrow_mirrored` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`focus` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_collapsed_hover_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_collapsed_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_hover_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Сигналы -------------- .. _class_FoldableContainer_signal_folding_changed: .. rst-class:: classref-signal **folding_changed**\ (\ is_folded\: :ref:`bool`\ ) :ref:`🔗` Выдается при складывании/раскладывании контейнера. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Перечисления ------------------------ .. _enum_FoldableContainer_TitlePosition: .. rst-class:: classref-enumeration enum **TitlePosition**: :ref:`🔗` .. _class_FoldableContainer_constant_POSITION_TOP: .. rst-class:: classref-enumeration-constant :ref:`TitlePosition` **POSITION_TOP** = ``0`` Размещает заголовок в верхней части контейнера. .. _class_FoldableContainer_constant_POSITION_BOTTOM: .. rst-class:: classref-enumeration-constant :ref:`TitlePosition` **POSITION_BOTTOM** = ``1`` Заставляет заголовок отображаться внизу контейнера. Также делает все StyleBoxes перевернутыми по вертикали. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Описания свойств -------------------------------- .. _class_FoldableContainer_property_foldable_group: .. rst-class:: classref-property :ref:`FoldableGroup` **foldable_group** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_foldable_group**\ (\ value\: :ref:`FoldableGroup`\ ) - :ref:`FoldableGroup` **get_foldable_group**\ (\ ) :ref:`FoldableGroup`, связанный с контейнером. Когда несколько узлов **FoldableContainer** разделяют одну и ту же группу, только один из них может быть развернут. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_folded: .. rst-class:: classref-property :ref:`bool` **folded** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_folded**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_folded**\ (\ ) Если ``true``, контейнер будет свернут и скроет все свои дочерние элементы. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_language: .. rst-class:: classref-property :ref:`String` **language** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_language**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_language**\ (\ ) Language code used for text shaping algorithms. If left empty, the current locale is used instead. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title: .. rst-class:: classref-property :ref:`String` **title** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_title**\ (\ ) Текст заголовка контейнера. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_alignment: .. rst-class:: classref-property :ref:`HorizontalAlignment` **title_alignment** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_alignment**\ (\ value\: :ref:`HorizontalAlignment`\ ) - :ref:`HorizontalAlignment` **get_title_alignment**\ (\ ) Горизонтальное выравнивание текста заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_position: .. rst-class:: classref-property :ref:`TitlePosition` **title_position** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_position**\ (\ value\: :ref:`TitlePosition`\ ) - :ref:`TitlePosition` **get_title_position**\ (\ ) Позиция заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_text_direction: .. rst-class:: classref-property :ref:`TextDirection` **title_text_direction** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_text_direction**\ (\ value\: :ref:`TextDirection`\ ) - :ref:`TextDirection` **get_title_text_direction**\ (\ ) Направление написания текста заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_text_overrun_behavior: .. rst-class:: classref-property :ref:`OverrunBehavior` **title_text_overrun_behavior** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior`\ ) - :ref:`OverrunBehavior` **get_title_text_overrun_behavior**\ (\ ) Определяет поведение заголовка, когда текст длиннее доступного места. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Описания метода ------------------------------ .. _class_FoldableContainer_method_add_title_bar_control: .. rst-class:: classref-method |void| **add_title_bar_control**\ (\ control\: :ref:`Control`\ ) :ref:`🔗` Добавляет :ref:`Control`, который будет размещен рядом с заголовком контейнера, скрывая область, доступную для нажатия. Основное использование — добавление узлов :ref:`Button`, но это может быть любой :ref:`Control`. Элемент управления будет добавлен как дочерний элемент этого контейнера и удален из предыдущего родителя, если необходимо. Элементы управления будут размещены выровненными по правому краю, причем первый добавленный элемент управления будет крайним левым. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_method_expand: .. rst-class:: classref-method |void| **expand**\ (\ ) :ref:`🔗` Раскрывает контейнер и испускает сигнал :ref:`folding_changed`. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_method_fold: .. rst-class:: classref-method |void| **fold**\ (\ ) :ref:`🔗` Складывает контейнер и испускает :ref:`folding_changed`. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_method_remove_title_bar_control: .. rst-class:: classref-method |void| **remove_title_bar_control**\ (\ control\: :ref:`Control`\ ) :ref:`🔗` Удаляет :ref:`Control`, добавленный с помощью :ref:`add_title_bar_control()`. Узел не освобождается автоматически, необходимо использовать :ref:`Node.queue_free()`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Описания свойств темы ------------------------------------------ .. _class_FoldableContainer_theme_color_collapsed_font_color: .. rst-class:: classref-themeproperty :ref:`Color` **collapsed_font_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗` Цвет шрифта заголовка в свернутом виде. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_color_font_color: .. rst-class:: classref-themeproperty :ref:`Color` **font_color** = ``Color(0.875, 0.875, 0.875, 1)`` :ref:`🔗` Цвет шрифта заголовка в развернутом виде. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_color_font_outline_color: .. rst-class:: classref-themeproperty :ref:`Color` **font_outline_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗` Цвет контура шрифта заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_color_hover_font_color: .. rst-class:: classref-themeproperty :ref:`Color` **hover_font_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗` Цвет шрифта заголовка при наведении. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_constant_h_separation: .. rst-class:: classref-themeproperty :ref:`int` **h_separation** = ``2`` :ref:`🔗` Горизонтальное разделение между значком заголовка и текстом, а также между элементами управления строки заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_constant_outline_size: .. rst-class:: classref-themeproperty :ref:`int` **outline_size** = ``0`` :ref:`🔗` Размер контура шрифта заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_font_font: .. rst-class:: classref-themeproperty :ref:`Font` **font** :ref:`🔗` Шрифт заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_font_size_font_size: .. rst-class:: classref-themeproperty :ref:`int` **font_size** :ref:`🔗` Размер шрифта заголовка. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_expanded_arrow: .. rst-class:: classref-themeproperty :ref:`Texture2D` **expanded_arrow** :ref:`🔗` Значок заголовка, используемый при раскрытии. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_expanded_arrow_mirrored: .. rst-class:: classref-themeproperty :ref:`Texture2D` **expanded_arrow_mirrored** :ref:`🔗` Значок заголовка, используемый при раскрытии (для нижнего заголовка). .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_folded_arrow: .. rst-class:: classref-themeproperty :ref:`Texture2D` **folded_arrow** :ref:`🔗` Значок заголовка, используемый в сложенном виде (для макетов слева направо). .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_folded_arrow_mirrored: .. rst-class:: classref-themeproperty :ref:`Texture2D` **folded_arrow_mirrored** :ref:`🔗` Значок заголовка, используемый в свернутом виде (для макетов с справа налево). .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_focus: .. rst-class:: classref-themeproperty :ref:`StyleBox` **focus** :ref:`🔗` Фон используется, когда **FoldableContainer** имеет фокус GUI. :ref:`focus` :ref:`StyleBox` отображается *над* базовым :ref:`StyleBox`, поэтому следует использовать частично прозрачный :ref:`StyleBox`, чтобы базовый :ref:`StyleBox` оставался видимым. :ref:`StyleBox`, представляющий контур или подчеркивание, хорошо подходит для этой цели. Чтобы отключить визуальный эффект фокуса, назначьте ресурс :ref:`StyleBoxEmpty`. Обратите внимание, что отключение визуального эффекта фокуса навредит удобству использования навигации с помощью клавиатуры/контроллера, поэтому это не рекомендуется по соображениям доступности. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **panel** :ref:`🔗` Фон по умолчанию для **FoldableContainer**. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_collapsed_hover_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_collapsed_hover_panel** :ref:`🔗` Фон, используемый при попадании курсора мыши в область заголовка в свернутом состоянии. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_collapsed_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_collapsed_panel** :ref:`🔗` Фон по умолчанию для заголовка **FoldableContainer** в свернутом виде. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_hover_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_hover_panel** :ref:`🔗` Фон, используемый при попадании курсора мыши в область заголовка при его развертывании. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_panel** :ref:`🔗` Фон по умолчанию для заголовка **FoldableContainer** при раскрытии. .. |virtual| replace:: :abbr:`virtual (Этот метод обычно должен быть переопределен пользователем, чтобы иметь какой-либо эффект.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (Этот метод не имеет побочных эффектов. Он не изменяет ни одну из переменных-членов экземпляра.)` .. |vararg| replace:: :abbr:`vararg (Этот метод принимает любое количество аргументов после описанных здесь.)` .. |constructor| replace:: :abbr:`constructor (Этот метод используется для создания типа.)` .. |static| replace:: :abbr:`static (Этот метод не нуждается в вызове экземпляра, поэтому его можно вызвать напрямую, используя имя класса.)` .. |operator| replace:: :abbr:`operator (Этот метод описывает допустимый оператор для использования с этим типом в качестве левого операнда.)` .. |bitfield| replace:: :abbr:`BitField (Это значение является целым числом, составленным как битовая маска следующих флагов.)` .. |void| replace:: :abbr:`void (Нет возвращаемого значения.)`