class Gtk::CellRendererMessage

Attributes

message[R]

Public Class Methods

new() click to toggle source
Calls superclass method
# File core/mui/cairo_cell_renderer_message.rb, line 13
def initialize()
  super() end

Public Instance Methods

create_miracle_painter(message) click to toggle source

MiraclePainterを生成して返す

# File core/mui/cairo_cell_renderer_message.rb, line 120
def create_miracle_painter(message)
  Gdk::MiraclePainter.new(message, avail_width).set_tree(@tree)
end
miracle_painter(message) click to toggle source

Messageに関連付けられた Gdk::MiraclePainter を取得する

# File core/mui/cairo_cell_renderer_message.rb, line 112
def miracle_painter(message)
  record = @tree.get_record_by_message(message)
  if record and record.miracle_painter
    record.miracle_painter
  else
    @tree.update!(message, Gtk::TimeLine::InnerTL::MIRACLE_PAINTER, create_miracle_painter(message)) end end
signal_do_button_press_event(e, path, column, cell_x, cell_y) click to toggle source
# File core/mui/cairo_cell_renderer_message.rb, line 39
def signal_do_button_press_event(e, path, column, cell_x, cell_y)
end
signal_do_button_release_event(e, path, column, cell_x, cell_y) click to toggle source
# File core/mui/cairo_cell_renderer_message.rb, line 42
def signal_do_button_release_event(e, path, column, cell_x, cell_y)
end
signal_do_click(e, path, column, cell_x, cell_y) click to toggle source
# File core/mui/cairo_cell_renderer_message.rb, line 51
def signal_do_click(e, path, column, cell_x, cell_y)
end
signal_do_leave_notify_event(e, path, column, cell_x, cell_y) click to toggle source
# File core/mui/cairo_cell_renderer_message.rb, line 48
def signal_do_leave_notify_event(e, path, column, cell_x, cell_y)
end
signal_do_motion_notify_event(e, path, column, cell_x, cell_y) click to toggle source
# File core/mui/cairo_cell_renderer_message.rb, line 45
def signal_do_motion_notify_event(e, path, column, cell_x, cell_y)
end
tree=(tree) click to toggle source
# File core/mui/cairo_cell_renderer_message.rb, line 54
def tree=(tree)
  @tree = tree
  tree.add_events(Gdk::Event::BUTTON_PRESS_MASK|Gdk::Event::BUTTON_RELEASE_MASK)
  armed_column = nil
  last_motioned = nil
  click_start = []

  tree.ssc("leave_notify_event") { |w, e|
    if last_motioned
      signal_emit("leave_notify_event", e, *last_motioned)
      last_motioned = nil end
    false }

  tree.ssc("motion_notify_event") { |w, e|
    path, column, cell_x, cell_y = tree.get_path_at_pos(e.x, e.y)
    if column
      armed_column = column
      motioned = [path, column, cell_x, cell_y]
      signal_emit("motion_notify_event", e, *motioned)
      if last_motioned
        motioned_message = @tree.get_record(motioned[0]).message rescue nil
        last_motioned_message = @tree.get_record(last_motioned[0]).message rescue nil
        if(last_motioned_message and motioned_message != last_motioned_message)
          emit_leave_notify_from_event_motion(e, *last_motioned) end end
      last_motioned = motioned end }

  tree.ssc("button_press_event") { |w, e|
    path, column, cell_x, cell_y = tree.get_path_at_pos(e.x, e.y)
    click_start = [cell_x, cell_y]
    if column
      armed_column = column
      signal_emit("button_press_event", e, path, column, cell_x, cell_y) end
    e.button == 3 && tree.get_active_pathes.include?(path) # 選択してるものを右クリックした時は、他のセルの選択を解除しない
  }

  tree.ssc("button_release_event") { |w, e|
    path, column, cell_x, cell_y = tree.get_path_at_pos(e.x, e.y)
    if column
      cell_x ||= -1
      cell_y ||= -1
      signal_emit("button_release_event", e, path, column, cell_x, cell_y)
      if click_start.size == 2 and click_start.all?{|x| x.respond_to? :-} and (column == armed_column) and (click_start[0] - cell_x).abs <= 4 and (click_start[1] - cell_y).abs <= 4
        signal_emit("click", e, path, column, cell_x, cell_y) end
      armed_column = nil end }

  last_selected = Set.new(tree.selection.to_enum(:selected_each).map{ |m, p, i| i[3] }).freeze
  tree.selection.ssc("changed") { |this|
    now_selecting = Set.new(this.to_enum(:selected_each).map{ |m, p, i| i[3] }).freeze
    new_selected = now_selecting - last_selected
    unselected = last_selected - now_selecting
    new_selected.each(&:on_selected)
    unselected.each(&:on_unselected)
    last_selected = now_selecting
    false }

  event_hooks end
uri=(uri) click to toggle source
# File core/mui/cairo_cell_renderer_message.rb, line 124
def uri=(uri)
  record = @tree.get_record_by_uri(uri)
  if record and record.message
    return render_message(record.message)
  else
    self.pixbuf = Skin['notfound.png'].pixbuf(width: 64, height: 64) end
rescue Exception => err
  error "#{err.class} by uri: #{uri} model: #{record ? record.message.inspect : nil}"
  raise if Mopt.debug
  error err
  self.pixbuf = Skin['notfound.png'].pixbuf(width: 64, height: 64) end