Re: Placing a Button on a DrawingArea



On 10/10/07, John Hobbs <john velvetcache org> wrote:
> Hello All,
>
> I'm using a drawing area to show the feed from a camera.  I want this to be
> full screen, and I'd like to put a few control buttons directly on the
> image.  Is there a container or something that I'm not seeing that could
> accomplish this? If not, is it possible to draw my own rectangle on the
> DrawingArea and make it click-able?

this isn't really possible with DrawingArea since it is not a
container class.  you can draw your own rectangle and make it
'clickable' by implementing a lot of custom stuff (e.g. detect the
coordinates of the click and test whether it's inside the area that
you've drawn your rectangle, etc).  The problem with this approach is
that it won't necessarily look like a button (especially in different
GTK+ themes, etc) or act like a button is expected to behave.
You could probably implement a custom container class to acheive this
as well (though I've personally never done this, so I can't offer much
help there, but there is a custom container example in the gtkmm
tutorial, I believe).  Another possible option might be to look at a
canvas library.  gnomecanvas has c++ bindings but it's kind of old and
not necessarily recommended for new development.  goocanvas(mm) might
be an option.

-- 
jonner



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