Class: Gtk2HTML::DrawingInstructions

Inherits:
Object
  • Object
show all
Defined in:
lib/gtk2html.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(area = nil) ⇒ DrawingInstructions



257
258
259
260
261
# File 'lib/gtk2html.rb', line 257

def initialize(area=nil)

  @area = area if area

end

Instance Attribute Details

#areaObject

Returns the value of attribute area.



254
255
256
# File 'lib/gtk2html.rb', line 254

def area
  @area
end

Instance Method Details

#draw_box(margin, coords, padding, style) ⇒ Object



263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/gtk2html.rb', line 263

def draw_box(margin, coords, padding, style)

  h2 = style.clone
  h2.delete :color

  x1, y1, x2, y2 = coords

  width = x2 - x1
  height = y2 - y1

  gc = gc_ini(h2)
  @area.window.draw_rectangle(gc, 1, x1, y1, width, height)
end

#draw_layout(text, coords, style) ⇒ Object



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/gtk2html.rb', line 277

def draw_layout(text, coords, style)

  x, y = coords

  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



297
298
299
# File 'lib/gtk2html.rb', line 297

def render(a)      
  draw a
end

#script(args) ⇒ Object



301
302
303
# File 'lib/gtk2html.rb', line 301

def script(args)

end

#window(args) ⇒ Object



294
295
# File 'lib/gtk2html.rb', line 294

def window(args)
end