COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	Copyright (c) Geoworks 1994 -- All Rights Reserved
	GEOWORKS CONFIDENTAL

PROJECT:	PC GEOS
MODULE:		table class
FILE:		table.def

AUTHOR:		Patrick Buck, Jun 24, 1994

EXPORTED METHODS:

   MSG_TABLE_SET_ROW_COUNT
   MSG_TABLE_GET_ROW_COUNT
   MSG_TABLE_SET_VISIBLE_ROW_COUNT
   MSG_TABLE_GET_VISIBLE_ROW_COUNT
   MSG_TABLE_GET_COLUMN_COUNT
   MSG_TABLE_SET_ROW_FLAGS
   MSG_TABLE_GET_ROW_FLAGS
   MSG_TABLE_SET_ALL_COLUMN_DEFINITIONS	
   MSG_TABLE_GET_ALL_COLUMN_DEFINITIONS	
   MSG_TABLE_SET_COLUMN_DEFINITION		
   MSG_TABLE_GET_COLUMN_DEFINITION		
   MSG_TABLE_SET_ROW_HEIGHT		
   MSG_TABLE_GET_ROW_HEIGHT		
   MSG_TABLE_SET_CURRENT_SELECTION		
   MSG_TABLE_GET_CURRENT_SELECTION		
   MSG_TABLE_INSERT_ROWS				
   MSG_TABLE_REMOVE_ROWS				
   MSG_TABLE_GROW_COLUMN_RIGHT			
   MSG_TABLE_GROW_COLUMN_LEFT			
   MSG_TABLE_SHRINK_COLUMN_RIGHT			
   MSG_TABLE_SHRINK_COLUMN_LEFT			
   MSG_TABLE_REDRAW_TABLE			
   MSG_TABLE_REDRAW_ROW				
   MSG_TABLE_REDRAW_COLUMN			
   MSG_TABLE_REDRAW_CELL
   MSG_TABLE_REDRAW_RANGE				
   MSG_TABLE_SCROLL
   MSG_TABLE_SCROLL_TO_ROW			
   MSG_TABLE_CHANGE_ROW_RANGE_SELECTION
   MSG_TABLE_GET_CELL_GSTATE
   MSG_TABLE_QUERY_DRAW
   MSG_TABLE_SELECT
   MSG_TABLE_GET_BOUNDS
   MSG_TABLE_SET_BORDER_FLAGS
   MSG_TABLE_GET_BORDER_FLAGS
   MSG_TABLE_SET_FLAGS
   MSG_TABLE_GET_FLAGS				
   MSG_TABLE_REDRAW_CURRENT_SELECTION
   MSG_TABLE_DRAG_DROP_SELECT
   MSG_TABLE_DRAG_DROP_COMPLETE
   MSG_TABLE_SET_SELECTION_DRAW_STYLE
   MSG_TABLE_GET_SELECTION_DRAW_STYLE
   MSG_TABLE_SCROLL_SINGLE_DOWN
   MSG_TABLE_SCROLL_SINGLE_UP
   MSG_TABLE_START_EDIT_CELL_TEXT
   MSG_TABLE_STOP_EDIT_CELL_TEXT
   MSG_TABLE_DONE_EDIT_CELL_TEXT
   MSG_TABLE_STRING_LOCATE
   MSG_TABLE_HOLD_DETECTED
   MSG_TABLE_GET_VISIBLE_ROW_RANGE
   MSG_TABLE_SELECTION_CHANGED

EXPORTED ROUTINES:

   TableDrawText

REVISION HISTORY:
	Name	Date		Description
	----	----		-----------
	PB	6/24/94   	Initial revision


DESCRIPTION:
	This file contains definitions for TableClass.

	This class implements a simple dynamic scrolling table.  An object
	of this class displays a group of rectangular "cells" organized into 
	rows and columns.  All cells have the same height but their width can
	vary depending on which column they reside in.  The width and number
	of columns is arbitrary but all columns must fit within the horizontal
	boundaries of the table.  The table can scroll in the vertical direction
	which means that it can have a large number of rows.

	The following is a list of important features that this class provides:
	
	    * Large number of equally sized rows
	    * Small number of variable sized columns
	    * Ability to scroll through the rows
	    * Ability to dynamically add and remove rows
	    * Ability to dynamically resize the width of the columns
	    * Rows can be separated by lines (affects all rows or none)
	    * Columns can be separated by lines (affects specified columns only)
	    * The contents of a cell are drawn by a table's subclass
	    * A variety of selection styles are supported (single cell,
	      row, column etc).  The subclass can be notified when the 
	      selection changes.
	    * Cells in different columns can respond or ignore a variety
	      of mouse/pen related events (start select, end select, hold
	      select etc.)
	    * Supports visual feedback for dragging and dropping
	      from cell to cell and from outside the table to a cell.
		
	$Id: table.def,v 1.1 97/04/04 14:17:43 newdeal Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@

SetDef	_TABLE

StartLibrary	table
UseLib	Objects/vTextC.def

TableClass	class	VisCompClass
uses TableTextClass

; ==========================================================================
; 			     Exported Constants
; ==========================================================================

T_NONE_SELECTED		equ	-1	; No cells selected	

; ==========================================================================
; 			     Exported Types
; ==========================================================================

; --------------------------------------
; Predetermined scrolling behavior types
; *NOTE* A change here requires a change
; in method TableScroll.
; --------------------------------------
TableScrollType		etype	word, 	0, 2
   	TST_SCROLL_PAGE_UP	enum	TableScrollType	  ; up by a page
   	TST_SCROLL_PAGE_DOWN	enum	TableScrollType	  ; down by a page
   	TST_SCROLL_UP		enum	TableScrollType	  ; up by a row
   	TST_SCROLL_DOWN		enum	TableScrollType	  ; down by a row
   	TST_SCROLL_TOP		enum	TableScrollType	  ; first row
   	TST_SCROLL_BOTTOM	enum	TableScrollType	  ; last row

