Table widget

Application Header file <Xraw/Table.h>
Class Header file <Xraw/TableP.h>
Class tableWidgetClass
Class Name Table
Superclass Container --> Constraint --> Composit --> Core

Table of Contents


    The Table widget presents a two dimension grid of cells ordering in horizontal and vertical directions to look like as a spreadsheet.
    Each of the cells is a rectangle with three-D border around it.

Table Face

New Resources

Name Class Type Notes Default Value
columnForeground Foreground Pixel CSG backgroundof Table widget
columnMargin ColumnMargin Dimension CSG 2
columns Columns int CSG 0
defaultWidth DefaultWidth Int CSG dinamic
editable Editable Boolean CSG True
editForeground Foreground Pixel CSG foreground of Table widget
editBackground Background Pixel CSG #D0D000
encoding Encoding UnsignedChar CG XawTextEncoding8bit
font Font XFontStruct CSG XtDefaultFont
foreground Foreground Pixel CSG XtDefaultForeground
horizontalScroll Scroll Widget CSG dinamic
internalHeight Height Dimension CSG 2
internalWidth Width Dimension CSG 4
justify Justify Justify CSG XtJustifyCenter
labelShadowWidth LabelShadowWidth Dimension CSG 1
literal Literal Boolean CG False
literalWidth LiteralWidth Dimension G dinamic
rowForeground Foreground Pixel CSG backgroundof Table widget
rowHeight RowHeight Int CSG 0
rowOriented RowOriented Boolean CSG True
rowMargin RowMargin Dimension CSG 2
rows Rows Int CSG 0
tableMargin tableMargin Dimension CSG 2
vetricalScroll Scroll Widget CSG dinamic
 
Callback resources
Name Class Type Notes Default Value
allowAddColumn Callback XtCallbackList C NULL
allowAddRow Callback XtCallbackList C NULL
allowDeleteColumn Callback XtCallbackList C NULL
allowDeleteRow Callback XtCallbackList C NULL
allowDeleteTable Callback XtCallbackList C NULL
addColumn Callback XtCallbackList C NULL
addRow Callback XtCallbackList C NULL
changedCell Callback XtCallbackList C NULL
changedColumnWidth Callback XtCallbackList C NULL
changedRowHeight Callback XtCallbackList C NULL
createTable Callback XtCallbackList C NULL
deleteColumn Callback XtCallbackList C NULL
deleteRow Callback XtCallbackList C NULL
deleteTable Callback XtCallbackList C NULL
whatCell Callback XtCallbackList C NULL
columnForeground Specifies foreground color for displaying vertical separated strips between cells.
columnMargin Specifies the width of vertical strip between cells. Look the map of margins.
columns Specifies the number of columns in the table.
defaultWidth Specifies default column width. If literal is True, then 10, if literal is False, then 60.
editable Specifies whether the user be allowed to change labels in table.
editBackground Specifies the pixel value for background color for displaying text in editable cell.
editForeground Specifies the pixel value for foreground color for displaying text in editable cell.
encoding Specifies text encoding method used by value of label of cell. The value may be XawTextEncoding8bit or XawTextEncodingChar2b.
font Specifies the text font to used for displaying label in a cell.
foreground Specifies default foreground color for displaying labels. The routine XawTableSetCellColours() sets foregrond and background colors for a particular cell.
vetricalScroll
horizontalScroll
Specifies scrollbar widgets that control the table.
Table widget redisplay method requires much time to redraw all labels in the table. Most of time only part of table is visible on the screen, so it is not necessary to redraw all cells, but just only visible ones. These resources allow to define edges of visibility of table.
In the widget creation time, if the resources have not been set and parent widget is subclass of ScrolledTable or Viewport, then Table widget intrinsics set these resources from parent, in opposite case set to NULL.
internalWidth
internalHeight
Specifies minimum amount of space between label and adges of cell. Look the map of margins
justify Specifies left, center, or right alignment of label within cell.
labelShadowWidth Specifies width of shadow around each cell. Look the map of margins.
literal If this resource is True, then widths of columns will be defined in literal unit, rather then pixel.
literalWidth Specifies the width of literal unit in pixel (width of letter "m") .
rowForeground Specifies foreground colors for displaying horizontal separated strips between cells.
rowHeight Specifies the height of a cell in pixels.
rowOriented If this resource is True, horizontal strips between cells will be drawn after vertical, just only to make visible affect "row oriented" table.
rowMargin Specifies the width of vertical strip between cells. Look the map of margins.
rows Specifies the number of rows in the table.
tableMargin Specifies the width of rectangle around the cells' cage. Look the map of margins.

