Module: Shoes::Common::State

Included in:
Button, Shoes::CheckButton, InputBox, ListBox
Defined in:
shoes-core/lib/shoes/common/state.rb

Constant Summary collapse

DISABLED_STATE =
"disabled"

Instance Method Summary collapse

Instance Method Details

#after_initialize(*_) ⇒ Object


8
9
10
11
# File 'shoes-core/lib/shoes/common/state.rb', line 8

def after_initialize(*_)
  super
  update_from_state
end

#enabled?Boolean


17
18
19
# File 'shoes-core/lib/shoes/common/state.rb', line 17

def enabled?
  state.to_s != DISABLED_STATE
end

#state=(value) ⇒ Object


13
14
15
# File 'shoes-core/lib/shoes/common/state.rb', line 13

def state=(value)
  style(state: value)
end

#update_from_stateObject


21
22
23
# File 'shoes-core/lib/shoes/common/state.rb', line 21

def update_from_state
  @gui.enabled(enabled?)
end