新規作成  編集  Ruby-GNOME2 Project Website  ページ一覧  検索  更新履歴  編集履歴  RSS  ログイン

Gtk::CellRenderer

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.

インスタンスメソッド

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)
  • 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.
start_editing(event, widget, path, background_area, cell_area, flags)
Passes an activate event to the cell renderer for possible processing.
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 Gtk::CellRenderer#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 Gtk::CellRenderer#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 Gtk::CellRenderer#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 Gtk::CellRenderer#expander=.
  • expander: true if the cell renderer is expander or false
  • Returns: self
mode
Returns the GtkCellRendererMode.
mode=(mode)
Sets the GtkCellRendererMode.
set_mode(mode)
Same as Gtk::CellRenderer#mode=.
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 Gtk::CellRenderer#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 Gtk::CellRenderer#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 Gtk::CellRenderer#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 Gtk::CellRenderer#ypad=.
  • ypad: the ypad value of the cell renderer.
  • Returns: self
stop_editing()
要編集
editing_canceled()
要編集
editing?()
要編集
cell_background_set=()
要編集
set_cell_background_set()
要編集
cell_background_set?()
要編集
cell_background_gdk=()
要編集
set_cell_background_gdk()
要編集
cell_background_gdk()
要編集
cell_background=()
要編集
set_cell_background()
要編集
sensitive=()
要編集
set_sensitive()
要編集
sensitive?()
要編集

定数

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.

その他

FOCUSED (Gtk::CellRenderer::State)
要編集

プロパティ

cell-background: String (Write)
Cell background color as a string
cell-background-gdk: Gdk::Color (Read/Write)
Cell background color as a Gdk::Color
cell-background-set: true or false (Read/Write)
Whether this tag affects the cell background color
height: Integer (Read/Write)
The fixed height
is-expanded: true or false (Read/Write)
Row is an expander row, and is expanded
is-expander: true or false (Read/Write)
Row has children
mode: Integer (Read/Write)
Editable mode of the CellRenderer
visible: true or false (Read/Write)
Display the cell
width: Integer (Read/Write)
The fixed width
xalign: Float (Read/Write)
The x-align
xpad: Integer (Read/Write)
The xpad
yalign: Float (Read/Write)
The y-align
ypad: Integer (Read/Write)
The ypad
editing:
要編集
sensitive:
要編集

更新履歴

  • 2014-06-15 クラスのメンバ項目でリストから漏れているものを追加。 - きたがわ
  • - Masao?