stock icon themes



Hi,

Owen and I were talking some about how to implement stock icons, and
how themes would modify them.

We can do each of the following:
 a) gtkrc provides one icon file, and we autogenerate states and sizes
 b) gtkrc specifies an icon file for each icon size (menu, toolbar,
    etc.)
 c) gtkrc specifies an icon file for each state (prelight, disabled,
    etc.)
 d) gtkrc specifies an icon file for size and state
 
On top of those dimensions, we need to specify left-to-right or
right-to-left (in Hebrew, arrows point the opposite direction, for
example).

If there's just one icon file, the syntax is probably something like:

style "foo" { 
  stock["OK"] = { (LTR, "my-ok-icon.png"),  /* left-to-right */
                  (RTL, "my-rtl-ok-icon.png") } /* right-to-left */

  stock["Cancel"] = { (*, "my-cancel-icon.png") } /* wild card */
}

If you can specify size and state, maybe:

style "foo" {
 stock["OK"] = { (*, "my-normal-ok.png", *, NORMAL),
                 (*, "my-prelight-ok.png", *, PRELIGHT) }
 stock["Cancel"] = { (*, "my-menu-cancel.png", MENU, *) }
}

"*" means wild card; if "*" is given for the size, then the other
sized icons will be created by scaling. If "*" is given for state,
then the state icons will be autogenerated by saturation, pixelation,
etc. "*" for direction means RTL and LTR use the same icon. 
* for both size and state autogenerates all 20 combinations of size
and state.

In addition to this gtkrc file stuff, we can have a function provided
by theme engines, that maps from a tuple (stock name, direction,
state, size) to a GdkPixbuf. This way theme engines can override the
default prelight/desensitization and scaling behavior with their own 
functions.

Comments welcome. In particular, we're wondering if theme designers
actually care to draw 20 variations on an icon, or if this feature
would mostly go unused (since it's a bit complicated to implement). 
Perhaps it's only useful to provide one small and one large variant of
the icon, to minimize scaling, and then always autogenerate the icon
states?

Note that most likely users will be able to configure the level of
saturation/pixelation used to represent prelight and sensitivity, and
of course the theme engine can replace the autogeneration function. So
there's some room for themeing here, even if you can't provide all 20
images.

Havoc






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