[Gtk+2] Reproduce the look of GtkTreeView header
- From: Maggio Mago <dev maggio gmail com>
- To: gtkmm-list gnome org
- Subject: [Gtk+2] Reproduce the look of GtkTreeView header
- Date: Thu, 2 Jan 2014 16:07:18 +0100
Hello,
I need to set a custom widget in the GtkTreeView header.
I have done this with gtk_tree_view_column_set_widget() but my widget wasn't worked.
So i have created my custom header widget and set gtk_tree_view_set_headers_visible(false).
However i can not reproduce the look of the TreeView header.
Maybe a problem of style
Can you help me to reproduce the look of a GtkTreeView header ?
Following my code:
/* @file my-header.c */
G_DEFINE_TYPE (MyHeader, my_header, GTK_TYPE_WIDGET)
static void
my_header_class_init(MyHeaderClass *klass)
{
GtkWidgetClass *gtkwidget_class;
gtkwidget_class = (GtkWidgetClass *) klass;
/* ... */
gtkwidget_class->expose_event = my_header_expose;
gtk_rc_parse_string ("widget_class '*.MyHeader' style 'treeview_header' ");
/* ... */
}
static gboolean
my_header_expose (GtkWidget *widget, GdkEventExpose *event)
{
gtk_paint_box(widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&event->area,
widget,
"button",
event->area.x, event->area.y, event->area.width, event->area.height);
return FALSE;
}
PJ: Sample
Attachment:
my_tree_view_header.tar.gz
Description: GNU Zip compressed data
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]