class GanttScaler
this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
Attributes
gantt_holder[R]
widget[R]
Public Class Methods
new(gantt_holder)
click to toggle source
Calls superclass method
# File lib/ListHolder/GanttHolder/GanttScaler.rb, line 7 def initialize(gantt_holder) @gantt_holder=gantt_holder super(gantt.hadjustment,Gtk::Adjustment.new(0,0,0,0,0,0)) # set_policy(Gtk::POLICY_NEVER,Gtk::POLICY_NEVER) # add_with_viewport(Gtk::EventBox.new.add(@widget=Gtk::Fixed.new)) add(@widget=Gtk::Fixed.new) @widget.set_height_request(gantt.list.columns_height) #set width the same as gantt's gantt.hadjustment.signal_connect("changed"){|vad| @widget.set_width_request(vad.upper) false } #font=get_conf(0,0,"list-cell-font")||"Sans 6" font="Sans 6" @widget.signal_connect("expose-event",font){|me,ev,font| cr=me.window.create_cairo_context pl=cr.create_pango_layout pl.set_font_description(Pango::FontDescription.new(font)) pl.set_wrap(Pango::Layout::WRAP_WORD_CHAR).set_ellipsize(Pango::Layout::ELLIPSIZE_NONE) unless gantt.points.size == 0 start=gantt.points.first/gantt.res gantt.points.each{|point| x=point/gantt.res-start cr.set_source_rgba(48.0/255,88.0/255,116.0/255,1).set_line_width(0.3) cr.move_to(x,3) cr.rel_line_to(0,@widget.allocation.height-6) cr.stroke cr.set_source_rgba(48.0/255,88.0/255,116.0/255,0.8) pl.set_text(Time.at(point).strftime_w(gantt.scaler_format)) cr.move_to(x+2,1) cr.show_pango_layout(pl) cr.stroke } end } end
Public Instance Methods
clear()
click to toggle source
# File lib/ListHolder/GanttHolder/GanttScaler.rb, line 49 def clear @widget.queue_draw_area(0, 0, @widget.allocation.width, @widget.allocation.height) end
gantt()
click to toggle source
# File lib/ListHolder/GanttHolder/GanttScaler.rb, line 56 def gantt gantt_holder.gantt end
to_s()
click to toggle source
# File lib/ListHolder/GanttHolder/GanttScaler.rb, line 59 def to_s "Scaler of #{gantt}" end
update(notifier)
click to toggle source
# File lib/ListHolder/GanttHolder/GanttScaler.rb, line 52 def update(notifier) @widget.set_height_request(gantt.list.columns_height) clear end