Class: Origami::Template::Button
- Inherits:
-
Annotation::Widget::PushButton
- Object
- Hash
- Dictionary
- Annotation
- Annotation::Widget
- Annotation::Widget::Button
- Annotation::Widget::PushButton
- Origami::Template::Button
- Defined in:
- lib/origami/template/widgets.rb
Constant Summary
Constants included from StandardObject
StandardObject::DEFAULT_ATTRIBUTES
Constants inherited from Dictionary
Constants included from Object
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
-
#initialize(caption, id: nil, x:, y:, width:, height:) ⇒ Button
constructor
A new instance of Button.
Methods inherited from Annotation::Widget::PushButton
Methods inherited from Annotation::Widget
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(caption, id: nil, x:, y:, width:, height:) ⇒ Button
Returns a new instance of Button.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/origami/template/widgets.rb', line 26 def initialize(caption, id: nil, x:, y:, width:, height:) super() set_indirect(true) self.set_name(id) self.H = Annotation::Widget::Highlight::INVERT self.Rect = [ x, y, x + width, y + height ] self.F = Annotation::Flags::PRINT 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: true, stroke: false, fill_color: Graphics::Color::RGB.new(0xE6, 0xE6, 0xFA)) 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::GrayScale.new(1.0)) 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::RGB.new(130, 130, 130)) appstm.draw_rectangle(0.5, 0.5, width-1, height-1, fill: false, stroke: true, stroke_color: Graphics::Color::GrayScale.new(0.0)) text_width = 4.75 * caption.length appstm.write(caption, x: (width - text_width)/2, y: height/2-5, size: 10) appstm.Resources = Resources.new set_normal_appearance(appstm) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Origami::FieldAccessor