WoW:LegoBlock: Difference between revisions

1,236 bytes added ,  15 August 2023
m
Move page script moved page LegoBlock to WoW:LegoBlock without leaving a redirect
(Initial Creation)
 
m (Move page script moved page LegoBlock to WoW:LegoBlock without leaving a redirect)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==Dongle Object LegoBlock-1.0 API==
{{usermodule|LegoBlock}}
 
LegoBlock: Embeddable library to provide block functionality. Generated LegoBlocks stick together using Tuller's FlyPaper code. Blocks do not currently stick across majors, though that is under consideration.
 
==Description==
LegoBlock lets you create a small block to display information in it like time, performance, haste or anything you can think of! Blocks can be snapped together in any position or order you can do simple things like snap them together into a long line to be positioned at the top of your UI, or you can snap them together in an "L" position and so on.
 
Theres two methods of snapping blocks together, one is simply to drag it to another block and it'll snap to the closet block for example if you drag block "A" to the bottom of block "B" it'll snap to the bottom, if you snap it to the left side of "B" it'll snap to that side and so on. If you have muultiple blocks and you need to specifically choose which one to snap to then drag block "A" into block "B" and you can choose which side to snap to without it trying to snap to anything else.
 
Blocks that are snapped togther become a group, if you have A, B and C you can drag any of those 3 and they'll all move together when you want to unsnap a block from a group hold down CTRL and drag it out.
 
LegoBlock is meant to display information, not as a methods of launching or viewing configuration.
 
