# Copyright (c) 1996, Expert Interface Technologies # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. # The file man.macros and some of the macros used by this file are # copyrighted: (c) 1990 The Regents of the University of California. # (c) 1994-1995 Sun Microsystems, Inc. # The license terms of the Tcl/Tk distribution are in the file # license.tcl. ## TO CHECK: ## ## callback: checked for defined of code ref (compare -edit*cmd) ## ## option ## formatcmd mentions format method but there is no format ## method documented ## ## methods: ## bdtype: what is it? no description given ## see: not documented? Not implemented?? ## ## todo: missing peaces marked by ???? =head1 NAME Tk::TixGrid - Create and manipulate Tix Grid widgets =for pm TixGrid/TixGrid.pm =for category Tix Extensions =head1 SYNOPSIS S< >I<$tixgrid> = I<$parent>->B?(I)?; =head1 DESCRIPTION This widget is intended as the basis of "spread sheet" like interfaces. The widget displays its contents in a two dimensional "grid" of cells. Each cell may contain one Tix display item, which may be in text, graphics or other formats. See L for more information about Tix display items. Because these "items" need not be "windows" large grids can be handled without consuming excessive display system resources. Individual cells, or groups of cells, can be formatted with a wide range of attributes, such as its color, relief and border. However because the widget is intended to handle large grids the mechanisms to achieve these are lower level, and more callback oriented than for other widgets. The assumption is that to avoid storing display details of a large number of cells, the data will be re-computed as needed. The port of Tix C code and some of the bindings to perl/Tk is done but still need further work. In several places the intent of the Tix code is not yet understood. For example the 'edit' interface is clearly intended for spread-sheet like cell content editing in an auxillary "entry" widget or similar, but how that should work is not yet clear. The B method creates a new TixGrid window and returns a blessed reference of this TixGrid widget. Additional options, described below, may be specified on the command line or in the option database to configure aspects of the B widget. =head1 STANDARD OPTIONS B<-background> B<-borderwidth> B<-cursor> B<-font> B<-foreground> B<-height> B<-highlightbackground> B<-highlightcolor> B<-highlightthickness> B<-padx> B<-pady> B<-relief> B<-selectbackground> B<-selectborderwidth> B<-selectforeground> B<-state> B<-takefocus> B<-width> B<-xscrollcommand> B<-yscrollcommand> See L for details of the standard options. =head1 WIDGET-SPECIFIC OPTIONS =over 4 =item Name: B =item Class: B =item Switch: B<-browsecmd> If defined, gives a perl/Tk L to be executed when the user browses a grid cell (This is normally the case when the user clicks on an entry). When this callback is called, it is passed with two additional parameters: I I, where (I,I) is the location of the cell that has just been clicked. =item Name: B =item Class: B =item Switch: B<-command> If defined, gives a perl/Tk L to be executed when the user double-clicks a grid cell. When this callback is called, it is passed with two additional parameters: I I, where (I,I) is the location of the cell that has just been clicked. =item Name: B =item Class: B =item Switch: B<-editdonecmd> If defined, gives a perl/Tk L to be executed when the user has edited grid cell. When this callback is called, it is passed with two additional parameters: I I, where (I,I) is the location of the cell that has just been edited. =item Name: B =item Class: B =item Switch: B<-editnotifycmd> If defined gives a perl/Tk L to be executed when the user tries to edit a grid cell. When this callback is called, it is passed with two additional parameters: I I, where (I,I,) is the location of the cell. This callback should return a boolean value: B indicates that the cell is editable and B otherwise. =item Name: B =item Class: B =item Switch: B<-floatingcols> Defines the number of extra columns beyond the existing grid that can be brought into view by scrolling. =item Name: B =item Class: B =item Switch: B<-floatingrows> Defines the number of extra rows beyond the the existing grid that can be brought into view by scrolling. =item Name: B =item Class: B =item Switch: B<-formatcmd> If defined, gives a perl/Tk L to be executed when the grid cells need to be displayed on the screen. Its primary purpose is to draw the background of the region before the cells are rendered on top. This is normally achieved by calling B or B (see below). However other uses can be made of this low-level callback. For example it can be used to "lazily" populate the grid by calling the B method only as cells come into view. When this callback is called, it is passed with five additional parameters: I I I I I. I I I I gives the extent of the region that needs formatting. I gives the logical type of the region in the grid. It may be one of the following. =over 8 =item B The horizontal margin. =item B The vertical margin. =item B The area in the top left corner where the horizontal and vertical margins are joined. =item B
The main body i.e. all the cells that do not fall into the above three types. =back =item Name: B =item Class: B =item Switch: B<-leftmargin> Gives the width of vertical margin in cells (columns). A zero indicates that no vertical margin exists. A positive value I indicates that first I columns are "labels" and are always displayed and not scrolled. =item Name: B =item Class: B =item Switch: B<-itemtype> Default item type for cells. =item Name: B =item Class: B =item Switch: B<-selectmode> Specifies one of several styles for manipulating the selection. The value of the option may be arbitrary, but the default bindings expect it to be either B, B, B, or B; the default value is B. =item Name: B =item Class: B =item Switch: B<-selectunit> Specifies the selection unit. Valid values are B, B or B. =item Name: B =item Class: B =item Switch: B<-sizecmd> Callback is called (with no extra arguments) when grid sizes are re-computed. For example if window changes size, a different font is specified etc. It is called just after scrollbars (if present) are updated. =item Name: B =item Class: B =item Switch: B<-topmargin> Gives the width of horizontal margin in cells (rows). A zero indicates that no horizontal margin exists. A positive value I indicates that first I rows are "labels" and are always displayed and not scrolled. =back =head1 WIDGET METHODS The B method creates a TixGrid widget and returns a blessed reference of this TixGrid widget. This reference may be used to invoke various operations on the widget. It has the following general form: S< >I<$tixgrid>->B?(I)? Is determine the exact behavior of the method. This object supports the B and B methods described in L which can be used to enquire and modify the options described above. The widget also inherits all the methods provided by the generic L class. The following additional methods are possible for B widgets: =over 4 =item I<$tixgrid>->B(I, I) =item I<$tixgrid>->B(I, I) =item I<$tixgrid>->B Manipulates the B of the B widget. The anchor cell is the end of the selection that is fixed while the user is dragging out a selection with the mouse. =item ($bd,$col,$row) = I<$tixgrid>->B(I ?,I,I?) Determines if the the screen (pixel) position I is in a border. This is useful for changing the mouse cursor when the user points at a border - e.g. to indicate that the border can be adjusted interactively. If in a border returns a list of three elements. First element is 'xy', 'x' or 'y', second two elements are integers. (Value of these are not understood, seem to indicate which column and row of the border the screen position corresponds to?) If not in a border returns an empty list. =item I<$tixgrid>->B(I, I?, I?) =item I<$tixgrid>->B(I?, I?) =item I<$tixgrid>->B(I?, I?) I may be B or B. If I is not given, deletes a single row (or column) at the position I. If I is given, deletes the range of rows (or columns) from position I through I. =item I<$tixgrid>->B(I