Re: Theming API hackfest: last call

Robert Staudinger wrote:
> On Wed, Oct 15, 2008 at 12:03 PM, Christian Dywan <christian imendio com> wrote:
> [...]
>> Sounds like it would make subclassing kind of hard, if I understand you
>> right. For instance people like to subclass to create all sorts of
>> buttons and it is only intuitive that they all look similar. What would
>> happen to my hypothetical ExampleSelectColorButton if the GtkButton
>> styles are not applied to it?
> It's not so much about picking the one or the other way, but providing
> both possibilities. The general case will likely be styling on the
> type name, but in rare cases implicit style inheritance may not be
> desired. Imagine (ok, this is somewhat contrieved) that window
> decorations will be drawn by gtk itself, and designers will just style
> GtkWindow to their liking. It is conceivable that this styling should
> not be inherited to GtkPlug, so ".GtkWindow { ... }" would be the way
> to go.

I still don't buy that.  What you want is to make sure GtkPlug style override
that of GTKWindow.  And that already happens I assume.  *Any* use of
".GtkWindow {...}" is wrong, because I may do this in my pygtk code:

class MyApp extends gtk.Window:

and then my app will not get all the style that it should.  The theme engine
should *not* have a way to discriminate based on class.  More specific types
should not styled differently unless there is style code for them specifically.

> Relatedly I am thinking of a sane way to import styling into CSS
> blocks to aid widget mimicking. Imagine you want to mimick a GtkButton
> with your own wonderful implementation "FooButton", but unrelated in
> the GType hierarchy (not inheriting from GtkButton). Something like
> this might aid to apply GtkButton styling:
> FooButton {
>     ccss: import(GtkButton);
> }
> Analogously, from the GtkWindow example above, it would be possible to
> apply styling from GtkWindow to GtkDialog (it would not apply
> implicitly, because we want to avoid styling GtkPlug). And let's make
> up some additional properties as well:

Just solve the GtkPlug problem some other way.  By adding:

GtkPlug {
    background: none:
    border: 0;

> GtkDialog {
>     ccss: import(.GtkWindow);
>     minimize-button: none;
>     maximize-button: none;
> }
> All this is of course pretty premature, but I hope the idea is clear.
> - Rob

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