Spec, Icons in subclasses of ComposableModel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Spec, Icons in subclasses of ComposableModel

Marion Noirbent
Hi,

In the issue 18742 add class to manage focusorder, Peter Uhnák says:

"
The idiomatic way of creating icons should be either
#smallBackIcon asIcon (ideally)

or the long-form
(Smalltalk ui icons iconNamed: #smallBackIcon)
"


But there is a third way, ComposableModel defines iconNamed: like that

ComposableModel>>iconNamed: aSymbol
  ^ Smalltalk ui icons iconNamed: aSymbol

So it is possible to use self iconNamed: #smallBackIcon

So my question is: what way is really ideal ?

Reply | Threaded
Open this post in threaded view
|

Re: Spec, Icons in subclasses of ComposableModel

stepharo


Le 18/7/16 à 14:12, Marion Noirbent a écrit :

> Hi,
>
> In the issue 18742 add class to manage focusorder, Peter Uhnák says:
>
> "
> The idiomatic way of creating icons should be either
> #smallBackIcon asIcon (ideally)
>
> or the long-form
> (Smalltalk ui icons iconNamed: #smallBackIcon)
> "
>
>
> But there is a third way, ComposableModel defines iconNamed: like that
>
> ComposableModel>>iconNamed: aSymbol
>    ^ Smalltalk ui icons iconNamed: aSymbol
>
> So it is possible to use self iconNamed: #smallBackIcon
>
> So my question is: what way is really ideal ?

For now use

ComposableModel>>iconNamed: aSymbol

Stef

>
>


Reply | Threaded
Open this post in threaded view
|

Re: Spec, Icons in subclasses of ComposableModel

Peter Uhnak
In reply to this post by Marion Noirbent
In that case it should be either

self iconNamed: #smallBackIcon
or
#smallBackIcon asIcon

that is — to avoid directly asking global singletons. This is similar to Theme, where one should not always ask Smalltalk ui theme, but instead have a single reference to it and ask "self theme".

As for which one of the two would be better in this situation, I don't know.
In general I would prefer the latter, but if there was a Spec-way added, then it should be used — it would make it easier to switch icons just for Spec in the future if such need would arise.

Also thanks for all the Spec fixes, this is really important!

Peter

On Mon, Jul 18, 2016 at 2:12 PM, Marion Noirbent <[hidden email]> wrote:
Hi,

In the issue 18742 add class to manage focusorder, Peter Uhnák says:

"
The idiomatic way of creating icons should be either
#smallBackIcon asIcon (ideally)

or the long-form
(Smalltalk ui icons iconNamed: #smallBackIcon)
"


But there is a third way, ComposableModel defines iconNamed: like that

ComposableModel>>iconNamed: aSymbol
  ^ Smalltalk ui icons iconNamed: aSymbol

So it is possible to use self iconNamed: #smallBackIcon

So my question is: what way is really ideal ?