Interface IUIFactory
Factory for creating UI controls (buttons, textboxes, etc).
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IUIFactory
Methods
| Improve this Doc View SourceCreateScrollingPanel(IPanel, Single, Single, Single)
Adds horizontal and vertical scrollbars on the edges of the panel that allow to scroll the contents on the panel. The scrollbars are only shown if the contents is bigger than panel.
The function expands the given panel by a gutter size which is used to display the scrollbars, and returns a contents panel with the original size, in which to put the scrolled contents.
Declaration
IPanel CreateScrollingPanel(IPanel panel, float gutterSize = 15F, float stepHorizontal = 10F, float stepVertical = 10F)
Parameters
Type | Name | Description |
---|---|---|
IPanel | panel | Panel. |
System.Single | gutterSize | The gutter size (which contains the scrollbars). |
System.Single | stepHorizontal | The step when clicking the arrows on the horizontal scrollbar. |
System.Single | stepVertical | The step when clicking the arrows on the vertical scrollbar. |
Returns
Type | Description |
---|---|
IPanel |
GetButton(String, ButtonAnimation, ButtonAnimation, ButtonAnimation, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single)
Creats a button.
Declaration
IButton GetButton(string id, ButtonAnimation idle, ButtonAnimation hovered, ButtonAnimation pushed, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the button (it has to be globally unique across all entities). |
ButtonAnimation | idle | Idle animation (when the button is not clicked on or hovered). |
ButtonAnimation | hovered | Hovered animation (when the mouse is hovering the button). |
ButtonAnimation | pushed | Pushed animation (when clicking the button). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the button. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the idle animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the idle animation's first frame). |
Returns
Type | Description |
---|---|
IButton | The button. |
GetButton(String, IAnimation, IAnimation, IAnimation, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single)
Creats a button.
Declaration
IButton GetButton(string id, IAnimation idle, IAnimation hovered, IAnimation pushed, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the button (it has to be globally unique across all entities). |
IAnimation | idle | Idle animation (when the button is not clicked on or hovered). |
IAnimation | hovered | Hovered animation (when the mouse is hovering the button). |
IAnimation | pushed | Pushed animation (when clicking the button). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the button. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the idle animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the idle animation's first frame). |
Returns
Type | Description |
---|---|
IButton | The button. |
GetButton(String, String, String, String, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single)
Creats a button.
Declaration
IButton GetButton(string id, string idleImagePath, string hoveredImagePath, string pushedImagePath, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the panel (it has to be globally unique across all entities). |
System.String | idleImagePath | Idle image resourece/file path (when the button is not clicked on or hovered). |
System.String | hoveredImagePath | Hovered image resource/file path (when the mouse is hovering the button). |
System.String | pushedImagePath | Pushed image resource/file path (when clicking the button). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the button. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the idle animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the idle animation's first frame) |
Returns
Type | Description |
---|---|
IButton | The button. |
GetButtonAsync(String, String, String, String, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single)
Creats a button asynchronously.
Declaration
Task<IButton> GetButtonAsync(string id, string idleImagePath, string hoveredImagePath, string pushedImagePath, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the panel (it has to be globally unique across all entities). |
System.String | idleImagePath | Idle image resourece/file path (when the button is not clicked on or hovered). |
System.String | hoveredImagePath | Hovered image resource/file path (when the mouse is hovering the button). |
System.String | pushedImagePath | Pushed image resource/file path (when clicking the button). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the button. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the idle animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the idle animation's first frame) |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IButton> | The button. |
GetCheckBox(String, ButtonAnimation, ButtonAnimation, ButtonAnimation, ButtonAnimation, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single, Boolean)
Creats a checkbox.
Declaration
ICheckBox GetCheckBox(string id, ButtonAnimation notChecked, ButtonAnimation notCheckedHovered, ButtonAnimation checked, ButtonAnimation checkedHovered, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F, bool isCheckButton = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the checkbox (it has to be globally unique across all entities). |
ButtonAnimation | notChecked | Not checked animation (when the checkbox is not checked). |
ButtonAnimation | notCheckedHovered | Hovered and not checked animation (when the checkbox is hovered by the mouse but not checked). |
ButtonAnimation | checked | Checked animation (when the checkbox is checked). |
ButtonAnimation | checkedHovered | Hovered and checked animation (when the checkbox is hovered by the mouse and checked). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the checkbox. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the not checked animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the not checked animation's first frame). |
System.Boolean | isCheckButton | If true, this checkbox will be skinned as a button (which has a check/unchecked state), and not as a checkbox, so it can look like a toggle button. |
Returns
Type | Description |
---|---|
ICheckBox | The checkbox. |
GetCheckBox(String, IAnimation, IAnimation, IAnimation, IAnimation, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single, Boolean)
Creats a checkbox.
Declaration
ICheckBox GetCheckBox(string id, IAnimation notChecked, IAnimation notCheckedHovered, IAnimation checked, IAnimation checkedHovered, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F, bool isCheckButton = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the checkbox (it has to be globally unique across all entities). |
IAnimation | notChecked | Not checked animation (when the checkbox is not checked). |
IAnimation | notCheckedHovered | Hovered and not checked animation (when the checkbox is hovered by the mouse but not checked). |
IAnimation | checked | Checked animation (when the checkbox is checked). |
IAnimation | checkedHovered | Hovered and checked animation (when the checkbox is hovered by the mouse and checked). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the checkbox. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the not checked animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the not checked animation's first frame). |
System.Boolean | isCheckButton | If true, this checkbox will be skinned as a button (which has a check/unchecked state), and not as a checkbox, so it can look like a toggle button. |
Returns
Type | Description |
---|---|
ICheckBox | The checkbox. |
GetCheckBox(String, String, String, String, String, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single, Boolean)
Creats a checkbox.
Declaration
ICheckBox GetCheckBox(string id, string notCheckedPath, string notCheckedHoveredPath, string checkedPath, string checkedHoveredPath, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F, bool isCheckButton = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the checkbox (it has to be globally unique across all entities). |
System.String | notCheckedPath | Not checked image resource/file path (when the checkbox is not checked). |
System.String | notCheckedHoveredPath | Hovered and not checked image resource/file path (when the checkbox is hovered by the mouse but not checked). |
System.String | checkedPath | Checked image resource/file path (when the checkbox is checked). |
System.String | checkedHoveredPath | Hovered and checked image resource/file path (when the checkbox is hovered by the mouse and checked). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the checkbox. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the not checked animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the not checked animation's first frame). |
System.Boolean | isCheckButton | If true, this checkbox will be skinned as a button (which has a check/unchecked state), and not as a checkbox, so it can look like a toggle button. |
Returns
Type | Description |
---|---|
ICheckBox | The checkbox. |
GetCheckBoxAsync(String, String, String, String, String, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single, Boolean)
Creats a checkbox asynchronously.
Declaration
Task<ICheckBox> GetCheckBoxAsync(string id, string notCheckedPath, string notCheckedHoveredPath, string checkedPath, string checkedHoveredPath, float x, float y, IObject parent = null, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F, bool isCheckButton = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the checkbox (it has to be globally unique across all entities). |
System.String | notCheckedPath | Not checked image resource/file path (when the checkbox is not checked). |
System.String | notCheckedHoveredPath | Hovered and not checked image resource/file path (when the checkbox is hovered by the mouse but not checked). |
System.String | checkedPath | Checked image resource/file path (when the checkbox is checked). |
System.String | checkedHoveredPath | Hovered and checked image resource/file path (when the checkbox is hovered by the mouse and checked). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | text | Text for the checkbox. |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width (if not supplied the engine takes it from the not checked animation's first frame). |
System.Single | height | Height (if not supplied the engine takes it from the not checked animation's first frame). |
System.Boolean | isCheckButton | If true, this checkbox will be skinned as a button (which has a check/unchecked state), and not as a checkbox, so it can look like a toggle button. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ICheckBox> | The checkbox. |
GetComboBox(String, IButton, ITextBox, Func<String, IUIControl>, IObject, Boolean, Single, Single, String, Single)
Creates a combo box (drop down).
Declaration
IComboBox GetComboBox(string id, IButton dropDownButton = null, ITextBox textBox = null, Func<string, IUIControl> listItemFactory = null, IObject parent = null, bool addToUi = true, float defaultWidth = 500F, float defaultHeight = 40F, string watermark = "", float dropDownPanelOffset = 0F)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the combo box (it has to be globally unique across all entities). |
IButton | dropDownButton | Drop down button. If not provided the a default one will be created. |
ITextBox | textBox | The text box for showing the selected choice. If not provided the a default one will be created. |
System.Func<System.String, IUIControl> | listItemFactory | A function for creating a button for the drop down list. If not provided a default one will be created. |
IObject | parent | The UI control's parent. |
System.Boolean | addToUi | If set to |
System.Single | defaultWidth | If no textbox was provided, this will be the width of the textbox. |
System.Single | defaultHeight | If no textbox or dropdown button was provided, this will be the height of the combobox. |
System.String | watermark | An optional watermark text to show when there's no text and the textbox is out of focus (i.e explanation text, see example here: https://marketplace.visualstudio.com/items?itemName=havardhu.WatermarkTextBoxControl). |
System.Single | dropDownPanelOffset | An optional vertical offset for the dropdown panel from the combobox |
Returns
Type | Description |
---|---|
IComboBox | The combo box. |
GetForm(String, String, Single, Single, Single, Single, Single, Boolean)
Creates a form.
Declaration
IForm GetForm(string id, string title, float width, float titleHeight, float contentsHeight, float x, float y, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier. |
System.String | title | Title. |
System.Single | width | Width. |
System.Single | titleHeight | Title height. |
System.Single | contentsHeight | Contents height. |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
IForm | The form. |
GetLabel(String, String, Single, Single, Single, Single, IObject, ITextConfig, Boolean)
Creates a label.
Declaration
ILabel GetLabel(string id, string text, float width, float height, float x, float y, IObject parent = null, ITextConfig config = null, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the label (it has to be globally unique across all entities). |
System.String | text | The text that appears on the label. |
System.Single | width | Width. |
System.Single | height | Height. |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
ITextConfig | config | The configuration for rendering the text. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
ILabel | The label. |
GetListBox(String, IRenderLayer, Func<String, IUIControl>, Single, Single, Boolean, Boolean, Boolean)
Creates a listbox (a list of items bound in a box).
Declaration
IListbox GetListBox(string id, IRenderLayer layer, Func<string, IUIControl> listItemFactory = null, float defaultWidth = 500F, float defaultHeight = 40F, bool addToUi = true, bool isVisible = true, bool withScrollBars = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier. |
IRenderLayer | layer | Layer. |
System.Func<System.String, IUIControl> | listItemFactory | A function for creating an item in the list. If not provided a default one will be created. |
System.Single | defaultWidth | The default width for a list item. |
System.Single | defaultHeight | The default height for a list item. |
System.Boolean | addToUi | If set to |
System.Boolean | isVisible | If set to |
System.Boolean | withScrollBars | If set to |
Returns
Type | Description |
---|---|
IListbox | The list box. |
GetPanel(String, IImage, Single, Single, IObject, Boolean)
Create a panel.
Declaration
IPanel GetPanel(string id, IImage image, float x, float y, IObject parent = null, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the panel (it has to be globally unique across all entities). |
IImage | image | A background image for the panel. |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
IPanel | The panel. |
GetPanel(String, Single, Single, Single, Single, IObject, Boolean)
Create a panel.
Declaration
IPanel GetPanel(string id, float width, float height, float x, float y, IObject parent = null, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the panel (it has to be globally unique across all entities). |
System.Single | width | The panel's width. |
System.Single | height | The panel's height. |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
IPanel | The panel. |
GetPanel(String, String, Single, Single, IObject, ILoadImageConfig, Boolean)
Create a panel.
Declaration
IPanel GetPanel(string id, string imagePath, float x, float y, IObject parent = null, ILoadImageConfig loadConfig = null, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the panel (it has to be globally unique across all entities). |
System.String | imagePath | A resource/file path (see cref="IResourceLoader") for the panel's background image/>. |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
ILoadImageConfig | loadConfig | The configuration for loading the image. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
IPanel | The panel. |
GetPanelAsync(String, String, Single, Single, IObject, ILoadImageConfig, Boolean)
Create a panel asynchronously.
Declaration
Task<IPanel> GetPanelAsync(string id, string imagePath, float x, float y, IObject parent = null, ILoadImageConfig loadConfig = null, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the panel (it has to be globally unique across all entities). |
System.String | imagePath | A resource/file path (see cref="IResourceLoader") for the panel's background image/>. |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
ILoadImageConfig | loadConfig | The configuration for loading the image. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IPanel> | The panel. |
GetScrollbar(String, SliderDirection, IObject, Single, Single, Single, Single)
Creates a scrollbar. A scrollbar is a ISlider with 2 buttons (left + right or up + down depending on which SliderDirection is used) that can be clicked to modify the slider.
Declaration
IScrollbar GetScrollbar(string idPrefix, SliderDirection direction, IObject parent = null, float width = 15F, float height = 15F, float step = 10F, float buttonBorderWidth = 1F)
Parameters
Type | Name | Description |
---|---|---|
System.String | idPrefix | Identifier prefix which will be used to generate ids for the slider and buttons. |
SliderDirection | direction | Direction. |
IObject | parent | Parent for the slider. |
System.Single | width | Width of the slider. |
System.Single | height | Height of the slider. |
System.Single | step | Step to move the slider when clicking the button. |
System.Single | buttonBorderWidth | Border width for the buttons. |
Returns
Type | Description |
---|---|
IScrollbar | The scrollbar. |
GetSlider(String, String, String, Single, Single, Single, IObject, ITextConfig, ILoadImageConfig, Boolean)
Creates a slider
Declaration
ISlider GetSlider(string id, string imagePath, string handleImagePath, float value, float min, float max, IObject parent = null, ITextConfig config = null, ILoadImageConfig loadConfig = null, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the slider (it has to be globally unique across all entities). |
System.String | imagePath | Image resource/file path for the slider. |
System.String | handleImagePath | Resource/file path for the handle's image (the item which you drag across the sliding line). |
System.Single | value | The slider's initial value. |
System.Single | min | The slider's minimum value. |
System.Single | max | The slider's maximum value. |
IObject | parent | The UI control's parent. |
ITextConfig | config | A configuration for rendering the slider's value as text (if null than the slider's value will not be rendered as text, but just the handle will be shown). |
ILoadImageConfig | loadConfig | Load configuration for the slider's images. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
ISlider | The slider. |
GetSliderAsync(String, String, String, Single, Single, Single, IObject, ITextConfig, ILoadImageConfig, Boolean)
Creates a slider asynchronously.
Declaration
Task<ISlider> GetSliderAsync(string id, string imagePath, string handleImagePath, float value, float min, float max, IObject parent = null, ITextConfig config = null, ILoadImageConfig loadConfig = null, bool addToUi = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the slider (it has to be globally unique across all entities). |
System.String | imagePath | Image resource/file path for the slider. |
System.String | handleImagePath | Resource/file path for the handle's image (the item which you drag across the sliding line). |
System.Single | value | The slider's initial value. |
System.Single | min | The slider's minimum value. |
System.Single | max | The slider's maximum value. |
IObject | parent | The UI control's parent. |
ITextConfig | config | A configuration for rendering the slider's value as text (if null than the slider's value will not be rendered as text, but just the handle will be shown). |
ILoadImageConfig | loadConfig | Load configuration for the slider's images. |
System.Boolean | addToUi | If set to |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ISlider> | The slider. |
GetTextBox(String, Single, Single, IObject, String, ITextConfig, Boolean, Single, Single)
Creats a textbox.
Declaration
ITextBox GetTextBox(string id, float x, float y, IObject parent = null, string watermark = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A unique identifer for the textbox (it has to be globally unique across all entities). |
System.Single | x | The x coordinate. |
System.Single | y | The y coordinate. |
IObject | parent | The UI control's parent. |
System.String | watermark | An optional watermark text to show when there's no text and the textbox is out of focus (i.e explanation text, see example here: https://marketplace.visualstudio.com/items?itemName=havardhu.WatermarkTextBoxControl). |
ITextConfig | config | Configuration for rendering the text. |
System.Boolean | addToUi | If set to |
System.Single | width | Width. |
System.Single | height | Height |
Returns
Type | Description |
---|---|
ITextBox | The textbox. |