[ruby-gnome2-doc-cvs] [Hiki] update - Gtk::CellRenderer

Back to archive index

ruby-****@lists***** ruby-****@lists*****
2003年 4月 1日 (火) 11:43:37 JST


-------------------------
REMOTE_ADDR = 61.204.181.66
REMOTE_HOST = 
-------------------------

-------------------------
= class Gtk::CellRenderer
The Gtk::CellRenderer is a base class of a set of objects used for rendering a cell to a Gdk::Drawable. These objects are used primarily by the Gtk::TreeView widget, though they aren't tied to them in any specific way. It is worth noting that Gtk::CellRenderer is not a Gtk::Widget and cannot be treated as such. 

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. To this extent, it isn't expected that a CellRenderer keep any permanent state around. Instead, any state is set just prior to use using GLib::Object property system. 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 formost, 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 honored by all children. 

== super class
* Gtk::Object

== public instance methods
--- get_size(widget, cell_area)
    Obtains the width and height needed to render the cell. Used by view widgets to determine the appropriate size for the cell_area passed to Gtk::CellRenderer#render. If cell_area is not nil, fills in the x and y offsets (if set) of the cell relative to this location. Please note that the values set in width and height, as well as those in x(x_offset) and y(y_offset) are inclusive of the xpad and ypad properties.
    * widget: the widget the renderer is rendering to
    * cell_area: The area a cell will be allocated, or nil  
    * Returns: Gdk::Rectangle.
       * x: location to return x offset of cell relative to cell_area
       * y: location to return y offset of cell relative to cell_area
       * width: location to return width needed to render a cell 
       * height: location to return height needed to render a cell

