-
-
Notifications
You must be signed in to change notification settings - Fork 26
Dock
Slab offers the ability for windows to be docked to a particular side of the viewport. These docked windows will be rendered on top of other windows and can be resized based on the dock position. These docked windows can also be untethered and return to be a floating state.
Below is a list of functions associated with the Dock API.
Enables the docking functionality for a particular side of the viewport.
Parameter | Type | Description |
---|---|---|
List | String/Table | A single item or list of items to enable for docking. The valid options are 'Left', 'Right', or 'Bottom'. |
Disables the docking functionality for a particular side of the viewport.
Parameter | Type | Description |
---|---|---|
List | String/Table | A single item or list of items to disable for docking. The valid options are 'Left', 'Right', or 'Bottom'. |
Set options for a dock type.
Parameter | Type | Description |
---|---|---|
Type | String | The type of dock to set options for. This can be 'Left', 'Right', or 'Bottom'. |
Options | Table | List of options that control how a dock behaves. |
Option | Type | Description |
---|---|---|
NoSavedSettings | Boolean | Flag to disable saving a dock's settings to the state INI file. |
Programmatically set a window to a dock. Must be called within BeginWindow
and EndWindow
Parameter | Type | Description |
---|---|---|
Type | String | The type of dock to set the window on. This can be 'Left', 'Right', or 'Bottom'. |
Sample usage of WindowToDock
:
--only once
local flag = false
local flag2 = false
local flag3 = false
--in update
Slab.BeginWindow("test", {
Title = "test",
W = 320,
})
if not flag then
Slab.WindowToDock("Left")
flag = true
end
Slab.EndWindow()
Slab.BeginWindow("test2", {
Title = "test2",
W = 160,
})
if not flag2 then
Slab.WindowToDock("Right")
flag2 = true
end
Slab.EndWindow()
Slab.BeginWindow("test3", {
Title = "test3",
H = 120
})
if not flag3 then
Slab.WindowToDock("Bottom")
flag3 = true
end
Slab.EndWindow()
Window
's W
option is applied only to Left
and Right
docks while H
for Bottom
(Note that in future release, storing of flags
will be stored internally so users wont have to deal with it)