Class: RubyCurses::ActionManager

Inherits:
Object
  • Object
show all
Includes:
Io
Defined in:
lib/rbcurse/core/include/actionmanager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Io

#__create_footer_window, #clear_this, #get_file, #print_this, #rb_getchar, #rb_gets, #rbgetstr, #warn

Constructor Details

#initializeActionManager

form, config={}, &block



17
18
19
20
# File 'lib/rbcurse/core/include/actionmanager.rb', line 17

def initialize #form, config={}, &block
  @actions = []
   #instance_eval &block if block_given?
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



15
16
17
# File 'lib/rbcurse/core/include/actionmanager.rb', line 15

def actions
  @actions
end

Instance Method Details

#add_action(act) ⇒ Object

instance_eval &block if block_given?



21
22
23
# File 'lib/rbcurse/core/include/actionmanager.rb', line 21

def add_action act
  @actions << act
end

#insert_action(pos, *val) ⇒ Object

insert an item at given position (index)



29
30
31
# File 'lib/rbcurse/core/include/actionmanager.rb', line 29

def insert_action pos, *val
  @actions[pos] = val
end

#remove_action(act) ⇒ Object



24
25
26
# File 'lib/rbcurse/core/include/actionmanager.rb', line 24

def remove_action act
  @actions.remove act
end

#show_actionsObject

popup the hist



38
39
40
41
42
43
44
45
46
47
# File 'lib/rbcurse/core/include/actionmanager.rb', line 38

def show_actions
  return if @actions.empty?
  list = @actions
  menu = PromptMenu.new self do |m|
  list.each { |e| 
    m.add *e
  }
  end
  menu.display_new :title => 'Widget Menu (Press letter)'
end