module MonoclePrint::Presentation
Constants
- ALIGNMENTS
Attributes
max_width[W]
owner[RW]
Public Class Methods
included( klass )
click to toggle source
Calls superclass method
MonoclePrint::included
# File lib/monocle-print/presentation.rb, line 9 def self.included( klass ) super klass.extend( ClassMethods ) end
Public Instance Methods
alignment( value = nil )
click to toggle source
# File lib/monocle-print/presentation.rb, line 31 def alignment( value = nil ) value and self.alignment = value @alignment or @owner ? @owner.alignment : :left end
alignment=(value)
click to toggle source
# File lib/monocle-print/presentation.rb, line 36 def alignment= value ALIGNMENTS.member?( value = value.to_sym ) or raise( ArgumentError, "unkown alignment: %p" % value ) @alignment = value end
height()
click to toggle source
# File lib/monocle-print/presentation.rb, line 68 def height @height or calculate_height end
max_width()
click to toggle source
# File lib/monocle-print/presentation.rb, line 78 def max_width @max_width or @owner && @owner.max_width or output.width end
output()
click to toggle source
# File lib/monocle-print/presentation.rb, line 82 def output @output ||= ( @owner and @owner.output or OutputDevice.stdout ) end
output=( io )
click to toggle source
# File lib/monocle-print/presentation.rb, line 86 def output=( io ) @output = io.nil? ? io : Output( io ) end
render( output = @output )
click to toggle source
# File lib/monocle-print/presentation.rb, line 51 def render( output = @output ) if output render_content( output ) return output else OutputDevice.buffer do | out | render_content( out ) end end end
style( value = nil )
click to toggle source
# File lib/monocle-print/presentation.rb, line 42 def style( value = nil ) value and self.style = value @style or @owner ? @owner.style : Graphics.default end
style=(value)
click to toggle source
# File lib/monocle-print/presentation.rb, line 47 def style= value @style = Style( value ) end
to_s()
click to toggle source
# File lib/monocle-print/presentation.rb, line 62 def to_s OutputDevice.buffer do | out | render_content( out ) end end
width()
click to toggle source
# File lib/monocle-print/presentation.rb, line 72 def width @width or calculate_width end
Private Instance Methods
default_border()
click to toggle source
# File lib/monocle-print/presentation.rb, line 117 def default_border Rectangle.new( false, false, false, false ) end
default_margin()
click to toggle source
# File lib/monocle-print/presentation.rb, line 109 def default_margin Rectangle.new( 0, 0, 0, 0 ) end
default_padding()
click to toggle source
# File lib/monocle-print/presentation.rb, line 113 def default_padding Rectangle.new( 0, 0, 0, 0 ) end
initialize_view( options = nil, owner = nil )
click to toggle source
# File lib/monocle-print/presentation.rb, line 92 def initialize_view( options = nil, owner = nil ) @max_width = @width = @height = nil @margin = @padding = @alignment = @style = nil @output = @foreground = @background = nil if options val = options[ :width ] and self.width = val val = options[ :align ] and self.alignment = val val = options[ :style ] and self.style = val val = options[ :padding ] and self.padding = val val = options[ :margin ] and self.margin = val val = options[ :output ] and self.output = val end @owner = owner end