==LegoBlock-Beta1 API==
===:New(name[, text, icon, optionsTbl])===
===:New(name[, text, icon, optionsTbl])===
Creates a new LegoBlock.
Creates a new LegoBlock.
====Args====
====Args====
{| style="{{CSS Darktable}}"
{| class="darktable"
|- style="{{CSS Darktable th}}"
! Arg !! Type !! Details
! Arg !! Type !! Details
|-
|-
| name || string || The name for your lego block. It will be prefixed with Lego.
| name || string || The name for your lego block. It will be prefixed with Lego.
|-
|-
| text || string || (Optional) The initial text for the lego block.
| text || string || (Optional) The initial text for the lego block.
Line 13: Line 26:
| icon || string/texture || (Optional) The initial texture for the icon on the lego block.
| icon || string/texture || (Optional) The initial texture for the icon on the lego block.
|-
|-
| optionsTbl || table || (Optional) A table to store settings about the lego. Should be given as a [[#OptionsTbl|LegoBlock optionsTbl]]
| optionsTbl || table || (Optional) A table to store settings about the lego. Should be given as a [[#OptionsTbl|LegoBlock optionsTbl]]
|-
|}
|}
====Returns====
====Returns====
{| style="{{CSS Darktable}}"
{| class="darktable"
|- style="{{CSS Darktable th}}"
! Return !! Type !! Details
! Return !! Type !! Details
|-
|-
| legoBlock || frame || The frame created. It is a [[#LegoBlock_Object_API|LegoBlock]]
| legoBlock || frame || The frame created. It is a [[#LegoBlock_Object_API|LegoBlock]]
|}
|}
====Remarks====
====Remarks====
The optionsTbl is used to store grouping information and should be of a permanent type storage like a SavedVariables table.
The optionsTbl is used to store block information and should be of a permanent type storage like a SavedVariables table.
====OptionsTbl====
====OptionsTbl====
Format for the optionsTbl is thus:
Format for the optionsTbl is thus:
{| style="{{CSS Darktable}}"
{| class="darktable"
|- style="{{CSS Darktable th}}"
! Key !! Value Type !! Details
! Key !! Value Type !! Details
|-
|-
Line 52: Line 62:
|-
|-
| noresize || boolean || Whether or not to resize the LegoBlock when you set the text.
| noresize || boolean || Whether or not to resize the LegoBlock when you set the text.
|-
| group || string || List of LegoBlocks that are grouped with this LegoBlock.
|-
|-
| appendstring || string || String to append to the CreateFrame call.
| appendstring || string || String to append to the CreateFrame call.
|-
|}
|}
<pre>
<pre>
Line 69: Line 76:
[showText] = boolean,
[showText] = boolean,
[hidden] = boolean,
[hidden] = boolean,
[group] = string separated by #,
[appendString] = string,
[appendString] = string,
[savedFields] = integer indexed table with extra key/value pairs to fill in </pre>
[savedFields] = integer indexed table with extra key/value pairs to fill in </pre>
Line 76: Line 82:
  self:New("HelloWorld"[, "My first lego block", nil, {}])
  self:New("HelloWorld"[, "My first lego block", nil, {}])


==LegoBlock Object API==
===LegoBlock:SetDB(optionsTbl)===
===LegoBlock:SetDB(optionsTbl)===
Changes the optionsTbl attached to a lego block
Changes the optionsTbl attached to a lego block
====Args====
====Args====
{| style="{{CSS Darktable}}"
{| class="darktable"
|- style="{{CSS Darktable th}}"
! Arg !! Type !! Details
! Arg !! Type !! Details
|-
|-
Line 89: Line 93:
self:SetDB({})
self:SetDB({})


===LegoBlock:ShowIcon(state)===
===LegoBlock:ShowIcon()===
Shows or hides the icon
Shows the icon
====Args====
====Args====
{| style="{{CSS Darktable}}"
None
|- style="{{CSS Darktable th}}"
====Remarks====
! Arg !! Type !! Details
Will automagically position the text on show.
|-
====Example====
| state || boolean || Shows or hides the icon.
self:ShowIcon()
|}
 
===LegoBlock:HideIcon()===
Hides the icon
====Args====
None
====Remarks====
Will automagically position the text on hide.
====Example====
====Example====
self:ShowIcon(true)
self:HideIcon()


===LegoBlock:SetIcon(icon)===
===LegoBlock:SetIcon(icon)===
Sets the icon
Sets the icon
====Args====
====Args====
{| style="{{CSS Darktable}}"
{| class="darktable"
|- style="{{CSS Darktable th}}"
! Arg !! Type !! Details
! Arg !! Type !! Details
|-
|-
Line 115: Line 124:
self:SetIcon(<fill me in>)
self:SetIcon(<fill me in>)


===LegoBlock:SetText(text[, noresize])===
===LegoBlock:ShowText()===
Shows the text
====Example====
self:ShowText()
 
===LegoBlock:HideText()===
Hides the text
====Example====
self:HideText()
 
===LegoBlock:SetText(text)===
Sets the text of the lego block
Sets the text of the lego block
====Args====
====Args====
{| style="{{CSS Darktable}}"
{| class="darktable"
|- style="{{CSS Darktable th}}"
! Arg !! Type !! Details
! Arg !! Type !! Details
|-
|-
| text || string || Sets the text of the lego block.
| text || string || Sets the text of the lego block.
|-
| noresize || boolean || Controls whether or not it should resize the block when you set the text.  Can be made permanent by settings noresize = true in the optionsTbl
|}
|}
====Remarks====
====Remarks====
You can set self.optionsTbl.noresize = true instead of setting noresize = true on each call.
You can set self.optionsTbl.noresize = true to not resize. Does not automagically show the text, you must call ShowText.
====Example====
====Example====
self:SetText("Woohooo", true)
self:SetText("Woohooo")


===LegoBlock:SetManyAttributes(...)===
== External links ==
Taken from [[Frame:SetManyAttributes]]
* [http://www.wowinterface.com/downloads/info7954-LegoBlock.html WoWInterface Link]
* [http://jira.wowace.com/browse/LEGO For posting bugs and requests]
* [http://code.google.com/p/legos-wow LegoBlock on Google Code]
[[Category:Dongle]]
Anonymous user