pharo-graphics / Toplo

A widget framework on top of Bloc
MIT License
19 stars 9 forks source link

Should Class present their ToWritableProperties fo ToStyleSheetTheme #215

Open Nyan11 opened 4 weeks ago

Nyan11 commented 4 weeks ago

Hello,

A Style Sheet is composed of a selector(type, stamps, and combinaison between them), a set of properties (backgroud, border, animation, ...) and values for the properties.

Currently the properties are defined in the method: ToStyleSheet class >> #defaultWritablePropertyList. But it would make more sens if the Toplo Widget contains their own stylable properties. This properties could be the standard API of the Widget.

For example, we have the property (ToFeatureProperty new name: #innerImage)., this property only makes sens on a Widget with a #innerImage method. Why do we need the #defaultWritablePropertyList ?

Nyan11 commented 4 weeks ago

Why do we need at the same time ToSkinEventAction and ToPropertyWriter to modify the properties of an object when we could only use ToSkinEventAction that are way simplier than ToPropertyWriter ?

Nyan11 commented 4 weeks ago

Answer: If two styleRules want to change the same property, ToStyleSheet will only apply the last installed one. Therefor we need a system to identify the properties, and it is difficult to identify the property if it is use directly in a block.

plantec commented 4 weeks ago

Interesting questions! the need for ToStyleSheet class >> #defaultWritablePropertyList is not clearly answered. @Nyan11 it would be cool to add your answer in the toplo book

Nyan11 commented 3 weeks ago

It is already present in: https://github.com/SquareBracketAssociates/Booklet-Graphics/blob/main/Chapters/toplo/stylesheet.md

By default, only the last writter per editable property and look event is installed for a given graphic element. You can force a rule to be applied using the supplements variable.