Chili Classes - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki

Development < Chili < Chili classes are the elements (panels, grids, etc.) that make up the game GUI. The .lua .lua files are stored in the directory LuaUI/Widgets/Chili/controls. Displayed elements such as window, as distinct from non-control classes (specifically, font objects and the screen) are referred to as controls.

Source

The default Chili classes can be found here.

Data Types

Tags may be one of the following data types:

  • number - A number with or without decimals.
  • bool - A value which can be true or false.
  • string - Text, or more precisely a string of alphanumeric characters.
  • color - An array of colors, in RGBA format.
  • number[4] - An array of numbers; used for positioning, etc.

Details

Chili classes use OOP with inheritance, with the following hierarchy:

object |_font |_screen |_control  |_button    |_image  |_checkbox  |_colorbars  |_label  |_layoutpanel    |_imagelistview    |_grid    |_stackpanel    |_treeview  |_panel  |_progressbar  |_scrollpanel  |_textbox  |_trackbar  |_treeview   |_treeviewnode  |_window

Consequently, it is possible for widgets to define their own Chili classes (discussed below).

Each Chili control has one parent (Chili.screen0 or another Chili control) and any non-negative number of children. Position is specified relative to the parent, taking into account the parent's padding and itemMargin tags.

Classes

Object

The base Chili object class. It should not be used directly.

Control

This is the base class for all Chili controls, specifying common properties. It should not be used directly.

General

Size

Positioning

These tags can be combined in different ways with each other and the width/height tags to precisely define the bounds of the element.

Drawing

Window

This is the basic container for all other controls. It is the only one that can be moved around by the user and responds to the docking widget. It can be made invisible for a borderless element, or to allow another control such as a Panel to draw the background.

Panel

A background element, similar to Window but drawn differently and without the resize/drag functions.

Button

Does things when clicked. Comes with its own implementation of HitTest, MouseDown and MouseUp, making it readily usable for this purpose.

Category:Libraries