Fwd: [Newbies] Omnibrowser, italic Traits' method names
Juraj.Kubelka at gmail.com
Sun Jun 24 12:28:29 UTC 2007
I asked David Röthlisberger and he did it in same way you wrote.
Begin forwarded message:
> From: David Röthlisberger <roethlis at iam.unibe.ch>
> Date: 24. června 2007 13:36:22 GMT+02:00
> To: "'Juraj Kubelka'" <Juraj.Kubelka at gmail.com>
> Subject: AW: [Newbies] Omnibrowser, italic Traits' method names
> Hi Juraj,
>> I remember you wrote about changes which
>> gives icons to column items. Is it also possible to set a
>> color in your implementation? I may help you to finish,
>> because I need to extend visualization support (for example
>> green Trait names) in OB.
> Yes, it is possible to set colors for the items.
> I use a subclass of LazyListMorph and override #colorForRow: to
> answer the
> color of the column item. And then i also introduced a new
> OBPluggableListMorph class and let it answer the new
> OBLazyListMorph class
> in #listMorphClass, as Robert Krahn explained.
> OBLazyListMorph >> #colorForRow: reads like this:
> colorForRow: row
> | item |
> ^(selectedRow notNil and: [ row = selectedRow])
> ifTrue: [ Color red ]
> ifFalse: [ item := self getListItem: row. item isText
> ifTrue: [item colorAt: 1] ifFalse: [self color] ].
> Now you can use the TextColor>>green attribute when building the
> strings for
> the column items.
> This seems to be the easiest solution.
> With these two new classes I could also add support for icons.
>> Begin forwarded message:
>>> From: Robert Krahn <robert.krahn at student.hpi.uni-potsdam.de>
>>> Date: 24. června 2007 2:51:33 GMT+02:00
>>> To: "A friendly place to get answers to even the most basic
>>> about Squeak." <beginners at lists.squeakfoundation.org>
>>> Subject: Re: [Newbies] Omnibrowser, italic Traits' method names
>>> Reply-To: "A friendly place to get answers to even the most basic
>>> questions about Squeak." <beginners at lists.squeakfoundation.org>
>>> Sorry, I don't want to spam you but I thought about a possible
>>> solution for that issue.
>>> The first thing one could do is to subclass LazyListMorph to have a
>>> Morph which permits the displayStrings to keep their color.
>> Then there
>>> is the need for a new PluggableListMorph which overrides
>>> PluggableListMorph >>listMorphClass to get this subclass of
>>> LazyListMorph. The next thing is to construct another
>>> which changes #listMorphForColumn:.
>>> Then a new builder exists which delivers browsers with the wanted
>>> property. I don't know if there are other classes which have to be
>>> changed (OBPane?) or if there is an easier solution. Please give me
>>> your opinion.
>>> Am 24.06.2007 um 02:18 schrieb Robert Krahn:
>>>> Am 24.06.2007 um 00:44 schrieb Juraj Kubelka:
>>>>> It is possible to use TextEmphasis>>bold now but TextColor>>green
>>>>> attribute doesn't work.
>>>> Yes, thats why the standard colors in LazyListMorph overwrite your
>>>> chosen color. LazyListMorph >>display: atRow:on: looks like that:
>>>> display: item atRow: row on: canvas
>>>> "display the given item at row row"
>>>> | drawBounds |
>>>> drawBounds := self drawBoundsForRow: row.
>>>> drawBounds := drawBounds intersect: self bounds.
>>>> item isText
>>>> ifTrue: [ canvas drawString: item in:
>> drawBounds font: (font
>>>> emphasized: (item emphasisAt: 1)) color: (self colorForRow: row) ]
>>>> ifFalse: [ canvas drawString: item in:
>> drawBounds font: font
>>>> color: (self colorForRow: row) ].
>>>> The item is your displayString but the color is changed to
>>>> LazyListMorph >>colorForRow: which turns out to be the follow:
>>>> colorForRow: row
>>>> ^(selectedRow notNil and: [ row = selectedRow])
>>>> ifTrue: [ Color red ]
>>>> ifFalse: [ self color ].
>>>> It seems that those things are really in the guts of the
>> system and
>>>> because of that they cannot be parameterized easily (yet).
>>>> Beginners mailing list
>>>> Beginners at lists.squeakfoundation.org
>>> Beginners mailing list
>>> Beginners at lists.squeakfoundation.org
More information about the Beginners