From 752402cf354a105496ed9a86038f83f56d0706fd Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 19 Jan 2023 19:14:09 +0300 Subject: Clean-up, harmonize, and improve StyleBox API - Make all margin properties follow the same naming convention (their getter and setter too). - Remove a virtual counterpart of `get_style_margin` from API. - Allow to override `get_minimum_size` from scripting and remove `get_center_size`. --- doc/classes/StyleBox.xml | 37 +++++++++----------------- doc/classes/StyleBoxTexture.xml | 58 ++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 53 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/StyleBox.xml b/doc/classes/StyleBox.xml index ff6d4d8821..4a63f4488c 100644 --- a/doc/classes/StyleBox.xml +++ b/doc/classes/StyleBox.xml @@ -17,21 +17,16 @@ - - - - - - - - + + + Virtual method to be implemented by the user. Returns a custom minimum size that the stylebox must respect when drawing. By default [method get_minimum_size] only takes content margins into account. This method can be overridden to add another size restriction. A combination of the default behavior and the output of this method will be used, to account for both sizes. @@ -50,10 +45,11 @@ The [RID] value can either be the result of [method CanvasItem.get_canvas_item] called on an existing [CanvasItem]-derived node, or directly from creating a canvas item in the [RenderingServer] with [method RenderingServer.canvas_item_create]. - - + + + - Returns the size of this [StyleBox] without the margins. + Returns the default margin of the specified [enum Side]. @@ -62,13 +58,6 @@ Returns the [CanvasItem] that handles its [constant CanvasItem.NOTIFICATION_DRAW] or [method CanvasItem._draw] callback at this moment. - - - - - Returns the default margin of the specified [enum Side]. - - @@ -89,7 +78,7 @@ Returns the "offset" of a stylebox. This helper function returns a value equivalent to [code]Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))[/code]. - + @@ -97,7 +86,7 @@ Sets the default value of the specified [enum Side] to [param offset] pixels. - + @@ -114,21 +103,21 @@ - + The bottom margin for the contents of this style box. Increasing this value reduces the space available to the contents from the bottom. If this value is negative, it is ignored and a child-specific margin is used instead. For example for [StyleBoxFlat] the border thickness (if any) is used instead. It is up to the code using this style box to decide what these contents are: for example, a [Button] respects this content margin for the textual contents of the button. [method get_margin] should be used to fetch this value as consumer instead of reading these properties directly. This is because it correctly respects negative values and the fallback mentioned above. - + The left margin for the contents of this style box. Increasing this value reduces the space available to the contents from the left. Refer to [member content_margin_bottom] for extra considerations. - + The right margin for the contents of this style box. Increasing this value reduces the space available to the contents from the right. Refer to [member content_margin_bottom] for extra considerations. - + The top margin for the contents of this style box. Increasing this value reduces the space available to the contents from the top. Refer to [member content_margin_bottom] for extra considerations. diff --git a/doc/classes/StyleBoxTexture.xml b/doc/classes/StyleBoxTexture.xml index aeba777b43..745187ed63 100644 --- a/doc/classes/StyleBoxTexture.xml +++ b/doc/classes/StyleBoxTexture.xml @@ -9,36 +9,36 @@ - + Returns the expand margin size of the specified [enum Side]. - + Returns the margin size of the specified [enum Side]. - + - + + - Sets the expand margin to [param size] pixels for all margins. + Sets the expand margin to [param size] pixels for the specified [enum Side]. - + - - + - Sets the expand margin to [param size] pixels for the specified [enum Side]. + Sets the expand margin to [param size] pixels for all margins. - + @@ -46,7 +46,7 @@ Sets the margin to [param size] pixels for the specified [enum Side]. - + @@ -64,48 +64,48 @@ If [code]true[/code], the nine-patch texture's center tile will be drawn. - + Expands the bottom margin of this style box when drawing, causing it to be drawn larger than requested. - + Expands the left margin of this style box when drawing, causing it to be drawn larger than requested. - + Expands the right margin of this style box when drawing, causing it to be drawn larger than requested. - + Expands the top margin of this style box when drawing, causing it to be drawn larger than requested. - + + Modulates the color of the texture when this style box is drawn. + + + Species a sub-region of the texture to use. + This is equivalent to first wrapping the texture in an [AtlasTexture] with the same region. + + + The texture to use when drawing this style box. + + Increases the bottom margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the bottom border of the 3×3 box. This is also the value used as fallback for [member StyleBox.content_margin_bottom] if it is negative. - + Increases the left margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the left border of the 3×3 box. This is also the value used as fallback for [member StyleBox.content_margin_left] if it is negative. - + Increases the right margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the right border of the 3×3 box. This is also the value used as fallback for [member StyleBox.content_margin_right] if it is negative. - + Increases the top margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the top border of the 3×3 box. This is also the value used as fallback for [member StyleBox.content_margin_top] if it is negative. - - Modulates the color of the texture when this style box is drawn. - - - Species a sub-region of the texture to use. - This is equivalent to first wrapping the texture in an [AtlasTexture] with the same region. - - - The texture to use when drawing this style box. - -- cgit v1.2.3