StyleBoxFlat

Customizable StyleBox with a given set of parameters (no texture required).

This StyleBox can be used to achieve all kinds of looks without the need of a texture. The following properties are customizable: - Color - Border width (individual width for each border) - Rounded corners (individual radius for each corner) - Shadow (with blur and offset) Setting corner radius to high values is allowed. As soon as corners overlap, the stylebox will switch to a relative system. Example:

More...
@GodotBaseClass
struct StyleBoxFlat {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

getAaSize
long getAaSize()
getBgColor
Color getBgColor()
getBorderBlend
bool getBorderBlend()
getBorderColor
Color getBorderColor()
getBorderWidth
long getBorderWidth(long margin)

Returns the given margin's border width. See margin for possible values.

getBorderWidthMin
long getBorderWidthMin()

Returns the smallest border width out of all four borders.

getCornerDetail
long getCornerDetail()
getCornerRadius
long getCornerRadius(long corner)

Returns the given corner's radius. See corner for possible values.

getExpandMargin
double getExpandMargin(long margin)

Returns the size of the given margin's expand margin. See margin for possible values.

getShadowColor
Color getShadowColor()
getShadowOffset
Vector2 getShadowOffset()
getShadowSize
long getShadowSize()
isAntiAliased
bool isAntiAliased()
isDrawCenterEnabled
bool isDrawCenterEnabled()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(StyleBoxFlat other)
opEquals
bool opEquals(typeof(null) n)
setAaSize
void setAaSize(long size)
setAntiAliased
void setAntiAliased(bool anti_aliased)
setBgColor
void setBgColor(Color color)
setBorderBlend
void setBorderBlend(bool blend)
setBorderColor
void setBorderColor(Color color)
setBorderWidth
void setBorderWidth(long margin, long width)

Sets the border width to width pixels for the given margin. See margin for possible values.

setBorderWidthAll
void setBorderWidthAll(long width)

Sets the border width to width pixels for all margins.

setCornerDetail
void setCornerDetail(long detail)
setCornerRadius
void setCornerRadius(long corner, long radius)

Sets the corner radius to radius pixels for the given corner. See corner for possible values.

setCornerRadiusAll
void setCornerRadiusAll(long radius)

Sets the corner radius to radius pixels for all corners.

setCornerRadiusIndividual
void setCornerRadiusIndividual(long radius_top_left, long radius_top_right, long radius_bottom_right, long radius_bottom_left)

Sets the corner radius for each corner to radius_top_left, radius_top_right, radius_bottom_right, and radius_bottom_left pixels.

setDrawCenter
void setDrawCenter(bool draw_center)
setExpandMargin
void setExpandMargin(long margin, double size)

Sets the expand margin to size pixels for the given margin. See margin for possible values.

setExpandMarginAll
void setExpandMarginAll(double size)

Sets the expand margin to size pixels for all margins.

setExpandMarginIndividual
void setExpandMarginIndividual(double size_left, double size_top, double size_right, double size_bottom)

Sets the expand margin for each margin to size_left, size_top, size_right, and size_bottom pixels.

setShadowColor
void setShadowColor(Color color)
setShadowOffset
void setShadowOffset(Vector2 offset)
setShadowSize
void setShadowSize(long size)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

antiAliasing
bool antiAliasing [@property getter]
bool antiAliasing [@property setter]

Antialiasing draws a small ring around the edges, which fades to transparency. As a result, edges look much smoother. This is only noticeable when using rounded corners.

antiAliasingSize
long antiAliasingSize [@property getter]
long antiAliasingSize [@property setter]

This changes the size of the faded ring. Higher values can be used to achieve a "blurry" effect.

bgColor
Color bgColor [@property getter]
Color bgColor [@property setter]

The background color of the stylebox.

borderBlend
bool borderBlend [@property getter]
bool borderBlend [@property setter]

If true, the border will fade into the background color.

borderColor
Color borderColor [@property getter]
Color borderColor [@property setter]

Sets the color of the border.

borderWidthBottom
long borderWidthBottom [@property getter]
long borderWidthBottom [@property setter]

Border width for the bottom border.

borderWidthLeft
long borderWidthLeft [@property getter]
long borderWidthLeft [@property setter]

Border width for the left border.

borderWidthRight
long borderWidthRight [@property getter]
long borderWidthRight [@property setter]

Border width for the right border.

borderWidthTop
long borderWidthTop [@property getter]
long borderWidthTop [@property setter]

Border width for the top border.

cornerDetail
long cornerDetail [@property getter]
long cornerDetail [@property setter]

This sets the number of vertices used for each corner. Higher values result in rounder corners but take more processing power to compute. When choosing a value, you should take the corner radius (setCornerRadiusAll) into account. For corner radii less than 10, 4 or 5 should be enough. For corner radii less than 30, values between 8 and 12 should be enough. A corner detail of 1 will result in chamfered corners instead of rounded corners, which is useful for some artistic effects.

cornerRadiusBottomLeft
long cornerRadiusBottomLeft [@property getter]
long cornerRadiusBottomLeft [@property setter]

The bottom-left corner's radius. If 0, the corner is not rounded.

cornerRadiusBottomRight
long cornerRadiusBottomRight [@property getter]
long cornerRadiusBottomRight [@property setter]

The bottom-right corner's radius. If 0, the corner is not rounded.

cornerRadiusTopLeft
long cornerRadiusTopLeft [@property getter]
long cornerRadiusTopLeft [@property setter]

The top-left corner's radius. If 0, the corner is not rounded.

cornerRadiusTopRight
long cornerRadiusTopRight [@property getter]
long cornerRadiusTopRight [@property setter]

The top-right corner's radius. If 0, the corner is not rounded.

drawCenter
bool drawCenter [@property getter]
bool drawCenter [@property setter]

Toggles drawing of the inner part of the stylebox.

expandMarginBottom
double expandMarginBottom [@property getter]
double expandMarginBottom [@property setter]

Expands the stylebox outside of the control rect on the bottom edge. Useful in combination with borderWidthBottom to draw a border outside the control rect.

expandMarginLeft
double expandMarginLeft [@property getter]
double expandMarginLeft [@property setter]

Expands the stylebox outside of the control rect on the left edge. Useful in combination with borderWidthLeft to draw a border outside the control rect.

expandMarginRight
double expandMarginRight [@property getter]
double expandMarginRight [@property setter]

Expands the stylebox outside of the control rect on the right edge. Useful in combination with borderWidthRight to draw a border outside the control rect.

expandMarginTop
double expandMarginTop [@property getter]
double expandMarginTop [@property setter]

Expands the stylebox outside of the control rect on the top edge. Useful in combination with borderWidthTop to draw a border outside the control rect.

shadowColor
Color shadowColor [@property getter]
Color shadowColor [@property setter]

The color of the shadow. This has no effect if shadowSize is lower than 1.

shadowOffset
Vector2 shadowOffset [@property getter]
Vector2 shadowOffset [@property setter]

The shadow offset in pixels. Adjusts the position of the shadow relatively to the stylebox.

shadowSize
long shadowSize [@property getter]
long shadowSize [@property setter]

The shadow size in pixels.

Static functions

_new
StyleBoxFlat _new()

Construct a new instance of StyleBoxFlat. Note: use memnew!StyleBoxFlat instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Detailed Description

height = 30 corner_radius_top_left = 50 corner_radius_bottom_left = 100

The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will never be more than the height. Result:

corner radius top left

10

corner radius bottom left

20

Meta