Class: Canis::CheckBox
- Inherits:
-
ToggleButton
- Object
- Widget
- Button
- ToggleButton
- Canis::CheckBox
- Defined in:
- lib/canis/core/util/app.rb,
lib/canis/core/widgets/rwidget.rb
Overview
A checkbox, may be selected or unselected
Instance Attribute Summary
Attributes inherited from Widget
#_object_created, #col_offset, #config, #curpos, #focussed, #form, #handler, #id, #key_label, #parent_component, #row_offset, #state
Instance Method Summary collapse
- #getvalue ⇒ Object
- #getvalue_for_paint ⇒ Object
-
#initialize(form, config = {}, &block) ⇒ CheckBox
constructor
if a variable has been defined, off and on value will be set in it (default 0,1).
-
#text(*val) ⇒ Object
a little dicey XXX.
Methods inherited from ToggleButton
#checked, #checked?, #fire, #handle_key, #toggle
Methods inherited from Button
#action, #bind_hotkey, button_layout, #command, #default_button, #fire, #handle_key, #map_keys, #mnemonic, #repaint, #selected?
Methods inherited from Widget
#action_manager, #bgcolor, #color, #color_pair, #command, #destroy, #focus, #focusable, #focusable?, #handle_key, #hide, #init_vars, #modified?, #move, #on_enter, #on_leave, #override_graphic, #process_key, #property_set, #remove, #repaint, #repaint_all, #repaint_required, #rowcol, #set_form, #set_form_col, #set_form_row, #set_modified, #setformrowcol, #setrowcol, #show, #unbind_key
Methods included from Io
#__create_footer_window, #clear_this, #get_file, #print_this, #rb_getchar, #rb_gets, #rb_getstr, #warn
Methods included from Utils
#ORIG_process_key, #ORIGbind_key, #ORIGkeycode_tos, #_process_key, #bind_composite_mapping, #bind_key, #bind_keys, #check_composite_mapping, #create_logger, #define_key, #define_prefix_command, #execute_mapping, #get_attrib, #get_color, #key, #key_tos, #print_key_bindings, #repeatm, #run_command, #shell_out, #shell_output, #suspend, #view, #xxxbind_composite_mapping
Methods included from ConfigSetup
Methods included from EventHandler
#bind, #event?, #event_list, #fire_handler, #fire_property_change, #register_events
Constructor Details
#initialize(form, config = {}, &block) ⇒ CheckBox
if a variable has been defined, off and on value will be set in it (default 0,1)
3457 3458 3459 3460 |
# File 'lib/canis/core/widgets/rwidget.rb', line 3457 def initialize form, config={}, &block @surround_chars = ['[', ']'] # 2008-12-23 23:16 added space in Button so overriding super end |
Instance Method Details
#getvalue ⇒ Object
3461 3462 3463 |
# File 'lib/canis/core/widgets/rwidget.rb', line 3461 def getvalue @value end |
#getvalue_for_paint ⇒ Object
3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 |
# File 'lib/canis/core/widgets/rwidget.rb', line 3465 def getvalue_for_paint = getvalue() ? "X" : " " dtext = @width.nil? ? @text : "%-*s" % [@width, @text] dtext = "" if @text.nil? # added 2009-01-13 00:41 since cbcellrenderer prints no text if @align_right @text_offset = 0 @col_offset = dtext.length + @surround_chars[0].length + 1 return "#{dtext} " + @surround_chars[0] + + @surround_chars[1] else pretext = @surround_chars[0] + + @surround_chars[1] @text_offset = pretext.length + 1 @col_offset = @surround_chars[0].length #@surround_chars[0] + buttontext + @surround_chars[1] + " #{@text}" return pretext + " #{dtext}" end end |
#text(*val) ⇒ Object
a little dicey XXX
65 66 67 68 69 70 71 72 |
# File 'lib/canis/core/util/app.rb', line 65 def text(*val) raise "FIXME this is being used Checkbox app.rb text(), otherwise delete this. 2014-08-19 - 21:01 " if val.empty? @value ? @onvalue : @offvalue else super end end |