Re: color of focus rectangle



Patrick Schweiger <pks@timing.com> writes: 
> I'm working on an application that uses black background all
> around and to top it off will run on a small display that's
> best looked at from a certain angle. The focus rectangle
> produced by all the components is black and appearancewise
> "shrinks" the focused control by a pixel instead of making
> it stand out.
> 

I take it from this that it's some sort of in-house or contract
application, and you control how it's deployed - 

> Does anyone know of a quick (maybe even dirty) way of
> changing the color of the focus rectangle for all controls?
> If so, thank you for your reply. If not - thank you anyway.
> 

Basically what you want to do is override the draw_focus method in 
GtkStyleClass for all widgets. Look over gtkstyle.[hc].

The clean and officially supported way to do that is to write a theme
engine and use that theme engine. You'd then ship the theme engine
with your app, along with a gtkrc file that assigned that theme engine
to all widgets. This will prevent users from switching themes, but
should be OK since you're already hardcoding a bunch of stuff.

The simpler way, if you already control deployment, is to just go in
to gtkstyle.c, find gtk_default_draw_focus, and change it to draw with
a color GC instead of style->black_gc.

There may also be some hack like getting a pointer to the default
style and poking a different function into the GtkStyleClass, but that
may or may not work.

Havoc





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