Module flower.widget.Button

This class is an image that can be pressed.

It is a simple button.

Extends:

Info:

  • Release: V3.0.0
  • Author: Makoto

Functions

Button:_initInternal () Initializes the internal variables.
Button:_initEventListeners ()
Button:_createChildren () Create children.
Button:_createButtonImage () Create the buttonImage.
Button:_createTextLabel () Create the textLabel.
Button:updateDisplay () Update the display.
Button:updateButtonImage () Update the buttonImage.
Button:updateTextLabel () Update the buttonImage.
Button:getImagePath () Returns the image path.
Button:getLabelContentRect () Returns the label content rect.
Button:isSelected () If the selected the button returns True.
Button:setSelected (selected) Sets the selected.
Button:setToggle (toggle) Sets the toggle.
Button:isToggle () Returns the toggle.
Button:setNormalTexture (texture) Sets the normal texture.
Button:setSelectedTexture (texture) Sets the selected texture.
Button:setDisabledTexture (texture) Sets the selected texture.
Button:setText (text) Sets the text.
Button:getText () Returns the text.
Button:setTextSize (textSize) Sets the textSize.
Button:getTextSize (textSize) Sets the textSize.
Button:setFontName (fontName) Sets the fontName.
Button:getFontName (textSize) Sets the textSize.
Button:getFont () Returns the font.
Button:setTextAlign (horizontalAlign, verticalAlign) Sets the text align.
Button:getTextAlign () Returns the text align.
Button:getAlignment () Returns the text align for MOAITextBox.
Button:setTextColor (red, green, blue, alpha) Sets the text color.
Button:getTextColor () Returns the text color.
Button:setTextPadding (paddingLeft, paddingTop, paddingRight, paddingBottom) Sets the text padding.
Button:getTextPadding () Returns the text padding.
Button:setOnClick (func) Set the event listener that is called when the user click the button.
Button:setOnDown (func) Set the event listener that is called when the user pressed the button.
Button:setOnUp (func) Set the event listener that is called when the user released the button.
Button:setOnSelectedChanged (func) Set the event listener that is called when selected changed.
Button:onEnabledChanged (e) This event handler is called when enabled Changed.
Button:onSelectedChanged (e) This event handler is called when selected changed.
Button:onTouchDown (e) This event handler is called when you touch the button.
Button:onTouchUp (e) This event handler is called when the button is released.
Button:onTouchMove (e) This event handler is called when you move on the button.
Button:onTouchCancel (e) This event handler is called when you cancel the touch.

Fields

STYLE_NORMAL_TEXTURE Style: normalTexture
STYLE_SELECTED_TEXTURE Style: selectedTexture
STYLE_DISABLED_TEXTURE Style: disabledTexture
STYLE_FONT_NAME Style: fontName
STYLE_TEXT_SIZE Style: textSize
STYLE_TEXT_COLOR Style: textColor
STYLE_TEXT_ALIGN Style: textAlign
STYLE_TEXT_PADDING Style: textPadding
EVENT_SELECTED_CHANGED Event: selectedChanged
EVENT_DOWN Event: down
EVENT_UP Event: up
EVENT_CLICK Event: click
EVENT_CANCEL Event: cancel


Functions

Button:_initInternal ()
Initializes the internal variables.
Button:_initEventListeners ()
Initializes the event listener.
Button:_createChildren ()
Create children.
Button:_createButtonImage ()
Create the buttonImage.
Button:_createTextLabel ()
Create the textLabel.
Button:updateDisplay ()
Update the display.
Button:updateButtonImage ()
Update the buttonImage.
Button:updateTextLabel ()
Update the buttonImage.
Button:getImagePath ()
Returns the image path.

Returns:

    imageDeck
Button:getLabelContentRect ()
Returns the label content rect.

Returns:

    content rect
Button:isSelected ()
If the selected the button returns True.

Returns:

    If the selected the button returns True
Button:setSelected (selected)
Sets the selected.

Parameters:

  • selected selected
Button:setToggle (toggle)
Sets the toggle.

Parameters:

  • toggle toggle
Button:isToggle ()
Returns the toggle.

