class Umbra::Checkbox

A checkbox, may be selected or unselected

Public Class Methods

new(config={}) click to toggle source
Calls superclass method
# File lib/umbra/checkbox.rb, line 17
def initialize config={}, &block
  @surround_chars = ['[', ']']    # 2008-12-23 23:16 added space in Button so overriding
  super
end

Public Instance Methods

getvalue() click to toggle source
# File lib/umbra/checkbox.rb, line 21
def getvalue
  @value 
end
getvalue_for_paint() click to toggle source
# File lib/umbra/checkbox.rb, line 25
def getvalue_for_paint
  buttontext = 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] + buttontext + @surround_chars[1] 
  else
    pretext = @surround_chars[0] + buttontext + @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