home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)ctrlpnlvie.tcl 1.4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)ctrlpnlvie.tcl 1.4 16 Nov 1995 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CtrlPnlView : {BrowsView} {
- constructor
- method destructor
- method dropEvent
- method reIndex
- }
-
- 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} {
- # 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]
-
- # remove the dropped object from the list
- foreach obj $objSet {
- if {$obj != $droppedObject} {
- lappend woObjSet $obj
- }
- }
-
- # replace the dropped object in the list
- if { $droppedAfterObject == ""} {
- set wObjSet "$droppedObject $woObjSet"
- } else {
- 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
-
-