home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)cbtextlist.tcl 1.4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)cbtextlist.tcl 1.4 31 Jan 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CBTextList : {TextList} {
- constructor
- method destructor
- method hasSelTextListEntry
- method getSelTextListEntry
- method removeTextListEntries
- method sortTextListEntries
- method selectEntry
- method deselectEntries
- method removeEntries
- method fillEntries
- method getContentsAsString
- method sort
- method addTextListEntry
- method removeTextListEntry
- attribute textListEntrySet
- }
-
- constructor CBTextList {class this name} {
- set this [TextList::constructor $class $this $name]
- $this textListEntrySet [List new]
- # Start constructor user section
- $this config \
- -selectionChanged {[%this browser] selTextListChanged %this} \
- -activated {[%this browser] fileOpen}
- # End constructor user section
- return $this
- }
-
- method CBTextList::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CBTextList::hasSelTextListEntry {this} {
- set idx [$this selectedIndexSet]
- if {[llength $idx] == 0} {
- return 0
- }
- return 1
- }
-
- method CBTextList::getSelTextListEntry {this} {
- set idx [$this selectedIndexSet]
- if {[llength $idx] == 0} {
- return ""
- }
- return [[$this textListEntrySet] index [lindex $idx 0]]
- }
-
- method CBTextList::removeTextListEntries {this} {
- [$this textListEntrySet] contents ""
- }
-
- method CBTextList::sortTextListEntries {this} {
- set sortedList [lsort -command CBTLEntry::compare \
- [[$this textListEntrySet] contents]]
- [$this textListEntrySet] contents $sortedList
- }
-
- method CBTextList::selectEntry {this entry} {
- set contents [[$this textListEntrySet] contents]
- set idx [lsearch -exact $contents $entry]
- if {$idx == -1} {
- $this selectedSet {}
- return
- }
- $this selectedIndexSet $idx
- $this makeIndexVisible $idx
- }
-
- method CBTextList::deselectEntries {this} {
- $this selectedIndexSet {}
- }
-
- method CBTextList::removeEntries {this} {
- $this entrySet ""
- }
-
- method CBTextList::fillEntries {this} {
- set lst ""
- [$this textListEntrySet] foreach textListEntry {
- lappend lst [$textListEntry format]
- }
- $this entrySet $lst
- }
-
- method CBTextList::getContentsAsString {this} {
- set result ""
-
- foreach entry [$this entrySet] {
- set result "${result}${entry}\n"
- }
- return $result
- }
-
- method CBTextList::sort {this} {
- set selection [$this getSelTextListEntry]
- $this sortTextListEntries
- $this fillEntries
- if {$selection != ""} {
- $this selectEntry $selection
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method CBTextList::addTextListEntry {this newTextListEntry} {
- [$this textListEntrySet] append $newTextListEntry
-
- }
-
- method CBTextList::removeTextListEntry {this oldTextListEntry} {
- [$this textListEntrySet] removeValue $oldTextListEntry
- }
-
-