1#==============================================================================
2# Main Tablelist and Tablelist_tile package module.
3#
4# Copyright (c) 2000-2010  Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5#==============================================================================
6
7namespace eval ::tablelist {
8    #
9    # Public variables:
10    #
11    variable version	5.1
12    variable library	[DIR]
13
14    #
15    # Creates a new tablelist widget:
16    #
17    namespace export	tablelist
18
19    #
20    # Sort the items of a tablelist widget by one or more of its columns:
21    #
22    namespace export	sortByColumn addToSortColumns
23
24    #
25    # Helper procedures used in binding scripts:
26    #
27    namespace export	convEventFields getTablelistPath getTablelistColumn
28
29    #
30    # Register various widgets for interactive cell editing:
31    #
32    namespace export	addBWidgetEntry addBWidgetSpinBox addBWidgetComboBox
33    namespace export    addIncrEntryfield addIncrDateTimeWidget \
34			addIncrSpinner addIncrSpinint addIncrCombobox
35    namespace export	addOakleyCombobox
36    namespace export	addDateMentry addTimeMentry addDateTimeMentry \
37			addFixedPointMentry addIPAddrMentry addIPv6AddrMentry
38}
39
40package provide tablelist::common $::tablelist::version
41
42#
43# The following procedure, invoked in "tablelist.tcl" and "tablelist_tile.tcl",
44# sets the variable ::tablelist::usingTile to the given value and sets a trace
45# on this variable.
46#
47proc ::tablelist::useTile {bool} {
48    variable usingTile $bool
49    trace variable usingTile wu [list ::tablelist::restoreUsingTile $bool]
50}
51
52#
53# The following trace procedure is executed whenever the variable
54# ::tablelist::usingTile is written or unset.  It restores the variable to its
55# original value, given by the first argument.
56#
57proc ::tablelist::restoreUsingTile {origVal varName index op} {
58    variable usingTile $origVal
59    switch $op {
60	w {
61	    return -code error "it is not allowed to use both Tablelist and\
62				Tablelist_tile in the same application"
63	}
64	u {
65	    trace variable usingTile wu \
66		  [list ::tablelist::restoreUsingTile $origVal]
67	}
68    }
69}
70
71interp alias {} ::tk::frame {} ::frame
72interp alias {} ::tk::label {} ::label
73
74#
75# Everything else needed is lazily loaded on demand, via the dispatcher
76# set up in the subdirectory "scripts" (see the file "tclIndex").
77#
78lappend auto_path [file join $::tablelist::library scripts]
79