Highlighting parts of complex widgets in themes

Karl Vogel karl.vogel at seagha.com
Wed Dec 17 14:05:51 GMT 2003

Since I like the gnome Simple theme that much and I couldn't find it for
thought I'd have a look at implementing it.

The thinice engine (the gtk engine used in the simple theme) has
highlighting of
the buttons if you move over them. For normal widgets (e.g. buttons) this
can be
achieved by installing an event filter that listens for Enter and Leave
(like it's also done in the Plastik theme)

However, this doesn't work for complex widgets like the scrollbar, as it is
composed of smaller Primitive Elements (arrow up, down, slider). The enter
leave event is for the entire scrollbar, so that alone can't be used as you
would highlight the entire widget, while only the Primitive Element should

I currently implemented this by installing an eventfilter on the scrollbar
also listens for mouse move events and then records the current mouse
within the widget. Then I issue a repaint and in the drawing code of the 
Primitive Element, I check if the recorded mouse position is within the

In order to receive the mouse move events, I had to enable mouse tracking on
widget, which I actived in the polish method of the style.

While this works, I'm wondering if there isn't a better way to do this.. as
feels kind of hackish and would mock things up if the application changes
tracking state. 

-- Karl

More information about the kde-core-devel mailing list