Skip to content
0.2.0-dev Download ZIP
45 lines ·2.4 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="MarginContainer" inherits="Container" api_type="core" keywords="padding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A container that keeps a margin around its child controls.
5 </brief_description>
6 <description>
7 [MarginContainer] adds an adjustable margin on each side of its child controls. The margins are added around all children, not around each individual one. To control the [MarginContainer]'s margins, use the [code]margin_*[/code] theme properties listed below.
8 [b]Note:[/b] The margin sizes are theme overrides, not normal properties. This is an example of how to change them in code:
9 [codeblocks]
10 [gdscript]
11 # This code sample assumes the current script is extending MarginContainer.
12 var margin_value = 100
13 add_theme_constant_override("margin_top", margin_value)
14 add_theme_constant_override("margin_left", margin_value)
15 add_theme_constant_override("margin_bottom", margin_value)
16 add_theme_constant_override("margin_right", margin_value)
17 [/gdscript]
18 [csharp]
19 // This code sample assumes the current script is extending MarginContainer.
20 int marginValue = 100;
21 AddThemeConstantOverride("margin_top", marginValue);
22 AddThemeConstantOverride("margin_left", marginValue);
23 AddThemeConstantOverride("margin_bottom", marginValue);
24 AddThemeConstantOverride("margin_right", marginValue);
25 [/csharp]
26 [/codeblocks]
27 </description>
28 <tutorials>
29 <link title="Using Containers">$DOCS_URL/tutorials/ui/gui_containers.html</link>
30 </tutorials>
31 <theme_items>
32 <theme_item name="margin_bottom" data_type="constant" type="int" default="0">
33 Offsets towards the inside direct children of the container by this amount of pixels from the bottom.
34 </theme_item>
35 <theme_item name="margin_left" data_type="constant" type="int" default="0">
36 Offsets towards the inside direct children of the container by this amount of pixels from the left.
37 </theme_item>
38 <theme_item name="margin_right" data_type="constant" type="int" default="0">
39 Offsets towards the inside direct children of the container by this amount of pixels from the right.
40 </theme_item>
41 <theme_item name="margin_top" data_type="constant" type="int" default="0">
42 Offsets towards the inside direct children of the container by this amount of pixels from the top.
43 </theme_item>
44 </theme_items>
45</class>