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(margin, coords, padding, style) ⇒ Object
- #draw_layout(text, coords, style) ⇒ 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.
226 227 228 229 230 |
# File 'lib/gtk2html.rb', line 226 def initialize(area=nil) @area = area if area end |
Instance Attribute Details
#area ⇒ Object
Returns the value of attribute area.
223 224 225 |
# File 'lib/gtk2html.rb', line 223 def area @area end |
Instance Method Details
#draw_box(margin, coords, padding, style) ⇒ Object
232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/gtk2html.rb', line 232 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
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/gtk2html.rb', line 246 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
266 267 268 |
# File 'lib/gtk2html.rb', line 266 def render(a) draw [a] end |
#script(args) ⇒ Object
270 271 272 |
# File 'lib/gtk2html.rb', line 270 def script(args) end |
#window(args) ⇒ Object
263 264 |
# File 'lib/gtk2html.rb', line 263 def window(args) end |