Class: Origami::Template::Edit

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

Direct Known Subclasses

MultiLineEdit, PasswordEdit

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 inherited from Dictionary

#names_cache, #strings_cache, #xref_cache

Attributes included from Object

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

Instance Method Summary collapse

Methods inherited from Annotation::Widget

#onActivate

Methods included from Annotation::Triggerable

#onBlur, #onFocus, #onMouseDown, #onMouseOut, #onMouseOver, #onMouseUp, #onPageClose, #onPageInvisible, #onPageOpen, #onPageVisible

Methods included from Field

included, #name, #name=, #onCalculate, #onFormat, #onKeyStroke, #onValidate, #pre_build, #set_name

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

#[], #[]=, add_type_signature, #cast_to, #copy, #delete, guess_type, hint_type, #key?, #map!, #merge, parse, #to_h, #to_obfuscated_str, #to_s

Methods included from FieldAccessor

#method_missing, #respond_to_missing?

Methods included from Object

#<=>, #cast_to, #copy, #document, #export, included, #indirect?, #indirect_parent, #logicalize, #logicalize!, #native_type, 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:) ⇒ Edit

Returns a new instance of Edit.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/origami/template/widgets.rb', line 62

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

    set_indirect(true)

    self.set_name(id)
    self.Rect = [ x, y, x+width, y+height ]
    self.F = Annotation::Flags::PRINT
    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