home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)ctrlpnlvie.tcl /main/titanic/2
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)ctrlpnlvie.tcl /main/titanic/2 20 Aug 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CtrlPnlView : {BrowsView} {
- constructor
- method destructor
- method dropEvent
- method reIndex
- method dialog
- attribute _dialog
- }
-
- constructor CtrlPnlView {class this name} {
- set this [BrowsView::constructor $class $this $name]
- # Start constructor user section
- $this destinationSet "CONTROLPANELENTRY dropEvent"
- # End constructor user section
- return $this
- }
-
- method CtrlPnlView::destructor {this} {
- set ref [$this _dialog]
- if {$ref != ""} {
- $ref _view ""
- }
- # Start destructor user section
- # End destructor user section
- }
-
- method CtrlPnlView::dropEvent {this droppedObject srcIsDst droppedAfterObject droppedForObject} {
-
-
- if {$srcIsDst == 0} {
- wmtkmessage "Drag & drop between tools is not supported (yet)"
- return
- }
-
- set objSet [$this objectSet]
- set objName [$droppedObject label]
-
- # remove the dropped object from the list in view and dialog
- [$this dialog] removeEntry $objName
- foreach obj $objSet {
- if {$obj != $droppedObject} {
- lappend woObjSet $obj
- }
- }
-
- # replace the dropped object in the list
- if { $droppedAfterObject == ""} {
- set wObjSet "$droppedObject $woObjSet"
- [$this dialog] insertEntryAfter "" $objName
- } else {
- [$this dialog] insertEntryAfter \
- [$droppedAfterObject label] $objName
- foreach obj $woObjSet {
- lappend wObjSet $obj
- if {$obj == $droppedAfterObject} {
- lappend wObjSet $droppedObject
- }
- }
- }
-
- set index 0
- foreach obj $wObjSet {
- $obj index $index
- incr index
- }
-
- $this sort -command "CtrlPnlView::sort"
- }
-
- method CtrlPnlView::reIndex {this} {
-
- set index 0
- foreach obj [$this objectSet] {
- $obj index $index
- incr index
- }
- }
-
- proc CtrlPnlView::sort {objA objB} {
-
- set idxA [$objA index]
- set idxB [$objB index]
-
- if {$idxA > $idxB} {
- return 1
- } elseif {$idxB > $idxA} {
- return -1
- } else {
- return 0
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method CtrlPnlView::dialog {this args} {
- if {$args == ""} {
- return [$this _dialog]
- }
- set ref [$this _dialog]
- if {$ref != ""} {
- $ref _view ""
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- $obj _view $this
- }
- $this _dialog $obj
- }
-
-