Class: RubyCurses::CheckBoxMenuItem
- Includes:
- DSL
- Defined in:
- lib/rbcurse/rmenu.rb,
lib/rbcurse/rpopupmenu.rb
Overview
menubar
Instance Attribute Summary collapse
-
#checkbox ⇒ Object
readonly
Returns the value of attribute checkbox.
Attributes inherited from MenuItem
#accelerator, #col, #enabled, #mnemonic, #parent, #row, #text, #width
Instance Method Summary collapse
- #fire ⇒ Object
- #getvalue ⇒ Object
- #getvalue_for_paint ⇒ Object
-
#initialize(text, mnemonic = nil, &block) ⇒ CheckBoxMenuItem
constructor
A new instance of CheckBoxMenuItem.
- #method_missing(sym, *args) ⇒ Object
- #offvalue ⇒ Object
- #onvalue ⇒ Object
- #repaint ⇒ Object
-
#text=(t) ⇒ Object
stack level too deep if no = .????.
-
#to_s ⇒ Object
added @ with text, else crashing on testmenu.rb.
Methods included from DSL
Methods inherited from MenuItem
#command, #destroy, #highlight, #on_enter, #on_leave
Constructor Details
#initialize(text, mnemonic = nil, &block) ⇒ CheckBoxMenuItem
Returns a new instance of CheckBoxMenuItem.
623 624 625 626 627 |
# File 'lib/rbcurse/rmenu.rb', line 623 def initialize text, mnemonic=nil, &block @checkbox = CheckBox.new nil @checkbox.text text super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
656 657 658 659 660 661 662 663 |
# File 'lib/rbcurse/rmenu.rb', line 656 def method_missing(sym, *args) if checkbox.respond_to? sym $log.debug("calling CHECKBOXMENU #{sym} called #{args[0]}") checkbox.send(sym, args) else $log.error("ERROR CHECKBOXMENU #{sym} called") end end |
Instance Attribute Details
#checkbox ⇒ Object (readonly)
Returns the value of attribute checkbox.
622 623 624 |
# File 'lib/rbcurse/rmenu.rb', line 622 def checkbox @checkbox end |
Instance Method Details
#fire ⇒ Object
646 647 648 649 650 651 |
# File 'lib/rbcurse/rmenu.rb', line 646 def fire checkbox.toggle super repaint highlight true end |
#getvalue ⇒ Object
640 641 642 |
# File 'lib/rbcurse/rmenu.rb', line 640 def getvalue checkbox.getvalue end |
#getvalue_for_paint ⇒ Object
643 644 645 |
# File 'lib/rbcurse/rmenu.rb', line 643 def getvalue_for_paint "|%-*s|" % [@width, checkbox.getvalue_for_paint] end |
#offvalue ⇒ Object
631 632 633 |
# File 'lib/rbcurse/rmenu.rb', line 631 def offvalue @checkbox.onvalue offvalue end |
#onvalue ⇒ Object
628 629 630 |
# File 'lib/rbcurse/rmenu.rb', line 628 def onvalue @checkbox.onvalue onvalue end |
#repaint ⇒ Object
652 653 654 655 |
# File 'lib/rbcurse/rmenu.rb', line 652 def repaint @parent.window.printstring( row, 0, getvalue_for_paint, $reversecolor) parent.window.wrefresh end |
#text=(t) ⇒ Object
stack level too deep if no = .????
634 635 636 |
# File 'lib/rbcurse/rmenu.rb', line 634 def text=(t) # stack level too deep if no = .???? @checkbox.text t end |
#to_s ⇒ Object
added @ with text, else crashing on testmenu.rb
725 726 727 |
# File 'lib/rbcurse/rpopupmenu.rb', line 725 def to_s " #{text} " end |