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



263
264
265
266
267
# File 'lib/gtk2html.rb', line 263

def initialize(area=nil)

  @area = area if area

end

Instance Attribute Details

#areaObject

Returns the value of attribute area.



260
261
262
# File 'lib/gtk2html.rb', line 260

def area
  @area
end

Instance Method Details

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



269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/gtk2html.rb', line 269

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



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/gtk2html.rb', line 283

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



303
304
305
# File 'lib/gtk2html.rb', line 303

def render(a)      
  draw a
end

#script(args) ⇒ Object



307
308
309
# File 'lib/gtk2html.rb', line 307

def script(args)

end

#window(args) ⇒ Object



300
301
# File 'lib/gtk2html.rb', line 300

def window(args)
end