Module Adjustable.Container
Just like a normal container, only adjustable.
Just use it like a normal Geyser Container with some extras like:
moveable, adjustable size, attach to borders, minimizeable, save/load.
Right click on top border for menu.
Inspired heavily by Adjustable Label (by Jor'Mox) and EMCO (by demonnic)
See: Mudlet Manual
Info:
- Author: guy,Edru
Functions
Adjustable.Container:addConnectMenu () | adds elements to connect containers to borders into the right click menu |
Adjustable.Container:attachToBorder (border) | attaches your container to the given border attach is only possible if the container is located near the border |
Adjustable.Container:changeMenuStyle (mode) | function to change the right click menu style there are 2 styles: dark and light |
Adjustable.Container:connectToBorder (border) | connect your container to a border |
Adjustable.Container:deleteSaveFile (dir) | deletes the file where your saved settings are stored |
Adjustable.Container:detach () | detaches the given container this means the mudlet main window border will be reset |
Adjustable.Container:disableAutoSave () | disableAutoSave function to disable a before enabled autoSave |
Adjustable.Container:disconnect () | disconnects your container from a border |
Adjustable.Container:doAll (myfunc) | executes the function myfunc which affects all your containers |
Adjustable.Container:enableAutoSave () | enablesAutoSave normally only used internally only useful if autoSave was set to false before |
Adjustable.Container:load (slot, dir) | restores/loads the before saved settings |
Adjustable.Container:loadAll (slot, dir) | loads all your adjustable containers at once |
Adjustable.Container:lockContainer (lockNr, lockStyle) | locks your adjustable container lock means that your container is no longer moveable/resizable by mouse. |
Adjustable.Container:minimize () | minimizes the container hides everything beside the title |
Adjustable.Container:new (cons, container) | constructor for the Adjustable Container |
Adjustable.Container:newCustomItem (name, func) | creates a new custom menu item |
Adjustable.Container:newLockStyle (name, func) | creates a new Lockstyle |
Adjustable.Container:oldnew (cons, container) | Overridden constructor to use the old add if someone really wants to use the old add for Adjustable Container use this function (not recommended) or just create elements inside the Adjustable Container with the cons useAdd2 = false |
Adjustable.Container:reposition () | overridden reposition function to raise an "AdjustableContainerReposition" event Event: "AdjustableContainerReposition" passed values (name, width, height, x, y, isMouseAction) (the isMouseAction property is true if the reposition is an effect of user dragging/resizing the window, and false if the reposition event comes as effect of external action, such as resizing of main window) |
Adjustable.Container:resetTitle () | function to reset your adjustable containers title to default |
Adjustable.Container:restore () | restores the container after it was minimized |
Adjustable.Container:save (slot, dir) | saves your container settings like position/size and some other variables in your Mudlet Profile Dir/ AdjustableContainer to be reliable it is important that the Adjustable.Container has an unique 'name' |
Adjustable.Container:saveAll (slot, dir) | saves all your adjustable containers at once |
Adjustable.Container:setAbsolute (size_as_absolute, position_as_absolute) | changes the values of your container to absolute values (standard settings are set values to percentages) |
Adjustable.Container:setBorderMargin (margin) | gives your MainWindow borders a margin |
Adjustable.Container:setPadding (padding) | sets the padding of your container changes how far the the container is positioned from the border of the container padding behaviour also depends on your lockStyle |
Adjustable.Container:setPercent (size_as_percent, position_as_percent) | changes the values of your container to be percentage values only needed if values where set to absolute before |
Adjustable.Container:setTitle (text, color, format) | function to give your adjustable container a new title |
Adjustable.Container:showAll () | shows all your adjustable containers |
Adjustable.Container:unlockContainer () | unlocks your previous locked container what means that the container is moveable/resizable by mouse again |
Functions
- Adjustable.Container:addConnectMenu ()
- adds elements to connect containers to borders into the right click menu
- Adjustable.Container:attachToBorder (border)
-
attaches your container to the given border
attach is only possible if the container is located near the border
Parameters:
- border possible border values are "top", "bottom", "right", "left"
- Adjustable.Container:changeMenuStyle (mode)
-
function to change the right click menu style
there are 2 styles: dark and light
Parameters:
- mode the style mode (dark or light)
- Adjustable.Container:connectToBorder (border)
-
connect your container to a border
Parameters:
- border main border ("top", "bottom", "left", "right")
- Adjustable.Container:deleteSaveFile (dir)
-
deletes the file where your saved settings are stored
Parameters:
- dir defines directory where the saved file is in [optional]
See also:
- Adjustable.Container:detach ()
- detaches the given container this means the mudlet main window border will be reset
- Adjustable.Container:disableAutoSave ()
- disableAutoSave function to disable a before enabled autoSave
- Adjustable.Container:disconnect ()
- disconnects your container from a border
- Adjustable.Container:doAll (myfunc)
-
executes the function myfunc which affects all your containers
Parameters:
- myfunc function which will be executed at all your containers
- Adjustable.Container:enableAutoSave ()
- enablesAutoSave normally only used internally only useful if autoSave was set to false before
- Adjustable.Container:load (slot, dir)
-
restores/loads the before saved settings
Parameters:
- slot defines a load slot for example a number (1,2,3..) or a string "backup" [optional]
- dir defines load directory [optional]
See also:
- Adjustable.Container:loadAll (slot, dir)
-
loads all your adjustable containers at once
Parameters:
- slot defines a load slot for example a number (1,2,3..) or a string "backup" [optional]
- dir defines load directory [optional]
See also:
- Adjustable.Container:lockContainer (lockNr, lockStyle)
-
locks your adjustable container
lock means that your container is no longer moveable/resizable by mouse.
You can also choose different lockStyles which changes the border or container style.
if no lockStyle is added "standard" style will be used
Parameters:
- lockNr the number of the lockStyle [optional]
- lockStyle the lockstyle used to lock the container, the lockStyle is the behaviour/mode of the locked state. integrated lockStyles are "standard", "border", "full" and "light" (default "standard") standard: This is the default lockstyle, with a small margin on top to keep the right click menu usable. light: Only hides the min/restore and close labels. Borders and margin are not affected. full: The container gets fully locked without any margin left for the right click menu. border: Keeps the borders of the container visible while locked.
- Adjustable.Container:minimize ()
- minimizes the container hides everything beside the title
- Adjustable.Container:new (cons, container)
-
constructor for the Adjustable Container
Parameters:
- cons besides standard Geyser.Container parameters there are also:
- defaultDir default dir where settings are loaded/saved to/from (default "getMudletHomeDir().."/AdjustableContainer/"" )
- ParentMenuWidth menu width of the main right click menu (default "102" )
- ChildMenuWidth menu width of the children in the right click menu (for attached, lockstyles and custom items) (default "82")
- MenuHeight height of a single menu item (default "22")
- MenuFontSize font size of the menu items (default "8")
- buttonsize size of the minimize and close buttons (default "15")
- buttonFontSize font size of the minimize and close buttons (default "8")
- padding how far is the inside element placed from the corner (depends also on the lockstyle setting) (default "10")
- attachedMargin margin for the MainWindow border if an adjustable container is attached (default "5")
- adjLabelstyle style of the main Label where all elements are in
- menustyle menu items style
- buttonstyle close and minimize buttons style
- minimized minimized at creation? (default false)
- locked locked at creation? (default false)
- attached attached to a border at creation? possible borders are ("top", "bottom", "left", "right") (default false)
- lockLabel.txt text of the "lock" menu item
- minLabel.txt text of the "min/restore" menu item
- saveLabel.txt text of the "save" menu item
- loadLabel.txt text of the "load" menu item
- attLabel.txt text of the "attached menu" item
- lockStylesLabel.txt text of the "lockstyle menu" item
- customItemsLabel.txt text of the "custom menu" item
- titleTxtColor color of the title text (default "green")
- titleText title text
- lockStyle choose lockstyle at creation. possible integrated lockstyle are: "standard", "border", "light" and "full" (default "standard")
- noLimit there is a minimum size limit if this constraint is set to false. (default false)
- raiseOnClick raise your container if you click on it with your left mouse button (default true)
- autoSave saves your container settings on exit (sysExitEvent). If set to false it won't autoSave (default true)
- autoLoad loads the container settings (if there are some to load) at creation of the container. If set to false it won't load the settings at creation (default true)
- container
- cons besides standard Geyser.Container parameters there are also:
- Adjustable.Container:newCustomItem (name, func)
-
creates a new custom menu item
Parameters:
- name Name of the new menu item
- func function of the new custom menu item
- Adjustable.Container:newLockStyle (name, func)
-
creates a new Lockstyle
Parameters:
- name Name of the menu item/lockstyle
- func function of the new lockstyle
- Adjustable.Container:oldnew (cons, container)
-
Overridden constructor to use the old add
if someone really wants to use the old add for Adjustable Container
use this function (not recommended)
or just create elements inside the Adjustable Container with the cons useAdd2 = false
Parameters:
- cons
- container
- Adjustable.Container:reposition ()
- overridden reposition function to raise an "AdjustableContainerReposition" event Event: "AdjustableContainerReposition" passed values (name, width, height, x, y, isMouseAction) (the isMouseAction property is true if the reposition is an effect of user dragging/resizing the window, and false if the reposition event comes as effect of external action, such as resizing of main window)
- Adjustable.Container:resetTitle ()
- function to reset your adjustable containers title to default
- Adjustable.Container:restore ()
- restores the container after it was minimized
- Adjustable.Container:save (slot, dir)
-
saves your container settings
like position/size and some other variables in your Mudlet Profile Dir/ AdjustableContainer
to be reliable it is important that the Adjustable.Container has an unique 'name'
Parameters:
- slot defines a save slot for example a number (1,2,3..) or a string "backup" [optional]
- dir defines save directory [optional]
See also:
- Adjustable.Container:saveAll (slot, dir)
-
saves all your adjustable containers at once
Parameters:
- slot defines a save slot for example a number (1,2,3..) or a string "backup" [optional]
- dir defines save directory [optional]
See also:
- Adjustable.Container:setAbsolute (size_as_absolute, position_as_absolute)
-
changes the values of your container to absolute values
(standard settings are set values to percentages)
Parameters:
- size_as_absolute bool true to have the size as absolute values
- position_as_absolute bool true to have the position as absolute values
- Adjustable.Container:setBorderMargin (margin)
-
gives your MainWindow borders a margin
Parameters:
- margin in pixel
- Adjustable.Container:setPadding (padding)
-
sets the padding of your container
changes how far the the container is positioned from the border of the container
padding behaviour also depends on your lockStyle
Parameters:
- padding the padding value (standard is 10)
- Adjustable.Container:setPercent (size_as_percent, position_as_percent)
-
changes the values of your container to be percentage values
only needed if values where set to absolute before
Parameters:
- size_as_percent bool true to have the size as percentage values
- position_as_percent bool true to have the position as percentage values
- Adjustable.Container:setTitle (text, color, format)
-
function to give your adjustable container a new title
Parameters:
- text new title text
- color title text color
- format title format
- Adjustable.Container:showAll ()
-
shows all your adjustable containers
See also:
- Adjustable.Container:unlockContainer ()
- unlocks your previous locked container what means that the container is moveable/resizable by mouse again