; ----------------------------------------   	
; Type used to indicate a particular kind
; of justification to be used when drawing
; text or graphics into a table cell
; ----------------------------------------
TableDrawJustificationType	etype	word, 0, 2
   TDJT_TOP_LEFT	enum	TableDrawJustificationType
   TDJT_TOP_CENTER 	enum	TableDrawJustificationType
   TDJT_TOP_RIGHT	enum	TableDrawJustificationType
   TDJT_CENTER_LEFT	enum	TableDrawJustificationType
   TDJT_CENTER_CENTER	enum	TableDrawJustificationType
   TDJT_CENTER_RIGHT	enum	TableDrawJustificationType
   TDJT_BOTTOM_LEFT	enum	TableDrawJustificationType
   TDJT_BOTTOM_CENTER	enum	TableDrawJustificationType
   TDJT_BOTTOM_RIGHT	enum	TableDrawJustificationType
   TDJT_CENTER_LEFT_ELLIPSIS	enum	TableDrawJustificationType
   TDJT_CENTER_CENTER_OR_LEFT_ELLISPSIS enum TableDrawJustificationType

; ---------------------------------------------------------------
; This is used to set the three low order TableColumnFlags values
; indicating how the default selections will look.
;
;   TRIT_CELL
;	Select only the cell that the mouse pointer is over.
;	Takes effect on start-select.
;
;   TRIT_ROW
;	Select an entire row.  Takes effect on start-select.
;
;   TRIT_CUSTOM_ROW
;  	Select an arbitrary range of cells along a row.
;  	The range is specified by setting TI_currentSelectionStart/End
;  	TCL_column values.  Whenever the user makes a selection or
;  	scrolls, the selection will be bounded by the current selection
;  	column values.
;
;   TRIT_COLUMN
;	Select the visible portion of a column (top to bottom of
;	visible table).  Takes effect on start-select.
;
;   TRIT_MULTI_ROW - !*NOT IMPLEMENTED YET*
;	Select all cells from left to right within a range.
;	Start-select sets first cell and drag-select sets last
;	cell.
;
;   TRIT_RECTANGLE
;	Select all cells within a rectangular region bounded by
;	two corner cells.  Start-select sets one corner cell and
;	drag-select sets the other corner.
;
;   TRIT_MULTI_ROW_FULL
;	Select a range of rows.  Start-select sets the starting
;	row and drag-select sets the ending row.
;
;   TRIT_MULTI_COL_FULL
;	Select a range of columns.  Start-select sets the starting
;	column and drag-select sets the ending column.
;
;   TRIT_SELECTION
;  	Set the specified selection as is.
;
;   TRIT_NONE
;	This indicates that you don't want to draw any selections.
;	Pass this up to the superclass when intercepting 
;	MSG_TABLE_SELECT or MSG_TABLE_DRAG_DROP_SELECT if you want
;	the current selection to be stored without drawing anything.
;
; !*Note*  See TableInvertRangeLow, TableFindInvertRange, 
; TableSetFlags, TableScrollDown, TableScrollUp if you change this etype.
;
; ---------------------------------------------------------------
TableRangeInversionType	etype	word, 0, 1
   TRIT_CELL		enum	TableRangeInversionType
   TRIT_ROW		enum	TableRangeInversionType
   TRIT_CUSTOM_ROW	enum	TableRangeInversionType
   TRIT_COLUMN		enum	TableRangeInversionType
   TRIT_MULTI_ROW	enum	TableRangeInversionType
   TRIT_RECTANGLE	enum	TableRangeInversionType
   TRIT_MULTI_ROW_FULL	enum	TableRangeInversionType
   TRIT_MULTI_COL_FULL	enum	TableRangeInversionType
   TRIT_SELECTION	enum	TableRangeInversionType
   TRIT_NONE		enum	TableRangeInversionType

; ----------------------------------
; Indicates how selections are drawn
; ----------------------------------
TableSelectionDrawStyleType etype word, 0, 2
   TSDST_FILLED_RECT	enum	TableSelectionDrawStyleType
   TSDST_SOLID_RECT	enum	TableSelectionDrawStyleType
   TSDST_OUTLINE_RECT	enum	TableSelectionDrawStyleType
   TSDST_DOTTED_RECT	enum	TableSelectionDrawStyleType
   TSDST_UNDERLINE	enum	TableSelectionDrawStyleType

; -------------------------------------------------------------
; This is used by some methods to indicate the default drawing
; related action.
; -------------------------------------------------------------
TableDrawCommandType	etype	word, 0, 2
   TDCT_DRAW		enum	TableDrawCommandType
   TDCT_ERASE		enum	TableDrawCommandType
   TDCT_TOGGLE		enum	TableDrawCommandType

; ------------------------------------------------------------
; This is used to by some methods to identify which internally
; stored range of cells to act upon.
; ------------------------------------------------------------
TableCellRangeType	etype	word, 0, 2
   TCRT_CURRENT		enum	TableCellRangeType
   TCRT_LAST		enum	TableCellRangeType

; ------------------------------------------------------------
; This type is used to identify the type of search that
; is to be done.
; ------------------------------------------------------------
TableStringLocateType		etype	word, 0, 2
   TSLT_STRING	enum	TableStringLocateType
   TSLT_CHAR	enum	TableStringLocateType

; ==========================================================================
; 			     Exported Records
; ==========================================================================


