# $Id: listbox.wgt,v 1.10 2005/11/11 07:54:52 kenparkerjr Exp $

##############################################################################
#
# Visual TCL - A cross-platform application development environment
#
# Copyright (C) 2001 Damon Courtney
#
# Description file for Tk Widget
#
# 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       Listbox
Lib     corepm

TreeLabel   @vTcl::widgets::core::listbox::getWidgetTreeLabel
Icon        icon_listbox.gif
DoubleClickCmd  vTcl::widgets::core::listbox::set_list
InsertCmd   vTcl::widgets::core::listbox::insertCmd
DefaultValues   -foreground \
                -highlightbackground -highlightcolor  -exportselection \
                -selectbackground -selectforeground -cursor xterm

DefaultOptions  -background white -font \$vTcl(actual_gui_font_fixed_desc) \
    	-height 4 -width 10 -exportselection 0

NewOption -activestyle "active style" choice  "dotbox underline none"
NewOption -selectmode "select mode " choice  "single browse multiple extended"

ClassOption    -_tooltip

VirtualEvents <<ListboxSelect>>

Function "Set Listvariable..." vTcl::widgets::core::listbox::setListVariable
Function "Fill Container"  vTcl::widgets::core::listbox::fill_container
namespace eval vTcl::widgets::core::listbox {

    proc setTooltip {} {
        global vTcl
        vTcl:set_tooltip $vTcl(w,widget)
    }

    proc fill_container {} {
         # Rozen function to expand widget to fill container.
         set w $::vTcl(w,widget)
         vTcl:fill_container $w
    }

    proc insertCmd {target} {
        global vTcl
        set last [lindex [split $target .] end]
        set last [vTcl:rename $last]
        set name ::[winfo toplevel $target]::$last
        set $name "listbox"
        #$target configure -listvariable ""   ;# Rozen 9/8/14
        $target configure -font $vTcl(actual_gui_font_fixed_desc)
        $target insert end List
    }

    proc getWidgetTreeLabel {target} {
        set val [$target cget -listvariable]
    if {[lempty $val]} { set val NONE }
        return "Listbox VAR: $val"
    }
    proc set_list {args} {
        tk_messageBox -message "Not Implimented! "
        global vTcl
        set target $vTcl(w,widget)
        vTcl:get_list $target
    }

    proc setListVariable {} {
        global vTcl
        vTcl:core:set_option $vTcl(w,widget)\
                         -listvariable \
                         "Listvariable for $vTcl(w,widget)"
    }

}
