Class: RubyCurses::CheckBoxMenuItem
Overview
Instance Attribute Summary collapse
Attributes inherited from MenuItem
#accelerator, #active_index, #bgcolor, #coffset, #col, #color, #color_pair, #enabled, #mnemonic, #parent, #row, #text, #width
Instance Method Summary
collapse
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.
913
914
915
916
917
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 913
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
948
949
950
951
952
953
954
955
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 948
def method_missing(sym, *args)
if checkbox.respond_to? sym
checkbox.send(sym, args)
else
$log.error("ERROR CHECKBOXMENU #{sym} called")
end
end
|
Instance Attribute Details
912
913
914
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 912
def checkbox
@checkbox
end
|
Instance Method Details
936
937
938
939
940
941
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 936
def fire
checkbox.toggle
super
repaint
highlight true
end
|
930
931
932
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 930
def getvalue
checkbox.getvalue
end
|
#getvalue_for_paint ⇒ Object
933
934
935
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 933
def getvalue_for_paint
"|%-*s|" % [@width, checkbox.getvalue_for_paint]
end
|
921
922
923
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 921
def offvalue
@checkbox.onvalue offvalue
end
|
918
919
920
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 918
def onvalue
@checkbox.onvalue onvalue
end
|
942
943
944
945
946
947
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 942
def repaint @color_pair ||= get_color($reversecolor, @color, @bgcolor)
@parent.window.printstring( row, 0, getvalue_for_paint, @color_pair)
parent.window.wrefresh
end
|
stack level too deep if no = .????
924
925
926
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 924
def text=(t) @checkbox.text t
end
|
927
928
929
|
# File 'lib/rbcurse/core/widgets/rmenu.rb', line 927
def to_s
" #{text} "
end
|