Deriving from Gtk::Image to add a border



Hi folks -

My end goal is to add a border to a Gtk::Image control.  I have several Gtk::Images placed inside of a Gtk::Layout (yes, on purpose) which is inside a scrollable window.  My general idea for doing this:

- Derive a class from Gtk::Image
- override on_size_request to inflate the requisition returned from the baseclass method
- override on_expose_event to:
   - draw an outline around where the image should be
   - adjust things in the GtkEventExpose* struct to make the baseclass on_expose_event draw the pixbuf centered

My implementation is working, but terribly, and gets all messed up when scrolling around.  It will constantly draw the border through the image if the last scroll was in the middle of the image, etc.  I've permanently pastebin'd the header/source here:
http://pastebin.ca/1232981

Can someone give some pointers as to anything I'm doing wrong (which may or may not include the entire method!)  I'm inclined to scrap the Layout in favor of a DrawingArea and just physically draw the pixbufs I want to show manually, as that might be easier than doing this!

thanks!
dave


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