void256/nifty-gui — pull request #170 by Joris-van-der-Wel (2013-11-17 23:19:09+00:00)
Title: SizeValue refactoring and wildcard text wrapping

I wanted a chat control with word wrap. This does not work for a couple of reasons. This pull request will make it possible:

1. A refactoring of SizeValue so that a null value is now a real value (width="default" or width="d"), this avoids "== null" checks.

2. A refactoring of SizeValue so that values that are computed (like in preProcessConstraintWidthThisLevel) do not have to store additional state somewhere. For example if the "default" value is used (which does a sum or max when using HorizontalLayout for example), the SizeValue will tell you the computed pixel value, but also that the computation was part of the "default" value.

3. Two new size values "sum" and "max", this is similar to the behaviour that was already present, namely compute the total/maximum heights of the children. These values are useful when you would like to be explicit. It also lets you use sum/max in any layout.

4. Text elements now support width="*" (wildcard) in horizontal layouts in combination with word wrap. This also lets you have parent panels that automatically base their height on these text elements. This allows for reimplementing the chat control using a ScrollPanel instead of a ListBox so that chat lines can wrap AND have player images. See issue #169

I also wrote test cases to test for this new behaviour.
I did my best to ensure backwards compatability. All the test cases pass, and I compared all the examples with a nifty-gui without these changes. (Although a few examples do not work, and "ControlsDemo" only seems to work on my AMD gpu, but not on my laptop with nvidia)

I made an example that shows you how these changes could implement a new chat control:

```xml

```

And here is a screenshot (the green squares represent what would be the image):
![nifty-wildcard-text](https://f.cloud.github.com/assets/745898/1559651/47debc46-4fde-11e3-92fb-71ddde354c93.png)