Callback resources

allowAddRow
allowAddColumn
Specifies list of callbacks that will be called to ask applicationas for an allowance to add new stuff into the table.
If the value of do_it would be set to False, then the adding will be discard. The reasons are XawTABLE_ALLOW_ADD_ROW and XawTABLE_ALLOW_ADD_COLUMN respectively.
allowDeleteRow Specifies list of callbacks that will be called to ask applicationas for an allowance to delete a row.
The values of old_cell and new_cell are identical and specify the first cell in the row.
If the value of do_it would be set to False by any one in callback list, then deleting of row will be districted.
The callback would not be invoked for each row when deleting table.
The reason is XawTABLE_ALLOW_DELETE_ROW.
allowDeleteColumn This is as the same as previous, but just for column.
The reason is XawTABLE_ALLOW_DELETE_COLUMN.
allowDeleteTable Specifies list of callbacks that will be called to ask applicationas for an allowance to delete all table stuff.
If application calls XawTableSetNewSize(), but sets do_it to False, then deleting of stuff of table will be restricted and new table size will not be set.
The reason is XawTABLE_ALLOW_DELETE_TABLE.
addRow
addColumn
Specifies list of callbacks that allows applicationas to make changes just after adding row/column into the table.
The value of do_it does not matter for this callback list.
The reasons are XawTABLE_ADD_ROW and XawTABLE_ADD_COLUMN respectively.
changedCell Specifies list of callbacks that allows applicationas to respond to changing parameters of cell (label, foreground, or background).
If value of do_it would be set to False by any one in callback list, then the changing will be districted.
The reason is XawTABLE_CHANGED_CELL.
changedColumnWidth Specifies list of callbacks that allows applicationas to respond to changing width of column. This is useful for ScrolledTable widget.
The value of do_it does not matter for this callback list.
Look the example of code.
The reason is XawTABLE_CHANGED_COLUMN_WIDTH.
changedRowHeight Specifies list of callbacks that allows applicationas to respond to changing hight of row. This is useful for ScrolledTable widget.
The value of do_it does not matter for this callback list.
Look the example of code.
The reason is XawTABLE_CHANGED_ROW_HEIGHT.
createTable Specifies list of callbacks that allows applicationas to make changes just after creating the new table staff. The value of do_it does not matter for this callback list.
The reason is XawTABLE_CREATE_TABLE.
deleteRow Specifies list of callbacks that allows applicationas to make last-time changes before deleting a row.
The values of old_cell and new_cell are identical and specify the first cell in the row.
The value of do_it does not matter for this callback list.
The callback would not be invoked for each row when deleting table.
The reason is XawTABLE_DELETE_ROW.
deleteColumn This is as the same as previous, but just for column.
The reason is XawTABLE_DELETE_COLUMN.
deleteTable Specifies list of callbacks that allows applicationas to make last-time changes before deleting the table.
The value of do_it does not matter for this callback list.
The reason is XawTABLE_DELETE_TABLE.
whatCell Specifies list of callbacks that is called when the user takes the what_cell() action. The value of do_it does not matter for this callback list.
The reason is XawTABLE_WHAT_CELL.

Inherited Resources

Container class resources
Name Class Type Notes Default Value
bottomShadowPixel BottomShadowPixel Pixel CSG Dinamic
bottomShadowPixmap BottomShadowPixmap Pixmap CSG UnspecifiedPixmap
shadowWidth ShadowWidth Dimension CSG 0
topShadowPixmap TopShadowPixmap Pixmap CSG UnspecifiedPixmap
topShadowPixel TopShadowPixel Pixel CSG Dinamic
userData UserData XtPointer CSG NULL
 
