DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Pending]

Link: http://www.fltk.org/str.php?L2948
Version: 1.3-feature
Fix Version: 1.3-current (r9871)


Albrecht> We're only calling const methods anyway, as x(), y(), window(),
Albrecht> and this code is not subject to be changed in the future.

Yes, though for some reason "as_window()" is not const,
(it probably should be), which is why that cheat is necessary at the end
there. Maybe using const_cast<Fl_Widget*>(w)->as_window() is better,
which is what I decided to go with in top_window_offset().. will check.

Note in manolo's implementation, const is cast away at the top
at the declaration of the variable, but I just switched it to const
and cast const away only at the place where it was needed, at the
as_window() call.

So this does two things:

   1) Keeps the variable const so one can't later add code like
      w->label("yoo hoo"); without getting an error.. 
      hey, it could be more subtle ;)

   2) Highlights exactly where the cheat is needed (at as_window())
      so if as_window() ever changes in the future to be const, it's
      easier to find and remove the const cast-away.

Is there a reason as_window() and friends (other virtual
implementations) are not const methods? Fl_Window::window() is.


Link: http://www.fltk.org/str.php?L2948
Version: 1.3-feature
Fix Version: 1.3-current (r9871)

_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to