Class: VR::Col::Ren::CellRendererSpin

Inherits:
Gtk::CellRendererSpin
  • Object
show all
Defined in:
lib/treeview/columns/CellRendererSpin.rb

Overview

This class is a helper to VR::ListView and VR::TreeView. When

colums are created, this class is used as the renderer because
it adds functionality to the Gtk Renderer.

When you call ListView#render(column_id) an instance of this class
will be returned.  It is a subclass of

GtkCellRendererSpin

So it has all the functionality of its parent, plus the methods listed here.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_col, column, view, model_sym) ⇒ CellRendererSpin

:nodoc:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/treeview/columns/CellRendererSpin.rb', line 19

def initialize(model_col, column, view, model_sym) # :nodoc:
  super()
  @model_col = model_col
  @model_sym = model_sym
  @column = column
  @view = view
  self.editable = true
  @view.model.set_sort_func(@model_col) { |m,x,y| x[@model_col].value <=> y[@model_col].value }
  @edited_callback = nil
  self.signal_connect('edited') do |ren, path, text|
    next unless iter = @view.model.get_iter(path)
    iter[@model_col].value = text.to_f if (iter)
    @edited_callback.call(@model_sym, @view.vr_row(iter)) if @edited_callback
  end
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



16
17
18
# File 'lib/treeview/columns/CellRendererSpin.rb', line 16

def column
  @column
end

#edited_callbackObject

Returns the value of attribute edited_callback.



17
18
19
# File 'lib/treeview/columns/CellRendererSpin.rb', line 17

def edited_callback
  @edited_callback
end

#model_colObject (readonly)

Returns the value of attribute model_col.



16
17
18
# File 'lib/treeview/columns/CellRendererSpin.rb', line 16

def model_col
  @model_col
end

#model_symObject (readonly)

Returns the value of attribute model_sym.



16
17
18
# File 'lib/treeview/columns/CellRendererSpin.rb', line 16

def model_sym
  @model_sym
end