ruby-****@sourc*****
ruby-****@sourc*****
2009年 2月 12日 (木) 02:42:15 JST
------------------------- REMOTE_ADDR = 74.15.84.244 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-parts ------------------------- @@ -60,7 +60,7 @@ Cell renderers are packed into tree view columns similar to how you add widgets into h/v-boxes. Each tree view column can contain one or more cell renderers, which are used to render the data. For example, in a file browser, the image column would be rendered with the Gtk::CellRendererPixbuf and the file name with Gtk::CellRendererText. The primary use of a Gtk::CellRenderer is for drawing a certain graphical elements on a Gdk::Drawable. Typically, one cell renderer is used to draw many cells on the screen. Each cell renderer is responsible for rendering a column of cells, one for every row in the tree view. It begins with the first row, rendering its cells and then proceeding to the next row down until all that was requested or the entire column is completed. -Cell renderers are composed of properties that define how each cell of data is rendered to the screen. There are a number of ways to set cell renderer properties, and it isn't expected that a CellRenderer objects keep any permanent state around. Instead, any state is set just prior their use using GLib::Object property system (see: "g_object_set()" in C GTK+ API doc). Then, the cell is measured using Gtk::CellRenderer#get_size. Finally, the cell is rendered in the correct location using Gtk::CellRenderer#render. +Cell renderers are composed of properties that define how each cell of data is rendered to the screen. There are a number of ways to set cell renderer properties, and it isn't expected that a CellRenderer objects keep any permanent state around. Instead, any state is set just prior their use using GLib::Object property system (see: "g_object_set()" in C GTK+ API doc, which in Ruby environment is a bit anachronistic feature; to demonstrate this at the end of this article I will list a plethora of methods and attributes belonging to Gtk::CellRendererText hierarchy). Then, the cell is measured using Gtk::CellRenderer#get_size. Finally, the cell is rendered in the correct location using Gtk::CellRenderer#render. There are a number of rules that must be followed when writing a new Gtk::CellRenderer. First and foremost, it's important that a certain set of properties will always yield a cell renderer of the same size, barring a Gtk::Style change. The Gtk::CellRenderer also has a number of generic properties that are expected to be honoured by all children.