# $Id: scrolledframe.wgt,v 1.4 2002/10/10 06:36:33 cgavin Exp $

##############################################################################
#
# Visual TCL - A cross-platform application development environment
#
# Copyright (C) 2001 Christian Gavin
#
# Description file for [Incr Widgets]
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

##############################################################################
#

Class		Scrolledframe
Lib		itcl

CreateCmd	::iwidgets::scrolledframe
Icon		../lib/Widgets/itcl/scrolledframe.gif
DumpChildren	no
MegaWidget	yes
TagsCmd         vTcl:lib_itcl:tagscmd
TreeChildrenCmd	{
		vTcl::widgets::iwidgets::scrolledframe::treeChildrenCmd
		vTcl::widgets::iwidgets::scrolledframe::treeChildrenChildsite
		}
DumpCmd		vTcl::widgets::iwidgets::scrolledframe::dumpCmd
DumpInfoCmd	vTcl::widgets::iwidgets::scrolledframe::dumpInfoCmd
DefaultOptions	-labeltext "Scrolled frame"

## for compatibility with older versions
proc vTcl:widget:scrolledframe:treeChildrenChildsite {target} {
    return [vTcl::widgets::iwidgets::scrolledframe::treeChildrenChildsite $target]
}

namespace eval vTcl::widgets::iwidgets::scrolledframe {

    proc treeChildrenCmd {target {diff "\#-3"}} {
        set children ""
        set wantsdiff [expr {$diff != ""}]

        foreach child [vTcl:complete_widget_tree [$target childsite] $wantsdiff] {
            lappend children $child$diff
        }

        return $children
    }

    proc treeChildrenChildsite {target} {
        return [$target childsite]
    }

    proc dumpCmd {target basename} {
        global vTcl

        set result [vTcl:dump_widget_opt $target $basename]
        set page   [$target childsite]
        set sitevariable "site_[llength [split $page .]]_0"
        append result "$vTcl(tab)set $sitevariable "
        append result "\[$basename childsite\]\n"
        append result [vTcl:lib_itcl:dump_subwidgets $page \$$sitevariable]

        return $result
    }

    proc dumpInfoCmd {target basename} {
        global vTcl classes

        set result [vTcl:dump:widget_info $target $basename]
        set page   [$target childsite]
        set sitevariable "site_[llength [split $page .]]_0"
        append result "$vTcl(tab)set $sitevariable "
        append result "\[$basename childsite\]\n"
        append result [$classes(Frame,dumpInfoCmd) $page \$$sitevariable]

        return $result
    }
}

