Class: Gtk2HTML::DrawingInstructions
- Inherits:
-
Object
- Object
- Gtk2HTML::DrawingInstructions
- Defined in:
- lib/gtk2html.rb
Instance Attribute Summary collapse
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#widgets ⇒ Object
readonly
Returns the value of attribute widgets.
Instance Method Summary collapse
- #draw_box(margin, coords, padding, style) ⇒ Object
- #draw_layout(text, coords, style) ⇒ Object
-
#initialize(layout = nil) ⇒ DrawingInstructions
constructor
A new instance of DrawingInstructions.
- #render(a) ⇒ Object
- #script(args) ⇒ Object
- #window(args) ⇒ Object
Constructor Details
#initialize(layout = nil) ⇒ DrawingInstructions
Returns a new instance of DrawingInstructions.
272 273 274 275 276 277 |
# File 'lib/gtk2html.rb', line 272 def initialize(layout=nil) @layout = layout if layout @widgets = [] end |
Instance Attribute Details
#layout ⇒ Object
Returns the value of attribute layout.
268 269 270 |
# File 'lib/gtk2html.rb', line 268 def layout @layout end |
#widgets ⇒ Object (readonly)
Returns the value of attribute widgets.
269 270 271 |
# File 'lib/gtk2html.rb', line 269 def @widgets end |
Instance Method Details
#draw_box(margin, coords, padding, style) ⇒ Object
279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/gtk2html.rb', line 279 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) @layout.bin_window.draw_rectangle(gc, 1, x1, y1, width, height) end |
#draw_layout(text, coords, style) ⇒ Object
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/gtk2html.rb', line 294 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) @layout.bin_window.draw_layout(gc, x, y, layout) end |
#render(a) ⇒ Object
314 315 316 |
# File 'lib/gtk2html.rb', line 314 def render(a) draw a end |
#script(args) ⇒ Object
318 319 320 |
# File 'lib/gtk2html.rb', line 318 def script(args) end |
#window(args) ⇒ Object
311 312 |
# File 'lib/gtk2html.rb', line 311 def window(args) end |