Class: RubyCurses::ItemEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/rbcurse/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



3065
3066
3067
3068
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3065

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



3052
3053
3054
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3052

def item
  @item
end

#item_firstObject (readonly)

if from a list

Since:

  • 1.2.0



3054
3055
3056
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3054

def item_first
  @item_first
end

#item_lastObject (readonly)

Since:

  • 1.2.0



3055
3056
3057
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3055

def item_last
  @item_last
end

#item_selectableObject (readonly)

item originating event such as list or collection

Since:

  • 1.2.0



3053
3054
3055
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3053

def item_selectable
  @item_selectable
end

#param_stringObject (readonly)

for debugging etc

Since:

  • 1.2.0



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

def param_string
  @param_string
end

#stateObject (readonly)

Since:

  • 1.2.0



3051
3052
3053
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3051

def state
  @state
end

Instance Method Details

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

Since:

  • 1.2.0



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

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