Efficient use of GDK Graphic contexts



I'm building a form designer application and need to draw a "grab"
border around widgets when the user selects them.  This part seems
straight forward and I've already got the border drawing working from
the expose event.  My question is how do do this in an efficient manner
since GCs seem to be tied to windows.

Currently I'm just building and destroying a new GC each time the
expose() event fires.  I know this isn't efficient at all, and I only
did it this was to test that I could actually draw a border.  GCs are
tied to windows, so it would seem I'll need a GC for each widget on my
form or can I have one GC and use it for all the widgets?  I guess I'm
asking what sort of overhead is involved in:

1) Creating a GC
2) Destroying a GC
3) Switching the window a GC is connected to
4) Memory overhead of each GC

Thanks for any help or suggestions.




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