Class: EideticRML::Widgets::PageNo

Inherits:
Span show all
Defined in:
lib/erml_widgets.rb

Instance Attribute Summary

Attributes inherited from Widget

#disabled, #height_pct, #max_height_pct, #max_width_pct, #parent, #printed, #visible, #width_pct

Instance Method Summary collapse

Methods inherited from Span

#printed

Methods included from Text

#has_height?, #has_width?, #layout_widget, #line_height, #strikeout, #underline

Methods inherited from Widget

#after_layout, #align, #attributes, #border, #border_bottom, #border_left, #border_right, #border_top, #bottom, #clone, #colspan, #content_bottom, #content_height, #content_left, #content_right, #content_top, #content_width, #default_padding_bottom, #default_padding_left, #default_padding_right, #default_padding_top, #display, #display_for_page, #fill, #font, #font_color, #font_size, #font_style, #font_weight, #has_height?, #has_width?, #height, #id, #initialize_copy, #klass, #layout_widget, #leaf?, #leaves, #left, #margin, #margin_bottom, #margin_left, #margin_right, #margin_top, #max_content_height, #max_height, #max_height_avail, #max_width, #non_content_height, #non_content_width, #origin_x, #origin_y, #padding, #padding_bottom, #padding_left, #padding_right, #padding_top, #path, #position, #preferred_height, #preferred_width, #print, #right, #root, #root_page, #rotate, #rowspan, #selector_tag, #shift, #tag, #top, #units, #width, #z_index

Methods included from Support

#from_units, parse_measurement, parse_measurement_pts, #to_units

Constructor Details

#initialize(parent, attrs = {}) ⇒ PageNo

Returns a new instance of PageNo.



1023
1024
1025
1026
# File 'lib/erml_widgets.rb', line 1023

def initialize(parent, attrs={})
  super(parent, attrs)
  parent.text(self)
end

Instance Method Details

#before_layoutObject



1028
1029
1030
1031
# File 'lib/erml_widgets.rb', line 1028

def before_layout
  super
  root.document_page_no = @new_page_no if @new_page_no
end

#text(value = nil) ⇒ Object



1033
1034
1035
1036
# File 'lib/erml_widgets.rb', line 1033

def text(value=nil)
  return root.document_page_no.to_s if value.nil?
  @new_page_no = value.to_i
end

#to_sObject



1038
1039
1040
# File 'lib/erml_widgets.rb', line 1038

def to_s
  text
end