class Fox::Enhancement::Xtras::Charting::Box

Box area of drawing interest. This is more virtual than actual, i.e. no clipping is performed.

Constants

MAX_DOMINANCE

Attributes

bottom_box[RW]

adjoining boxes

bottom_margin[RW]

margins

dominance[RW]

dominance rating (must be supplied)

enabled[RW]
floating[RW]
height[RW]

coordinate and dimensions of the box

hint_height[RW]

hints on width and heigt, if meaningful, otherwise nil

hint_width[RW]

hints on width and heigt, if meaningful, otherwise nil

left_box[RW]
left_margin[RW]

margins

name[R]

Name of this box – we use this in some cases to avoid class polution

orientation[RW]

textual / apperance orientation :horizontal, :vertical, :none placement :top, :bottom, :left, :right

placement[RW]

textual / apperance orientation :horizontal, :vertical, :none placement :top, :bottom, :left, :right

right_box[RW]
right_margin[RW]

margins

top_box[RW]

adjoining boxes

top_margin[RW]

margins

width[RW]

coordinate and dimensions of the box

x[RW]

coordinate and dimensions of the box

y[RW]

coordinate and dimensions of the box

Public Class Methods

new(chart, name: self.class, float: false, enabled: true, dom: 1, orient: :none, placement: :unspecified) click to toggle source
# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 58
def initialize chart,
               name: self.class,
               float: false,
               enabled: true,
               dom: 1,
               orient: :none,
               placement: :unspecified
  @chart = chart
  @name = name
  @dominance = dom
  @floating = float
  @top_margin = @bottom_margin = @left_margin = @right_margin = 0
  @orientation = orient
  @enabled = enabled
  @placement = placement
end

Public Instance Methods

calculate_dimensions() click to toggle source

calc the width and height of this box. Override!

# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 53
def calculate_dimensions
  self.width  ||= (hint_width || 20) #TODO: remove the cheats
  self.height ||= (hint_height || 10)
end
enabled?() click to toggle source
# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 49
def enabled? ; enabled ; end
floating?() click to toggle source
# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 50
def floating? ; floating ; end
render(dc) click to toggle source

always overide this the default simply renders a box

# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 42
def render dc
  raise "layout error in #{self.class}" if x.nil? or y.nil? or width.nil? or height.nil?
  dc.setClipRectangle FXRectangle.new(x,y,width,height)
  dc.foreground = black
  dc.drawRectangle x, y, width-1, height-1
end
to_s() click to toggle source
# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 75
def to_s
  sprintf "<%50s dom=%s xywh=%-17s LRTB=%-14s %s>" % [name,
                                                      "#{dominance}",
                                                      "[#{x||'NIL'},#{y||'NIL'},#{width||'NIL'},#{height||'NIL'}]",
                                                      "[#{left_margin},#{right_margin},#{top_margin},#{bottom_margin}]",
                                                      "#{floating? ? 'floater' : ''}"
                                                     ]
end