Custom GtkCellRenderer for Buttons
- From: Tilo Villwock <codemusings gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Custom GtkCellRenderer for Buttons
- Date: Wed, 25 Jan 2017 09:25:14 +0100
Hello,
I would like to implement a custom cell renderer for buttons but can't
figure out how. I looked at the source code for GtkCellRendererToggle
and the only code that might even be remotely connected to rendering a
checkbox or radio button in a cell seems to use a class that is called
GtkSnapshot.
I couldn't find any info on that class so I'm assuming this is
something internal and not meant for outside use?
I tried to render a button using the render vfunc but I keep getting
failing assertions about the the size of the button not having been
allocated prior to the call to gtk_widget_draw. This is the code I've
got so far:
static void
render(GtkCellRenderer* r, cairo_t* cr, GtkWidget* w,
const GdkRectangle* background_area,
const GdkRectangle* cell_area,
GtkCellRendererState state)
{
GtkWidget* button = gtk_button_new_with_label("Click me!");
gtk_widget_set_allocation(button, cell_area);
gtk_widget_draw(button, cr);
gtk_widget_destroy(button);
}
This obviously doesn't allow for handling any click events anyway so
I'm probably going about this the wrong way. Any pointers in the right
direction would be appreciated.
--Tilo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]