Class GUILayout
The interface for GUI with automatic layout.
Inheritance
Inherited Members
Namespace:ImGui
Assembly:ImGui.dll
Syntax
public class GUILayout
Methods
| Improve this DocBeginHorizontal(LayoutOption[])
Begin a horizontal layout group.
Declaration
public static void BeginHorizontal(params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
LayoutOption[] | options |
BeginVertical(LayoutOption[])
Begin a vertical layout group.
Declaration
public static void BeginVertical(params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
LayoutOption[] | options |
Button(String, String, LayoutOption[])
Create an auto-layout button. When the user click it, something will happen immediately.
Declaration
public static bool Button(string text, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | text to display on the button |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Returns
Type | Description |
---|---|
System.Boolean | true when the users clicks the button. |
EndHorizontal()
End a horizontal layout group.
Declaration
public static void EndHorizontal()
EndVertical()
End a vertical layout group.
Declaration
public static void EndVertical()
ExpandHeight(Boolean)
Set whether the height of a control should be expanded to occupy as much space as possible.
Declaration
public static LayoutOption ExpandHeight(bool expand)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | expand | expanded? |
Returns
Type | Description |
---|---|
LayoutOption | A LayoutOption that will expand the height of a control/group. |
ExpandWidth(Boolean)
Set whether the width of a control should be expanded to occupy as much space as possible.
Declaration
public static LayoutOption ExpandWidth(bool expand)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | expand | expanded? |
Returns
Type | Description |
---|---|
LayoutOption | A LayoutOption that will expand the width of a control/group. |
FlexibleSpace()
Put a expanded space inside a layout group.
Declaration
public static void FlexibleSpace()
Height(Double)
Set the height of a control.
Declaration
public static LayoutOption Height(double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | height | height value |
Returns
Type | Description |
---|---|
LayoutOption | A LayoutOption that will set the height of a control/group. |
HoverButton(String, String, LayoutOption[])
Create an auto-layout button that will be actived when the mouse is over it.
Declaration
public static bool HoverButton(string text, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | text to display on the button |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Returns
Type | Description |
---|---|
System.Boolean | whether it is activated (the mouse is over it) |
Image(String, String, LayoutOption[])
Create an auto-layout image.
Declaration
public static void Image(string filePath, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | file path of the image to display. The path should be relative to current dir or absolute. |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Label(String, String, LayoutOption[])
Create an auto-layout label.
Declaration
public static void Label(string text, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | text to display on the label |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
PolygonButton(IReadOnlyList<Point>, Rect, String, String, LayoutOption[])
Create an auto-layout polyon-button.
Declaration
public static bool PolygonButton(IReadOnlyList<Point> points, Rect textRect, string text, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IReadOnlyList<Point> | points | Point list of the polygon. |
Rect | textRect | the rect that occupied by the text |
System.String | text | text to display on the button |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Returns
Type | Description |
---|---|
System.Boolean | true when the users clicks the button. |
Slider(Size, Double, Double, Double, String, LayoutOption[])
Create an auto-layout horizontal slider that user can drag to select a value.
Declaration
public static double Slider(Size size, double value, double minValue, double maxValue, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
Size | size | size of the slider |
System.Double | value | The value the slider shows. |
System.Double | minValue | The value at the left end of the slider. |
System.Double | maxValue | The value at the right end of the slider. |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Returns
Type | Description |
---|---|
System.Double | The value set by the user. |
Remarks
minValue <= value <= maxValue
Space(Double)
Put a fixed-size space inside a layout group.
Declaration
public static void Space(double pixels)
Parameters
Type | Name | Description |
---|---|---|
System.Double | pixels | size of the space |
StretchHeight(Int32)
Set the factor when expanding the height of a control.
Declaration
public static LayoutOption StretchHeight(int factor)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | factor | the value of the factor |
Returns
Type | Description |
---|---|
LayoutOption | A LayoutOption that will set the factor when expanding the height of a control/group. |
StretchWidth(Int32)
Set the factor when expanding the width of a control.
Declaration
public static LayoutOption StretchWidth(int factor)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | factor | the value of the factor |
Returns
Type | Description |
---|---|
LayoutOption | A LayoutOption that will set the factor when expanding the width of a control/group. |
Toggle(Boolean, String, LayoutOption[])
Create an auto-layout toggle (check-box).
Declaration
public static bool Toggle(bool value, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | value | Is this toggle checked or unchecked? |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Returns
Type | Description |
---|---|
System.Boolean | new value of the toggle |
ToggleButton(String, Boolean, String, LayoutOption[])
Create an auto-layout button that acts like a toggle.
Declaration
public static bool ToggleButton(string text, bool value, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | text to display on the button |
System.Boolean | value | Is this toggle checked or unchecked? |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Returns
Type | Description |
---|---|
System.Boolean | new value of the toggle-button |
VSlider(Size, Double, Double, Double, String, LayoutOption[])
Create an auto-layout vertical slider that user can drag to select a value.
Declaration
public static double VSlider(Size size, double value, double minValue, double maxValue, string id, params LayoutOption[] options)
Parameters
Type | Name | Description |
---|---|---|
Size | size | size of the slider |
System.Double | value | The value the slider shows. |
System.Double | minValue | The value at the top end of the slider. |
System.Double | maxValue | The value at the bottom end of the slider. |
System.String | id | the unique id of this control |
LayoutOption[] | options | layout options that specify layouting properties. See also Width(Double), Height(Double), ExpandWidth(Boolean), ExpandHeight(Boolean), StretchWidth(Int32), StretchHeight(Int32) |
Returns
Type | Description |
---|---|
System.Double | The value set by the user. |
Remarks
minValue <= value <= maxValue
Width(Double)
Set the width of a control.
Declaration
public static LayoutOption Width(double width)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | width value |
Returns
Type | Description |
---|---|
LayoutOption | A LayoutOption that will set the width of a control/group. |