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


14432
14433
# File 'Monkeybrains.rb', line 14432

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


14380
14381
14382
# File 'Monkeybrains.rb', line 14380

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


14410
14411
14412
# File 'Monkeybrains.rb', line 14410

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


14390
14391
14392
# File 'Monkeybrains.rb', line 14390

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


14400
14401
14402
# File 'Monkeybrains.rb', line 14400

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


14462
14463
# File 'Monkeybrains.rb', line 14462

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


14442
14443
# File 'Monkeybrains.rb', line 14442

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


14453
14454
# File 'Monkeybrains.rb', line 14453

def setState(state)
end