Class: HeaderLayout

Inherits:
Object
  • Object
show all
Includes:
ManqodCommon
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])

Constant Summary

Constants included from ManqodCommon

ManqodCommon::CRITICAL, ManqodCommon::DEBUG, ManqodCommon::ERROR, ManqodCommon::INFO, ManqodCommon::NORMAL, ManqodCommon::WARNING

Constants included from Eprint

Eprint::DOMAIN, Eprint::LEVEL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ManqodCommon

#add_where, #admin, #admin_cache, #admin_qrow, #admin_rows, #backtrace_to_debug, #cache, #changed_ids_of_base, #client, #client_fields, #client_image_of_id, #client_qrow, #client_query, #client_rows, #eeval, #escape_string, #getBinding, #guess_base, #guess_table, #image_of_id, #lzero, #manqod_db, #measure, #myexec, #nick, #nick_id, #number_format, #qrow, #query, #reconnect_manqod_db, #rows, #run_events, #send_message, #sendmail, #set_manqod_db_uri, #set_nick

Methods included from Eprint

#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception

Constructor Details

#initialize(cr, pop) ⇒ HeaderLayout

Returns a new instance of HeaderLayout.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 7

def initialize(cr,pop)
	@pop=pop
	@layout = cr.create_pango_layout
	text=pop.list.gtk_attribute("print_custom_header").nil? ? pop.list.title : eeval(pop.list.gtk_attribute("print_custom_header"),pop.list).to_s
	ecode(text)
	layout.set_text(text).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(false)
	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

#heightObject

Returns the value of attribute height.



24
25
26
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 24

def height
  @height
end

#layoutObject

Returns the value of attribute layout.



24
25
26
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 24

def layout
  @layout
end

#tlayoutObject

Returns the value of attribute tlayout.



24
25
26
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 24

def tlayout
  @tlayout
end

Instance Method Details

#draw(cr) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb', line 26

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