Class: RubyCurses::CheckBoxMenuItem
- Defined in:
- lib/rbcurse/rmenu.rb
Overview
menubar
Instance Attribute Summary collapse
-
#checkbox ⇒ Object
readonly
Returns the value of attribute checkbox.
Attributes inherited from MenuItem
#accelerator, #active_index, #bgcolor, #coffset, #col, #color, #color_pair, #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
checkbox.
-
#text=(t) ⇒ Object
stack level too deep if no = .????.
- #to_s ⇒ Object
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.
894 895 896 897 898 |
# File 'lib/rbcurse/rmenu.rb', line 894 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
929 930 931 932 933 934 935 936 |
# File 'lib/rbcurse/rmenu.rb', line 929 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.
893 894 895 |
# File 'lib/rbcurse/rmenu.rb', line 893 def checkbox @checkbox end |
Instance Method Details
#fire ⇒ Object
917 918 919 920 921 922 |
# File 'lib/rbcurse/rmenu.rb', line 917 def fire checkbox.toggle super repaint highlight true end |
#getvalue ⇒ Object
911 912 913 |
# File 'lib/rbcurse/rmenu.rb', line 911 def getvalue checkbox.getvalue end |
#getvalue_for_paint ⇒ Object
914 915 916 |
# File 'lib/rbcurse/rmenu.rb', line 914 def getvalue_for_paint "|%-*s|" % [@width, checkbox.getvalue_for_paint] end |
#offvalue ⇒ Object
902 903 904 |
# File 'lib/rbcurse/rmenu.rb', line 902 def offvalue @checkbox.onvalue offvalue end |
#onvalue ⇒ Object
899 900 901 |
# File 'lib/rbcurse/rmenu.rb', line 899 def onvalue @checkbox.onvalue onvalue end |
#repaint ⇒ Object
checkbox
923 924 925 926 927 928 |
# File 'lib/rbcurse/rmenu.rb', line 923 def repaint # checkbox # FIXME need @color_pair here @color_pair ||= get_color($reversecolor, @color, @bgcolor) @parent.window.printstring( row, 0, getvalue_for_paint, @color_pair) parent.window.wrefresh end |
#text=(t) ⇒ Object
stack level too deep if no = .????
905 906 907 |
# File 'lib/rbcurse/rmenu.rb', line 905 def text=(t) # stack level too deep if no = .???? @checkbox.text t end |
#to_s ⇒ Object
908 909 910 |
# File 'lib/rbcurse/rmenu.rb', line 908 def to_s " #{text} " end |