Re: Drawing on a DrawingArea without using polymorphism
- From: "Jonathon Jongsma" <jonathon jongsma gmail com>
- To: Atma <fcamblor gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Drawing on a DrawingArea without using polymorphism
- Date: Mon, 18 Sep 2006 15:52:44 -0500
On 9/18/06, Atma <fcamblor gmail com> wrote:
Hi there !
I'd like to draw a line on a drawing area.
I succeeded by creating a subclass of DrawingArea and overriding the
on_expose_event() method... but I no longer want to use this behaviour.
So I used signals in order to delegate this task :
<code>
Gtk::DrawingArea* mainDrawingArea;
// Initializing my drawing area...
mainDrawingArea->signal_expose_event().connect(sigc::ptr_fun(&
SignalsLinker::drawMainArea));
</code>
Then, implementing drawMainArea() :
<code>
bool SignalsLinker::drawMainArea(GdkEventExpose *event){
printf("Draw !\n");
}
</code>
The "draw" is successfully displayed !
Now, what I'd want to know, is the way of retrieving my concerned
DrawingArea in order to gather the corresponding Window object and draw
lines on it .. is it possible ?
(note : I won't have any pointer on my DrawingArea in my SignalsLinker class
... wouldn't it be possible to retrieve it with the GdkEventExpose object
given ?)
Thanks in advance ;)
You could always use sigc::bind to pass a pointer to the DrawingArea
along as a parameter to your drawMainArea() handler.
--
jonner
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]