Re: HButtonBox edge buttons theming patch



On Tue, 2004-01-20 at 13:26, Matthias Clasen wrote:
> > 
> > Are you interested in extending the theming capabilities of
> > GtkHButtonBox this way?
> 
> How is this implemented ? 
> 
> I think this functionality would make most sense as a generalized
> "context-sensitive" theming, by e.g. allowing to classify the parent-child-relation in
> paths in rc files. Ie, instead of  GtkHButtonBox.GtkButton, allow to write
> GtkHButtonBox.[left].GtkButton or GtkTable.[topleft].*

In _gtk_button_paint() of gtkbutton.c the following is done in place of
the original gtk_paint_box of this function:

---- Snippet ----
gchar *position = NULL;
while ( !(position = g_object_get_data (G_OBJECT (widget), 			 
gtk_hbuttonbox_position_key)))
   {
   g_object_set_data_full (G_OBJECT (widget), 
		      gtk_hbuttonbox_position_key,
		      g_strdup("button"), g_free);
    }
gtk_paint_box (widget->style, widget->window,
		 state_type,
		 shadow_type, area, widget, position,
		 x, y, width, height);
---- Snippet ----

In gtkhbbox.c the value stored under gtk_hbuttonbox_position_key is set
appropriately according to position in the buttonbox (left, middle,
right, solitary).

And in the rcfile the "detail" passed on to gtk_paint_box(), is used to
theme the button (GtkButton) properly.

Is this an acceptable method? Or is your suggestion the way to go?
Your suggestion makes it more explicitly about the buttonbox, and from
that perspective I think it is the better approach.

-Aschwin




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