Class: GGLib::CheckBox
- Inherits:
-
Widget
- Object
- Tile
- Containable
- Widget
- GGLib::CheckBox
- Defined in:
- lib/ext/widgets.rb
Defined Under Namespace
Classes: CheckedHk
Instance Attribute Summary
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, text = "", checked = false, theme = Themes::blank) ⇒ CheckBox
constructor
A new instance of CheckBox.
- #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, text = "", checked = false, theme = Themes::blank) ⇒ CheckBox
Returns a new instance of CheckBox.
380 381 382 383 384 |
# File 'lib/ext/widgets.rb', line 380 def initialize(name, x, y, text="", checked=false, theme = Themes::blank) @themek = theme super(name,x,y,x+13,y+13,theme) @checked = checked end |
Instance Method Details
#checked=(val) ⇒ Object
400 401 402 403 404 405 406 407 408 |
# File 'lib/ext/widgets.rb', line 400 def checked=(val) return if val == @checked @checked = val if @checked @theme = @themek.newInstance(CheckedHk.new(@x1,@y1,@x2,@y2)) else @theme = @themek.newInstance(self) end end |
#checked? ⇒ Boolean
397 398 399 |
# File 'lib/ext/widgets.rb', line 397 def checked? return @checked end |
#draw ⇒ Object
409 410 411 |
# File 'lib/ext/widgets.rb', line 409 def draw @theme.font.default.draw(name, @x1+13+1, @y1-2, ZOrder::Text) end |
#onClick ⇒ Object
385 386 387 |
# File 'lib/ext/widgets.rb', line 385 def onClick self.checked = !@checked end |
#onMouseDown ⇒ Object
388 389 390 |
# File 'lib/ext/widgets.rb', line 388 def onMouseDown @theme.setDownState end |
#onMouseOut ⇒ Object
394 395 396 |
# File 'lib/ext/widgets.rb', line 394 def onMouseOut @theme.setDefaultState end |
#onMouseOver ⇒ Object
391 392 393 |
# File 'lib/ext/widgets.rb', line 391 def onMouseOver @theme.setOverState end |