Class: Canis::CheckBoxMenuItem
- Defined in:
- lib/canis/core/widgets/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.
939 940 941 942 943 |
# File 'lib/canis/core/widgets/rmenu.rb', line 939 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
974 975 976 977 978 979 980 981 |
# File 'lib/canis/core/widgets/rmenu.rb', line 974 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.
938 939 940 |
# File 'lib/canis/core/widgets/rmenu.rb', line 938 def checkbox @checkbox end |
Instance Method Details
#fire ⇒ Object
962 963 964 965 966 967 |
# File 'lib/canis/core/widgets/rmenu.rb', line 962 def fire checkbox.toggle super repaint highlight true end |
#getvalue ⇒ Object
956 957 958 |
# File 'lib/canis/core/widgets/rmenu.rb', line 956 def getvalue checkbox.getvalue end |
#getvalue_for_paint ⇒ Object
959 960 961 |
# File 'lib/canis/core/widgets/rmenu.rb', line 959 def getvalue_for_paint "|%-*s|" % [@width, checkbox.getvalue_for_paint] end |
#offvalue ⇒ Object
947 948 949 |
# File 'lib/canis/core/widgets/rmenu.rb', line 947 def offvalue @checkbox.onvalue offvalue end |
#onvalue ⇒ Object
944 945 946 |
# File 'lib/canis/core/widgets/rmenu.rb', line 944 def onvalue @checkbox.onvalue onvalue end |
#repaint ⇒ Object
checkbox
968 969 970 971 972 973 |
# File 'lib/canis/core/widgets/rmenu.rb', line 968 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 = .????
950 951 952 |
# File 'lib/canis/core/widgets/rmenu.rb', line 950 def text=(t) # stack level too deep if no = .???? @checkbox.text t end |
#to_s ⇒ Object
953 954 955 |
# File 'lib/canis/core/widgets/rmenu.rb', line 953 def to_s " #{text} " end |