de.sciss.lucre.swing.graph.Panel.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lucreswing_2.13.0-M5 Show documentation
Show all versions of lucreswing_2.13.0-M5 Show documentation
Swing support for Lucre, and common views
The newest version!
/*
* Panel.scala
* (LucreSwing)
*
* Copyright (c) 2014-2019 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Lesser General Public License v2.1+
*
*
* For further information, please contact Hanns Holger Rutz at
* [email protected]
*/
package de.sciss.lucre.swing
package graph
import de.sciss.lucre.expr.graph.Constant
import de.sciss.lucre.expr.{Ex, IExpr}
import de.sciss.lucre.stm.Sys
object Panel {
final case class Border(w: Panel) extends Ex[graph.Border] {
override def productPrefix: String = s"Panel$$Border" // serialization
def expand[S <: Sys[S]](implicit ctx: Ex.Context[S], tx: S#Tx): IExpr[S, graph.Border] = {
val valueOpt = ctx.getProperty[Ex[graph.Border]](w, keyBorder)
valueOpt.fold(Constant(defaultBorder).expand[S])(_.expand[S])
}
}
private[graph] final val keyBorder = "border"
private[graph] final val defaultBorder: graph.Border = graph.Border.Empty(0)
}
trait Panel extends Component {
def contents: Seq[Widget]
var border: Ex[Border]
}