|
Drag[en]gine Script Module DragonScript 1.32.1
|
Arrange widgets along X or Y axis with weighted size. More...
Classes | |
| class | LayoutSettings |
| Immutable widget layout settings. More... | |
Public Member Functions | |
| void | addWidget (Widget widget, Object settings) |
| Add widget to layout using settings. | |
| void | doLayout (Container container) |
| Layout widgets in container. | |
| LayoutSettings | getWidgetSettings (Widget widget) |
| Layout settings for widget. | |
| WeightLayout | new (LayoutAxis axis) |
| Create layout with 0 gap. | |
| WeightLayout | new (LayoutAxis axis, int gap) |
| Create layout. | |
| void | removeWidget (Widget widget) |
| Remove widget from layout. | |
| void | setWidgetSettings (Widget widget, LayoutSettings settings) |
| Set layout settings for widget. | |
Public Member Functions inherited from Dragengine.Gui.Layouts.BoxLayout | |
| LayoutAxis | getAxis () |
| Axis to arrange widgets along. | |
| int | getGap () |
| Gap between child widgets. | |
| Point | getMinimumSize (Container container) |
| Minimal size required for layout in container. | |
| Point | getMinimumSizeForHeight (Container container, int height) |
| Minimum size of layout using reference widget height and variable width. | |
| Point | getMinimumSizeForWidth (Container container, int width) |
| Minimum size of layout using reference width and variable height. | |
| void | setAxis (LayoutAxis axis) |
| Set axis to arrange along. | |
| void | setGap (int gap) |
| Set gap between child widgets. | |
Public Attributes | |
| int | pWeightSum |
| Weight sum or -1 if not calculated yet. | |
| Dictionary | pWidgetSettings |
| Widget layout settings as Dictionary with Widget keys and LayoutSettings values. | |
Protected Member Functions | |
| Point | getMinimumSizeFor (Container container, int width, int height) |
| Minimum size of layout using reference and variable size. | |
| int | getWeightSum () |
| Weight sum. | |
Arrange widgets along X or Y axis with weighted size.
Distribute size across widgets based on fixed size and weight factors. The minimum, preferred and maximum size requirements of widgets are disregarded to allow widget sizes to align with fixed external factors. This can be used to enforce relative distribution across different containers no matter what size requirements widgets have.
Use instances of immutable LayoutSettings as layout options when adding widgets. The layout settings can be replaced after adding the widgets. This can be used for example for column based lists to apply changed column sizes to all widgets in affected layouts.
LayoutSettings uses a fixed size and a weight factor. The fixed size replaces the minimum size indicated by the widget measured in pixels. The weight factors are sumemd up across all widgets to obtain the weight sum. The size of each widget is the weight factor divided by the weight sum. The fixed sizes are subtracted from the available space before doing weight calculation.
Instances of this layout can not be shared across multiple widgets.
| void Dragengine.Gui.Layouts.WeightLayout.addWidget | ( | Widget | widget, |
| Object | settings | ||
| ) |
Add widget to layout using settings.
| widget | Widget to add to layout. |
| settings | Instance of LayoutSettings. If null a weight of 1 is used. |
Reimplemented from Dragengine.Gui.Layouts.BoxLayout.
| void Dragengine.Gui.Layouts.WeightLayout.doLayout | ( | Container | container | ) |
Layout widgets in container.
Reimplemented from Dragengine.Gui.Layouts.BoxLayout.
|
protected |
Minimum size of layout using reference and variable size.
If LayoutAxis.x or LayoutAxis.inverseX is used height is the reference size. If LayoutAxis.y or LayoutAxis.inverseY is used widthis the reference size.
Reimplemented from Dragengine.Gui.Layouts.BoxLayout.
|
protected |
Weight sum.
Recalculates weight sum if required.
| LayoutSettings Dragengine.Gui.Layouts.WeightLayout.getWidgetSettings | ( | Widget | widget | ) |
Layout settings for widget.
| WeightLayout Dragengine.Gui.Layouts.WeightLayout.new | ( | LayoutAxis | axis | ) |
Create layout with 0 gap.
Reimplemented from Dragengine.Gui.Layouts.BoxLayout.
| WeightLayout Dragengine.Gui.Layouts.WeightLayout.new | ( | LayoutAxis | axis, |
| int | gap | ||
| ) |
Create layout.
| gap | Size of gap between child widgets. Can be negative to overlap widgets. |
Reimplemented from Dragengine.Gui.Layouts.BoxLayout.
| void Dragengine.Gui.Layouts.WeightLayout.removeWidget | ( | Widget | widget | ) |
Remove widget from layout.
Reimplemented from Dragengine.Gui.Layouts.BoxLayout.
| void Dragengine.Gui.Layouts.WeightLayout.setWidgetSettings | ( | Widget | widget, |
| LayoutSettings | settings | ||
| ) |
Set layout settings for widget.
Layouts the parent of widget after changing the settings.
| widget | Widget to set settings for. |
| settings | Widget settings. If null a weight of 1 is used. |
| int Dragengine.Gui.Layouts.WeightLayout.pWeightSum |
Weight sum or -1 if not calculated yet.
| Dictionary Dragengine.Gui.Layouts.WeightLayout.pWidgetSettings |
Widget layout settings as Dictionary with Widget keys and LayoutSettings values.