; ----------------------------------------------------
; Table Flags
; 
; TF_INTERNAL_DRAG_DROP
;  	start-select and hold-select specify a cell to
;  	be dragged; drag-select performs the dragging;
;  	end-select performs the drop.  If this flag is
;  	set, TF_EXTERNAL_DRAG_DROP is ignored.
;
; TF_EXTERNAL_DRAG_DROP
;  	we are dragging something into the table from
;  	an external source, drag-select performs the
;  	dragging; end-select performs the drop.
;
; TF_ENABLE_AUTO_SCROLLING
;  	Enables scrolling whenever the mouse is dragged
;  	above or below the boundaries of the table.
;
; TF_SELECTION_ALWAYS_VISIBLE
;  	Selection stays within visible table when
;  	scrolling.  If this flag is set,
;  	TF_FIXED_SELECTION is ignored.
;
; TF_FIXED_SELECTION - !*NOT IMPLEMENTED YET*
;  	Selection remains visually fixed as cells
;  	scroll by.
;
; TF_EXIT_DRAG_DROP_UPON_COMPLETION
;  	Exit drag-and-drop mode automatically upon completion of
;  	every drag-and-drop operation.
;
; TF_TARGETABLE
;	Indicates that the table object will grab the target
;	whenever it gets MSG_META_START_SELECT.
;
; TF_NOTIFY_SELECTION_CHANGED
;  	Set this if you want the table object to send itself
;  	MSG_TABLE_NOTIFY_SELECTION_CHANGED whenever the
;  	stored selection value changes.
;
; TF_MAIN_TABLE
;  	Indicates that this is the main table in a content/view
;  	containing more than one table object.  A main table
;  	is the one that is considered to be active among a group
;  	and it will take care of things like enabling/disabling
;  	the scroll buttons for the view its in.
;
; TF_CONFIRM_NEW_SELECTION
;  	Set this if you want the table to send itself
;  	MSG_TABLE_CONFIRM_NEW_SELECTION before updating
;  	the selection range to a new set of values.
;
; NOTE: *Never* set TF_EXTERNAL_DRAG_DROP or TF_INTERNAL_DRAG_DROP
;       manually.  The rest of the flags may be set statically.
;  	Use MSG_TABLE_SET_FLAGS to set the flags dynamically.                 
; ----------------------------------------------------
TableFlags		record
   	TF_INTERNAL_DRAG_DROP:1
   	TF_EXTERNAL_DRAG_DROP:1
   	TF_ENABLE_AUTO_SCROLLING:1
   	TF_SELECTION_ALWAYS_VISIBLE:1
   	TF_FIXED_SELECTION:1
   	TF_EXIT_DRAG_DROP_UPON_COMPLETION:1
	TF_TARGETABLE:1
   	TF_NOTIFY_SELECTION_CHANGED:1
   	TF_MAIN_TABLE:1
   	TF_CONFIRM_NEW_SELECTION:1
   	:6
TableFlags		end

; --------------------------------------------------------
; TableBorder Flags
;
; These flags indicate what type of borders and/or margins
; to place around the table.
; --------------------------------------------------------
TableBorderFlags	record
	TBF_BOX_BORDERS:1			; draw a box around the table
   	TBF_BOX_MARGINS:1			; leave margins all around
	TBF_TOP_BORDER:1			; draw a top border
	TBF_BOTTOM_BORDER:1			; draw a bottom border
	TBF_LEFT_BORDER:1			; draw a left border
	TBF_RIGHT_BORDER:1			; draw a right border
   	TBF_TOP_MARGIN:1			; leave a top margin			
   	TBF_BOTTOM_MARGIN:1			; leave a bottom margin
   	TBF_LEFT_MARGIN:1			; leave a left margin
   	TBF_RIGHT_MARGIN:1			; leave a right margin
   	:6
TableBorderFlags	end

; --------------------------------------------------
;   Column flags
;
;   TCF_DRAW_RIGHT_SEPARATOR
;	Draw a line between the current column and the next one.
;
;   TCF_ALLOW_AUTO_RESIZE - !*NOT IMPLEMENTED YET*
;	Resize this column when table object gets resized.
;
;   TCF_START_SELECT
;	Send MSG_TABLE_SELECT on a start-select.
;
;   TCF_END_SELECT
;	Send MSG_TABLE_SELECT on an end-select.
;
;   TCF_DRAG_SELECT
;	Send MSG_TABLE_SELECT when the mouse pointer crosses
;	cell boundaries between a start-select and an end-select.
;
;   TCF_DOUBLE_SELECT
;	Send MSG_TABLE_SELECT on a double-press.
;
;   TCF_RESELECT
;	Send MSG_TABLE_SELECT on a start-select if the cell
;	under the mouse pointer is already within a range
;	of selected cells.
;
;   TCF_HOLD_SELECT
;	Send MSG_TABLE_SELECT after clicking on a cell and 
;	holding for a period of time.
;
;   TCF_TRIT
;	These specify the TableRangeInversionType to be used
;	when selecting a cell in this column.  This value should
;	be set using the type mentioned above (see below for
;	an explanation of each type).
;
; !*Note*  See TableSelect if you change this etype.
; --------------------------------------------------
TableColumnFlags	record
	TCF_DRAW_RIGHT_SEPARATOR:1
	TCF_ALLOW_AUTO_RESIZE:1
	TCF_START_SELECT:1
   	TCF_END_SELECT:1
   	TCF_DRAG_SELECT:1
   	TCF_DOUBLE_SELECT:1
   	TCF_RESELECT:1
   	TCF_HOLD_SELECT:1
   	:4
   	TCF_TRIT TableRangeInversionType :4
TableColumnFlags	end

; Shift constant for TableRangeInversionType in TableColumnFlags
; --------------------------------------------------------------
TCF_TRIT_OFFSET	equ 0

; -------------------------------------------
;  Row flags
;
;   TRF_DRAW_ROW_SEPARATOR
;	Draws a line between all of the rows.
;
;
;   TRF_CELL_CONTENTS_IN_ROW_SEPARATOR
;        This flag indicates that part of a cell's
;	contents will be drawn into the row separator
;	area.  The row separator area is the top
;	pixel of each table cell.  The row separator
;	line will be drawn in there (border separator
;	line for the first visible row).
;
;	Pixels in this area are not included during
;	bit blitting for single line scrolling.  
;	This is so top and bottom borders won't
;	get copied into the table for tables
;	without row separators.  
;
;	If you plan to draw into this area, then
;	you probably won't be using row separators.
;	In this case you will want pixels in this
;	area to get bit blitted.
;
;	IMPORTANT:
;	If you set this flag to include row
;	separator pixels in scrolling, you must
;	also clear TRF_DRAW_ROW_SEPARATOR and
;	set TBF_TOP_MARGIN and TBF_BOTTOM_MARGIN
;	border flags.
;
; -------------------------------------------
TableRowFlags	record
	TRF_DRAW_ROW_SEPARATOR:1
   	TRF_CELL_CONTENTS_IN_ROW_SEPARATOR:1
	:14
TableRowFlags	end	

; -------------------------------------------------------------------
; Private flags - <Internal use only>
;
; TPF_HAVE_MOUSE_GRAB
;  	Used to indicate if the table has
;  	the mouse grab.
;
; TPF_AUTO_SCROLL_ON
;  	Indicates that the table is being scrolled by dragging the
;  	mouse pen beyond the top or bottom table boundaries.
;
; TPF_CELL_TEXT_EDITOR
;  	Indicates that the cell text editor is on
;
; TPF_WAITING_FOR_HOLD_EVENT
;  	Table is waiting for a hold event after a start-select
;
; TPF_HAVE_TARGET
;	Indicates that the table has the target.
;
; TPF_POSSIBLE_RESELECTION
;  	Indicates that the pen just entered a selected cell
;  	which allows us to set.
;
; -------------------------------------------------------------------
TablePrivateFlags	record
   	TPF_HAVE_MOUSE_GRAB:1
   	TPF_AUTO_SCROLL_ON:1
   	TPF_EDIT_CELL_TEXT:1
   	TPF_WAITING_FOR_HOLD_EVENT:1
	TPF_HAVE_TARGET:1
   	TPF_POSSIBLE_RESELECTION:1
   	:10
