Class: RubyCurses::PCheckBoxMenuItem
- Defined in:
- lib/rbcurse/rpopupmenu.rb
Overview
menubar
Instance Attribute Summary collapse
-
#checkbox ⇒ Object
readonly
Returns the value of attribute checkbox.
Attributes inherited from PMenuItem
#accelerator, #col, #enabled, #mnemonic, #parent, #row, #width
Instance Method Summary collapse
- #fire ⇒ Object
- #getvalue ⇒ Object
- #getvalue_for_paint ⇒ Object
-
#initialize(text, mnemonic = nil, &block) ⇒ PCheckBoxMenuItem
constructor
A new instance of PCheckBoxMenuItem.
- #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 inherited from PMenuItem
#command, #destroy, #highlight, #on_enter, #on_leave, #text
Constructor Details
#initialize(text, mnemonic = nil, &block) ⇒ PCheckBoxMenuItem
Returns a new instance of PCheckBoxMenuItem.
713 714 715 716 717 |
# File 'lib/rbcurse/rpopupmenu.rb', line 713 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
747 748 749 750 751 752 753 754 |
# File 'lib/rbcurse/rpopupmenu.rb', line 747 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.
712 713 714 |
# File 'lib/rbcurse/rpopupmenu.rb', line 712 def checkbox @checkbox end |
Instance Method Details
#fire ⇒ Object
737 738 739 740 741 742 |
# File 'lib/rbcurse/rpopupmenu.rb', line 737 def fire checkbox.toggle super repaint highlight true end |
#getvalue ⇒ Object
731 732 733 |
# File 'lib/rbcurse/rpopupmenu.rb', line 731 def getvalue checkbox.getvalue end |
#getvalue_for_paint ⇒ Object
734 735 736 |
# File 'lib/rbcurse/rpopupmenu.rb', line 734 def getvalue_for_paint "|%-*s|" % [@width, checkbox.getvalue_for_paint] end |
#offvalue ⇒ Object
721 722 723 |
# File 'lib/rbcurse/rpopupmenu.rb', line 721 def offvalue @checkbox.onvalue offvalue end |
#onvalue ⇒ Object
718 719 720 |
# File 'lib/rbcurse/rpopupmenu.rb', line 718 def onvalue @checkbox.onvalue onvalue end |
#repaint ⇒ Object
743 744 745 746 |
# File 'lib/rbcurse/rpopupmenu.rb', line 743 def repaint @parent.window.printstring( row, 0, getvalue_for_paint, $reversecolor) parent.window.wrefresh end |
#text=(t) ⇒ Object
stack level too deep if no = .????
724 725 726 |
# File 'lib/rbcurse/rpopupmenu.rb', line 724 def text=(t) # stack level too deep if no = .???? @checkbox.text t end |
#to_s ⇒ Object
added @ with text, else crashing on testmenu.rb
728 729 730 |
# File 'lib/rbcurse/rpopupmenu.rb', line 728 def to_s " #{@text} " end |