Class: Nuklear::UI::Selectable

Inherits:
Checkbox show all
Includes:
TextAlign
Defined in:
lib/nuklear/ui/selectable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TextAlign

#align_as_flags

Methods inherited from Checkbox

#checked=, #checked?, #result

Methods inherited from Base

descendants, #dsl, inherited

Methods included from Enableable

#disable, #disabled=, #disabled?, #enable, #enabled=, #enabled?

Methods included from Events

#event_listeners_for, #on, #trigger

Constructor Details

#initialize(text: nil, align: :left, image: nil, selected: false, **options, &block) ⇒ Selectable

Returns a new instance of Selectable.



8
9
10
11
12
13
14
# File 'lib/nuklear/ui/selectable.rb', line 8

def initialize(text: nil, align: :left, image: nil, selected: false, **options, &block)
  super(**options, &block)
  self.selected = selected
  @text = text
  @image = image
  @align = align
end

Instance Attribute Details

#alignObject

Returns the value of attribute align.



6
7
8
# File 'lib/nuklear/ui/selectable.rb', line 6

def align
  @align
end

#imageObject

Returns the value of attribute image.



6
7
8
# File 'lib/nuklear/ui/selectable.rb', line 6

def image
  @image
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/nuklear/ui/selectable.rb', line 6

def text
  @text
end

Instance Method Details

#to_commandObject



16
17
18
# File 'lib/nuklear/ui/selectable.rb', line 16

def to_command
  [ :ui_selectable, image, text, selected?, align_as_flags(align) ]
end