Class: Rubygoo::Icon
Overview
Icon is basically a place holder for images
Constant Summary
Constants inherited from Widget
Instance Attribute Summary
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
- #added ⇒ Object
- #draw(adapter) ⇒ Object
-
#icon_image(new_val = nil) ⇒ Object
DSL methods.
-
#initialize(opts = {}) ⇒ Icon
constructor
A new instance of Icon.
Methods inherited from Widget
#_draw, #_focus, #_key_pressed, #_key_released, #_mouse_down, #_mouse_drag, #_mouse_dragging, #_mouse_motion, #_mouse_up, #_unfocus, #_update, #contains?, #disable, #enable, #enabled?, #focus, #focussed?, #get, #get_color, goo_prop, #hide, inherited, #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
#initialize(opts = {}) ⇒ Icon
Returns a new instance of Icon.
4 5 6 7 |
# File 'lib/rubygoo/icon.rb', line 4 def initialize(opts={}) @icon = opts[:icon] super opts end |
Instance Method Details
#added ⇒ Object
9 10 11 |
# File 'lib/rubygoo/icon.rb', line 9 def added() update_rect end |
#draw(adapter) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubygoo/icon.rb', line 13 def draw(adapter) x1 = @rect[0] y1 = @rect[1] x2 = @rect[2] + x1 y2 = @rect[3] + y1 # TODO center icon ix = x1#+((x2-x1)[email protected]) iy = y1#+((y2-y1)[email protected]) adapter.draw_image @icon, ix+@padding_left,iy+@padding_top end |
#icon_image(new_val = nil) ⇒ Object
DSL methods
26 27 28 29 |
# File 'lib/rubygoo/icon.rb', line 26 def icon_image(new_val=nil) @icon = new_val if new_val @icon end |