TablePrivateFlags	end

; -------------------------------------------------------------------
; Drag drop flags
;
; TDDF_DONT_RESCAN_CELLS
;  	Used by subclasses that intercept MSG_TABLE_DRAG_DROP... type
;  	messages to tell the superclass not to redraw the visible
;  	cells.
; -------------------------------------------------------------------
TableDragDropFlags	record
   	TDDF_DONT_RESCAN_CELLS:1
   	:15
TableDragDropFlags	end

; ==========================================================================
; 			     Exported Structures
; ==========================================================================

; ------------------
; Location of a cell
; ------------------
TableCellLocation	struct
	TCL_row		word			; Row number
	TCL_column	word			; Column number
TableCellLocation	ends

; -----------------
; Column definition
; -----------------
TableColumnDefinition	struct
	TCD_flags	TableColumnFlags
	TCD_width	word			; width of column in points
TableColumnDefinition	ends

; ----------
; Cell range
; ----------
TableCellRange		struct
   	TCR_start	TableCellLocation	; start of a range
   	TCR_end		TableCellLocation	; end of a range
TableCellRange		ends

; ------------------------------------------
; Drag-and-drop source and destination cells
; ------------------------------------------
TableDragDropCell	struct
   	TDDC_from	TableCellRange		; source cell
   	TDDC_to		TableCellRange		; destination cell
TableDragDropCell	ends

; ---------------------------------------------------------------
; This structure is used to pass parameters on the stack for
; MSG_TABLE_DRAG_DROP_COMPLETE.  We need this for the C interface
; ---------------------------------------------------------------
TableDragDropCompleteParams	struct
   	TDDCP_dragDrop	TableDragDropCell	; from/to
   	TDDCP_flags	TableDragDropFlags	; flags
TableDragDropCompleteParams	ends

; -----------------------------------------------------------------
; This structure is used to pass parameters on the stack for
; MSG_TABLE_START_EDIT_CELL_TEXT.  We need this for the C interface
; -----------------------------------------------------------------
TableEditCellTextParams	struct
   	TECT_cells	TableCellRange		; cell range to edit
   	TECT_text	hptr			; ptr to initial text
   	TECT_length	word			; string length (0 if null terminated)
TableEditCellTextParams	ends

; ==========================================================================
; 			     Exported Methods
; ==========================================================================

; -----------------------------------------------------
  MSG_TABLE_SET_ROW_COUNT			message
; -----------------------------------------------------
; Sets the total number of rows in a table object.
; Selections will be erased if they fall outside of
; the new row count.
;
; PASS:		cx = row count
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_ROW_COUNT			message
; -----------------------------------------------------
; Gets the total number of rows in a table object.
;
; PASS:		nothing
; RETURN:	cx = row count
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SET_VISIBLE_ROW_COUNT		message
; -----------------------------------------------------
; Sets the number of rows that are visible.
; This forces the entire visible table to be redrawn. 
;
; PASS:		cx = visible row count
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_VISIBLE_ROW_COUNT		message
; -----------------------------------------------------
; Gets the number of rows that are visible.
;
; PASS:		nothing
; RETURN:	cx = visible row count
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_COLUMN_COUNT			message
; -----------------------------------------------------
; Gets the total number of columns in a table object.
;
; PASS:		nothing
; RETURN:	cx = visible column count
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SET_ROW_FLAGS			message
; -----------------------------------------------------
; Sets the row flags. 
;
; PASS:		cx = TableRowFlags value
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_ROW_FLAGS			message
; ----------------------------------------------------- 
; Gets the row flags.
;
; PASS:		nothing
; RETURN:	cx = TableRowFlags value
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SET_ALL_COLUMN_DEFINITIONS		message
; -----------------------------------------------------
; !*NOT IMPLEMENTED YET* 
; Sets definitions for all of the columns.  The definitions are passed
; as an array of TableColumnDefinition's stored in a global memory block.
; The elements in this array should be ordered starting with the 
; definition for column zero.
;
; The visible table will be redrawn if any of the columns gets a new width.
;
; PASS:		  cx = total number of columns
;		^hbp = global memory handle to an array of 
;		       TableColumnDefinition entries 
; RETURN:	nothing	
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_ALL_COLUMN_DEFINITIONS		message
; -----------------------------------------------------
; !*NOT IMPLEMENTED YET* 
; Gets definitions for all of the columns.  The definitions are returned
; as an array of TableColumnDefinition's stored in a global memory block.
; The elements in this array are ordered starting with the definition for
; column zero.
;
; PASS:		nothing
;
; RETURN:	  cx = total number of columns
;   		^hbp = global memory handle to an array of 
;		       TableColumnDefinition entries 
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SET_COLUMN_DEFINITION		message
; -----------------------------------------------------
;
; Sets the definition structure for a column.  
; The visible table will be redrawn.
; 
; PASS:		^hbp = global memory handle to a block with
;		       the TableColumnDefinition value
;
;		cx   = column number
; 
; RETURN:	nothing	
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_COLUMN_DEFINITION		message
; -----------------------------------------------------
;
; Gets the definition structure for a column.
;
; PASS:		cx   = column number
;
; RETURN:	^hbp = global memory handle to a block with
;		       the TableColumnDefinition value
;
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SET_ROW_HEIGHT			message
; -----------------------------------------------------
;
; Sets the height for all rows.  This forces the visible table to be redrawn. 
; 
; PASS:		cx   = new row height
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_ROW_HEIGHT			message
; ----------------------------------------------------- 
; Gets the height for all rows.
;
; PASS:		nothing
; RETURN:	cx   = row height
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SET_CURRENT_SELECTION		message
; ----------------------------------------------------- 
; Sets the cell to be used as the current selection.
;
; PASS:		ss:bp = TableCellRange
;
; RETURN:	nothing
; DESTROYED:	nothing
;
; NOTE:		if calling with ObjMessage use:
;  		dx    = size TableCellRange
;  		di    = mask MF_STACK

