Maybe widgets should delegate to the theme the rendering?

So

Morph subclass: Widget. "So this applies only for widget morphs?"

Widget subclass: List.

List >> drawOn: aCanvas
    self theme drawList: self onCanvas: aCanvas

And then each theme can really render different each widget.


On Tue, Jan 7, 2014 at 11:10 AM, Esteban Lorenzano <esteba...@gmail.com>wrote:

> I’m experimenting with separate the widget from the skin… problem is
> sometimes theming is just change colors, but some others is widget building
> it self, so we will need widget factories (for theme), etc.
>
> all is doable, but all implies time :)
>
> On 07 Jan 2014, at 11:07, Stéphane Ducasse <stephane.duca...@inria.fr>
> wrote:
>
>
> I think this is too convoluted because, like Estaban says, you want to
> keep the theming orthogonal with widget definition.
>
>
> Yes I do not like it either.
>
> But, you gave me an idea:
>
> If we implement in Morph the followings:
>
> Morph>>themer
>     ^ themer ifNil: [self themerFor: self theme]
>
>
> what would be self theme I do not really like the idea to have all the
> morph talking to UITheme
> theme
> ^ UITheme current
> is not sexy to me
>
> Morph>>themerFor: aTheme
>     ^ self subclassResponsibility
>
> And then in a morph we would have something like this:
>
> SpotlightItemMorph>>themerFor: aTheme
>     ^ aTheme spotterThemer
>
> SpotlightItemMorph>>onSelected
> self themer configureSelectedItemMorph: self
>
>
> Then we could simply do pretty much what you want:
>
> SpotlightItemMorph new themer: MySpotterThemer new.
>
> I like this idea. What do you think?
>
>
> I do not know. Now what is clear is that we need strategy as in your
> original design. I was thinking about that too.
>
> Stef
>
>
>

Reply via email to