Class: Canis::ActionManager
- Includes:
- Io
- Defined in:
- lib/canis/core/include/actionmanager.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
Instance Method Summary collapse
-
#add_action(act) ⇒ Object
instance_eval &block if block_given?.
-
#initialize ⇒ ActionManager
constructor
form, config={}, &block.
-
#insert_action(pos, *val) ⇒ Object
insert an item at given position (index).
- #remove_action(act) ⇒ Object
-
#show_actions ⇒ Object
popup the hist.
Methods included from Io
#__create_footer_window, #clear_this, #get_file, #print_this, #rb_getchar, #rb_gets, #rb_getstr, #warn
Constructor Details
#initialize ⇒ ActionManager
form, config={}, &block
17 18 19 20 |
# File 'lib/canis/core/include/actionmanager.rb', line 17 def initialize #form, config={}, &block @actions = [] #instance_eval &block if block_given? end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
15 16 17 |
# File 'lib/canis/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/canis/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/canis/core/include/actionmanager.rb', line 29 def insert_action pos, *val @actions[pos] = val end |
#remove_action(act) ⇒ Object
24 25 26 |
# File 'lib/canis/core/include/actionmanager.rb', line 24 def remove_action act @actions.remove act end |
#show_actions ⇒ Object
popup the hist
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/canis/core/include/actionmanager.rb', line 38 def show_actions return if @actions.empty? list = @actions = PromptMenu.new self do |m| list.each { |e| m.add *e } end .display_new :title => 'Widget Menu (Press letter)' end |