Dewdrop-2.0/AddLine Arguments

From WowAce Wiki

Jump to: navigation, search

Contents

text

string - the text on the button.

Example

dewdrop:AddLine(
    'text', "Hello, World!",
)

level

number - the level the line should be added at.

Remarks

In almost all cases, you won't need this, as the level is inferred automatically.

Example

dewdrop:AddLine(
    'text', "Hello, World!",
    'level', 2
)

disabled

boolean - whether the button is disabled.


Remarks

Disabling causes the button to be unclickable and makes the text gray.

Example

dewdrop:AddLine(
    'text', "Hello, World!",
    'disabled', true
)

isTitle

boolean - whether the button is a title.

Remarks

Being a title causes the button to be disabled, but have the standard yellow color.

Example

dewdrop:AddLine(
    'text', "I am a title",
    'isTitle', true
)

notClickable

boolean - whether the button is clickable or not.

Remarks

Being unclickable causes the button to be disabled, but have the standard white color, so it would look like other buttons.


Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'notClickable', true
)

textR, textG, textB

textR 
number [0, 1] - red value

textG 
number [0, 1] - green value
textB 
number [0, 1] - blue value

Remarks

Sets the text color of the button, overriding disabled, isTitle, or notClickable's colors.
This only works if all three colors are set.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'textR', 1,
    'textG', 1,
    'textB', 1
)

notCheckable

boolean - whether the button is checkable or not.

Remarks

Really, this being set just causes the blank space that would be normally for a checkbox to not be there.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'notCheckable', true
)


isRadio

boolean - whether the button is a radio button.

Remarks

If set to true, it uses a texture similar to "Interface\Buttons\UI-RadioButton", which is 4 buttons side-by-side, unchecked, checked, highlight, and blank.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'isRadio', true,
)

checked

boolean - whether the button is checked or not.

Remarks

If set to true, it sets the check's alpha to fully visible, otherwise makes it invisible.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'checked', math.random() < 0.5
)

checkIcon

string - path to the check texture.

Remarks

If not set, assume "Interface\\Buttons\\UI-CheckBox-Check"

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'checkIcon', "Interface\\Buttons\\UI-CheckBox-Check"
)

func

function(arg1, arg2, arg3, arg4) - function to call when button is clicked.

Remarks

The args fed in are the ones given by arg1, arg2, arg3, and arg4.
After being called, the menu level is refreshed, so any checks or whatnot are updated.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'func', function()
        print("Click!")
    end
)

arg1, arg2, arg3, arg4

arg1 
Value - First value fed into the given func

arg2 
Value - Second value fed into the given func
arg3 
Value - Third value fed into the given func
arg4 
Value - Fourth value fed into the given func

Remarks

You don't need all 4 to work, you may only specify if needed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'func', function(val)
        print("Click! " .. val)
    end,
    'arg1', math.random()
)

hasColorSwatch

boolean - whether the button has a color swatch.

Remarks

If hasColorSwatch is true, then func has no purpose, since clicking opens up a color picker.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasColorSwatch', true
)


r, g, b

number [0,1] - The red value.
number [0,1] - The green value.
Number [0,1] - The blue value.

Remarks

Sets the color of the color swatch, and conseqently, the color picker.
This only works if all three colors are set.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasColorSwatch', true,
    'r', 1,
    'g', 1,
    'b', 1
)

colorFunc

function(r, g, b [, a]) - function called when the color changes.

Remarks

Requires that hasColorSwatch is true.
The [a] argument is provided if hasOpacity is true.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasColorSwatch', true,
    'hasOpacity', true,
    'colorFunc', function(r, g, b, a)
        print("New color: " .. r .. "-" .. g .. "-" .. b .. '-' .. a)
    end
)

colorArg1, colorArg2, colorArg3, colorArg[#]

colorArg1 
Value - First value fed into the given colorFunc

colorArg2 
Value - Second value fed into the given colorFunc
colorArg3 
Value - Third value fed into the given colorFunc
colorArg[#] 
Value - #th value fed into the given colorFunc

Remarks

You don't need all 3 to work, you may only specify if needed.

Now any number of arguments is supported.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'colorFunc', function(value, r, g, b, a)
        print("New color: " .. value .. " :: " .. r .. "-" .. g .. "-" .. b .. '-' .. a)
    end,
    'colorArg1', math.random()
)

opacity

number [0,1] - current opacity level.

Remarks

Requires that hasColorSwatch and hasOpacity are true.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasColorSwatch', true,
    'hasOpacity', true
    'opacity', math.random()
)

hasArrow

boolean - whether button has an arrow.

Remarks

Requires that either value is not nil or hasSlider is true.


Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'value', "hello"
)

value

value - any unique, identifiable value.

Remarks

Requires that hasArrow is true.
The same value will be fed in to the initalizer function when the sublevel is opened.

Example

if level == 1 then
    dewdrop:AddLine(
        'text', "Hello,",
        'hasArrow', true,
        'value', "hello"
    )
