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


15916
15917
# File 'Monkeybrains.rb', line 15916

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


15864
15865
15866
# File 'Monkeybrains.rb', line 15864

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


15894
15895
15896
# File 'Monkeybrains.rb', line 15894

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


15874
15875
15876
# File 'Monkeybrains.rb', line 15874

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


15884
15885
15886
# File 'Monkeybrains.rb', line 15884

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


15946
15947
# File 'Monkeybrains.rb', line 15946

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


15926
15927
# File 'Monkeybrains.rb', line 15926

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


15937
15938
# File 'Monkeybrains.rb', line 15937

def setState(state)
end