class GerbilCharts::Surfaces::TitlePanel

TitlePanel

just  - left or right justify the title

Attributes

just[RW]

Public Class Methods

new(opts={}) click to toggle source
Calls superclass method GerbilCharts::Surfaces::Panel::new
# File lib/gerbilcharts/surfaces/title_panel.rb, line 9
def initialize(opts={})
  @class = "titlepanel"
  @just  = :left
  @just  = opts[:just] if opts[:just]
  
  super(opts)
end

Public Instance Methods

align_to_anchor(anc) click to toggle source
# File lib/gerbilcharts/surfaces/title_panel.rb, line 35
def align_to_anchor(anc)
  super
  @bounds.deflate_v(4,4)
  @bounds.deflate_h(2,2)
  
  if @width
    @bounds.bottom= @bounds.top + @lay_dimension
  end
  
end
int_render(g) click to toggle source
# File lib/gerbilcharts/surfaces/title_panel.rb, line 17
def int_render(g)
  opts = {:class => "titletext"}
  opts.store(:href, @parent.href) if @parent.href
  
  if @just == :left
    g.textout(@bounds.left, @bounds.top+16,  parent.modelgroup.name, opts)
  else
    g.textout(@bounds.right, @bounds.top+16, parent.modelgroup.name, opts.merge("text-anchor" => "end"))
  end
  
      xoff=0
  parent.get_global_option(:toolhrefs,[]).each do  |tool|
    topts = {:class => "titletool"}
    g.textout(@bounds.left + xoff, @bounds.top+29, tool[0] , topts.merge(:href => tool[1]) )
            xoff =xoff+ 7*(tool[0].length )
  end
end