|
Than Ngo |
b7bcaa |
#// objective: test for bug 729092 - TCL: Full documentation not shown for procs in namespaces.
|
|
Than Ngo |
b7bcaa |
#// check: namespaceoo.xml
|
|
Than Ngo |
b7bcaa |
#// check: namespaceoo_1_1_helpers.xml
|
|
Than Ngo |
b7bcaa |
#// check: namespaceoo_1_1define.xml
|
|
Than Ngo |
b7bcaa |
#// config: EXTRACT_ALL = yes
|
|
Than Ngo |
b7bcaa |
#// config: GENERATE_HTML = yes
|
|
Than Ngo |
b7bcaa |
|
|
Than Ngo |
b7bcaa |
# taken from
|
|
Than Ngo |
b7bcaa |
# https://bugzilla.gnome.org/show_bug.cgi?id=729092
|
|
Than Ngo |
b7bcaa |
|
|
Than Ngo |
b7bcaa |
##
|
|
Than Ngo |
b7bcaa |
# Extension to TclOO to add static methods.
|
|
Than Ngo |
b7bcaa |
# Defines the method on the class instead of on the object. Can be used for
|
|
Than Ngo |
b7bcaa |
# the creation of megawidgets using TclOO by overriding the unknown method to
|
|
Than Ngo |
b7bcaa |
# detect if the user is trying to instantiate a widget (because the method
|
|
Than Ngo |
b7bcaa |
# will be unknown and start with a dot).
|
|
Than Ngo |
b7bcaa |
#
|
|
Than Ngo |
b7bcaa |
proc ::oo::define::classmethod {name {args ""} {body ""}} {
|
|
Than Ngo |
b7bcaa |
# Create the method on the class if the caller gave arguments and body.
|
|
Than Ngo |
b7bcaa |
if {[llength [info level 0]] == 4} {
|
|
Than Ngo |
b7bcaa |
uplevel 1 [list self method $name $args $body]
|
|
Than Ngo |
b7bcaa |
}
|
|
Than Ngo |
b7bcaa |
# Get the name of the class being defined.
|
|
Than Ngo |
b7bcaa |
set cls [lindex [info level -1] 1]
|
|
Than Ngo |
b7bcaa |
# Make connection to private class "my" command by forwarding.
|
|
Than Ngo |
b7bcaa |
uplevel forward $name [info object namespace $cls]::my $name
|
|
Than Ngo |
b7bcaa |
}
|
|
Than Ngo |
b7bcaa |
|
|
Than Ngo |
b7bcaa |
##
|
|
Than Ngo |
b7bcaa |
# Extension to TclOO to add static variables.
|
|
Than Ngo |
b7bcaa |
# Defines variables on the class instead of on the object. Can be used to
|
|
Than Ngo |
b7bcaa |
# enforce a limited number of instantiations.
|
|
Than Ngo |
b7bcaa |
#
|
|
Than Ngo |
b7bcaa |
proc ::oo::Helpers::classvar {args} {
|
|
Than Ngo |
b7bcaa |
# Get reference to class's namespace.
|
|
Than Ngo |
b7bcaa |
set nsCl [info object namespace [uplevel 1 {self class}]]
|
|
Than Ngo |
b7bcaa |
set nsObj [uplevel 1 {namespace current}]
|
|
Than Ngo |
b7bcaa |
# Link variables into local (caller's) scope.
|
|
Than Ngo |
b7bcaa |
foreach v $args {
|
|
Than Ngo |
b7bcaa |
uplevel "my variable $v"
|
|
Than Ngo |
b7bcaa |
upvar #0 ${nsCl}::$v ${nsObj}::$v
|
|
Than Ngo |
b7bcaa |
}
|
|
Than Ngo |
b7bcaa |
}
|