class GUIUtility

Helper class that performs various operations related to GUI.

Public

Methods

staticLogicalToPhysical

static GUIPhysicalUnit LogicalToPhysical(const GUILogicalUnit &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticLogicalToPhysical

static GUIPhysicalUnitF LogicalToPhysical(const GUILogicalUnitF &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticLogicalToPhysical

static GUIPhysicalPoint LogicalToPhysical(const GUILogicalPoint &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticLogicalToPhysical

static GUIPhysicalPointF LogicalToPhysical(const GUILogicalPointF &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticLogicalToPhysical

static GUIPhysicalSize LogicalToPhysical(const GUILogicalSize &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticLogicalToPhysical

static GUIPhysicalSizeF LogicalToPhysical(const GUILogicalSizeF &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticLogicalToPhysical

static GUIPhysicalArea LogicalToPhysical(const GUILogicalArea &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticLogicalToPhysical

static GUIPhysicalAreaF LogicalToPhysical(const GUILogicalAreaF &value, float scale)

Converts a value from logical pixels to physical pixels.

value
Value in logical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in physical pixels.

staticPhysicalToLogical

static GUILogicalUnit PhysicalToLogical(const GUIPhysicalUnit &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticPhysicalToLogical

static GUILogicalUnitF PhysicalToLogical(const GUIPhysicalUnitF &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticPhysicalToLogical

static GUILogicalPoint PhysicalToLogical(const GUIPhysicalPoint &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticPhysicalToLogical

static GUILogicalPointF PhysicalToLogical(const GUIPhysicalPointF &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticPhysicalToLogical

static GUILogicalSize PhysicalToLogical(const GUIPhysicalSize &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticPhysicalToLogical

static GUILogicalSizeF PhysicalToLogical(const GUIPhysicalSizeF &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticPhysicalToLogical

static GUILogicalArea PhysicalToLogical(const GUIPhysicalArea &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticPhysicalToLogical

static GUILogicalAreaF PhysicalToLogical(const GUIPhysicalAreaF &value, float scale)

Converts a value from physical pixels to logical pixels.

value
Value in physical pixels.
scale
Scale applied to physical pixels. Normally the DPI scale, but can also include per-element scale depending on the requirements.

Returns: Value in logical pixels.

staticCalculateSizeWithPaddingAndBorder

static GUILogicalSize CalculateSizeWithPaddingAndBorder(const GUILogicalSize &contentSize, const GUIStyleSheetRules &styleSheetRule)

Calculates size of the GUI element area based on the GUI content size.

This is just the content area expanded by padding and border provided by the style.

contentSize
Size of the GUI element's content area.
styleSheetRule
Style to use when rendering the GUI element.

Returns: Size of the GUI element (including the border).

staticCalculateOptimalContentSizeWithPaddingAndBorder

static GUILogicalSize CalculateOptimalContentSizeWithPaddingAndBorder(const GUIContent &content, const GUIStyleSheetRules &styleSheetRule, GUILogicalUnit wordWrapWidth = 0)

Calculates optimal size for displaying particular GUI contents.

content
Content to calculate size for.
styleSheetRule
Style that the content will be displayed with.
wordWrapWidth
If non-zero, the width at which to perform word wrap. If not provided, all the text will be placed in a single line. Only relevant if the contents contain text.

Returns: Optimal size of the GUI element, including content size, style padding and border width.

staticCalculateOptimalContentSizeWithPaddingAndBorder

static GUILogicalSize CalculateOptimalContentSizeWithPaddingAndBorder(const String &text, const GUIStyleSheetRules &styleSheetRule, GUILogicalUnit wordWrapWidth = 0)

Calculates optimal size for displaying text.

text
Text to calculate size for.
styleSheetRule
Style that the content will be displayed with.
wordWrapWidth
If non-zero, the width at which to perform word wrap. If not provided, all the text will be placed in a single line.

Returns: Optimal size of the GUI element, including content size and the style padding (area within GUI elements border).

staticRemovePaddingAndBorder

static GUILogicalArea RemovePaddingAndBorder(const GUILogicalSize &layoutSize, const GUIStyleSheetRules &styleSheetRules)

Calculates the content area based on the total element size (i.e. size as calculated by the layout).

This is the layout area potentially offset/reduced by border/padding as specified in the style sheet rules.

staticCalculateTextBounds

static Size2I CalculateTextBounds(const String &text, const HFont &font, float fontSize)

Calculates optimal content size for the provided text using the provided font and size.

Size is calculated without word wrap.

text
Text to calculate the size for.
font
Font to use for rendering the text.
fontSize
Size of individual characters in the font, in points.

Returns: Width/height required to display the text, in pixels.