Class: GGLib::RadioButton
- Inherits:
-
Widget
- Object
- Tile
- Containable
- Widget
- GGLib::RadioButton
- Defined in:
- lib/ext/widgets.rb
Defined Under Namespace
Classes: CheckedHk
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Widget
#buttonId, #defimage, #id, #name, #sleeping, #theme, #window, #zfocus
Attributes inherited from Containable
#align, #container, #maxSize, #minSize, #offset, #padding, #valign
Attributes inherited from Tile
#id, #inclusive, #x1, #x2, #y1, #y2
Instance Method Summary collapse
- #checked=(val) ⇒ Object
- #checked? ⇒ Boolean
- #draw ⇒ Object
-
#initialize(name, x, y, value, parent, checked = false, theme = Themes::blank) ⇒ RadioButton
constructor
A new instance of RadioButton.
- #onClick ⇒ Object
- #onMouseDown ⇒ Object
- #onMouseOut ⇒ Object
- #onMouseOver ⇒ Object
Methods inherited from Widget
#acceptStickyFocus?, #acceptText?, #blur, #button, #clicked?, #del, #downevent, #event, #feedText, #focus, #hasFocus?, #hasStickyFocus?, #intDraw, #onDelete, #onDrag, #onInitialize, #onKeyDown, #onKeyUp, #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, #resize, setAllInstances, #setCoordinates, #setTile, #width, #xTile
Constructor Details
#initialize(name, x, y, value, parent, checked = false, theme = Themes::blank) ⇒ RadioButton
Returns a new instance of RadioButton.
423 424 425 426 427 428 429 |
# File 'lib/ext/widgets.rb', line 423 def initialize(name, x, y, value, parent, checked=false, theme = Themes::blank) @themek = theme super(name,x,y,x+12,y+12,theme) @value = value @checked = checked @parent = parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
422 423 424 |
# File 'lib/ext/widgets.rb', line 422 def parent @parent end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
422 423 424 |
# File 'lib/ext/widgets.rb', line 422 def value @value end |
Instance Method Details
#checked=(val) ⇒ Object
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/ext/widgets.rb', line 445 def checked=(val) @checked = val if @checked if @parent.selected.nil? @theme = @themek.newInstance(CheckedHk.new(@x1,@y1,@x2,@y2)) @parent.selected = self return end return if @parent.selected == self @theme = @themek.newInstance(CheckedHk.new(@x1,@y1,@x2,@y2)) @parent.selected.checked = false @parent.selected = self else return if @parent.selected != self @theme = @themek.newInstance(self) end end |
#checked? ⇒ Boolean
442 443 444 |
# File 'lib/ext/widgets.rb', line 442 def checked? return @checked end |
#draw ⇒ Object
462 463 464 |
# File 'lib/ext/widgets.rb', line 462 def draw @theme.font.default.draw(name, @x1+12+1, @y1-2, ZOrder::Text) end |
#onClick ⇒ Object
430 431 432 |
# File 'lib/ext/widgets.rb', line 430 def onClick self.checked=!@checked end |
#onMouseDown ⇒ Object
433 434 435 |
# File 'lib/ext/widgets.rb', line 433 def onMouseDown @theme.setDownState end |
#onMouseOut ⇒ Object
439 440 441 |
# File 'lib/ext/widgets.rb', line 439 def onMouseOut @theme.setDefaultState end |
#onMouseOver ⇒ Object
436 437 438 |
# File 'lib/ext/widgets.rb', line 436 def onMouseOver @theme.setOverState end |