Updownquark / Quick

Quark's User Interface Creation Kit
0 stars 0 forks source link

Special style schemas #38

Closed Updownquark closed 10 years ago

Updownquark commented 11 years ago

Currently, stateful styles are specified in the XML with a '.', e.g. "style.click". The '.' operator is resolution in java and on other places in the MUIS framework, so this is inconsistent and I don't like it. Moreover, I believe I will need eventually to be able to specify style values for specific pieces (attach points) of templated widgets, and the '.' operator would be ideal for this (e.g. in a style sheet, [block.contents]{layout.padding=5} ). While this doesn't actually create a conflict (since the '.' would be inside the square brackets denoting the type), it would make the format more confusing.

Ideally, the stateful format would be mofre like style#click, but '#' isn't a valid character in an XML attribute name. I'm stuck with letters, numbers, '.', '_' and '-'. I'd prefer not to reserve '-', but maybe that's the best way.

So this issue comprises refactoring the styles to not use '.' for states and to add the templated.attach-point format in style sheets (might think about allowing that from the XML as well).

Updownquark commented 11 years ago

After I finish the piece I'm currently on, I need to make a special listener that listens for attach point attributes to be set as roles on an element and set those template paths on the element's filtered style sheet. It also needs to listen to its parent's roles (when the element itself has roles) and set those for 2-deep template paths. When the parent has any roles, it needs to listen to the grandparent, and so on.

After that I need to actually adjust the style sheet schema to be able to specify template paths in the style sheets. Then I'll set some styles for some of the attach points in text-field to try it out.

Updownquark commented 10 years ago

Attach-point styles now work. In the style sheet, they're specified like

text-field#border{...}

Although attach-point styles are now working as I had originally architected them, I'm not satisfied. Currently I'm not sure how group-styles and attach-point styles would mix, but I'm certain it would be unintuitive. Perhaps you could specify styles for an attach point that belonged to a group, but it's not possible to specify styles for an attach point of a parent widget belonging to a group. The latter behavior would be desirable because then you could override the styles of underlying components of a widget with a particular group. The latter should be specified with something like

[text-field](black)#border{
    border-style.color=white
    bg.color=black
}

The former should be specifiable with

[text-field]#border(black){
    border-style.color=white
    bg.color=black
}

This will require making the style expressions somewhat hierarchical, since whether a style applies to an attach point element may depend on the state of the owning widget.

Updownquark commented 10 years ago

It's done. The text field test works. Didn't exercise the full feature set, but the gist of it works. This is done until I find bugs later.