Class: RubyCurses::ItemEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/rbhex/core/widgets/rwidget.rb

Overview

an event fired when an item that can be selected is toggled/selected

Since:

  • 1.2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item, item_selectable) ⇒ ItemEvent

i think only one is needed per object, so create once only

Since:

  • 1.2.0



3070
3071
3072
3073
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3070

def initialize item, item_selectable
  @item, @item_selectable =
    item, item_selectable
end

Instance Attribute Details

#itemObject (readonly)

the item pressed such as toggle button

Since:

  • 1.2.0



3057
3058
3059
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3057

def item
  @item
end

#item_firstObject (readonly)

if from a list

Since:

  • 1.2.0



3059
3060
3061
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3059

def item_first
  @item_first
end

#item_lastObject (readonly)

Since:

  • 1.2.0



3060
3061
3062
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3060

def item_last
  @item_last
end

#item_selectableObject (readonly)

item originating event such as list or collection

Since:

  • 1.2.0



3058
3059
3060
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3058

def item_selectable
  @item_selectable
end

#param_stringObject (readonly)

for debugging etc

Since:

  • 1.2.0



3061
3062
3063
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3061

def param_string
  @param_string
end

#stateObject (readonly)

Since:

  • 1.2.0



3056
3057
3058
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3056

def state
  @state
end

Instance Method Details

#set(state, item_first = -1,, item_last = -1,, param_string = nil) ⇒ Object

Since:

  • 1.2.0



3074
3075
3076
3077
3078
# File 'lib/rbhex/core/widgets/rwidget.rb', line 3074

def set state, item_first=-1, item_last=-1, param_string=nil
  @state, @item_first, @item_last, @param_string =
    state, item_first, item_last, param_string
  @param_string = "Item event fired: #{item}, #{state}" if param_string.nil?
end