Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FoldableContainer #234

Open
wants to merge 1 commit into
base: blazium-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions doc/classes/FoldableContainer.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="FoldableContainer" inherits="Container" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<class name="FoldableContainer" inherits="Container" keywords="expandable, collapsible, collapse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A container that can be expanded/collapsed.
</brief_description>
<description>
A container that can be expanded/collapsed, with a title that can contain buttons.
The title can be positioned at the top or bottom of the container.
The container can be expanded or collapsed by clicking the title.
Buttons can be added with [method add_button].
Buttons can be toggled by setting the [code]toggle_mode[/code] property to [code]true[/code].
Buttons can be hidden or disabled with [method set_button_hidden] and [method set_button_disabled].
Buttons can have metadata associated with them, which can be retrieved with [method get_button_metadata] and set with [method set_button_metadata].
Buttons can have tooltips associated with them, which can be retrieved with [method get_button_tooltip] and set with [method set_button_tooltip].
Buttons can have an ID associated with them, which can be retrieved with [method get_button_id] and set with [method set_button_id].
Buttons only support icons not text, and it can be retrieved with [method get_button_icon] and changed with [method set_button_icon].
The container can be expanded or collapsed by clicking the title or by pressing [code]ui_accept[/code] when focused.
Child control nodes are hidden when the container is collapsed. Ignores non-control children.
</description>
<tutorials>
</tutorials>
Expand All @@ -27,17 +21,16 @@
Adds a button to the title.
</description>
</method>
<method name="get_button_at_position" qualifiers="const">
<return type="int" />
<param index="0" name="position" type="Vector2" />
<method name="clear">
<return type="void" />
<description>
Returns the button's ID at the given position.
</description>
</method>
<method name="get_button_count" qualifiers="const">
<method name="get_button_at_position" qualifiers="const">
<return type="int" />
<param index="0" name="position" type="Vector2" />
<description>
Returns the total number of buttons.
Returns the button's ID at the given position. Returns -1 if no button was found at this position, or if the button is disabled or hidden.
</description>
</method>
<method name="get_button_icon" qualifiers="const">
Expand Down Expand Up @@ -72,11 +65,11 @@
<return type="Rect2" />
<param index="0" name="index" type="int" />
<description>
Returns the Rect2 which represents the position and size of the button.
Returns the [Rect2] which represents the position and size of the button.
</description>
</method>
<method name="get_button_toggle_mode" qualifiers="const">
<return type="int" />
<return type="bool" />
<param index="0" name="index" type="int" />
<description>
Returns whether the button at the given index is a toggle button.
Expand Down Expand Up @@ -115,7 +108,7 @@
<param index="0" name="from" type="int" />
<param index="1" name="to" type="int" />
<description>
Changes the button's position ie. index.
Changes the button's index.
</description>
</method>
<method name="remove_button">
Expand Down Expand Up @@ -191,6 +184,8 @@
</method>
</methods>
<members>
<member name="button_count" type="int" setter="set_button_count" getter="get_button_count" default="0">
</member>
<member name="expanded" type="bool" setter="set_expanded" getter="is_expanded" default="true">
If [code]false[/code], the container will becomes folded and will hide all it's children.
</member>
Expand All @@ -209,24 +204,22 @@
The Container's title text.
</member>
<member name="title_alignment" type="int" setter="set_title_alignment" getter="get_title_alignment" enum="HorizontalAlignment" default="0">
Title's text horizontal alignment as defined in the [enum HorizontalAlignment] enum.
Title's horizontal text alignment as defined in the [enum HorizontalAlignment] enum.
</member>
<member name="title_position" type="int" setter="set_title_position" getter="get_title_position" enum="FoldableContainer.TitlePosition" default="0">
Title's position as defined in the [enum TitlePosition] enum.
</member>
</members>
<signals>
<signal name="button_pressed">
<param index="0" name="id" type="int" />
<param index="1" name="index" type="int" />
<param index="0" name="index" type="int" />
<description>
Emitted when a button is pressed.
</description>
</signal>
<signal name="button_toggled">
<param index="0" name="toggled_on" type="bool" />
<param index="1" name="id" type="int" />
<param index="2" name="index" type="int" />
<param index="1" name="index" type="int" />
<description>
Emitted when a button is toggled.
</description>
Expand Down
2 changes: 1 addition & 1 deletion editor/themes/editor_theme_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("title_hover_panel", "FoldableContainer", foldable_container_hover);
p_theme->set_stylebox("title_collapsed_panel", "FoldableContainer", make_flat_stylebox(p_config.dark_color_1.darkened(0.125), p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin));
p_theme->set_stylebox("title_collapsed_hover_panel", "FoldableContainer", make_flat_stylebox(p_config.dark_color_1.lerp(p_config.base_color, 0.4), p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin));
Ref<StyleBoxFlat> foldable_container_panel = make_flat_stylebox(p_config.dark_color_1, p_config.forced_even_separation, p_config.base_margin, p_config.base_margin, p_config.base_margin);
Ref<StyleBoxFlat> foldable_container_panel = make_flat_stylebox(p_config.dark_color_1, p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin);
foldable_container_panel->set_corner_radius(CORNER_TOP_LEFT, 0);
foldable_container_panel->set_corner_radius(CORNER_TOP_RIGHT, 0);
p_theme->set_stylebox(SceneStringName(panel), "FoldableContainer", foldable_container_panel);
Expand Down
Loading
Loading