Hi Stef,



On Mon, Jan 6, 2014 at 5:54 PM, Stéphane Ducasse
<[email protected]>wrote:

> Ok I read
>
>
> UITheme would act as a theme factory.
> and each widget delegate to the Themer associated to themselve and the
> current theme
>
> So subclasse of UITheme can propose different themer for the same widget.
>

Exactly.


> Now since the themer is a separate class (from the morph it means that you
> must have all the hooks to customise it).
> So why not.
> I was also thinking that a widget could be an “abstract” class whose
> subclasses implement the themes.
>
> Then you would create a widget like that
>
>
> SpolightItemMorph forThemer: UITheme blue
> and it would create an instance of a subclas SpotligherBluerItemMorph.
>
> Did you try this design?
>

I think this is too convoluted because, like Estaban says, you want to keep
the theming orthogonal with widget definition.

But, you gave me an idea:

If we implement in Morph the followings:

Morph>>themer
    ^ themer ifNil: [self themerFor: self theme]

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?

Doru


Stef
>



-- 
www.tudorgirba.com

"Every thing has its own flow"

Reply via email to