Skip to content

Commit

Permalink
converted DragMode to an Enumeration
Browse files Browse the repository at this point in the history
  • Loading branch information
reggert committed Jun 19, 2020
1 parent 827e393 commit 6fdfcc6
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/scala/scala/swing/DesktopPane.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,33 @@ class DesktopPane extends Component with SequentialContainer.Wrapper {
/**
* Specifies how dragged frames will be animated.
*
* @param newMode either `LiveDragMode` or `OutlineDragMode`.
* @param newMode either `DragMode.Live` or `DragMode.Outline`.
*/
def dragMode_= (newMode : DragMode) : Unit = peer.setDragMode(newMode.intValue)
def dragMode_= (newMode : DragMode) : Unit = peer.setDragMode(newMode.id)
}


object DesktopPane {

/**
* Indicates how an internal frame will be animated as it is dragged.
* Supported types of drag modes for internal frames.
*/
final case class DragMode(intValue : Int)
//noinspection TypeAnnotation
object DragMode extends Enumeration {
/**
* Renders the contents of the frame while dragging.
*/
val Live = Value(JDesktopPane.LIVE_DRAG_MODE)

/**
* Indicates that a dragged internal frame will be animated with its contents.
*/
val LiveDragMode: DragMode = DragMode(JDesktopPane.LIVE_DRAG_MODE)
/**
* Renders only the outline of the frame while dragging.
*/
val Outline = Value(JDesktopPane.OUTLINE_DRAG_MODE)
}

/**
* Indicates that a dragged internal frame will only render as an outline.
* Type indicating a type of mode for dragging internal frames.
*/
val OutlineDragMode: DragMode = DragMode(JDesktopPane.OUTLINE_DRAG_MODE)
type DragMode = DragMode.Value

}

0 comments on commit 6fdfcc6

Please sign in to comment.