Class: Nuklear::UI::ColorPicker

Inherits:
Base
  • Object
show all
Defined in:
lib/nuklear/ui/color_picker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(color, type: :rgba, **options) ⇒ ColorPicker

Returns a new instance of ColorPicker.



7
8
9
10
11
# File 'lib/nuklear/ui/color_picker.rb', line 7

def initialize(color, type: :rgba, **options)
  super(**options)
  self.color = color
  self.type = type
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



4
5
6
# File 'lib/nuklear/ui/color_picker.rb', line 4

def color
  @color
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/nuklear/ui/color_picker.rb', line 5

def type
  @type
end

Instance Method Details

#result(color, context) ⇒ Object



24
25
26
27
28
# File 'lib/nuklear/ui/color_picker.rb', line 24

def result(color, context)
  @color = color
  trigger :color_changed
  @last_event = nil
end

#to_commandObject



20
21
22
# File 'lib/nuklear/ui/color_picker.rb', line 20

def to_command
  [:ui_color_picker, color, type]
end