Gtk2
view release on metacpan or search on metacpan
xs/GtkCellRenderer.xs view on Meta::CPAN
=item o $cell_area (Gtk2::Gdk::Rectangle) cell area as passed to C<RENDER>.
=item o $flags (Gtk2::CellRendererState) render flags
=back
For cells that are editable, this is called to put the cell into editing
mode. If the return value is an object is a Gtk2::CellEditable, that
widget will be used to edit the value; the calling code takes care of
sizing, placing, and showing the editable, you just need to return it.
If the return value is undef, the editing is aborted.
=back
Note: for backward compatibility, the bizarre and non-standard scheme used
for this in 1.02x is still supported, but is deprecated and should not be
used in new code, and since i don't want people to use it any more i will
not document it here.
=cut
=for flags GtkCellRendererState
=cut
=for enum GtkCellRendererMode
=cut
## void gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell, gint width, gint height)
=for apidoc
Set the renderer's size explicitly, independent of object properties. A value
of -1 means "don't use a fixed size for this dimension."
=cut
void
gtk_cell_renderer_set_fixed_size (cell, width, height)
GtkCellRenderer * cell
gint width
gint height
## void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell, gint *width, gint *height)
=for apidoc
Fetch the fixed size if I<$cell>. Values of -1 mean "this dimension is not
fixed."
=cut
void
gtk_cell_renderer_get_fixed_size (GtkCellRenderer * cell, OUTLIST gint width, OUTLIST gint height)
## void gtk_cell_renderer_get_size (GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height)
=for apidoc
=for signature (x_offset, y_offset, width, height) = $cell->get_size ($widget, $cell_area)
=cut
void
gtk_cell_renderer_get_size (cell, widget, cell_area)
GtkCellRenderer * cell
GtkWidget * widget
GdkRectangle_ornull * cell_area
PREINIT:
gint x_offset;
gint y_offset;
gint width;
gint height;
PPCODE:
PUTBACK;
gtk_cell_renderer_get_size(cell, widget, cell_area,
&x_offset, &y_offset, &width, &height);
SPAGAIN;
EXTEND(SP,4);
PUSHs(sv_2mortal(newSViv(x_offset)));
PUSHs(sv_2mortal(newSViv(y_offset)));
PUSHs(sv_2mortal(newSViv(width)));
PUSHs(sv_2mortal(newSViv(height)));
## void gtk_cell_renderer_render (GtkCellRenderer *cell, GdkWindow *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
void
gtk_cell_renderer_render (cell, drawable, widget, background_area, cell_area, expose_area, flags)
GtkCellRenderer * cell
GdkDrawable * drawable
GtkWidget * widget
GdkRectangle * background_area
GdkRectangle * cell_area
GdkRectangle * expose_area
GtkCellRendererState flags
## gboolean gtk_cell_renderer_activate (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags)
gboolean
gtk_cell_renderer_activate (cell, event, widget, path, background_area, cell_area, flags)
GtkCellRenderer * cell
GdkEvent * event
GtkWidget * widget
const gchar * path
GdkRectangle * background_area
GdkRectangle * cell_area
GtkCellRendererState flags
## gtk_cell_renderer_start_editing() is normally a constructor,
## returning a widget with a floating ref ready for the caller to take
## over. But the generated typemap for "interface" objects like
## GtkCellEditable only treats it as GObject and doesn't sink when
## making the perl wrapper, so cast up to GtkWidget to get that.
## GtkWidget is a requirement of GtkCellEditable, so "editable" is
## certain to be a widget.
##
## The returned widget is normally about to be put in a container
## anyway, which sinks any floating ref, but sink it now to follow the
## general rule that wrapped widgets at the perl level don't have a
## floating ref left. In particular this means if you start_editing()
## and then strike an error or otherwise never add it to a container
## it won't be a memory leak.
##
##GtkCellEditable* gtk_cell_renderer_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags)
=for apidoc
=for signature celleditable or undef = $cell->start_editing ($event, $widget, $path, $background_area, $cell_area, $flags)
=cut
GtkWidget_ornull *
gtk_cell_renderer_start_editing (cell, event, widget, path, background_area, cell_area, flags)
GtkCellRenderer * cell
GdkEvent * event
GtkWidget * widget
const gchar * path
GdkRectangle * background_area
GdkRectangle * cell_area
GtkCellRendererState flags
xs/GtkCellRenderer.xs view on Meta::CPAN
if (! g_type_is_a (gtype, GTK_TYPE_CELL_RENDERER))
croak ("%s(%s) is not a GtkCellRenderer",
package, g_type_name (gtype));
/* peek should suffice, as the bindings should keep this class
* alive for us. */
class = g_type_class_peek (gtype);
if (! class)
croak ("internal problem: can't peek at type class for %s(%d)",
g_type_name (gtype), gtype);
gtk2perl_cell_renderer_class_init (class);
##
## here we provide a hokey way to chain up from one of the overrides we
## installed above. since the class of an object is determined by looking
## at the bottom of the chain, we can't rely on that to give us the
## class of the parent; so we rely on the package returned by caller().
## if caller returns nothing useful, then we assume we need to call the
## base method.
##
## For backward compatibility, we support the old parent_foo syntax, although
## the actual call semantics are slightly different.
##
=for apidoc Gtk2::CellRenderer::GET_SIZE __hide__
=cut
=for apidoc Gtk2::CellRenderer::RENDER __hide__
=cut
=for apidoc Gtk2::CellRenderer::ACTIVATE __hide__
=cut
=for apidoc Gtk2::CellRenderer::START_EDITING __hide__
=cut
=for apidoc Gtk2::CellRenderer::parent_get_size __hide__
=cut
=for apidoc Gtk2::CellRenderer::parent_render __hide__
=cut
=for apidoc Gtk2::CellRenderer::parent_activate __hide__
=cut
=for apidoc Gtk2::CellRenderer::parent_start_editing __hide__
=cut
void
GET_SIZE (GtkCellRenderer * cell, ...)
ALIAS:
Gtk2::CellRenderer::RENDER = 1
Gtk2::CellRenderer::ACTIVATE = 2
Gtk2::CellRenderer::START_EDITING = 3
Gtk2::CellRenderer::parent_get_size = 4
Gtk2::CellRenderer::parent_render = 5
Gtk2::CellRenderer::parent_activate = 6
Gtk2::CellRenderer::parent_start_editing = 7
PREINIT:
GtkCellRendererClass *parent_class = NULL;
GType this, parent;
PPCODE:
/* look up the parent.
*
* FIXME: this approach runs into an endless loop with a hierarchy
* where a Perl class inherits from a C class which inherits from a
* Perl class. Like this:
*
* ...
* +- GtkCellRenderer
* +- Foo::RendererOne (Perl subclass)
* +- FooRendererTwo (C subclass)
* +- Foo::RendererThree (Perl subclass)
*
* yes, this is contrived. but possible!
*/
this = G_OBJECT_TYPE (cell);
while ((parent = g_type_parent (this))) {
if (! g_type_is_a (parent, GTK_TYPE_CELL_RENDERER))
croak ("parent of %s is not a GtkCellRenderer",
g_type_name (this));
parent_class = g_type_class_peek (parent);
/* check if this class isn't actually one of ours. if it is a
* Perl class, then we must not chain up to it: if it had a sub
* defined for the current vfunc, we wouldn't be in this
* fallback one here since perl's method resolution machinery
* would have found and called the sub. so chaining up would
* result in the fallback being called again. this will lead
* to an endless loop.
*
* so, if it's not a Perl class, we're done. if it is,
* continue in the while loop to the next parent. */
if (parent_class->get_size != gtk2perl_cell_renderer_get_size) {
break;
}
this = parent;
}
/* the ancestry will always contain GtkCellRenderer, so parent and
* parent_class should never be NULL. */
assert (parent != 0 && parent_class != NULL);
switch (ix) {
case 4: /* deprecated parent_get_size */
case 0: /* GET_SIZE */
if (parent_class->get_size) {
gint x_offset, y_offset, width, height;
parent_class->get_size (cell,
SvGtkWidget (ST (1)),
SvGdkRectangle_ornull (ST (2)),
&x_offset,
&y_offset,
&width,
&height);
EXTEND (SP, 4);
PUSHs (sv_2mortal (newSViv (x_offset)));
PUSHs (sv_2mortal (newSViv (y_offset)));
PUSHs (sv_2mortal (newSViv (width)));
PUSHs (sv_2mortal (newSViv (height)));
( run in 0.451 second using v1.01-cache-2.11-cpan-5511b514fd6 )