Class: Origami::Template::TextPanel

Inherits:
Annotation::FreeText show all
Defined in:
lib/origami/template/widgets.rb

Constant Summary

Constants included from StandardObject

StandardObject::DEFAULT_ATTRIBUTES

Constants inherited from Dictionary

Dictionary::TOKENS

Constants included from Object

Object::TOKENS

Instance Attribute Summary

Attributes included from ObjectCache

#names_cache, #strings_cache, #xref_cache

Attributes included from Object

#file_offset, #generation, #no, #objstm_offset, #parent

Instance Method Summary collapse

Methods included from Annotation::Markup

included

Methods inherited from Annotation

#set_down_appearance, #set_normal_appearance, #set_rollover_appearance

Methods included from StandardObject

included, #pre_build, #version_required

Methods inherited from Dictionary

#[], #[]=, hint_type, #merge, parse, #to_h, #to_obfuscated_str, #to_s, #transform_values, #transform_values!

Methods included from Origami::TypeGuessing

#guess_type

Methods included from FieldAccessor

#method_missing, #respond_to_missing?

Methods included from CompoundObject

#copy, #delete, #include?, #update_values, #update_values!

Methods included from ObjectCache

#rebuild_caches

Methods included from Object

#cast_to, #copy, #document, #export, included, #indirect?, #indirect_parent, #logicalize, #logicalize!, #native_type, #numbered?, parse, #post_build, #pre_build, #reference, #set_document, #set_indirect, skip_until_next_obj, #solve, #to_o, #to_s, #type, typeof, #version_required, #xrefs

Constructor Details

#initialize(id, x:, y:, width:, height:) ⇒ TextPanel

Returns a new instance of TextPanel.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/origami/template/widgets.rb', line 120

def initialize(id, x:, y:, width:, height:)
    super()

    set_indirect(true)

    self.Rect = [ x, y, x + width, y + height ]
    self.F = Annotation::Flags::PRINT
    self.NM = id
    self.DA = '/F1 12 Tf 0 g'

    appstm = Annotation::AppearanceStream.new.setFilter(:FlateDecode)
    appstm.BBox = [ 0, 0, width, height ]
    appstm.Matrix = [ 1, 0, 0, 1, 0, 0 ]

    appstm.draw_rectangle(0, 0, width, height,
        fill: false, stroke: true, stroke_color: Graphics::Color::GrayScale.new(0.0))

    appstm.draw_polygon([[1,1],[1,height-1],[width-1,height-1],[width-2,height-2],[2,height-2],[2,2]],
        fill: true, stroke: false, fill_color: Graphics::Color::RGB.new(130, 130, 130))

    appstm.draw_polygon([[width-1,height-1],[width-1,1],[1,1],[2,2],[width-2,2],[width-2,height-2]],
        fill: true, stroke: false, fill_color: Graphics::Color::GrayScale.new(1.0))

    appstm.draw_rectangle(0.5, 0.5, width-1, height-1,
        fill: false, stroke: true, stroke_color: Graphics::Color::GrayScale.new(0.0))

    set_normal_appearance(appstm)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Origami::FieldAccessor