:github_url: hide .. _class_FlowContainer: FlowContainer ============= **繼承:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **被繼承:** :ref:`HFlowContainer`, :ref:`VFlowContainer` 將子控制項橫向或縱向排列並在邊界處換行的容器。 .. rst-class:: classref-introduction-group 說明 ---- 將子控制項橫向或縱向排列並在邊界處換行的容器。類似於書本中文字在一行中寫不下以後的換行方式。 .. rst-class:: classref-introduction-group 教學 ---- - :doc:`使用容器 <../tutorials/ui/gui_containers>` .. rst-class:: classref-reftable-group 屬性 ---- .. table:: :widths: auto +------------------------------------------------------------------------+------------------------------------------------------------------------------+-----------+ | :ref:`AlignmentMode` | :ref:`alignment` | ``0`` | +------------------------------------------------------------------------+------------------------------------------------------------------------------+-----------+ | :ref:`LastWrapAlignmentMode` | :ref:`last_wrap_alignment` | ``0`` | +------------------------------------------------------------------------+------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`reverse_fill` | ``false`` | +------------------------------------------------------------------------+------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`vertical` | ``false`` | +------------------------------------------------------------------------+------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-reftable-group 方法 ---- .. table:: :widths: auto +-----------------------+--------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_line_count`\ (\ ) |const| | +-----------------------+--------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group 主題屬性 -------- .. table:: :widths: auto +-----------------------+----------------------------------------------------------------------+-------+ | :ref:`int` | :ref:`h_separation` | ``4`` | +-----------------------+----------------------------------------------------------------------+-------+ | :ref:`int` | :ref:`v_separation` | ``4`` | +-----------------------+----------------------------------------------------------------------+-------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 列舉 ---- .. _enum_FlowContainer_AlignmentMode: .. rst-class:: classref-enumeration enum **AlignmentMode**: :ref:`🔗` .. _class_FlowContainer_constant_ALIGNMENT_BEGIN: .. rst-class:: classref-enumeration-constant :ref:`AlignmentMode` **ALIGNMENT_BEGIN** = ``0`` 子控制項會被排列在該容器的開頭,如果是垂直朝向則為頂部,如果是水平朝向則為左側(RTL 佈局時為右側)。 .. _class_FlowContainer_constant_ALIGNMENT_CENTER: .. rst-class:: classref-enumeration-constant :ref:`AlignmentMode` **ALIGNMENT_CENTER** = ``1`` 子控制項會在該容器裡居中。 .. _class_FlowContainer_constant_ALIGNMENT_END: .. rst-class:: classref-enumeration-constant :ref:`AlignmentMode` **ALIGNMENT_END** = ``2`` 子控制項會被排列在該容器的末尾,如果是垂直朝向則為底部,如果是水平朝向則為右側(RTL 佈局時為左側)。 .. rst-class:: classref-item-separator ---- .. _enum_FlowContainer_LastWrapAlignmentMode: .. rst-class:: classref-enumeration enum **LastWrapAlignmentMode**: :ref:`🔗` .. _class_FlowContainer_constant_LAST_WRAP_ALIGNMENT_INHERIT: .. rst-class:: classref-enumeration-constant :ref:`LastWrapAlignmentMode` **LAST_WRAP_ALIGNMENT_INHERIT** = ``0`` The last partially filled row or column will wrap aligned to the previous row or column in accordance with :ref:`alignment`. .. _class_FlowContainer_constant_LAST_WRAP_ALIGNMENT_BEGIN: .. rst-class:: classref-enumeration-constant :ref:`LastWrapAlignmentMode` **LAST_WRAP_ALIGNMENT_BEGIN** = ``1`` The last partially filled row or column will wrap aligned to the beginning of the previous row or column. .. _class_FlowContainer_constant_LAST_WRAP_ALIGNMENT_CENTER: .. rst-class:: classref-enumeration-constant :ref:`LastWrapAlignmentMode` **LAST_WRAP_ALIGNMENT_CENTER** = ``2`` The last partially filled row or column will wrap aligned to the center of the previous row or column. .. _class_FlowContainer_constant_LAST_WRAP_ALIGNMENT_END: .. rst-class:: classref-enumeration-constant :ref:`LastWrapAlignmentMode` **LAST_WRAP_ALIGNMENT_END** = ``3`` The last partially filled row or column will wrap aligned to the end of the previous row or column. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 屬性說明 -------- .. _class_FlowContainer_property_alignment: .. rst-class:: classref-property :ref:`AlignmentMode` **alignment** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_alignment**\ (\ value\: :ref:`AlignmentMode`\ ) - :ref:`AlignmentMode` **get_alignment**\ (\ ) 該容器子節點的對齊方式(必須是 :ref:`ALIGNMENT_BEGIN`\ 、\ :ref:`ALIGNMENT_CENTER`\ 、\ :ref:`ALIGNMENT_END` 之一)。 .. rst-class:: classref-item-separator ---- .. _class_FlowContainer_property_last_wrap_alignment: .. rst-class:: classref-property :ref:`LastWrapAlignmentMode` **last_wrap_alignment** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_last_wrap_alignment**\ (\ value\: :ref:`LastWrapAlignmentMode`\ ) - :ref:`LastWrapAlignmentMode` **get_last_wrap_alignment**\ (\ ) The wrap behavior of the last, partially filled row or column (must be one of :ref:`LAST_WRAP_ALIGNMENT_INHERIT`, :ref:`LAST_WRAP_ALIGNMENT_BEGIN`, :ref:`LAST_WRAP_ALIGNMENT_CENTER`, or :ref:`LAST_WRAP_ALIGNMENT_END`). .. rst-class:: classref-item-separator ---- .. _class_FlowContainer_property_reverse_fill: .. rst-class:: classref-property :ref:`bool` **reverse_fill** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_reverse_fill**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_reverse_fill**\ (\ ) If ``true``, reverses fill direction. Horizontal **FlowContainer**\ s will fill rows bottom to top, vertical **FlowContainer**\ s will fill columns right to left. When using a vertical **FlowContainer** with a right to left :ref:`Control.layout_direction`, columns will fill left to right instead. .. rst-class:: classref-item-separator ---- .. _class_FlowContainer_property_vertical: .. rst-class:: classref-property :ref:`bool` **vertical** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_vertical**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_vertical**\ (\ ) 如果為 ``true``\ ,則 **FlowContainer** 將垂直排列子節點,而不是水平排列。 使用 :ref:`HFlowContainer` 和 :ref:`VFlowContainer` 時不能改變。 .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 方法說明 -------- .. _class_FlowContainer_method_get_line_count: .. rst-class:: classref-method :ref:`int` **get_line_count**\ (\ ) |const| :ref:`🔗` 返回目前的行數。 .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 主題屬性說明 ------------ .. _class_FlowContainer_theme_constant_h_separation: .. rst-class:: classref-themeproperty :ref:`int` **h_separation** = ``4`` :ref:`🔗` The horizontal separation of child nodes. .. rst-class:: classref-item-separator ---- .. _class_FlowContainer_theme_constant_v_separation: .. rst-class:: classref-themeproperty :ref:`int` **v_separation** = ``4`` :ref:`🔗` The vertical separation of child nodes. .. |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 (無回傳值。)`