; -----------------------------------------------------
  MSG_TABLE_GET_CURRENT_SELECTION		message
; ----------------------------------------------------- 
; Gets the cell to be used as the current selection.
;
; PASS:		nothing
; RETURN:	ax   = current selection start row
;  		bp   = current selection start column
;  		cx   = current selection end row
;  		dx   = current selection end column
;		
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_INSERT_ROWS				message
; -----------------------------------------------------
;
; Insert rows starting *after* the specified row.
; This may force the visible table to redraw.
; The number of visible rows is not affected.
;
; PASS:		cx   = row number (-1 to prepend)
;		dx   = number of rows to insert 
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_REMOVE_ROWS				message
; -----------------------------------------------------
;
; Remove rows starting *at* the specified row.
; This may force the visible table to redraw.
; The number of visible rows is not affected.
;
; PASS:		cx   = row number 
;		dx   = number of rows to remove 
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GROW_COLUMN_RIGHT			message
; -----------------------------------------------------
;
; Increase the width of a column toward the right.
; A column will refuse to grow if it will cause a neighboring column
; to shrink to zero points.  This will force the visible table to redraw.
;
; PASS:		cx   = column number
;		dx   = amount of space to add in points
;
; RETURN:	carry set if unable to grow the column
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GROW_COLUMN_LEFT			message
; -----------------------------------------------------
;
; Increase the width of a column toward the left.
; A column will refuse to grow if it will cause a neighboring column
; to shrink to zero points.  This will force the visible table to redraw.
;
; PASS:		cx   = column number
;		dx   = amount of space to add in points
;
; RETURN:	carry set if unable to grow the column
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SHRINK_COLUMN_RIGHT			message
; -----------------------------------------------------
;
; Decrease the width of a column from the right.
; A column cannot shrink to zero points.
; This will force the visible table to redraw.
; 
; PASS:		cx   = column number
;		dx   = amount of space to remove in points
;
; RETURN:	carry set if unable to shrink the column
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SHRINK_COLUMN_LEFT			message
; -----------------------------------------------------
;
; Decrease the width of a column from the left.
; A column cannot shrink to zero points.
; This will force the visible table to redraw.
;
; PASS:		cx   = column number
;		dx   = amount of space to remove in points
;
; RETURN:	carry set if unable to shrink the column
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_REDRAW_TABLE			message
; ----------------------------------------------------- 
; Forces the entire visible table to redraw itself.
;
; PASS:		nothing
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_REDRAW_ROW				message
; ----------------------------------------------------- 
; Forces a row to redraw itself.
;
; PASS:		cx   = row number
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_REDRAW_COLUMN			message
; ----------------------------------------------------- 
; Forces a column to redraw itself.
;
; PASS:		cx   = column number
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_REDRAW_CELL				message
; -----------------------------------------------------
; Forces a cell to redraw itslef.
;
; PASS:		cx   = row number
;		dx   = column number
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_REDRAW_RANGE			message
; ----------------------------------------------------- 
; Forces a range of cells to redraw themselves.
;
; PASS:		ss:bp = TableCellRange  	
;
; RETURN:	nothing
; DESTROYED:	nothing
;
; NOTE:		if calling with ObjMessage use:
;  		dx    = size TableCellRange
;  		di    = mask MF_STACK

; -----------------------------------------------------
  MSG_TABLE_SCROLL				message
