Class: HeaderLayout
- Inherits:
-
Object
- Object
- HeaderLayout
- Defined in:
- lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb
Overview
this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#tlayout ⇒ Object
Returns the value of attribute tlayout.
Instance Method Summary collapse
- #draw(cr) ⇒ Object
-
#initialize(cr, pop) ⇒ HeaderLayout
constructor
A new instance of HeaderLayout.
Constructor Details
#initialize(cr, pop) ⇒ HeaderLayout
Returns a new instance of HeaderLayout.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 6 def initialize(cr,pop) @pop=pop @layout = cr.create_pango_layout layout.set_text(pop.list.title).set_width(@pop.pango_width) layout.set_font_description(Pango::FontDescription.new(@pop.header_font)) layout.set_wrap(Pango::Layout::WRAP_WORD).set_ellipsize(Pango::Layout::ELLIPSIZE_NONE).set_single_paragraph_mode(true) layout.set_alignment(Pango::Layout::Alignment::CENTER) @tlayout = cr.create_pango_layout tlayout.set_text(Time.new.strftime("%m/%d/%Y")).set_width(@pop.pango_width).set_alignment(Pango::Layout::ALIGN_RIGHT) tlayout.set_font_description(Pango::FontDescription.new(@pop.date_font)) tlayout.set_wrap(Pango::Layout::WRAP_WORD).set_ellipsize(Pango::Layout::ELLIPSIZE_NONE) @height=2*layout.size[1]/Pango::SCALE+cr.line_width*3 end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
21 22 23 |
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 21 def height @height end |
#layout ⇒ Object
Returns the value of attribute layout.
21 22 23 |
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 21 def layout @layout end |
#tlayout ⇒ Object
Returns the value of attribute tlayout.
21 22 23 |
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 21 def tlayout @tlayout end |
Instance Method Details
#draw(cr) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 23 def draw(cr) cr.move_to(0,0) #position on begining of page cr.show_pango_layout(layout) if @pop.print_title cr.show_pango_layout(tlayout) if @pop.print_date if @pop.draw_header_line cr.set_line_width(@pop.header_line_width) cr.move_to(0,2*layout.size[1]/Pango::SCALE+cr.line_width) #move below header cr.line_to(@pop.width,2*layout.size[1]/Pango::SCALE+cr.line_width) #draw the line end cr.stroke end |