Class: RubyCurses::CheckBox
- Inherits:
-
ToggleButton
- Object
- Widget
- Button
- ToggleButton
- RubyCurses::CheckBox
- Defined in:
- lib/rbcurse/core/widgets/rwidget.rb,
lib/rbcurse/core/util/app.rb
Overview
A checkbox, may be selected or unselected
Instance Attribute Summary
Attributes inherited from Widget
#_object_created, #col_offset, #cols_panned, #config, #curpos, #focussed, #form, #id, #key_label, #parent_component, #row_offset, #rows_panned, #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, #mnemonic, #repaint, #selected?
Methods inherited from Widget
#action_manager, #changed, #click, #color_pair, #command, #destroy, #enter, #event_list, #focus, #get_preferred_size, #handle_key, #height, #height=, #hide, #init_vars, #leave, #modified?, #move, #on_enter, #on_leave, #override_graphic, #process_key, #remove, #repaint, #repaint_all, #repaint_required, #rowcol, #set_buffer_modified, #set_buffering, #set_form, #set_form_col, #set_form_row, #set_modified, #setformrowcol, #setrowcol, #show, #text_variable, #unbind_key, #width, #width=
Methods included from Io
#__create_footer_window, #clear_this, #get_file, #print_this, #rb_getchar, #rb_gets, #rbgetstr, #warn
Methods included from Utils
#OLDdefine_key, #_process_key, #bind_key, #bind_keys, #clean_string!, #define_key, #define_prefix_command, #display_app_help, #get_attrib, #get_color, #keycode_tos, #last_line, #one_line_window, #parse_formatted_text, #print_key_bindings, #repeatm, #run_command, #shell_out, #shell_output, #suspend, #view, #wrap_text
Methods included from ConfigSetup
#cget, #config_setup, #configure, #variable_set
Methods included from EventHandler
#bind, #fire_handler, #fire_property_change
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)
3174 3175 3176 3177 |
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3174 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
3178 3179 3180 |
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3178 def getvalue @value end |
#getvalue_for_paint ⇒ Object
3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 |
# File 'lib/rbcurse/core/widgets/rwidget.rb', line 3182 def getvalue_for_paint = getvalue() ? "X" : " " dtext = @display_length.nil? ? @text : "%-*s" % [@display_length, @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
61 62 63 64 65 66 67 |
# File 'lib/rbcurse/core/util/app.rb', line 61 def text(*val) if val.empty? @value ? @onvalue : @offvalue else super end end |