Re: How to use the treeview column title style for a button?



Hi,

On Sun, Oct 07, 2007 at 12:35:01PM +0200, Bastiaan Veelo wrote:
I am a style newbie. I want some of the buttons in my widget to look 
like the column title buttons in a treeview. How do I do that?

As far as I know themes style the buttons in the column headers of
GtkTreeView by using a "widget path" indicating that the parent of the
buttons is a GtkTreeView: "*.GtkTreeView.GtkButton".  Using
gtk_rc_get_style_by_paths() you can get the style corresponding to this
widget path.  Then apply the style to the widget using
gtk_widget_set_style().

Something like this seems to work for me:

  button = gtk_button_new_with_label ("...");
  style = gtk_rc_get_style_by_paths (gtk_widget_get_settings (button),
                                     "*.GtkTreeView.GtkButton",
                                     NULL,
                                     G_OBJECT_TYPE (button));
  gtk_widget_set_style (button, style);


regards,

-kris.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]