This file defines the tab control where Snappers, Animations, etc. icons are located and arranged for end-users to easily use. These are some of the crucial elements within this file:
The Main Library Object
This is the main function that contains instructions on how the library looks like. It's always a good idea to cache the Library
object as there is no need to instantiate multiple instances. To start creating the Library
, a LibraryLimb
(usually named "root") is created:
/** * Library. */ private Library _lib; private symbol pkg = #:package; /** * Fika office library. */ public Library fikaOfficeLibrary() { if (!developMode and _lib) return _lib; // Root library limb LibraryLimb root(pkg, "root", frame=false); // Header image (refer to Library Header section below)
...
// Add additional limbs (refer to Library Limbs section below)
... return _lib = CompanyLibrary(root, pkg, companyKey="Fika"); }
Library Header
Usually, all extensions would have a header image/title to name this current library:
The Fika Office extension has two HeaderLimb
s which is used to create the image and the text:
...
// Header image HeaderLimb header(root, pkg, "", extendRight=true, compact=false, image=foIcon("fikaOfficeHeader.png"), margins=(0, 7)); header.forceText=""; NewlineHint(root); HeaderLimb subHeader(root, pkg, "FikaOfficeHeader", extendRight=true, margins=(0, 3));
...
Library Limbs
Within the Library, we can create multiple sections that can be collapsible and automatically managed:
Usually, multiple sections like this would be delegated into smaller functions within this file to maintain readability:
...
// Add additional limbs addGlobalLimb(root); addPanelsLimb(root); addWorksurfaceLimb(root); addCantileverLimb(root); addTablesLimb(root); addLowStorageLimb(root); addUpperStorageLimb(root); addChairsLimb(root); addDevToolsLimb(root);
...
/** * Panels. */ private void addPanelsLimb(LibraryLimb root) { LibraryLimb frameGroup(root, pkg, "FrameGroup", label=$frameGroup); FOSnapperLimb(frameGroup, pkg, "FOPanelFrame", hint=UIFixedSizeHint(image=foIcon("panel_frame.png"), preferredSize=prefSize)); FOSnapperLimb(frameGroup, pkg, "FOWallStart", hint=UIFixedSizeHint(image=foIcon("wall-start.png"), preferredSize=prefSize)); NewlineHint(frameGroup); FOAnimationLimb(frameGroup, pkg, "FOPanelTileSegmentAnimation", hint=UIFixedSizeHint(image=foIcon("tiles_12.png"), preferredSize=prefSize)); ...
}
Another LibraryLimb
is created to establish the subsection's name. From here, you can add SnapperLimb
s and AnimationLimb
s which corresponds to your Snapper
and Animation
's class name.
FOSnapperLimb
is made. Usually, just using the SnapperLimb
object would be enough.
Comments
0 comments
Please sign in to leave a comment.