Reference



Layout Item Resizing


Layout Items can be controlled by a number of different settings. However, some of these settings will have different effects based on what sort of layout contains the item.


MinSize - minimize pixel size of the item. If the value is -1, there is no minimum.


MaxSize - maximum pixel size of the item. If the value is -1, there is no maximum.


FixedSize - constant pixel size of the item. The control will not change size in the layout. If the value is -1, there is no fixed size.


HorizAlign, VertAlign - alignment of the item in the space allocated to the item. The layout may assign more space than is required for the item. In this case the alignment is used to position the item in the space.


VertResizeMode, HorizResizeMode - resizing mode of the item. This value may be automatically set for fixed, min, and max sized items. For stretch (the default) mode, the item will resize based on the size of the layout. For greedy mode, the item will "steal" as much available space from other items that it can.


StetchFactor - relative stretch size for stretch and greedy mode items. An item with twice as much stretch as another will attempt to be twice as large.


Border - additional padding/spacing required by the item.



Layouts


HBoxLayout

Children are organized in a horizontal line:




As seen by the example, the items are layed out horizontally but additional factors such as min and max sizes will adjust the final size of the control.




VBoxLayout

Children are organized in a vertical line:




GridLayout

Children are organized in a grid pattern. Child items can also be set to stretch into adjacent grid cells.




FormLayout

Children are organized into rows with labels.




FlowLayout

Children will flow and wrap around to the next line. A scrollbar will be visible if the children do not fit.




Additional Layouts



Panel - used for a clipped box similar to a Unity Group.


ScrollableHBoxLayout - HBoxLayout but with optional scroll buttons if the layout doesn't fit.




Widgets


Widgets are generally special controls that have a layout and a more complex configuration of children.


FoldoutWidget - control used for hiding data until an expand button is clicked.


GroupBox - layout with a line around the edges and title text, used for grouping like controls toegether.


InspectorTitleBarWidget - specialized foldout that looks like the inspector.


ObjectFoldoutWidget - object editor with a foldout inspector.


ScrollArea - scrollable panel.


Splitter - horizontal or vertical split that can be resized and dragged.


StatusBar - status commonly seen at the bottom of a dialog.


ToolBar - button bar commonly seen under the menu bar at the top of a dialog.


TabWidget - tabbed control that displays buttons to select which tab to show.




Menus


Menus are hierarchical with either more submenu or item children. Menus can be shown as a popup like a context menu or in a traditional menu bar.


Menuing example found in WindowTest2Dialog.cs:

Menu fileMenu = new Menu("File");
fileMenu.addItem(new MenuItem("New"new Icon(DefaultIcon.New), ""onMenu));
fileMenu.addItem(new MenuItem("Open"new Icon(DefaultIcon.Open), ""onMenu));
fileMenu.addItem(new MenuItem("Save"new Icon(DefaultIcon.Save), ""onMenu));
fileMenu.addItem(new MenuItem("SaveAs"new Icon(DefaultIcon.SaveAs), ""onMenu));
fileMenu.addSeparator();
fileMenu.addItem(new MenuItem("Exit"new Icon(DefaultIcon.Exit), ""onMenu));
 
Menu editMenu = new Menu("Edit");
editMenu.addItem(new MenuItem("Cut"new Icon(DefaultIcon.Cut), ""onMenu));
editMenu.addItem(new MenuItem("Copy"new Icon(DefaultIcon.Copy), ""onMenu));
editMenu.addItem(new MenuItem("Paste"new Icon(DefaultIcon.Paste), ""onMenu));
 
Menu helpMenu = new Menu("Help");
helpMenu.addItem(new MenuItem("About"new Icon(DefaultIcon.Info), ""onMenu));
helpMenu.addItem(new MenuItem("About"new Icon(DefaultIcon.Info), ""onMenu));
 
setMenuBar(new MenuBar().
    addMenu(fileMenu).
    addMenu(editMenu).
    addMenu(helpMenu) );



Controls



Every Unity editor control is wrapped by Layout to work with the framework.


In addition to the default controls, some additional controls are provided:


HLine, VLine - horizontal and vertical lines


ObjectEditor - acts like a mini-inspector for object property editing


Spacer - empty object used for controlling layout by adding a stretch or fixed size spacer object.


Toggle - On/Off slider toggle that works similarly to a checkbox but with a prettier interface.


WaitCircle - draws a wait cursor over its parent layout.




Controls - Buttons


Buttons can used in a variety of ways beyond just detecting a mouse click.


Checkable - flag for allowing the button to enter a "checked" set. For a radio or checkbox, the button would show a tick mark.


Checked - flag for radios and checkboxes to show a tick mark.


Repeatable - flag for a button automatically sending a click event if the mouse button is held down.


Mixed - mixed (multi) state check boxes and radio buttons.


Flat - flat buttons down show the raised border, mainly used by toolbar buttons.


Group - buttons can be grouped together. A group is especially useful for radio buttons working together. Groups can be all set at once.






Controls - Lists



ListWidget - displays a linear list of list widget items.


TableWidget - displays a two dimensional list of widget items. The items can have values for each column.


TreeWidget - similar to a TableWidget but allows the tree widget items to be configured in a hierarchy.


HeaderBar - the list widgets can optionally use a header bar that displays column header information. The columns can be resized and sorted.


ReorderableList - wraps the Unity reorderable list control to work with the layout framework.