elseif level == 2
    if value == "hello" then
        dewdrop:AddLine(
            'text', "World!"
        )
    end
end

hasSlider

boolean - whether the sublevel is a slider.

Remarks

Requires that hasArrow is true.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
)

sliderMin

number - the minimum value

Remarks:

Requires that hasArrow and hasSlider are true.
If not given, 0 is assumed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
    'sliderMin', 0
)

sliderMax

number - the minimum value

Remarks:

Requires that hasArrow and hasSlider are true.
If not given, 1 is assumed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
    'sliderMax', 1
)

sliderIsPercent

boolean - whether sliderMinText and sliderMaxText will be percents.

Remarks:

Requires that hasArrow and hasSlider are true.
If not given, false is assumed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
    'sliderIsPercent', true
)

sliderMaxText

string - the text representing the max value

Remarks:

Requires that hasArrow and hasSlider are true.
If not given, 100 * sliderMax .. "%" is assumed if a percentage, otherwise, just sliderMax.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
    'sliderMaxText', '100%'
)

sliderMinText

string - the text representing the min value

Remarks:

Requires that hasArrow and hasSlider are true.
If not given, 100 * sliderMin .. "%" is assumed if a percentage, otherwise, just sliderMin.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
    'sliderMinText', '0%'
)

sliderValue

number [0,1] - the current value of the slider.

Remarks

Requires that hasArrow and hasSlider are true. If not given, 0.5 is assumed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true,
    'sliderValue', 0.5
)


sliderStep

number - the step between values that can be selected

Remarks

Requires that hasArrow and hasSlider are true. If not given, 0.01 is assumed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true,
    'sliderStep', 0.05
)

sliderFunc

function(value) - function to call when the value changed.

Remarks

Requires that hasArrow and hasSlider are true. If sliderFunc(value) returns a string, then that is used to set the current value string on the slider. value will always be within [0, 1].

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
    'sliderFunc', function(value)
        print("New value: " .. value)
        return format("%.0f%%", value)
    end
)

sliderArg1, sliderArg2, sliderArg3, sliderArg[#]

sliderArg1 
Value - First value fed into the given sliderFunc

sliderArg2 
Value - Second value fed into the given sliderFunc
sliderArg3 
Value - Third value fed into the given sliderFunc
sliderArg[#] 
Value - #th value fed into the given sliderFunc

Remarks

You don't need all 3 to work, you may only specify if needed.

Now any number of arguments is supported.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasSlider', true
    'sliderFunc', function(key, value)
        print("New " .. key .. ": " .. value)
        return format("%.0f%%", value)
    end,
    'sliderArg1', "hello"
)

textHeight

number - height of the text.

Remarks

If not provided, 10 is assumed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'textHeight', 10
)

justifyH

string - horizontal justification of the text.

Remarks

Must be either "LEFT", "RIGHT", or "CENTER"
If not provided, "LEFT" is assumed.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'justifyH', "CENTER"
)

tooltipTitle

string - title of the newbie tooltip.

Remarks

If not provided, the tooltip won't show up.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'tooltipTitle', "Hello"
)

tooltipText

string - text of the newbie tooltip.

Remarks

Requires tooltipTitle to be set.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'tooltipTitle', "Hello",
    'tooltipText', "world!"
)

tooltipFunc

function - A function to call when the tooltip is to be shown.

Remarks

Will set the owner and location of GameTooltip.


Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'tooltipFunc', GameTooltip.SetHyperlink,
    'tooltipArg1', GameTooltip,
    'tooltipArg2', "item:1234:0:0:0"
)

tooltipArg1, tooltipArg2, tooltipArg3, tooltipArg[#]

tooltipArg1 
Value - First value fed into the given tooltipFunc

tooltipArg2 
Value - Second value fed into the given tooltipFunc
tooltipArg3 
Value - Third value fed into the given tooltipFunc
tooltipArg[#] 
Value - #th value fed into the given tooltipFunc

Remarks

You don't need all 3 to work, you may only specify if needed.

Now any number of arguments is supported.

Example

dewdrop:AddLine(

   'text', "Hello, world!",
   'tooltipFunc', GameTooltip.SetHyperlink,
   'tooltipArg1', GameTooltip,
   'tooltipArg2', "item:1234:0:0:0"

)

closeWhenClicked

boolean - whether to close menu when clicked.

Remarks

This closes the whole menu, not just the one level.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'closeWhenClicked', true
)

hasEditBox

boolean - whether the sublevel is an edit box.

Remarks

Requires that hasArrow is true.


Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasEditBox', true
)

editBoxText

string - the current text of the edit box.

Remarks

Requires that hasArrow and hasEditBox are true. If not given, "" is assumed.

Example

dewdrop:AddLine(
    'text', "Hello",
    'hasArrow', true,
    'hasEditBox', true
    'editBoxText', "world!"
)

editBoxFunc

function(text) - function to call when the enter key is pressed.

Remarks

Requires that hasArrow and hasEditBox are true.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxFunc', function(text)
        print("New text: " .. text)
    end
)


