Class: GGLib::RadioGroup
Defined Under Namespace
Modules: Layout, Spacing
Instance Attribute Summary
Attributes inherited from Widget
#buttonId, #defimage, #id, #name, #sleeping, #window, #zfocus
Attributes inherited from Tile
#id, #inclusive, #x1, #x2, #y1, #y2
Instance Method Summary
collapse
Methods inherited from Widget
#blur, #button, #clicked?, #del, #downevent, #draw, #event, #feedText, #focus, #hasFocus?, #hasStickyFocus?, #intDraw, #onClick, #onDelete, #onDrag, #onInitialize, #onKeyPress, #onMouseDown, #onMouseOut, #onMouseOver, #onRightClick, #onRightDrag, #onRightMouseDown, #onStickyBlur, #onStickyFocus, #over?, #sleep, #sleeping?, #stickFocus, #unstickFocus, #wakeUp
Methods inherited from Tile
#centerOn, #del, deleteAllInstances, deleteById, #each, #eachBorder, getAllInstances, getById, #height, #iTile, #intersect?, intersect?, #isInTile?, #move, setAllInstances, #setCoordinates, #setTile, #width, #xTile
Constructor Details
#initialize(name, x, y, buttons = {}, layout = Layout::Vertical, spacing = -1,, theme = Themes::blank) ⇒ RadioGroup
Returns a new instance of RadioGroup.
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
|
# File 'lib/ext/widgets.rb', line 462
def initialize(name, x, y, buttons = {}, layout = Layout::Vertical, spacing = -1, theme = Themes::blank)
super(name,x,y,x,y,Themes::blank,false)
@buttons = Array.new(buttons.size)
i = 0
if layout == Layout::Horizontal
if spacing == -1
spacing = 75
end
buttons.each { |k,v|
@buttons.push(RadioButton.new(k, x+i, y, v, self, false, theme))
i+=spacing
}
else
if spacing == -1
spacing = 25
end
buttons.each { |k,v|
@buttons.push(RadioButton.new(k, x, y+i, v, self, false, theme))
i+=spacing
}
end
end
|
Instance Method Details
#selected ⇒ Object
503
504
505
|
# File 'lib/ext/widgets.rb', line 503
def selected
return @selected
end
|
#selected=(val) ⇒ Object
506
507
508
|
# File 'lib/ext/widgets.rb', line 506
def selected=(val)
@selected = val
end
|
#theme ⇒ Object
484
485
486
487
|
# File 'lib/ext/widgets.rb', line 484
def theme
return @buttons[0].theme if @buttons.size > 0
return Themes::blank
end
|
#theme=(val) ⇒ Object
488
489
490
491
492
|
# File 'lib/ext/widgets.rb', line 488
def theme=(val)
@buttons.each { |button|
button.theme = val
}
end
|
#value ⇒ Object
493
494
495
496
|
# File 'lib/ext/widgets.rb', line 493
def value
return @selected.value unless @selected.nil?
return nil
end
|
#value=(val) ⇒ Object
497
498
499
500
501
502
|
# File 'lib/ext/widgets.rb', line 497
def value=(val)
@buttons.each { |button|
self.selected = button if button.value == val
}
raise RuntimeException.new("No value #{val} in #{self.inspect} (#{self.name})")
end
|