Class: FooterLayout

Inherits:
Object
  • Object
show all
Defined in:
lib/ListHolder/EditableList/ListPrintOperation/FooterLayout.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

Instance Method Summary collapse

Constructor Details

#initialize(cr, pop) ⇒ FooterLayout

Returns a new instance of FooterLayout.



6
7
8
9
10
11
12
# File 'lib/ListHolder/EditableList/ListPrintOperation/FooterLayout.rb', line 6

def initialize(cr,pop)
	@pop=pop
	@layout=cr.create_pango_layout
	layout.set_text("00").set_width(@pop.pango_width).set_alignment(Pango::Layout::ALIGN_CENTER)
	@y = @pop.height-layout.size[1]/Pango::SCALE-cr.line_width-1
	edebug("footer_position: #{@y}","printing","debug")
end

Instance Attribute Details

#layoutObject

Returns the value of attribute layout.



13
14
15
# File 'lib/ListHolder/EditableList/ListPrintOperation/FooterLayout.rb', line 13

def layout
  @layout
end

#yObject

Returns the value of attribute y.



13
14
15
# File 'lib/ListHolder/EditableList/ListPrintOperation/FooterLayout.rb', line 13

def y
  @y
end

Instance Method Details

#draw(cr, page_num) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/ListHolder/EditableList/ListPrintOperation/FooterLayout.rb', line 15

def draw(cr,page_num)
	layout.set_text((page_num+1).to_s + " / "+ @pop.n_pages.to_s).set_font_description(Pango::FontDescription.new(@pop.footer_font))
	if @pop.draw_footer_line
		cr.set_line_width(@pop.footer_line_width)
		cr.move_to(0,y)
		cr.line_to(@pop.width,y)
	end
	cr.move_to(0,y+cr.line_width+1)
	cr.show_pango_layout(layout)
end