home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
cbfindclas.tcl
< prev
next >
Wrap
Text File
|
1996-09-23
|
4KB
|
130 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1994
#
# File: @(#)cbfindclas.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cbfindclas.tcl /main/titanic/2 23 Sep 1996 Copyright 1994 Westmount Technology
# Start user added include file section
# End user added include file section
Class CBFindClassDialog : {TemplateDialog} {
constructor
method destructor
method handleCaseSensitiveChanged
method handleOkPressed
method handleNextPressed
method findMatchingClass
method initialisedView
attribute nextClassIndex
attribute classNameWildCard
}
constructor CBFindClassDialog {class this name} {
set this [TemplateDialog::constructor $class $this $name]
$this nextClassIndex 0
$this classNameWildCard ""
# Start constructor user section
$this config -title "Find Class" \
-okPressed "%this handleOkPressed" \
-helpPressed "$classBrowser helpOnName findClass"
interface DlgColumn $this.c {
Label message {text "Class Name:"}
SingleLineText classNameWildCard {columnCount 15}
CheckButton findCaseSensitive {label "Case Sensitive"}
}
$this.c.findCaseSensitive config \
-state [expr {([m4_var get M4_find_case_sensitive] == "1") \
? "yes" : "no"}] \
-stateChanged "$this handleCaseSensitiveChanged"
PushButton new $this.next -label Next \
-activated "$this handleNextPressed"
# End constructor user section
return $this
}
method CBFindClassDialog::destructor {this} {
# Start destructor user section
# End destructor user section
}
method CBFindClassDialog::handleCaseSensitiveChanged {this} {
catch {m4_var set M4_find_case_sensitive \
[$this.c.findCaseSensitive state]}
}
method CBFindClassDialog::handleOkPressed {this} {
busy {
wmtkmessage "Finding first matching class ..."
$this nextClassIndex 0
$this classNameWildCard [$this.c.classNameWildCard text]
if {[$this findMatchingClass]} {
wmtkmessage ""
}
}
}
method CBFindClassDialog::handleNextPressed {this} {
if {[$this.c.classNameWildCard text] != [$this classNameWildCard]} {
$this handleOkPressed
} else {
busy {
wmtkmessage "Finding next matching class ..."
if {[$this findMatchingClass]} {
wmtkmessage ""
}
}
}
}
method CBFindClassDialog::findMatchingClass {this} {
if {[string length [$this classNameWildCard]] == 0} {
wmtkmessage "No match found for ''"
return 0
}
set classList [[[$classBrowser classTL] textListEntrySet] contents]
set idx [$this nextClassIndex]
set found 0
while {$idx < [llength $classList]} {
set class [lindex $classList $idx]
if {[$this.c.findCaseSensitive state]} {
set found [string match [$this classNameWildCard] \
[$class name]]
} else {
set found [string match \
[string tolower [$this classNameWildCard]] \
[string tolower [$class name]]]
}
if {$found} {
$this nextClassIndex [expr {$idx + 1}]
$class open
break
}
incr idx
}
if {!$found} {
if {[$this nextClassIndex] == 0} {
set classNameWildCard [$this classNameWildCard]
wmtkmessage "No match found for '$classNameWildCard'"
} else {
$this nextClassIndex 0
return [$this findMatchingClass]
}
}
return $found
}
method CBFindClassDialog::initialisedView {this} {
$this nextClassIndex 0
}
# Do not delete this line -- regeneration end marker