# $Id: checkbox.wgt,v 1.9 2002/10/10 06:36:31 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		Checkbox
Lib		itcl

CreateCmd	::iwidgets::checkbox
Icon		icon_checkbox.gif
DumpChildren	no
MegaWidget	yes
DumpCmd		vTcl::widgets::iwidgets::checkbox::dumpCmd
InsertCmd	vTcl::widgets::iwidgets::checkbox::insertCmd
TagsCmd         vTcl:lib_itcl:tagscmd
DefaultOptions	-labeltext "Checkbox"
DefaultValues   -background -font
ClassOption     -_itcl_radiocheckboxes
GetImagesCmd    vTcl::widgets::iwidgets::boxes::getImagesCmd
GetFontsCmd     vTcl::widgets::iwidgets::boxes::getFontsCmd

Function    "Edit..."   vTcl::widgets::iwidgets::checkbox::editCmd

namespace eval vTcl::widgets::iwidgets::checkbox {

    proc editCmd {} {
        vTcl::itemEdit::edit $::vTcl(w,widget) vTcl::widgets::iwidgets::boxes::edit
    }

    proc dumpCmd {target basename} {
        global vTcl
        set result [vTcl:dump_widget_opt $target $basename]
        set last -1
        catch {set last [$target index end]}

        for {set i 0} {$i <= $last} {incr i} {
            set conf [$target buttonconfigure $i]
            set pairs [vTcl:get_subopts_special $conf $target]

            append result "$vTcl(tab)$basename add chk$i \\\n"
            append result "[vTcl:clean_pairs $pairs]\n"
        }

        return $result
    }

    proc insertCmd {target} {
        $target add check1   -text {Check 1}
        $target add check2   -text {Check 2}
        $target add check3   -text {Check 3}

        vTcl::widgets::iwidgets::boxes::setDefaultValues $target \
            {-activebackground -activeforeground
             -background -disabledforeground
             -font -foreground -highlightbackground
             -highlightcolor -highlightthickness -selectcolor}
    }
}

