From: Kevin S. <kev...@ya...> - 2001-09-01 03:32:22
|
Right now, child widgets inside a window do not get drawn. I think I understand the problem, and the solution. I'll fix it, but I wanted to let you know what I'm doing. The problem is that right now, when FLTK calls draw, it goes to the virtual method in our RBFL class. That calls the Ruby draw method, which (by default) calls the Ruby call_parent_draw method. That casts the C++ pointer to RBFLWidget, and calls call_parent_draw. Now, inside there, it can't just call draw, because that would cause infinite recursion. It needs to call the FLTK class's draw instead. Right now, it is calling Fl_Widget::draw. But if the widget is actually an Fl_Window, we still call Fl_Widget::draw because we specify that class. All subclasses end up calling Fl_Widget::draw. I think the chain instead should be: FLTK calls draw, which is our RBFL virtual method. It should call the Ruby draw method. But by default, the Ruby draw method should simply call its own RBFL call_parent_draw method, which will call the correct FTLK draw. To do this, I will create a macro FN_CALL_RENAME, which will allow us to map a Ruby method ("draw") to a different RBFL method ("call_parent_draw"). Since every Ruby draw method has to call its own RBFL call_parent_draw, every class will have to have: static FN_CALL_RENAME(Window, draw, call_parent_draw); and DEF_METHOD(Window, draw, 0); We can then get rid of the rb_flwidget_draw and rb_flwidget_call_parent_draw methods in flwidget.cc. I should be able to do this right now, and check it in within an hour or so. Kevin __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com |