; -----------------------------------------------------
; This message tells the table to scroll by a predetermined amount.
;
; PASS:		cx	= TableScrollType
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SCROLL_TO_ROW			message
; -----------------------------------------------------
;
; This message tells the table to scroll to the indicated
; row (this row will become the first visible row if possible)
;
; PASS:		cx   = destination row number
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_CHANGE_ROW_RANGE_SELECTION		message
; -----------------------------------------------------
; This message changes the current selection to the
; specified range of cells along a row.  
;
; PASS:		cx   = row number
;		dx   = starting column number
;  		bp   = ending column number
;
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_CELL_GSTATE			message
; -----------------------------------------------------
; This message gets a gstate for the specified cell.
; The gstate comes with a clipping region describing
; the cell's boundaries.  The CP is set to the upper
; left corner of this clipping region.
;
; PASS:		cx	= row number
;  		dx	= column number
;		^hbp	= gstate to use (0 to create one)
;
; RETURN:	^hax	= gstate to draw into (zero if cell is not visible
;			  or does not exist.

; -----------------------------------------------------
  MSG_TABLE_QUERY_DRAW				message
; -----------------------------------------------------
; The TableClass object sends itself this message every time
; it needs to draw the contents of a cell.  The default
; handler does not draw anything.  This message is meant
; to be subclassed.
;
; Source:	TableClass object
; Destination:	TableClass object
; Interception:	A subclass of TableClass should intercept
;               this message to draw the contents of a
;  		cell.  There is no need to pass this
;  		message to the superclass since it does
;  		not do anything.
;
; PASS:		cx   = row number
;		dx   = column number
;		^hbp = gstate to draw into
;		
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_SELECT				message
; -----------------------------------------------------
; The TableClass object sends this message to itself whenever
; a cell is selected.  Selection happens when a cell
; receives one of the following messages:
;
;    MSG_META_START_SELECT (single and double selection)  
;    MSG_META_END_SELECT
;    MSG_META_DRAG_SELECT
;    MSG_META_PTR
;
; The selected cell will become the current selection.
; 
; The column flags for this cell also indicate whether this action
; gets sent at all.  The value of bp shows which column flag
; was responsible for causing this action to be sent.
;
; The default behavior for this message is to cause a range
; of cells to become inverted depending on what type of
; TableRangeInversionType value is stored in the
; TableColumnFlags.  You can change this value to
; TRIT_NONE if you don't want the inversion to be drawn.
;
; If this message is sent as a result of a drag-and-drop,
; TableColumnFlags will be clear and the default handler will
; draw graphics appropriate to drag-and-drop.
;
; Source:	TableClass object
; Destination:	TableClass object
; Interception:	A subclass should intercept this to perform
;  		different or additional actions upon selection. 
; 
; Pass:		cx   = row number
;		dx   = column number
;		bp   = TableColumnFlags
;		
; Return:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_BOUNDS				message
; -----------------------------------------------------
; Get the bounds of the table within the vis bounds
;
; Pass:		nothing
; Return:	ax   = left
;  		bp   = top
;  		cx   = right
;  		dx   = bottom

; -----------------------------------------------------
  MSG_TABLE_SET_BORDER_FLAGS			message
; -----------------------------------------------------
; !*NOT IMPLEMENTED YET* 
; Set the border flags.
;
; Pass:		cx   = TableBorderFlags
; Return:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_BORDER_FLAGS			message
; -----------------------------------------------------
; !*NOT IMPLEMENTED YET* 
; Get the border flags.
;
; Pass:		nothing
; Return:	cx   = TableBorderFlags

; -----------------------------------------------------
  MSG_TABLE_SET_FLAGS				message
; -----------------------------------------------------
; Set the table flags.
;
; Pass:		cx   = TableFlags to set
;  		dx   = TableFlags to unset
; Return:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_FLAGS				message
; -----------------------------------------------------
; Get the table flags.
;
; Pass:		nothing
; Return:	cx   = TableFlags

; -----------------------------------------------------
  MSG_TABLE_REDRAW_CURRENT_SELECTION		message
; -----------------------------------------------------
; The TableClass object sends this message to itself
; whenever it needs to redraw the currently selected
; range of cells.  This happens when the table needs
; to redraw some part of itself due to being moved,
; resized, scrolled etc.
;
; The default behavior of this message is to invert
; the selected cells.
;
; Source:	TableClass object
; Destination:	TableClass object
; Interception:	Subclasses that intercept MSG_TABLE_SELECT
;  		to provide a custom look for their
;  		selection bars.  		
; 
; Pass:		cx    = TableDrawCommandType
;  		^hbp  = gstate to draw through (0 to create one)
;
; Return:	^hbp  = gstate unchanged (if subclassing)

; -----------------------------------------------------
  MSG_TABLE_DRAG_DROP_SELECT			message
; -----------------------------------------------------
;
; The TableClass object sends this message to itself
; instead of MSG_TABLE_SELECT when its operating in
; drag-and-drop mode.
;
; The TableColumnFlags value has these meanings:
;
;  	TCF_START_SELECT - A source has been chosen
;  	TCF_DRAG_SELECT  - We are dragging
;
; The default handler for this message just draws the
; appropriate drag-and-drop selection bars.  You can
; intercept this message but you should let the
; the superclass draw the drag-and-drop selection
; bars.
;
; Pass:		cx   = row number
;		dx   = column number
;		bp   = TableColumnFlags
;		
; Return:	nothing
 
; -----------------------------------------------------
  MSG_TABLE_DRAG_DROP_COMPLETE			message
; -----------------------------------------------------
;
; The TableClass object sends this message to itself at
; the end of a drag-and-drop operation.  The table is
; set to drag-and-drop mode by setting one of these
; TableFlags:
;
;  	TF_INTERNAL_DRAG_DROP
;  	TF_EXTERNAL_DRAG_DROP
;
; In 'internal' mode, the source and destination of
; the drag-and-drop are cells within the table.
; In 'external' mode, the destination is a table cell
; but the source is external to the table.
; If both drag-and-drop flags are set, the mode will
; default to 'internal'.
;
; The default handler for MSG_TABLE_DRAG_AND_DROP_COMPLETE
; sends MSG_TABLE_QUERY_DRAW messages for all of the visible
; cells in the table.  You should call the superclass
; *after* updating the database of table entries.
;
; If you want a different range of cells to be redrawn,
; intercept this message and use MSG_TABLE_REDRAW_xxx
; messages to redraw the affected cells.  If you do this,
; you must pass the TDDF_DONT_RESCAN_CELLS flag to the
; superclass.
;
; Source:	TableClassObject
; Destination:	TableClassObject
; Interception:	A subclass intercepts this to update
;  		its database of table entries.
;
; Pass:		ss:bp = TableDragDropCompleteParams
;
;   	TDDCP_dragDrop.TDDC_from = source cell range (TableCellRange type)
;  				   where values in TableCellRange are
;  				   T_NONE_SELECTED if external drag-and-drop
;
;  	TDDCP_dragDrop.TDDC_to   = destination cell range (TableCellRange type)
;
;  	TDDCP_flags		 = TableDragDropFlags
;
; Return:	nothing
;
; Note:		if calling with ObjMessage use:
;  		dx    = size TableDragDropCompleteParams
;  		di    = mask MF_STACK

; -----------------------------------------------------
  MSG_TABLE_SET_SELECTION_DRAW_STYLE		message
; -----------------------------------------------------
; Sets the TableSelectionDrawStyleType for the table.
; It also changes the currently drawn selection bar if
; its visible.
;
; Pass:		cx   = TableSelectionDrawStyleType
; Return:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_SELECTION_DRAW_STYLE		message
; -----------------------------------------------------
; Gets the TableSelectionDrawStyleType for the table.
;
; Pass:		nothing
; Return:	cx   = TableSelectionDrawStyleType

; -----------------------------------------------------
  MSG_TABLE_SCROLL_SINGLE_DOWN			message
  MSG_TABLE_SCROLL_SINGLE_UP			message
; -----------------------------------------------------
; These messages can be used instead of MSG_TABLE_SCROLL
; to make the table scroll up or down by a single row.
;
; Pass:		nothing
; Return:	nothing
; Destroyed:	nothing

; -----------------------------------------------------
  MSG_TABLE_START_EDIT_CELL_TEXT		message
; -----------------------------------------------------
; This message creates a VisText object that can be used to
; edit the textual contents of a cell.  It creates a text object
; and places it over the cell to be edited.  The text object will
; be empty unless some initial text is passed in TECT_text.
;
; Pass:		ss:bp = TableEditCellTextParams
;
;   			TECT_cells	cell range to edit
;   			TECT_text	hptr to initial text
;  			TECT_length	string length (0 if null terminated)
;
; Return:	nothing
;
; Note:		if calling with ObjMessage use:
;  		dx    = size TableEditCellTextParams
;  		di    = mask MF_STACK

; -----------------------------------------------------
  MSG_TABLE_STOP_EDIT_CELL_TEXT			message
; -----------------------------------------------------
; This message removes the VisText cell editor.
;
; Pass:		nothing
; Return:	nothing

; -----------------------------------------------------
  MSG_TABLE_DONE_EDIT_CELL_TEXT			message
; -----------------------------------------------------
; The TableClass object receives this message from the
; VisText cell editor at the end of the editing operation.
;
; Pass:		ss:bp = TableEditCellTextParams
;
;   			TECT_cells	cell range being edited
;   			TECT_text	hptr to final text
;  			TECT_length	string length (0 if null terminated)
;
; Return:	nothing
; Note:		Call superclass so text block can be freed


; -----------------------------------------------------
  MSG_TABLE_GET_TEXT_CLASS			message
; -----------------------------------------------------
; The table will send this to itself to query for the class
; to use for an item.  Applications needing subclass
; TableTextClaas to provide some special behavior can get
; their TableText subclass used for the table by
; subclassing this message
; 
; Pass:		nothing
; Return:	cx:dx	= class to use for item
; Destoryed:	ax, bp
;

; -----------------------------------------------------
  MSG_TABLE_STRING_LOCATE			message
; -----------------------------------------------------
; This method is meant to be implemented by a subclass.
; Its functionality will be to act on some information
; about the data in the table based on the supplied string.
; Default handler returns carry.
;
; Pass:		cx:dx	= text string
; Return:	carry set if unable to find string
; Destroy:	Specified by subclass

; -----------------------------------------------------
  MSG_TABLE_HOLD_DETECTED			message
; -----------------------------------------------------
; The table will receive this message when a hold event
; is detected after having received a start-select.
; This will only be recived once until the the next
; start-select.
;
; Pass:		nothing
; Return:	nothing

; -----------------------------------------------------
  MSG_TABLE_GET_VISIBLE_ROW_RANGE		message
; -----------------------------------------------------
; Gets the row numbers of the top and bottom visible
; rows.  If there are less rows than the height of the
; table, the last row number is returned as the
; bottom row.
;
; Pass:		nothing
; Return:	cx = top row number
;  		dx = bottom row number

; -----------------------------------------------------
  MSG_TABLE_NOTIFY_SELECTION_CHANGED		message
; -----------------------------------------------------
; Notification sent by the table object to itself to indicate
; that the table selection value has changed. You must set 
; TF_NOTIFY_SELECTION_CHANGED (TableFlags) in order for this 
; message to be sent.
; 
; 	 Pass:		nothing
; 	 Return:	nothing

; -----------------------------------------------------
  MSG_TABLE_CHAR_LOCATE			message
; -----------------------------------------------------
; This method is meant to be implemented by a subclass.
; Its functionality will be to act on some information
; about the data in the table based on the supplied char.
; Default handler returns carry.
;
; Pass:		cl	=  char to search for
; Return:	carry set if unable to find string
; Destroy:	Specified by subclass

; ==========================================================================
; 			     Exported Routines
; ==========================================================================

; -------------------------------------------------
  global	TableDrawText:			far
  global	TABLEDRAWTEXT:			far
; -------------------------------------------------
; Attempts to draw justified text inside a table cell.
; The supplied gstate should contain font and point size
; information so that the size of the text can be determined.
;
; Justification is calculated relative to the rectangular
; clipping region within the gstring.  The text can be justified
; to nine different positions.  Once the position has been
; chosen, offsets can be added to fine tune the position of
; the text.
;
; 	Justification Positions
;
; 	TDJT_TOP_LEFT
; 	TDJT_TOP_CENTER
; 	TDJT_TOP_RIGHT
; 	TDJT_CENTER_LEFT
; 	TDJT_CENTER_CENTER
; 	TDJT_CENTER_RIGHT
; 	TDJT_BOTTOM_LEFT
; 	TDJT_BOTTOM_CENTER
; 	TDJT_BOTTOM_RIGHT
;  	TDJT_CENTER_LEFT_ELLIPSIS
;
;  Pass:	ds:si	= text string
;   		cx	= number of chars in string (zero if null terminated)
;   		bx	= TableDrawJustificationType
;   		dl	= x signed offset in points (pos right, neg left)
;   		dh	= y signed offset in points (pos down, neg up)
;   		^hdi	= gstate to draw in (with rectangular clip region)
;
; Return:	nothing

; ---------------------------------------------
   MSG_TABLE_CONFIRM_NEW_SELECTION	message
; ---------------------------------------------
; Confirmation msg sent by the table object to itself to indicate
; that the table selection value is about to be changed.
; This allows the subclass to set a different selection range before
; returning.
;
; This is useful during situations such as auto scrolling where
; the subclass may want to expand or contract a selection
; to include or exclude some columns after some particular
; row scrolls out of or into the visible table.
;
; You must set TF_CONFIRM_NEW_SELECTION (TableFlags) in order for this 
; message to be sent.
; 
; 	 Pass:		ss:bp = TableCellRange (default new selection)
; 	 Return:	nothing


; ==========================================================================
; 			     Instance data
; ==========================================================================

TI_rows				word
	; Total number of rows in the table

TI_columns			word		
	; Total number of columns in the table (all columns are visible)
		
TI_visibleRows			word
	; Number of rows currently displayed

TI_topRow			word
	; Row number of the first visible row		

TI_tableFlags			TableFlags
   	; Info about the table
  
TI_rowFlags			TableRowFlags
	; Attributes common to all rows.

TI_columnDefinitions		lptr
	; Chunk handle to a list of column definitions.  Each definition 
	; consists of the following:
	;   
	;    TableColumnFlags record 
	;    column width in points

TI_rowHeight			word		
	; Row height in points (row can be taller).

TI_currentSelectionStart	TableCellLocation
	; Stores the upper-left cell of in the current range 
	;  of selected cells.

TI_currentSelectionEnd		TableCellLocation
	; Stores the lower-right cell in the current range
	;  of selected cells. 

TI_lastSelectionStart		TableCellLocation
	; Stores the upper-left cell in the last 
	;  range of selected cells. 

TI_lastSelectionEnd		TableCellLocation
	; Stores the lower-right cell in the last range
	;  of selected cells if.

TI_bounds			Rectangle <0, 0, 0, 0>
   	; <Internal Use Only>
   	; These are the bounds of the table itself.  If
   	; the table has margins and/or borders, these
   	; values will be different than VI_bounds.

TI_borderFlags			TableBorderFlags
   	; These flags are used to control the presence and type of 
	;  borders and margins to be used when drawing the table.

TI_tableRangeInversion		TableRangeInversionType
   	; <Internal Use Only>
   	; Stores the type of range inversion that was used
   	; for the last cell range selection.

TI_lastCell			TableCellLocation
   	; <Internal Use Only>
   	; Need to keep track of last cell visited which
   	; is not necessarily the last cell selected. 

TI_selectionDrawStyle		TableSelectionDrawStyleType
   	; Indicates how selections should be drawn.
   	; Always use MSG_TABLE_SET_SELECTION_DRAW_STYLE to set
   	; this because it will take care of redrawing the
   	; current selection bar if its visible.  Your UI will
   	; not look right otherwise.	

TI_privateFlags			TablePrivateFlags
   	; These flags store state information that is used internally

TI_textObj			lptr
   	; Chunk handle to a VisText object used to accept user
   	; input.

TableClass	endc


TableTextClass	class	VisTextClass

; -----------------------------------------------------
  MSG_TABLE_TEXT_INITIALIZE			message
; -----------------------------------------------------
; <Internal use only>

TTI_startCell			TableCellLocation
TTI_endCell			TableCellLocation
   	; Stores the range of cells over which the text object appears

TableTextClass	endc

TableContentClass	class	VisContentClass
; ==========================================================================
; 			     Exported Methods
; ==========================================================================

; -----------------------------------------------------
  MSG_TABLE_CONTENT_KBD_SEND_TO_CHILDREN_ON	message
; -----------------------------------------------------
; This tells the TableContent to send the keyboard
; messages to the children.  This behavior is the
; default behavior for the TableContent.
; It will not be able to send to the children if
; someone already has exclusive access to it.
;
; PASS:		nothing
; RETURN:	carry set if it could not send to all.
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_CONTENT_KBD_SEND_TO_CHILDREN_OFF	message
; -----------------------------------------------------
; This tells the TableContent not to send the keyboard
; messages to the children.  It will not be able to
; turn off this feature if someone already has
; exclusive access to it.
;
; PASS:		nothing
; RETURN:	carry set if it could not send to all.
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_CONTENT_GRAB_KBD_EXCLUSIVE		message
; -----------------------------------------------------
; Sent by one of the content's children so that
; it can be the only one to receive KBD messages.
;
; PASS:		^lcx:dx	= optr to where to send keyboard
; RETURN:	carry set if it could not grab it.
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_TABLE_CONTENT_RELEASE_KBD_EXCLUSIVE	message
; -----------------------------------------------------
; Sent by one of the content's children so that
; it can release the exclusive hold it has on KBD messages.
; Only the object who had exclusive can release it.
;
; PASS:		^lcx:dx	= optr who is releasing it.
; RETURN:	carry set if could not release
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_META_KBD_CHAR_WITH_RETURN equ MSG_META_KBD_CHAR
; -----------------------------------------------------
; This is the normal keyboard message, except that we want a 
; return value specified so that the table content can know
; if the keyboard event was wanted.  
;
; PASS:		cx = 	character
;		dx =	flags
;		bp =	state
; RETURN:	carry (TRUE) if keyboard event not used.
;		clear carry (FALSE) if event used.
;
;

; ==========================================================================
; 			     Instance data
; ==========================================================================

TCI_kbdSend		BooleanByte		BB_TRUE
	; Flag to tell us to send messages to children

TCI_exclDestination	optr			NULL
	; who is going to get sole use of kbd messages


TCI_childSpacing	word			0
TCI_childWrapSpacing	word			0
	; Default spacing for children of this content.

TableContentClass	endc

LocatorClass	class	TableClass

LOCATOR_NUM_OF_ACTION_BUTTONS	equ	13
LocatorSelections	type	LOCATOR_NUM_OF_ACTION_BUTTONS	dup (byte)

;
; These are private flags and should not be used by otheres.
; LSF_INITIALIZED	= tells if the Locator has already been initialized
; LSF_ACTION_BAR	= tells if current appearance of locator is
;			  an action bar
; LSF_CELL_LEAVE_AND_HOLDING
;			= tells if user has pressed action bar and moving
; 			  around the pen/mouse outside the cell
;

LocatorStateFlags	record
	LSF_INITIALIZED:1
	LSF_ACTION_BAR:1
	LSF_CELL_LEAVE_AND_HOLDING:1			
	:5
LocatorStateFlags	end

; ==========================================================================
; 			     Exported Methods
; ==========================================================================

; -----------------------------------------------------
  MSG_LOCATOR_CHANGE_TO_ACTION_BAR		message
; -----------------------------------------------------
; Tells the locator that it should apear as the "ABC"
; buttons on the top as opposed to the text search
; field.
;
; PASS:		nothing
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_LOCATOR_CHANGE_TO_TEXT_SEARCH		message
; -----------------------------------------------------
; Tells the locator that is should appear as the
; test search field as opposed to the action bar.
;
;
; PASS:		nothing
; RETURN:	nothing
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_LOCATOR_DO_STRING_LOCATE		message
; -----------------------------------------------------
; Tells the locator to call the table object that
; is associated with the locator, to locate the
; string that is passed
;
; PASS:		cx:dx	= string to pass
; RETURN:	carry returned if search failed
; DESTROYED:	nothing

; -----------------------------------------------------
  MSG_LOCATOR_DO_CHAR_LOCATE		message
; -----------------------------------------------------
; Tells the locator to call the table object that
; is associated with the locator, to locate the
; char that is passed
;
; PASS:		cx	= Char to search for
; RETURN:	carry returned if search failed
; DESTROYED:	nothing

; ==========================================================================
; 			     Instance data
; ==========================================================================

LI_state	LocatorStateFlags
	; Tells state of the locator.

LI_actionBarColDefsHandle	lptr

LI_textSearchColDefsHandle	lptr

LI_selectionStart		TableCellLocation

LI_selections			LocatorSelections
	; Data to keep track of what position each button is on

LI_destination			optr
	; Where this locator will send its apply message

LocatorClass	endc

LocatorTextClass	class	TableTextClass
LocatorTextClass	endc

;===========================================================================
; 				TableViewClass
;===========================================================================

TableViewClass	class	GenViewClass
protominor	TableNewForDove

;
; A TableClass object may be placed within the TableView (instead of
; GenView) in order to have the View's scrollbar messages handled
; automatically.
;

TVI_mainTable			optr
TVI_scrollerPos			word

protoreset
TableViewClass	endc


EndLibrary	table




