Class: GGLib::RadioButton
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 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
#blur, #button, #clicked?, #del, #downevent, #event, #feedText, #focus, #hasFocus?, #hasStickyFocus?, #intDraw, #onDelete, #onDrag, #onInitialize, #onKeyPress, #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, value, parent, checked = false, theme = Themes::blank) ⇒ RadioButton
Returns a new instance of RadioButton.
409 410 411 412 413 414 415 |
# File 'lib/ext/widgets.rb', line 409 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.
408 409 410 |
# File 'lib/ext/widgets.rb', line 408 def parent @parent end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
408 409 410 |
# File 'lib/ext/widgets.rb', line 408 def value @value end |
Instance Method Details
#checked=(val) ⇒ Object
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/ext/widgets.rb', line 431 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
428 429 430 |
# File 'lib/ext/widgets.rb', line 428 def checked? return @checked end |
#draw ⇒ Object
448 449 450 |
# File 'lib/ext/widgets.rb', line 448 def draw @theme.font.default.draw(name, @x1+12+1, @y1-2, ZOrder::Text) end |
#onClick ⇒ Object
416 417 418 |
# File 'lib/ext/widgets.rb', line 416 def onClick self.checked=!@checked end |
#onMouseDown ⇒ Object
419 420 421 |
# File 'lib/ext/widgets.rb', line 419 def onMouseDown @theme.setDownState end |
#onMouseOut ⇒ Object
425 426 427 |
# File 'lib/ext/widgets.rb', line 425 def onMouseOut @theme.setDefaultState end |
#onMouseOver ⇒ Object
422 423 424 |
# File 'lib/ext/widgets.rb', line 422 def onMouseOver @theme.setOverState end |