Re: How to make a button look like a treeview column title? [Was: How to use the treeview column title style for a button?]



Kristian Rietveld wrote:
On Mon, Oct 08, 2007 at 03:53:29PM +0200, Bastiaan Veelo wrote:
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);

Thank you for replying. However, for me the above has no visible effect. Now I understand that a GtkStyle is just about colors and similar settings, which only partly determine the looks of a widget. In my case I suspect that a GtkTreeView.GtkButton has the same GtkStyle settings as ordinary buttons, which is why I see no change.

By default it does have the same settings, but in multiple themes it
does not.

I recently discovered that there is something called a theme engine, and I guess I need to trick the theme engine into thinking that it is drawing a GtkTreeView button. Is there a way to do that? If the method would be engine-dependent, I need it to work on MS Windows.

That is exactly what the code above tries to achieve.  I briefly looked
at the Windows theme source code and figured that it does things a little
different than the theme engine I first looked at.  Does using:

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

instead of the call to gtk_rc_get_style_by_paths() posted earlier have
any effect?

No, it does not. Could it be that the style is overwritten as per http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-set-style?

Bastiaan.




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