Re: Drawing on a DrawingArea without using polymorphism



Yeah that sounds really good ;)
It works thanks !! :)


Jonathon Jongsma wrote:
> 
> 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
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 
> 

-- 
View this message in context: http://www.nabble.com/Drawing-on-a-DrawingArea-without-using-polymorphism-tf2293533.html#a6372063
Sent from the Gtkmm mailing list archive at Nabble.com.




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