I am trying to implement a customized CellRenderer in Ruby/GTK, and I've already found this suggestion:
However, when I try the following:
class CellRendererCustom < Gtk::CellRendererText
type_register #register within gobject system?
def initialize
super
end
def get_size(widget, cell_area)
puts "Never called :-("
return 0,0,100,100
end
def signal_do_get_size(widget, cell_area)
puts "Never called :-("
return 0,0,100,100
end
def signal_do_on_get_size(widget, cell_area)
puts "Never called :-("
return 0,0,100,100
end
def on_get_size(widget, cell_area)
puts "Never called :-("
return 0,0,100,100
end
end
Those signals are never called. I guess there this has something to do with how Ruby is connected to the GObject API, but honestly, I have no idea how this all works.
What I want to do is subclass CellRendererText, and overwrite a method, in this example get_size, which gets called by TreeView. However, I think because CellRendererText is a C Module, and not a ruby class, I cannot overwrite its methods without actually making the system aware of that.
Also I am CellRenderers need to be assigned to a TreeViewColumn, which then calls get_size and other methods.
As far as I know, a similar problem existed in PyGtk, where it was somehow circumvented by adding a "GenericCellRenderer" class:
http://faq.pygtk.org/index.py?req=show&file=faq13.045.htp