Implementing x/y/width/height trapping
Charles Goodwin <[email protected]> Tue, 04 May 2004 00:46:02 +0000
| Newsgroups | gmane.comp.java.xwt.core |
|---|---|
| Organization | Vexi.org - Veni Vidi Vici |
| Message-ID | <[email protected]> |
Adam,
I'm going to have a go at implementing x/y/width/height trapping in
Box.java over the next several days [1].
Since we are striving towards a common goal, I just wanted to go over
the implementation details with you so that we do not divulge too much
from the Ibex sources [2].
The plan is to work like so:
o If box resizes, put to width or height if property has changed.
However, check that the JS box properties "width" or "height" have
not been explicitly set, to prevent:
1) traps firing twice. (Not necessary, but clean.)
2) preventing actual resize before re-resize by a trap
This would need extra flags WIDTH_CHANGED and HEIGHT_CHANGED.
o If parent moves relative to surface, or a box (packed or unpacked)
gets repositioned within parent, then put to x or y as needed.
If the parent has moved, simply reput the same value to fire traps
ie JS equivalent of x=x;
This will require changing the flag MOVED into MOVED_X and MOVED_Y
which isn't an issue (is it?)
[1] After some thought, I agreed with you on this:
http://lists.vexi.org/archives?mss:139
[2] I've rewritten pack() and solve() using similar logic in order to
work correctly so you may want to check them out. I've also
overhauled reflow to only get called as needed. This involved
introducing 3 extra flags, REPACK_CHILDREN, RECONSTRAIN_CHILDREN,
and REPLACE_CHILDREN so that everything wasn't blindly redone but
only as necessary. I took the best facets of your logic and (I
should hope) improved upon it. The result is faster and accurate.
Patches on darcs.vexi.org if you care to look.
--
- Charlie
Charles Goodwin <[email protected]>
Online @ www.charlietech.com