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
adjoining boxes
margins
dominance rating (must be supplied)
coordinate and dimensions of the box
hints on width and heigt, if meaningful, otherwise nil
hints on width and heigt, if meaningful, otherwise nil
margins
Name of this box – we use this in some cases to avoid class polution
textual / apperance orientation :horizontal, :vertical, :none placement :top, :bottom, :left, :right
textual / apperance orientation :horizontal, :vertical, :none placement :top, :bottom, :left, :right
margins
adjoining boxes
margins
coordinate and dimensions of the box
coordinate and dimensions of the box
coordinate and dimensions of the box
Public Class Methods
# 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
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
# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 49 def enabled? ; enabled ; end
# File lib/fxruby-enhancement/xtras/charting-boxes.rb, line 50 def floating? ; floating ; end
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
# 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