--- render(window, widget, background_area, cell_area, expose_area, flags)
    Invokes the virtual render function of the Gtk::CellRenderer. The three passed-in rectangles are areas of window. Most renderers will draw within cell_area; the xalign, yalign, xpad, and ypad fields of the Gtk::CellRenderer should be honored with respect to cell_area. background_area includes the blank space around the cell, and also the area containing the tree expander; so the background_area rectangles for all cells tile to cover the entire window. expose_area is a clip rectangle.

    * window: a Gdk::Drawable to draw to  
    * widget: the widget owning window  
    * background_area: entire cell area(Gdk::Rectangle). Including tree expanders and maybe padding on the sides.
    * cell_area: area normally rendered by a cell renderer(Gdk::Rectangle)
    * expose_area: area that actually needs updating(Gdk::Rectangle)
    * flags: flags that affect rendering(((<GtkCellRendererState|Gtk::CellRenderer#GtkCellRendererState>)))
    * Returns: self

--- activate(event, widget, path, background_area, cell_area, flags)
    Passes an activate event to the cell renderer for possible processing. Some cell renderers may use events; for example, Gtk::CellRendererToggle toggles when it gets a mouse click.
    * event: a Gdk::Event
    * widget: widget that received the event  
    * path: widget-dependent string representation of the event location; e.g. for Gtk::TreeView, a string representation of Gtk::TreePath  
    * background_area: background area as passed to Gtk::CellRenderer#render  
    * cell_area: cell area as passed to Gtk::CellRenderer#render
    * flags: render flags  
    * Returns: true if the event was consumed/handled, or false

--- start_editing(event, widget, path, background_area, cell_area, flags)
    Passes an activate event to the cell renderer for possible processing.
    * event: a Gdk::Event
    * widget: widget that received the event  
    * path: widget-dependent string representation of the event location; e.g. for Gtk::TreeView, a string representation of Gtk::TreePath 
    * background_area: background area as passed to Gtk::CellRenderer#render  
    * cell_area: cell area as passed to Gtk::CellRenderer#render  
    * flags: render flags(((<GtkCellRendererState|Gtk::CellRenderer#GtkCellRendererState>)))
    * Returns: A new Gtk::CellEditable, or nil

--- fixed_size
    Returns the appropriate size of cell.
    * Returns: [width, height]

--- set_fixed_size(width, height)
    Sets the renderer size to be explicit, independent of the properties set.
    * width: the width of the cell renderer, or -1  
    * height: the height of the cell renderer, or -1
    * Returns: self

--- height
    Returns the height of the cell renderer.
    * Returns: the height of the cell renderer

--- height=(height)
    Sets the height of the cell renderer.
    * height: the height of the cell renderer.
    * Returns: height

--- set_height(height)
    Same as height=.
    * height: the height of the cell renderer.
    * Returns: self

--- width
    Returns the width of the cell renderer.
    * Returns: the width of the cell renderer

--- width=(width)
    Sets the width of the cell renderer.
    * width: the width of the cell renderer.
    * Returns: width

--- set_width(width)
    Same as width=.
    * width: the width of the cell renderer.
    * Returns: self

--- expanded?
    Returns true If the cell renderer is expanded or false.
    * Returns: true or false

--- expanded=(expanded)
    Sets the cell renderer is expanded or not.
    * expanded: true if the cell renderer is expanded or false
    * Returns: expanded

--- set_expanded(expanded)
    Same as expanded=.
    * expanded: true if the cell renderer is expanded or false
    * Returns: self

--- expander?
    Returns true If the cell renderer is expander or false.
    * Returns: true or false

--- expander=(expander)
    Sets the cell renderer is expander or not.
    * expander: true if the cell renderer is expander or false
    * Returns: expander

--- set_expander(expander)
    Same as expander=.
    * expander: true if the cell renderer is expander or false
    * Returns: self

--- mode
    Returns the ((<GtkCellRendererMode|Gtk::CellRenderer#GtkCellRendererMode>)).
    * Returns: ((<GtkCellRendererMode|Gtk::CellRenderer#GtkCellRendererMode>))

--- mode=(mode)
    Sets the ((<GtkCellRendererMode|Gtk::CellRenderer#GtkCellRendererMode>)).
    * mode: ((<GtkCellRendererMode|Gtk::CellRenderer#GtkCellRendererMode>))
    * Returns: ((<GtkCellRendererMode|Gtk::CellRenderer#GtkCellRendererMode>))

--- set_mode(mode)
    Same as mode=.
    * mode: ((<GtkCellRendererMode|Gtk::CellRenderer#GtkCellRendererMode>))
    * Returns: self

--- visible?
    Returns true if the cell renderer is visible or false.
    * Returns: true or false

--- visible=(visible)
    Sets visible of the cellrenderer.
    * visible: true or false
    * Returns: visible

--- set_visible(visible)
    Sets visible of the cellrenderer.
    * visible: true or false
    * Returns: self

--- xalign
    Returns the x alignment value of the cell renderer.
    * Returns: the x alignment value of the cell renderer.

--- xalign=(xalign)
    Sets the x alignment value of the cell renderer.
    * xalign: the x alignment value of the cell renderer.
    * Returns: xalign

--- set_xalign(xalign)
    Same as xalign=.
    * xalign: the x alignment value of the cell renderer.
    * Returns: self

--- yalign
    Returns the y alignment value of the cell renderer.
    * Returns: the y alignment value of the cell renderer.

--- yalign=(yalign)
    Sets the y alignment value of the cell renderer.
    * yalign: the y alignment value of the cell renderer.
    * Returns: yalign

--- set_yalign(yalign)
    Same as yalign=.
    * yalign: the y alignment value of the cell renderer.
    * Returns: self

--- xpad
    Returns the y alignment value of the cell renderer.
    * Returns: the xpad value of the cell renderer.

--- xpad=(xpad)
    Sets the y alignment value of the cell renderer.
    * xpad: the xpad value of the cell renderer.
    * Returns: xpad

--- set_xpad(xpad)
    Same as xpad=.
    * xpad: the xpad value of the cell renderer.
    * Returns: self

--- ypad
    Returns the y alignment value of the cell renderer.
    * Returns: the ypad value of the cell renderer.

--- ypad=(ypad)
    Sets the y alignment value of the cell renderer.
    * ypad: the ypad value of the cell renderer.
    * Returns: ypad

--- set_ypad(ypad)
    Same as ypad=.
    * ypad: the ypad value of the cell renderer.
    * Returns: self

== constants
=== GtkCellRendererState
Tells how a cell is to be rendererd. 
--- SELECTED
    The cell is currently selected, and probably has a selection colored background to render to. 
--- PRELIT
    The mouse is hovering over the cell. 
--- INSENSITIVE
    The cell is drawn in an insensitive manner 
--- SORTED
    The cell is in a sorted row 

=== GtkCellRendererMode
Identifies how the user can interact with a particular cell. 
--- MODE_INERT
    The cell is just for display and cannot be interacted with. Note that this doesn't mean that eg. the row being drawn can't be selected -- just that a particular element of it cannot be individually modified. 
--- MODE_ACTIVATABLE
    The cell can be clicked. 

--- MODE_EDITABLE
    The cell can be edited or otherwise modified. 

== See Also
Gtk::CellRendererText, Gtk::CellRendererPixbuf, Gtk::CellRendererToggle

- ((<Masao>))




ruby-gnome2-cvs メーリングリストの案内
Back to archive index