The layout system of the toolbox is separate from the actual build process. This is so that we can redo the layout on the fly, without rebuilding any windows. The actual build method is in the Extension
class's buildLibrary()
and the layout system is in a Library
. The main building block of a Library are LibraryLimbs. The whole LibraryLimb structure is like a tree structure with parents and children.
LibraryLimb
There are a ton of LibraryLimb implementations for you to use in order to make the toolbox function well and look organized. Please do try checking the current implementations and see if any could be what you are specifically looking for. These are a few main LibraryLimbs that are commonly used:
Limb | Description |
LibraryLimb | Create the root LibraryLimb, or a subsection of a toolbox. |
HeaderLimb | Insert in a header image or text that describes the whole toolbox. |
SnapperLimb | Initiate an insert animation to insert a Snapper. |
AnimationLimb | Initiate an Animation. |
VoidCallbackLimb | Run a callback function that returns nothing/void. |
BoolCallbackLimb | Tickbox with a label on the right. Runs a callback function and sets a boolean variable. |
NewlineHint | Insert an empty vertical gap in the toolbox, adjustable gap size. |
Some implementations of LibraryLimbs also have a UIHint
field which gives additional explanation on the LibraryLimb that is shown to the user. Some examples of UIHint implementations are:
UIHint | Description |
UILabelHint | Adds a label under the image of the button. |
UITextSideHint | Adds a text at the side of the image of the button. |
UIHelpImageHint | Special hint (extends UIHint ) that will exclude the button from the layout and place it in the top right corner. |
There is also an implementation of LibraryLimb called LayoutHintLimb
that not only begins a subsection of a toolbox, but also controls the dimensions of whatever is under it:
LayoutHintLimb | Description |
RowSameWidthHint | Make buttons on current row have the same width. |
MultiRowSameWidthHint | Make buttons have the same width, per row. |
EndSameWidthHint | End same-width mode. |
GlobalSameWidthHint | Make all buttons in the section have the same width. |
SwitchOrganizerLimb | This is how you specify organizers from your library. Can be done in the middle of a group, but the results are not always great. Works best if you start your group with this and let the specified organizer take care of the whole group. There is a class called UIGroupOrganizer that takes care of the layout for a single section in a toolbox tab automatically by default. It can be subclassed to do all possible layouts, and you can also switch organizers on the fly, which can be set from this limb:
|
Using the combined strength of these new layout features, my hope is that you will almost never have to use the LayoutGroupLimb
anymore. And as a bonus, apart from simplifying your library code, your toolboxes will now support dynamic layout!
Examples
Newline with spacing:
limb NewlineHint nl1(spacing=4);
Help button using uiHelpImageHint
(which is a UIHelpImageHint
singleton):
limb VoidCallbackLimb generalHelpButton("helpGeneral", uiHelpImageHint) : callback() { showToolboxHelp(#:package, "helpGeneral", $helpGeneral); }
Switching to a column organizer:
limb SwitchOrganizerLimb ex1(organizer=ColumnGroupOrganizer(nCols=4)); limb AnimationLimb shape(pkg=pkg, "VolumeShapePathAnimation", image=icon("architectural/path")); limb AnimationLimb split(pkg=pkg, "VolumeShapeSplitAnimation", image=icon("architectural/add"));
Scheme manager group in two ways:
container LibraryLimb schemes("GOSchemeGroup") { limb SwitchOrganizerLimb sw1(organizer=SubSetAndButtonGroupOrganizer(rowSpacing=0)); limb SchemeLimb s1("goWallSchemeGroup", tag=cGOWallSchemeKey); limb SchemeLimb s2(cGOStorageSchemeKey, tag=cGOStorageSchemeKey); limb SchemeLimb s3(cGOCounterSchemeKey, tag=cGOCounterSchemeKey); } container LibraryLimb schemes("GOSchemeGroup") { limb SchemeOrganizerLimb organizer(); limb SchemeLimb s1("goWallSchemeGroup", tag=cGOWallSchemeKey); limb SchemeLimb s2(cGOStorageSchemeKey, tag=cGOStorageSchemeKey); limb SchemeLimb s3(cGOCounterSchemeKey, tag=cGOCounterSchemeKey); }
Comments
0 comments
Please sign in to leave a comment.