Class: Gtk2HTML::DrawingInstructions
- Inherits:
-
Object
- Object
- Gtk2HTML::DrawingInstructions
- Defined in:
- lib/gtk2html.rb
Instance Attribute Summary collapse
-
#area ⇒ Object
Returns the value of attribute area.
Instance Method Summary collapse
- #draw_box(args) ⇒ Object
- #draw_layout(args) ⇒ Object
-
#initialize(area = nil) ⇒ DrawingInstructions
constructor
A new instance of DrawingInstructions.
- #render(a) ⇒ Object
- #script(args) ⇒ Object
- #window(args) ⇒ Object
Constructor Details
#initialize(area = nil) ⇒ DrawingInstructions
Returns a new instance of DrawingInstructions.
84 85 86 87 88 |
# File 'lib/gtk2html.rb', line 84 def initialize(area=nil) @area = area if area end |
Instance Attribute Details
#area ⇒ Object
Returns the value of attribute area.
81 82 83 |
# File 'lib/gtk2html.rb', line 81 def area @area end |
Instance Method Details
#draw_box(args) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/gtk2html.rb', line 90 def draw_box(args) margin, raw_coords, padding, style = args coords = raw_coords.map.with_index {|x,i| x ? x : @curpos[i] } h2 = style.clone h2.delete :color x1, y1, x2, y2 = coords @curpos = coords gc = gc_ini(h2) @area.window.draw_rectangle(gc, 1, x1, y1, x2, y2) end |
#draw_layout(args) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/gtk2html.rb', line 105 def draw_layout(args) text, style = args x, y = @curpos text ||= '' h2 = style.clone h2.delete :'background-color' layout = Pango::Layout.new(Gdk::Pango.context) layout.font_description = Pango::FontDescription.\ new('Sans ' + style[:'font-size']) layout.text = text gc = gc_ini(h2) @area.window.draw_layout(gc, x, y, layout) end |
#render(a) ⇒ Object
127 128 129 130 131 |
# File 'lib/gtk2html.rb', line 127 def render(a) @latest_style = a[4] method(a[0]).call(args=a[1..4]) draw a[5] end |
#script(args) ⇒ Object
133 134 135 |
# File 'lib/gtk2html.rb', line 133 def script(args) end |
#window(args) ⇒ Object
124 125 |
# File 'lib/gtk2html.rb', line 124 def window(args) end |