Re: Re: RFC: should the engine support retheming?

Adam Megacz <[email protected]> 14 Apr 2003 07:53:04 -0700
Newsgroups gmane.comp.java.xwt.general
Organization XWT
Message-ID <[email protected]>
David Crawshaw <[email protected]> writes:
> - First off, we could have the concept of a 'global property'. Any 

Well, yes, but I don't really think there will ever be any other
global properties.  Actually I'm starting to think that the theme trap
will be more like _KeyPressed (it gets triggered on every box with the
invariant that it is always triggered on a parent before its
children).


> These global properties  would have to use immutable traps to stop 
> chaos.

Good point.


> - The global property xwt.theme can be passed a string, or an array of 
> strings. These are the namespace(s) to be applied.

I think only the *target* of the mount operation gets passed.  So it
looks like this:

  xwt.mount(some.resource, "xwt.theme") =>
      for(every box, in top-down order) {
          box.Mount = "xwt.theme";
      }

Note that box._Mount doesn't find out that some.resource was the
resource that got overlaid/mounted.  I don't think it should be told
that.


> Box.unapply(<template>), on all the templates from the old namespace in 
> reverse order.

No, because you don't know which templates have been applied to a
given box.  I'm trying really hard not to keep that information
around.

Rather, when applying xwt.widget.foo, it sets a "checkpoint".  During
the retheme operation, it calls some magic function that removes any
traps set before the checkpoint.  So all we need now is a single bit
per instance of org.xwt.Trap that indicates if the trap was set before
or after the checkpoint.  The checkpoint can only be set once on a
given box.


> Do we need a version of the preserve to be implemented?

Fortunately, xwt/widget/foo.xwt knows what properties must be
preserved for <foo/>s (the preserve list is actually the same for
every theme's implementation of a given widget since it specifies the
properties that get passed from the old theme to the new one).  This
list of properties is actually just a chunk of code in
xwt/widget/foo.xwt:_Mount().


> This also keeps the widget library design exactly the same as it is 
> now, with only one extra template (xwt.theme.themeable).

And a trap in each org/xwt/*.xwt called _Mount which performs the work
formerly done by <preserve/>.  But it's a very simple trap.

  - a

_______________________________________________
http://lists.xwt.org/listinfo/dev