All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sciss.lucre.swing.graph.Panel.scala Maven / Gradle / Ivy

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]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy