Commits

Matthias Mann  committed 85abb58

added named gaps for DialogLayout

  • Participants
  • Parent commits 035af61

Comments (0)

Files changed (1)

File src/de/matthiasmann/twlscala/DialogLayout.scala

         def orMore               = new MinPrefMaxGap(this.size, this.size, Gap.MAX)
         override def toString = "FixedGap("+size2string(size)+")"
     }
+    case class NamedGap private[twlscala] (name:String) extends Gap {
+        override def toString = "NamedGap("+name+")"
+    }
     case object Filler extends Gap
     case object SmallGap extends FixedGap(TWLDialogLayout.SMALL_GAP)
     case object MediumGap extends FixedGap(TWLDialogLayout.MEDIUM_GAP)
     case object DefaultGap extends FixedGap(TWLDialogLayout.DEFAULT_GAP)
     object Gap {
         def apply(size:Int) = { require(size >= 0); new FixedGap(if(size<MAX) size else MAX) }
+        def apply(name:String) = new NamedGap(name)
         def between(min:FixedGap, max:FixedGap) = new MinPrefMaxGap(min.size, min.size, max.size)
         def between(min:Int, max:FixedGap):MinPrefMaxGap = between(Gap(min), max)
         def between(min:FixedGap, max:Int):MinPrefMaxGap = between(min, Gap(max))
         def underlaying:TWLGroup
         protected def addGap(g:Gap):Unit =  g match {
             case Filler                      => underlaying.addGap
+            case NamedGap(name)              => underlaying.addGap(name)
             case FixedGap(s)                 => underlaying.addGap(s)
             case MinPrefMaxGap(min,pref,max) => underlaying.addGap(min,pref,max)
         }