lib/rubygoo/label.rb in rubygoo-0.0.5 vs lib/rubygoo/label.rb in rubygoo-0.0.6
- old
+ new
@@ -1,5 +1,6 @@
+require 'publisher'
module Rubygoo
class Label < Widget
def initialize(text, opts={})
super opts
@text = text
@@ -21,24 +22,28 @@
@text = text
@rendered_text = @app.renderer.render_text @text, @font_file, @font_size, @color
@rect = Rect.new [@x,@y,@rendered_text.width+@x_pad,@rendered_text.height+@y_pad]
end
- def draw(screen)
+ def draw(adapter)
+ x1 = @rect[0]
+ y1 = @rect[1]
+ x2 = @rect[2] + x1
+ y2 = @rect[3] + y1
if @focussed
- screen.fill @focus_color, @rect
+ adapter.fill x1, y1, x2, y2, @focus_color
elsif @bg_color
- screen.fill @bg_color, @rect
+ adapter.fill x1, y1, x2, y2, @bg_color
end
if @border_color
- x1 = @rect[0]
- y1 = @rect[1]
- x2 = @rect[2] + x1
- y2 = @rect[3] + y1
- screen.draw_box x1, y1, x2, y2, @border_color
+ adapter.draw_box x1, y1, x2, y2, @border_color
end
- screen.draw_image @rendered_text, @x, @y, @color
+ adapter.draw_image @rendered_text, @x, @y, @color
+ end
+
+ def tab_to?()
+ false
end
end
end