Composit class resources
Name Class Type Notes Default Value
children ReadOnly WidgetList G NULL
insertPosition InsertPosition XtOrderProc CSG Insert new children at the end of the child list
numChildren ReadOnly Cardinal G 0
 
Core class resources
Name Class Type Notes Default Value
accelerators Accelerators XtAccelerators CSG NULL
ancestorSensitive AncestorSensitive Boolean G True
background Background Pixel CSG XtDefaultBackground
backgroundPixmap Pixmap Pixmap CSG XtUnspecifiedPixmap
borderColor BorderColor Pixel CSG XtDefaultForeground
borderPixmap Pixmap Pixmap CSG XtUnspecifiedPixmap
borderWidth BorderWidth Dimension CSG 0
colormap Colormap Colormap CG Parent's Colormap
depth Depth int CG Parent's Depth
destroyCallback Callback XtCallbackList C NULL
height Height Dimension CSG 0
initialResourcesPersistent InitialResourcesPersistent Boolean C True
mappedWhenManaged MappedWhenManaged Boolean CSG True
screen Screen Screen CG Parent's Screen
sensitive Sensitive Boolean CSG True
translations Translations XtTranslations CSG NULL
width Width Dimension CSG 0
x Position Position CSG 0
y Position Position CSG 0


Constraint Resources

This version of Table widget does not define any constraint resource and does not fulfil any geometry management for its children widgets.

Callback Information

A pointer to the following structure is passed to each callback:

typedef struct {

  int           reason;
  XEvent       *event;
  XawTableCell  old_cell;
  XawTableCell  new_cell;
  int           row;
  int           column;
  Boolean       do_it;

} XawTableCallbackStruct;
reason Specifies why the callback was invoked.
event Pointer to the XEvent that triggered the callback.
old_cell Contains old values of cell.
new_cell Contains new values of cell.
row The row number of cell.
column The column number of cell.
do_it Initialy is set to True, if chandes is not acceptable, then callback must set it to False and the chandes will be discarded.

Table Actions

The Table widget supports the following actions: The following are the default translation bindings used by the Table widget:
   Ctrl<Btn1Up>:   what_cell()                                    \n\
   <Btn1Up>:       call-edit()                                    \n\
   <Btn2Up>:       insert-selection(PRIMARY, CUT_BUFFER0)         \n\
   <Btn3Up>:       highlight() store-in-buffer(PRIMARY,CUT_BUFFER0)
what_cell() This action invokes whatCell callback list to inform aplication about user manipulations with the table. For example, if you want to mark a cell that user points to, then you should use these pair to know this cell. Note that the triggered event must be button event.
call-edit() This action assigns the AsciiText widget for cell where event was triggered off.
insert-selection(name[,name...]) This action retrives the value of the first(left-most) named selection that exists or the cut buffer that is not empty and invokes callback changeCell to ask application for allowance to insert it into the cell which is pointed to. A name can be a selection (e.g.PRIMARY) or a cut buffer (e.g.CUT_BUFFER0). Note that case is important and the triggered event must be button event.
store-in-buffer(name[,name...]) This action asserts ownership ot the selection or selections spesified. A name can be a selection (e.g. PRIMARY) or a cut buffer(e.g. CUT_BUFFER0). Note that case is important and the triggered event must be button event.
highlight() This action inverts the background and foreground colours in cell.

Knowing Problems

A string in edit cell is not visible.
When font for Table widget is less then 14, then size of cell too small for AsciiText widget.
It must be fixed.

If you try to add simbols in edit cell where exists just only one simbol, last one is changing to '@'.
This is the bug in AsciiText widget.
It must be fixed.


[ Xraw home ]       [ Xraw widget class hierarchy ]


Vladimir T. Romanovski
romsky@hp1.oea.ihep.su