#712 UI enhancements

brian Mon 10 Aug 2009

Below are some notes for some of the UI changes Andy and I mapped out today for handling CSS like borders in gfx/fwt...

New gfx::Border class will model a CSS like border with four aspects:

  • width
  • color
  • style
  • radius

Each of those four aspects has four values for each side (or corner in case of radius) for a total of 16 fields. String format will allow one to four values for each aspect:

"1 #000"          // solid 1 pixel black border
"1,0,0,0"         // 1 pixel just on top
"2 inset #f00 2"  // 2 pixel red inset with radius of 2

A new gfx::Pattern brush for images based on CSS:

@serializable
class Pattern : Brush
{
  Image image
  Color? bg :=  null
  Bool vrepeat := true
  Bool hrepeat := true
  Halign halign := Halign.left
  Valign valign := Valign. top

  new make(Image img, |,| itBlock)
}

The existing fwt::BorderPane will be modified to:

class BorderPane
{
  Border border := Border("0")
  Insets insets := Insets(0,0,0,0)
  Brush? bg := null

  new make(|,| itBlock)
}

Unforetunetly SWT doesn't support image brushes very well (only simple tiled images). But browsers don't support gradients very well, so most gradients are actually done with images. So we decided to just define a solid overall model in FWT even though neither SWT nor browsers can support the full model today (but probably will over the coming years).

brian Wed 12 Aug 2009

Promoted to ticket #712 and assigned to brian

brian Wed 12 Aug 2009

Ticket resolved in 1.0.46

All this stuff is checked in, new HSB color APIs too. Reworked Pattern design a bit to just add repeat as option to Halign and Valign (which also got moved from fwt to gfx).

FWT demo has a new tab to play around with borders.

SWT supports mostly everything, not bg with radius or some of the non-repeating Patterns.

Browser support BorderPane still not done yet.

Login or Signup to reply.