Class: RubyCurses::ItemEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/rbcurse/rwidget.rb

Overview

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

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



2466
2467
2468
2469
# File 'lib/rbcurse/rwidget.rb', line 2466

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

Instance Attribute Details

#itemObject (readonly)

the item pressed such as toggle button



2453
2454
2455
# File 'lib/rbcurse/rwidget.rb', line 2453

def item
  @item
end

#item_firstObject (readonly)

if from a list



2455
2456
2457
# File 'lib/rbcurse/rwidget.rb', line 2455

def item_first
  @item_first
end

#item_lastObject (readonly)

Returns the value of attribute item_last.



2456
2457
2458
# File 'lib/rbcurse/rwidget.rb', line 2456

def item_last
  @item_last
end

#item_selectableObject (readonly)

item originating event such as list or collection



2454
2455
2456
# File 'lib/rbcurse/rwidget.rb', line 2454

def item_selectable
  @item_selectable
end

#param_stringObject (readonly)

for debugging etc



2457
2458
2459
# File 'lib/rbcurse/rwidget.rb', line 2457

def param_string
  @param_string
end

#stateObject (readonly)



2452
2453
2454
# File 'lib/rbcurse/rwidget.rb', line 2452

def state
  @state
end

Instance Method Details

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



2470
2471
2472
2473
2474
# File 'lib/rbcurse/rwidget.rb', line 2470

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