Returns:

    toggle
Button:setNormalTexture (texture)
Sets the normal texture.

Parameters:

  • texture texture
Button:setSelectedTexture (texture)
Sets the selected texture.

Parameters:

  • texture texture
Button:setDisabledTexture (texture)
Sets the selected texture.

Parameters:

  • texture texture
Button:setText (text)
Sets the text.

Parameters:

  • text text
Button:getText ()
Returns the text.

Returns:

    text
Button:setTextSize (textSize)
Sets the textSize.

Parameters:

  • textSize textSize
Button:getTextSize (textSize)
Sets the textSize.

Parameters:

  • textSize textSize
Button:setFontName (fontName)
Sets the fontName.

Parameters:

  • fontName fontName
Button:getFontName (textSize)
Sets the textSize.

Parameters:

  • textSize textSize
Button:getFont ()
Returns the font.

Returns:

    font
Button:setTextAlign (horizontalAlign, verticalAlign)
Sets the text align.

Parameters:

  • horizontalAlign horizontal align(left, center, top)
  • verticalAlign vertical align(top, center, bottom)
Button:getTextAlign ()
Returns the text align.

Returns:

  1. horizontal align(left, center, top)
  2. vertical align(top, center, bottom)
Button:getAlignment ()
Returns the text align for MOAITextBox.

Returns:

  1. horizontal align
  2. vertical align
Button:setTextColor (red, green, blue, alpha)
Sets the text color.

Parameters:

  • red red(0 ... 1)
  • green green(0 ... 1)
  • blue blue(0 ... 1)
  • alpha alpha(0 ... 1)
Button:getTextColor ()
Returns the text color.

Returns:

  1. red(0 ... 1)
  2. green(0 ... 1)
  3. blue(0 ... 1)
  4. alpha(0 ... 1)
Button:setTextPadding (paddingLeft, paddingTop, paddingRight, paddingBottom)
Sets the text padding.

Parameters:

  • paddingLeft padding left
  • paddingTop padding top
  • paddingRight padding right
  • paddingBottom padding bottom
Button:getTextPadding ()
Returns the text padding.

Returns:

  1. paddingLeft
  2. paddingTop
  3. paddingRight
  4. paddingBottom
Button:setOnClick (func)
Set the event listener that is called when the user click the button.

Parameters:

  • func click event handler
Button:setOnDown (func)
Set the event listener that is called when the user pressed the button.

Parameters:

  • func button down event handler
Button:setOnUp (func)
Set the event listener that is called when the user released the button.

Parameters:

  • func button up event handler
Button:setOnSelectedChanged (func)
Set the event listener that is called when selected changed.

Parameters:

  • func selected changed event handler
Button:onEnabledChanged (e)
This event handler is called when enabled Changed.

Parameters:

  • e Touch Event
Button:onSelectedChanged (e)
This event handler is called when selected changed.

Parameters:

  • e Touch Event
Button:onTouchDown (e)
This event handler is called when you touch the button.

Parameters:

  • e Touch Event
Button:onTouchUp (e)
This event handler is called when the button is released.

Parameters:

  • e Touch Event
Button:onTouchMove (e)
This event handler is called when you move on the button.

Parameters:

  • e Touch Event
Button:onTouchCancel (e)
This event handler is called when you cancel the touch.

Parameters:

  • e Touch Event

Fields

STYLE_NORMAL_TEXTURE
Style: normalTexture
STYLE_SELECTED_TEXTURE
Style: selectedTexture
STYLE_DISABLED_TEXTURE
Style: disabledTexture
STYLE_FONT_NAME
Style: fontName
STYLE_TEXT_SIZE
Style: textSize
STYLE_TEXT_COLOR
Style: textColor
STYLE_TEXT_ALIGN
Style: textAlign
STYLE_TEXT_PADDING
Style: textPadding
EVENT_SELECTED_CHANGED
Event: selectedChanged
EVENT_DOWN
Event: down
EVENT_UP
Event: up
EVENT_CLICK
Event: click
EVENT_CANCEL
Event: cancel
generated by LDoc 1.3