editBoxArg1, editBoxArg2, editBoxArg3, editBoxArg[#]

editBoxArg1 
Value - First value fed into the given editBoxFunc
editBoxArg2 
Value - Second value fed into the given editBoxFunc
editBoxArg3 
Value - Third value fed into the given editBoxFunc

editBoxArg[#] 
Value - #th value fed into the given editBoxFunc

Remarks

You don't need all 3 to work, you may only specify if needed.

Now any number of arguments is supported.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxFunc', function(key, text)
        print("New " .. key .. ": " .. text)
    end,
    'editBoxArg1', "hello"
)

editBoxChangeFunc

function(text) - function to call when the text changes.

Remarks

Requires that hasArrow and hasEditBox are true.
If this returns a string, the text box will be changed to it.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxChangeFunc', function(text)
        value = string.upper(text)
        print("New value: " .. text)
        return value -- changes text to uppercase
    end
)

editBoxChangeArg1, editBoxChangeArg2, editBoxChangeArg3, editBoxChangeArg[#]

editBoxChangeArg1 
Value - First value fed into the given editBoxChangeFunc

editBoxChangeArg2 
Value - Second value fed into the given editBoxChangeFunc
editBoxChangeArg3 
Value - Third value fed into the given editBoxChangeFunc
editBoxChangeArg[#] 
Value - #th value fed into the given editBoxChangeFunc

Remarks

You don't need all 3 to work, you may only specify if needed.

Now any number of arguments is supported.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxChangeFunc', function(key, text)
        value = string.upper(text)
        print("New " .. key .. ": " .. text)
        return value -- changes text to uppercase
    end
    'editBoxChangeArg1', "hello"
)

editBoxIsKeybinding

boolean - flag whether the editbox is handling a keybinding or not

Example

dewdrop:AddLine(
    'text', "My Keybinding",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxIsKeybinding', true
)

editBoxKeybindingOnly

table - table which accepts only the given keybindings

Example

dewdrop:AddLine(
    'text', "My Keybinding",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxIsKeybinding', true,
    'editBoxKeybindingOnly', {BUTTON1=true, BUTTON2=true}
)

editBoxKeybindingExcept

table - table which accepts everything except the given keybindings


Example

dewdrop:AddLine(
    'text', "My Keybinding",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxIsKeybinding', true,
    'editBoxKeybindingExcept', {BUTTON1=true, BUTTON2=true}
)

editBoxValidateFunc

function(text) - function to call when the enter key is pressed.

Remarks

Requires that hasArrow and hasEditBox are true.
If this returns a true value, it will pass through, if it returns a false value, a message will pop up.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxValidateFunc', function(text)
        -- no spaces
        return not string.find(text, "%s")
    end
)

editBoxValidateArg1, editBoxValidateArg2, editBoxValidateArg3, editBoxValidateArg[#]

editBoxValidateArg1 
Value - First value fed into the given editBoxValidateFunc
editBoxValidateArg2 
Value - Second value fed into the given editBoxValidateFunc
editBoxValidateArg3 
Value - Third value fed into the given editBoxValidateFunc
editBoxValidateArg[#] 
Value - #th value fed into the given editBoxValidateFunc


Remarks

You don't need all 3 to work, you may only specify if needed.

Now any number of arguments is supported.

Example

dewdrop:AddLine(
    'text', "Hello, world!",
    'hasArrow', true,
    'hasEditBox', true,
    'editBoxValidateFunc', function(key, text)
        return not string.find(text, key)
    end
    'editBoxValidateArg1', "%s" -- no spaces
)


icon, iconWidth, iconHeight

icon 
string - Path of the icon relative to the wow root folder
iconWidth 
number - Width of the icon, a value beyond 24 begins to overlap other rows.
iconHeight 
number - Height of the icon, a value beyond 24 begins to overlap other rows.

Remarks

You don't need iconWidth and iconHeight for it to work, you may only specify if needed. If not specified, iconWidth and iconHeight default to 16, 16.

Example

dewdrop:AddLine(
    'text', "MyAddon v249",
    'icon', "Interface\\Buttons\\UI-GroupLoot-Dice-Up",
    'isTitle', true
)

or

dewdrop:AddLine(
    'text', "MyAddon v249",
    'icon', "Interface\\Buttons\\UI-GroupLoot-Dice-Up",
    'iconWidth', 16,
    'iconHeight', 24,
    'isTitle', true
)

iconCoordLeft, iconCoordRight, iconCoordBottom, iconCoordTop

iconCoordLeft 
number - left position
iconCoordRight 
number - right position

iconCoordBottom 
number - bottom position
iconCoordTop 
number - top position

Remarks

In essence, these values will be fed into :SetTexCoord of the icon.

Example

dewdrop:AddLine(
    'text', "Skull",
    'icon', "Interface\\TargetingFrame\\UI-RaidTargetingIcons",
    'iconCoordLeft', 0.75,
    'iconCoordRight', 1,
    'iconCoordBottom', 0.5,
    'iconCoordTop', 0.25
)
Personal tools
Support the Site