Class: Toybox::WatchUi::Selectable

Inherits:
Drawable show all

Overview

Note:

See the Selectable sample distributed with the SDK for an example of the use of the Selectable class

A representation of an on-screen selectable object with defined states depending on selection mode.

See Also:

Since:

  • 2.1.0

Direct Known Subclasses

Button

Direct Known Subclasses

Button

Instance Attribute Summary collapse

Attributes inherited from Drawable

height, identifier, locX, locY, width

Instance Method Summary collapse

Methods inherited from Drawable

setLocation, setSize

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(settings) ⇒ Selectable

Returns a new instance of Selectable

Parameters:

Options Hash (settings):

  • :locX (Toybox::Lang::Number)

    The absolute, on-screen x-coordinate for the Selectable object (required)

  • :locY (Toybox::Lang::Number)

    The absolute, on-screen y-coordinate for the Selectable object (required)

  • :width (Toybox::Lang::Number)

    The clip width of the Selectable object (required)

  • :height (Toybox::Lang::Number)

    The clip height of the Selectable object (required)

  • :stateDefault (Toybox::Lang::Object)

    The Drawable or color to display in default state (optional)

  • :stateHighlighted (Toybox::Lang::Object)

    The Drawable or color to display in disable state (optional)

  • :stateSelected (Toybox::Lang::Object)

    The Drawable or color to display in highlight state (optional)

  • :stateDisabled (Toybox::Lang::Object)

    The Drawable or color to display in selected state (optional)

See Also:

Since:

  • 2.1.0


15943
15944
# File 'Monkeybrains.rb', line 15943

def initialize(settings)
end

Instance Attribute Details

stateDefaultToybox::Lang::Object

The default state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the default state of the Selectable

Returns:

Since:

  • 2.1.0


15891
15892
15893
# File 'Monkeybrains.rb', line 15891

def stateDefault
  @stateDefault
end

stateDisabledToybox::Lang::Object

The disabled state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the disabled state of the Selectable

Returns:

Since:

  • 2.1.0


15921
15922
15923
# File 'Monkeybrains.rb', line 15921

def stateDisabled
  @stateDisabled
end

stateHighlightedToybox::Lang::Object

The highlighted state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the highlighted state of the Selectable

Returns:

Since:

  • 2.1.0


15901
15902
15903
# File 'Monkeybrains.rb', line 15901

def stateHighlighted
  @stateHighlighted
end

stateSelectedToybox::Lang::Object

The selected state of a Selectable object.

A Drawable, Graphics.COLOR_* constant, or 24-bit integer of the form 0xRRGGBB representing the selected state of the Selectable

Returns:

Since:

  • 2.1.0


15911
15912
15913
# File 'Monkeybrains.rb', line 15911

def stateSelected
  @stateSelected
end

Instance Method Details

draw(dc) ⇒ Object

Draw the Selectable to the device context (Dc).

This method assumes that the device context has already been configured to the proper settings.

Parameters:

Since:

  • 2.1.0


15973
15974
# File 'Monkeybrains.rb', line 15973

def draw(dc)
end

getStateToybox::Lang::Symbol

Get the current state of a Selectable object.

Returns:

  • (Toybox::Lang::Symbol)

    The current state:

    • :stateDefault

    • :stateHighlighted

    • :stateSelected

    • :stateDisabled

Since:

  • 2.1.0


15953
15954
# File 'Monkeybrains.rb', line 15953

def getState()
end

setState(state) ⇒ Object

Set the current state of a Selectable object.

Parameters:

  • state (Toybox::Lang::Symbol)

    The desired state:

    • :stateDefault

    • :stateHighlighted

    • :stateSelected

    • :stateDisabled

Raises:

Since:

  • 2.1.0


15964
15965
# File 'Monkeybrains.rb', line 15964

def setState(state)
end