Class: Rubygoo::RadioButton

Inherits:
CheckBox show all
Defined in:
lib/rubygoo/radio_button.rb

Overview

this is basically a round checkbox

Constant Summary

Constants inherited from CheckBox

CheckBox::DEFAULT_PARAMS

Constants inherited from Widget

Widget::DEFAULT_PARAMS

Instance Attribute Summary

Attributes inherited from CheckBox

#checked, #label_text

Attributes inherited from Widget

#app, #container, #enabled, #focus_priority, #focussed, #goo_id, #h, #mouse_over, #opts, #padding_left, #padding_top, #parent, #relative, #visible, #w, #x, #y

Instance Method Summary collapse

Methods inherited from CheckBox

#added, #check, #checked?, #initialize, #key_pressed, #mouse_drag, #mouse_up, #toggle, #uncheck

Methods inherited from Widget

#_draw, #_focus, #_key_pressed, #_key_released, #_mouse_down, #_mouse_drag, #_mouse_dragging, #_mouse_motion, #_mouse_up, #_unfocus, #_update, #added, #contains?, #disable, #enable, #enabled?, #focus, #focussed?, #get, #get_color, goo_prop, #hide, inherited, #initialize, #key_pressed, #key_released, #modal?, #mouse_down, #mouse_drag, #mouse_dragging, #mouse_enter, #mouse_exit, #mouse_motion, #mouse_over?, #mouse_up, #removed, #show, #tab_to?, #theme_property, #unfocus, #update, #update_rect, #visible?

Methods included from Inflector

#camelize, #classify, #constantize, #dasherize, #demodulize, #foreign_key, #humanize, #inflections, #ordinalize, #pluralize, #singularize, #tableize, #titleize, #underscore

Constructor Details

This class inherits a constructor from Rubygoo::CheckBox

Instance Method Details

#draw(adapter) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rubygoo/radio_button.rb', line 5

def draw(adapter)
  x1 = @rect[0]
  y1 = @rect[1]
  x2 = @rect[2] + x1
  y2 = @rect[3] + y1

  radius = (@rect[2]/2.0).ceil

  if @focussed
    adapter.draw_circle @rect.centerx, @rect.centery, radius, @focus_color
  elsif @bg_color
    adapter.draw_circle @rect.centerx, @rect.centery, radius, @bg_color
  end

  if @checked
    adapter.draw_circle_filled @rect.centerx, @rect.centery, radius-@padding_left, @checked_color
  end

  if mouse_over? and @hover_color
    adapter.draw_circle_filled @rect.centerx, @rect.centery, radius-@padding_left, @hover_color
  end

  if @border_color
    adapter.draw_circle @rect.centerx, @rect.centery, radius, @border_color
  end
end