On Sun, Aug 8, 2010 at 10:32 PM, Kai Sterker <kai.ster...@gmail.com> wrote:
> gfx::drawable::draw is declared as const. gui::base::draw was not and > quite a few of the widgets have code in their draw() implementation > that modifies class members. So here's the question: is there a quick > way to work around these problems (other than removing the const from > drawable::draw), which will open other issues? Or will I have to go > over each widget and rewrite it even more than I already did? > > Personally, I see a few possibilities: > > * divide the code into an update() and draw() method. (drawable > already provides an update() methodl, probably exactly for that > purpose). > * move the stuff that changes (like the text of a label) into a class > of its own, as inside a const method we can call non-const methods of > other objects. > * do the changes before the drawing (i.e. render the label text > whenever a new string is set or the color is changed), even though > this might add some overhead. Decided to use the second alternative. So all the stuff that changes during drawing is now constrained to the font and the new created decoration and textcache classes. > P.S.: Nothing to commit, yet, as it's horribly broken right now. > Expect working stuff later in the week. Late yesterday night I got guitest up and running again. There's one little bug with the cursor of text input fields, which somehow has the wrong y-offset. I also have not updated the focus code, so for now we still have the plain border as focus indicator instead of the decorative overlay. So there is a bit more work to put in, including formatting and properly documenting the code. But I think I'll check in an intermediate version tonight, since I don't want to risk losing all the many changes I made and debugged :-). Kai _______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/adonthell-devel