home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-03-22 | 50.3 KB | 1,785 lines |
- Newsgroups: comp.sources.x
- Path: uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
- From: Andrew Wason <aw@bae.bellcore.com>
- Subject: v17i037: Xbae widgets (MOTIF), Part10/12
- Message-ID: <1992Mar23.180401.16340@msi.com>
- Originator: dcmartin@fascet
- Sender: dcmartin@msi.com (David C. Martin - Moderator)
- Organization: Molecular Simulations, Inc.
- References: <csx-17i028-xbae@uunet.UU.NET>
- Date: Mon, 23 Mar 1992 18:04:01 GMT
- Approved: dcmartin@msi.com
-
- Submitted-by: Andrew Wason <aw@bae.bellcore.com>
- Posting-number: Volume 17, Issue 37
- Archive-name: xbae/part10
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # this is Xbae.shar.10 (part 10 of Xbae)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file Xbae/src/ClipP.h continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 10; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping Xbae/src/ClipP.h'
- else
- echo 'x - continuing file Xbae/src/ClipP.h'
- sed 's/^X//' << 'SHAR_EOF' >> 'Xbae/src/ClipP.h' &&
- X */
- X
- /*
- X * ClipP.h - Private definitions for Clip widget
- X */
- X
- #ifndef _ClipP_h
- #define _ClipP_h
- X
- /*
- X * "@(#)ClipP.h 3.3 2/18/92"
- X */
- X
- #include <Xm/XmP.h>
- #include <Xbae/Clip.h>
- X
- /*
- X * New type for class method
- X */
- X
- #if defined (__cplusplus) || defined(c_plusplus)
- extern "C" {
- #endif
- X
- typedef void (*XbaeClipRedrawProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */
- #endif
- X );
- X
- #if defined (__cplusplus) || defined(c_plusplus)
- }
- #endif
- X
- /*
- X * New fields for the Clip widget class record
- X */
- typedef struct {
- X XbaeClipRedrawProc redraw;
- X XtPointer extension;
- } XbaeClipClassPart;
- X
- /*
- X * Full class record declaration
- X */
- typedef struct _XbaeClipClassRec {
- X CoreClassPart core_class;
- X XmPrimitiveClassPart primitive_class;
- X XbaeClipClassPart clip_class;
- } XbaeClipClassRec;
- X
- extern XbaeClipClassRec xbaeClipClassRec;
- X
- /*
- X * New inheritance constant
- X */
- #define XbaeInheritRedraw ((XbaeClipRedrawProc) _XtInherit)
- X
- /*
- X * New fields for the Clip widget record
- X */
- typedef struct {
- X /* resources */
- X XtExposeProc expose_proc; /* function to call on expose */
- X XtCallbackList focus_callback; /* callbacks for when we get focus */
- } XbaeClipPart;
- X
- /*
- X * Full instance record declaration
- X */
- typedef struct _XbaeClipRec {
- X CorePart core;
- X XmPrimitivePart primitive;
- X XbaeClipPart clip;
- } XbaeClipRec;
- X
- #endif /* _ClipP_h */
- SHAR_EOF
- echo 'File Xbae/src/ClipP.h is complete' &&
- chmod 0444 Xbae/src/ClipP.h ||
- echo 'restore of Xbae/src/ClipP.h failed'
- Wc_c="`wc -c < 'Xbae/src/ClipP.h'`"
- test 2526 -eq "$Wc_c" ||
- echo 'Xbae/src/ClipP.h: original size 2526, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/src/Matrix.h ==============
- if test -f 'Xbae/src/Matrix.h' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/src/Matrix.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/src/Matrix.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/Matrix.h' &&
- /*
- X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
- X * All rights reserved
- X * Permission to use, copy, modify and distribute this material for
- X * any purpose and without fee is hereby granted, provided that the
- X * above copyright notice and this permission notice appear in all
- X * copies, and that the name of Bellcore not be used in advertising
- X * or publicity pertaining to this material without the specific,
- X * prior written permission of an authorized representative of
- X * Bellcore.
- X *
- X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
- X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
- X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE
- X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
- X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
- X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
- X * ING TO THE SOFTWARE.
- X *
- X * MatrixWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
- X */
- X
- #ifndef _Matrix_h
- #define _Matrix_h
- X
- /*
- X * "@(#)Matrix.h 3.7 3/11/92"
- X */
- X
- /*
- X * Matrix Widget public include file
- X */
- X
- #include <Xm/Xm.h>
- #include <X11/Core.h>
- X
- X
- /* Resources:
- X * Name Class RepType Default Value
- X * ---- ----- ------- -------------
- X * boldLabels BoldLabels Boolean False
- X * cellHighlightThickness HighlightThickness HorizontalDimension 2
- X * cellMarginHeight MarginHeight VerticalDimension 5
- X * cellMarginWidth MarginWidth HorizontalDimension 5
- X * cells Cells StringTable NULL
- X * cellShadowThickness ShadowThickness HorizontalDimension 2
- X * colors Colors PixelTable NULL
- X * columnAlignments Alignments AlignmentArray dynamic
- X * columnLabelAlignmentsAlignments AlignmentArray dynamic
- X * columnLabels Labels StringArray NULL
- X * columnMaxLengths ColumnMaxLengths MaxLengthArray NULL
- X * columnWidths ColumnWidths WidthArray NULL
- X * columns Columns int 0
- X * enterCellCallback Callback Callback NULL
- X * fixedColumns FixedColumns Dimension 0
- X * fixedRows FixedRows Dimension 0
- X * fontList FontList FontList fixed
- X * leaveCellCallback Callback Callback NULL
- X * modifyVerifyCallback Callback Callback NULL
- X * rowLabelAlignment Alignment Alignment XmALIGNMENT_END
- X * rowLabelWidth RowLabelWidth Short dynamic
- X * rowLabels Labels StringArray NULL
- X * rows Rows int 0
- X * selectCellCallback Callback Callback NULL
- X * selectedCells SelectedCells BooleanTable dynamic
- X * space Space Dimension 6
- X * textTranslations Translations TranslationTable dynamic
- X * topRow TopRow int 0
- X * traverseCellCallback Callback Callback NULL
- X * visibleColumns VisibleColumns Dimension 0
- X * visibleRows VisibleRows Dimension 0
- X */
- X
- #define XmNboldLabels "boldLabels"
- #define XmNcellHighlightThickness "cellHighlightThickness"
- #define XmNcellMarginHeight "cellMarginHeight"
- #define XmNcellMarginWidth "cellMarginWidth"
- #define XmNcellShadowThickness "cellShadowThickness"
- #define XmNcells "cells"
- #define XmNcolors "colors"
- #define XmNcolumnAlignments "columnAlignments"
- #define XmNcolumnLabelAlignments "columnLabelAlignments"
- #define XmNcolumnLabels "columnLabels"
- #define XmNcolumnMaxLengths "columnMaxLengths"
- #define XmNcolumnWidths "columnWidths"
- #define XmNeditVerifyCallback "editVerifyCallback"
- #define XmNenterCellCallback "enterCellCallback"
- #define XmNfixedColumns "fixedColumns"
- #define XmNfixedRows "fixedRows"
- #define XmNleaveCellCallback "leaveCellCallback"
- #define XmNrowLabelAlignment "rowLabelAlignment"
- #define XmNrowLabelWidth "rowLabelWidth"
- #define XmNrowLabels "rowLabels"
- #define XmNselectedCells "selectedCells"
- #define XmNselectCellCallback "selectCellCallback"
- #define XmNtopRow "topRow"
- #define XmNtraverseCellCallback "traverseCellCallback"
- #define XmNvisibleColumns "visibleColumns"
- #define XmNvisibleRows "visibleRows"
- X
- #define XmCAlignments "Alignments"
- #define XmCBoldLabels "BoldLabels"
- #define XmCCells "Cells"
- #define XmCColors "Colors"
- #define XmCColumnMaxLengths "ColumnMaxLengths"
- #define XmCColumnWidths "ColumnWidths"
- #define XmCFixedColumns "FixedColumns"
- #define XmCFixedRows "FixedRows"
- #define XmCLabels "Labels"
- #define XmCRowLabelWidth "RowLabelWidth"
- #define XmCSelectedCells "SelectedCells"
- #define XmCTopRow "TopRow"
- #define XmCVisibleColumns "VisibleColumns"
- #define XmCVisibleRows "VisibleRows"
- X
- #define XmRStringArray "StringArray"
- #define XmRWidthArray "WidthArray"
- #define XmRMaxLengthArray "MaxLengthArray"
- #define XmRAlignmentArray "AlignmentArray"
- #define XmRPixelTable "PixelTable"
- #define XmRBooleanTable "BooleanTable"
- X
- X
- /* Class record constants */
- X
- extern WidgetClass xbaeMatrixWidgetClass;
- X
- typedef struct _XbaeMatrixClassRec *XbaeMatrixWidgetClass;
- typedef struct _XbaeMatrixRec *XbaeMatrixWidget;
- X
- /*
- X * External interfaces to class methods
- X */
- X
- #if defined (__cplusplus) || defined(c_plusplus)
- #define CONST const
- extern "C" {
- #else
- #define CONST
- #endif
- X
- extern void XbaeMatrixSetCell(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */,
- X CONST String /* value */
- #endif
- X );
- X
- extern void XbaeMatrixEditCell(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- extern void XbaeMatrixSelectCell(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- extern void XbaeMatrixSelectRow(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */
- #endif
- X );
- X
- extern void XbaeMatrixSelectColumn(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* column */
- #endif
- X );
- X
- extern void XbaeMatrixDeselectAll(
- #if NeedFunctionPrototypes
- X Widget /* w */
- #endif
- X );
- X
- extern void XbaeMatrixDeselectCell(
- #if NeedFunctionPrototypes
- X Widget/* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- extern void XbaeMatrixDeselectRow(
- #if NeedFunctionPrototypes
- X Widget/* w */,
- X int /* row */
- #endif
- X );
- X
- extern void XbaeMatrixDeselectColumn(
- #if NeedFunctionPrototypes
- X Widget/* w */,
- X int /* column */
- #endif
- X );
- X
- extern String XbaeMatrixGetCell(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- extern Boolean XbaeMatrixCommitEdit(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X Boolean /* unmap */
- #endif
- X );
- X
- extern void XbaeMatrixCancelEdit(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X Boolean /* unmap */
- #endif
- X );
- X
- X
- extern void XbaeMatrixAddRows(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X String * /* rows */,
- X String * /* labels */,
- X Pixel * /* colors */,
- X int /* num_colors */
- #endif
- X );
- X
- extern void XbaeMatrixDeleteRows(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X int /* num_rows */
- #endif
- X );
- X
- extern void XbaeMatrixAddColumns(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X String * /* columns */,
- X String * /* labels */,
- X short * /* widths */,
- X int * /* max_lengths */,
- X unsigned char * /* alignments */,
- X unsigned char * /* label_alignments */,
- X Pixel * /* colors */,
- X int /* num_columns */
- #endif
- X );
- X
- extern void XbaeMatrixDeleteColumns(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X int /* num_columns */
- #endif
- X );
- X
- extern void XbaeMatrixSetRowColors(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X Pixel * /* colors */,
- X int /* num_colors */
- #endif
- X );
- X
- extern void XbaeMatrixSetColumnColors(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X Pixel * /* colors */,
- X int /* num_colors */
- #endif
- X );
- X
- extern void XbaeMatrixSetCellColor(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */,
- X Pixel /* color */
- #endif
- X );
- X
- #if defined (__cplusplus) || defined(c_plusplus)
- }
- #endif
- #undef CONST
- X
- /*
- X * Callback reasons. Try to stay out of range of the Motif XmCR_* reasons.
- X */
- typedef enum _XbaeReasonType {
- X XbaeModifyVerifyReason = 102,
- X XbaeEnterCellReason,
- X XbaeLeaveCellReason,
- X XbaeTraverseCellReason,
- X XbaeSelectCellReason,
- } XbaeReasonType;
- X
- /*
- X * Struct passed to modifyVerifyCallback
- X */
- typedef struct _XbaeMatrixModifyVerifyCallbackStruct {
- X XbaeReasonType reason;
- X int row, column;
- X XmTextVerifyCallbackStruct *verify;
- } XbaeMatrixModifyVerifyCallbackStruct;
- X
- /*
- X * Struct passed to enterCellCallback
- X */
- typedef struct _XbaeMatrixEnterCellCallbackStruct {
- X XbaeReasonType reason;
- X int row, column;
- X Boolean doit;
- } XbaeMatrixEnterCellCallbackStruct;
- X
- /*
- X * Struct passed to leaveCellCallback
- X */
- typedef struct _XbaeMatrixLeaveCellCallbackStruct {
- X XbaeReasonType reason;
- X int row, column;
- X String value;
- X Boolean doit;
- } XbaeMatrixLeaveCellCallbackStruct;
- X
- /*
- X * Struct passed to traverseCellCallback
- X */
- typedef struct _XbaeMatrixTraverseCellCallbackStruct {
- X XbaeReasonType reason;
- X int row, column;
- X int next_row, next_column;
- X int fixed_rows, fixed_columns;
- X int num_rows, num_columns;
- X String param;
- X XrmQuark qparam;
- } XbaeMatrixTraverseCellCallbackStruct;
- X
- /*
- X * Struct passed to selectCellCallback
- X */
- typedef struct _XbaeMatrixSelectCellCallbackStruct {
- X XbaeReasonType reason;
- X int row, column;
- X Boolean **selected_cells;
- X String **cells;
- X Cardinal num_params;
- X String *params;
- X XEvent *event;
- } XbaeMatrixSelectCellCallbackStruct;
- X
- X
- #endif /* _Matrix_h */
- /* DON'T ADD STUFF AFTER THIS #endif */
- X
- SHAR_EOF
- chmod 0444 Xbae/src/Matrix.h ||
- echo 'restore of Xbae/src/Matrix.h failed'
- Wc_c="`wc -c < 'Xbae/src/Matrix.h'`"
- test 9884 -eq "$Wc_c" ||
- echo 'Xbae/src/Matrix.h: original size 9884, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/src/MatrixP.h ==============
- if test -f 'Xbae/src/MatrixP.h' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/src/MatrixP.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/src/MatrixP.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/MatrixP.h' &&
- /*
- X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
- X * All rights reserved
- X * Permission to use, copy, modify and distribute this material for
- X * any purpose and without fee is hereby granted, provided that the
- X * above copyright notice and this permission notice appear in all
- X * copies, and that the name of Bellcore not be used in advertising
- X * or publicity pertaining to this material without the specific,
- X * prior written permission of an authorized representative of
- X * Bellcore.
- X *
- X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
- X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
- X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE
- X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
- X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
- X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
- X * ING TO THE SOFTWARE.
- X *
- X * MatrixWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
- X */
- X
- /*
- X * MatrixP.h - Private definitions for Matrix widget
- X */
- X
- #ifndef _MatrixP_h
- #define _MatrixP_h
- X
- /*
- X * "@(#)MatrixP.h 3.7 3/11/92"
- X */
- X
- #include <Xm/XmP.h>
- #include <Xbae/Matrix.h>
- X
- X
- /*
- X * New types for the class methods
- X */
- X
- #if defined (__cplusplus) || defined(c_plusplus)
- #define CONST const
- extern "C" {
- #else
- #define CONST
- #endif
- X
- typedef void (*XbaeMatrixSetCellProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */,
- X CONST String /* value */
- #endif
- X );
- X
- typedef String (*XbaeMatrixGetCellProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- typedef void (*XbaeMatrixEditCellProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- typedef void (*XbaeMatrixSelectCellProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- typedef void (*XbaeMatrixSelectRowProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */
- #endif
- X );
- X
- typedef void (*XbaeMatrixSelectColumnProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* column */
- #endif
- X );
- X
- typedef void (*XbaeMatrixDeselectAllProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */
- #endif
- X );
- X
- typedef void (*XbaeMatrixDeselectCellProc)(
- #if NeedFunctionPrototypes
- X Widget/* w */,
- X int /* row */,
- X int /* column */
- #endif
- X );
- X
- typedef void (*XbaeMatrixDeselectRowProc)(
- #if NeedFunctionPrototypes
- X Widget/* w */,
- X int /* row */
- #endif
- X );
- X
- typedef void (*XbaeMatrixDeselectColumnProc)(
- #if NeedFunctionPrototypes
- X Widget/* w */,
- X int /* column */
- #endif
- X );
- X
- typedef Boolean (*XbaeMatrixCommitEditProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X Boolean /* unmap */
- #endif
- X );
- X
- typedef void (*XbaeMatrixCancelEditProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X Boolean/* unmap */
- #endif
- X );
- X
- typedef void (*XbaeMatrixAddRowsProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X String * /* rows */,
- X String * /* labels */,
- X Pixel * /* colors */,
- X int /* num_rows */
- #endif
- X );
- X
- typedef void (*XbaeMatrixDeleteRowsProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X int /* num_rows */
- #endif
- X );
- X
- typedef void (*XbaeMatrixAddColumnsProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X String * /* columns */,
- X String * /* labels */,
- X short * /* widths */,
- X int * /* max_lengths */,
- X unsigned char* /* alignments */,
- X unsigned char* /* label_alignments */,
- X Pixel * /* colors */,
- X int /* num_columns */
- #endif
- X );
- X
- typedef void (*XbaeMatrixDeleteColumnsProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X int /* num_columns */
- #endif
- X );
- X
- typedef void (*XbaeMatrixSetRowColorsProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X Pixel * /* colors */,
- X int /* num_colors */
- #endif
- X );
- X
- typedef void (*XbaeMatrixSetColumnColorsProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* position */,
- X Pixel * /* colors */,
- X int /* num_colors */
- #endif
- X );
- X
- typedef void (*XbaeMatrixSetCellColorProc)(
- #if NeedFunctionPrototypes
- X Widget /* w */,
- X int /* row */,
- X int /* column */,
- X Pixel /* color */
- #endif
- X );
- X
- #if defined (__cplusplus) || defined(c_plusplus)
- }
- #endif
- #undef CONST
- X
- /*
- X * Different than the traversal directions in Xm.h
- X */
- #define NOT_TRAVERSING -1
- X
- /*
- X * New fields for the Matrix widget class record
- X */
- typedef struct {
- X XbaeMatrixSetCellProc set_cell;
- X XbaeMatrixGetCellProc get_cell;
- X XbaeMatrixEditCellProc edit_cell;
- X XbaeMatrixSelectCellProc select_cell;
- X XbaeMatrixSelectRowProc select_row;
- X XbaeMatrixSelectColumnProc select_column;
- X XbaeMatrixDeselectAllProc deselect_all;
- X XbaeMatrixDeselectCellProc deselect_cell;
- X XbaeMatrixDeselectRowProc deselect_row;
- X XbaeMatrixDeselectColumnProc deselect_column;
- X XbaeMatrixCommitEditProc commit_edit;
- X XbaeMatrixCancelEditProc cancel_edit;
- X XbaeMatrixAddRowsProc add_rows;
- X XbaeMatrixDeleteRowsProc delete_rows;
- X XbaeMatrixAddColumnsProc add_columns;
- X XbaeMatrixDeleteColumnsProc delete_columns;
- X XbaeMatrixSetRowColorsProc set_row_colors;
- X XbaeMatrixSetColumnColorsProc set_column_colors;
- X XbaeMatrixSetCellColorProc set_cell_color;
- X XtPointer extension;
- } XbaeMatrixClassPart;
- X
- /*
- X * Full class record declaration
- X */
- typedef struct _XbaeMatrixClassRec {
- X CoreClassPart core_class;
- X CompositeClassPart composite_class;
- X ConstraintClassPart constraint_class;
- X XmManagerClassPart manager_class;
- X XbaeMatrixClassPart matrix_class;
- } XbaeMatrixClassRec;
- X
- extern XbaeMatrixClassRec xbaeMatrixClassRec;
- X
- X
- /*
- X * Inheritance constants for set/get/edit methods
- X */
- #define XbaeInheritGetCell ((XbaeMatrixGetCellProc) _XtInherit)
- #define XbaeInheritSetCell ((XbaeMatrixSetCellProc) _XtInherit)
- #define XbaeInheritEditCell ((XbaeMatrixEditCellProc) _XtInherit)
- #define XbaeInheritSelectCell ((XbaeMatrixSelectCellProc) _XtInherit)
- #define XbaeInheritSelectRow ((XbaeMatrixSelectRowProc) _XtInherit)
- #define XbaeInheritSelectColumn ((XbaeMatrixSelectColumnProc) _XtInherit)
- #define XbaeInheritDeselectAll ((XbaeMatrixDeselectAllProc) _XtInherit)
- #define XbaeInheritDeselectCell ((XbaeMatrixDeselectCellProc) _XtInherit)
- #define XbaeInheritDeselectRow ((XbaeMatrixDeselectRowProc) _XtInherit)
- #define XbaeInheritDeselectColumn ((XbaeMatrixDeselectColumnProc) _XtInherit)
- #define XbaeInheritCommitEdit ((XbaeMatrixCommitEditProc) _XtInherit)
- #define XbaeInheritCancelEdit ((XbaeMatrixCancelEditProc) _XtInherit)
- #define XbaeInheritAddRows ((XbaeMatrixAddRowsProc) _XtInherit)
- #define XbaeInheritDeleteRows ((XbaeMatrixDeleteRowsProc) _XtInherit)
- #define XbaeInheritAddColumns ((XbaeMatrixAddColumnsProc) _XtInherit)
- #define XbaeInheritDeleteColumns ((XbaeMatrixDeleteColumnsProc)_XtInherit)
- #define XbaeInheritSetRowColors ((XbaeMatrixSetRowColorsProc)_XtInherit)
- #define XbaeInheritSetColumnColors ((XbaeMatrixSetColumnColorsProc)_XtInherit)
- #define XbaeInheritSetCellColor ((XbaeMatrixSetCellColorProc)_XtInherit)
- X
- X
- /*
- X * New data structures for the ScrollMgr code
- X */
- typedef struct _SmScrollNode {
- X int x;
- X int y;
- X struct _SmScrollNode *next;
- X struct _SmScrollNode *prev;
- } SmScrollNodeRec, *SmScrollNode;
- X
- typedef struct _SmScrollMgr {
- X int offset_x;
- X int offset_y;
- X int scroll_count;
- X SmScrollNode scroll_queue;
- X Boolean scrolling;
- } SmScrollMgrRec, *SmScrollMgr;
- X
- X
- /*
- X * Data structure for column labels
- X */
- typedef struct _ColumnLabelLines {
- X int lines;
- X int *lengths;
- } ColumnLabelLinesRec, *ColumnLabelLines;
- X
- X
- /*
- X * New fields for the Matrix widget record
- X */
- typedef struct {
- X /* resources */
- X int rows, columns; /* number of cells per row/column */
- X Dimension fixed_rows, /* number of fixed rows OR columns */
- X fixed_columns;
- X Pixel **colors; /* 2D array of Pixels */
- X Dimension visible_columns; /* number of columns to make visible */
- X Dimension visible_rows; /* number of rows to make visible */
- X short *column_widths; /* width of each column in chars */
- X int *column_max_lengths;/* max length of each column in chars */
- X short row_label_width; /* max width of row labels in chars */
- X
- X String **cells; /* 2D array of strings */
- X String *row_labels; /* array of labels next to each row */
- X String *column_labels; /* array of labels above each column */
- X unsigned char
- X *column_alignments; /* alignment of each column */
- X unsigned char
- X *column_label_alignments; /* alignment of each column label */
- X unsigned char
- X row_label_alignment;/* alignment of row labels */
- X
- X XmFontList font_list; /* fontList of widget and textField */
- X
- X Dimension space; /* spacing for scrollbars */
- X Boolean bold_labels; /* draw bold row/column labels */
- X
- X Boolean **selected_cells; /* 2D array indicating selected cells */
- X
- X Dimension cell_margin_width, /* margin resources for textField */
- X cell_margin_height;
- X Dimension cell_shadow_thickness; /* shadow thickness for textField */
- X Dimension cell_highlight_thickness; /* highlight thickness for
- X * textField */
- X XtTranslations
- X text_translations; /* translations for textField widget */
- X
- X XtCallbackList
- X modify_verify_callback; /* verify change to textField */
- X XtCallbackList
- X enter_cell_callback;/* called when a cell is entered */
- X XtCallbackList
- X leave_cell_callback;/* called when a cell is left */
- X XtCallbackList
- X traverse_cell_callback; /* determines the next cell to
- X traverse to */
- X XtCallbackList
- X select_cell_callback;/* called when cells are selected */
- X
- X int top_row; /* vertical origin (in row space) */
- X
- X
- X /* private state */
- X int horiz_origin; /* horizontal origin (in pixel space) */
- X
- X int current_row, /* row/column we are editing */
- X current_column;
- X
- X int text_baseline; /* baseline of text in each cell */
- X
- X GC draw_gc; /* GC for drawing cells/labels */
- X GC inverse_gc; /* GC for drawing selected cells */
- X GC draw_clip_gc; /* GC for clipped cells/labels */
- X GC inverse_clip_gc; /* GC for clipped selected cells */
- X GC cell_top_shadow_clip_gc; /* GC for clipped top shadow */
- X GC cell_bottom_shadow_clip_gc; /* GC for clipped bottom shadow */
- X
- X XFontStruct *font; /* fontStruct from fontList */
- X int char_width; /* average character width for font */
- X
- X int *column_positions; /* pixel position of each column */
- X
- X unsigned int cell_total_width; /* width of cell area in pixels */
- X
- X int cell_visible_height; /* height of visible cell area in pixels
- X (not truncated to nearest row) */
- X
- X Dimension desired_width, /* width/height widget wants to be */
- X desired_height;
- X
- X SmScrollMgr matrix_scroll_mgr, /* ScrollMgrs for Matrix and Clip */
- X clip_scroll_mgr;
- X
- X int traversing; /* set to direction we are traversing,
- X * or NOT_TRAVERSING */
- X
- X ColumnLabelLines
- X column_label_lines; /* structs to handle multi line column
- X * labels */
- X int column_label_maxlines;
- X /* max # lines in column labels */
- X
- } XbaeMatrixPart;
- X
- /*
- X * Full instance record declaration
- X */
- typedef struct _XbaeMatrixRec {
- X CorePart core;
- X CompositePart composite;
- X ConstraintPart constraint;
- X XmManagerPart manager;
- X XbaeMatrixPart matrix;
- } XbaeMatrixRec;
- X
- #endif /* _MatrixP_h */
- SHAR_EOF
- chmod 0444 Xbae/src/MatrixP.h ||
- echo 'restore of Xbae/src/MatrixP.h failed'
- Wc_c="`wc -c < 'Xbae/src/MatrixP.h'`"
- test 12125 -eq "$Wc_c" ||
- echo 'Xbae/src/MatrixP.h: original size 12125, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/src/Imakefile ==============
- if test -f 'Xbae/src/Imakefile' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/src/Imakefile (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/src/Imakefile (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/Imakefile' &&
- #include "../Xbae.tmpl"
- X
- X SRCS = Matrix.c Clip.c Caption.c version.c
- X OBJS = Matrix.o Clip.o Caption.o version.o
- X HEADERS = Matrix.h MatrixP.h Clip.h ClipP.h Caption.h CaptionP.h
- X
- #if ProjectX < 5
- # We need to override this in R4 so we don't pick up system Xbae includes
- # due to R4 imake bug
- ALLINCLUDES = $(INCLUDES) $(STD_INCLUDES) $(TOP_INCLUDES) $(EXTRA_INCLUDES)
- #endif
- X
- X DEFINES = -D_NO_PROTO
- X INCLUDES = -I.
- X
- all::
- X $(RM) Xbae
- X $(LN) . Xbae
- X NormalLibraryObjectRule()
- X
- NormalLibraryTarget(Xbae,$(OBJS))
- InstallLibrary(Xbae,$(USRLIBDIR))
- InstallMultiple($(HEADERS),$(INCROOT)/Xbae)
- X
- DependTarget()
- X
- clean::
- X $(RM) Xbae
- SHAR_EOF
- chmod 0644 Xbae/src/Imakefile ||
- echo 'restore of Xbae/src/Imakefile failed'
- Wc_c="`wc -c < 'Xbae/src/Imakefile'`"
- test 676 -eq "$Wc_c" ||
- echo 'Xbae/src/Imakefile: original size 676, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/Mri/Mri.c ==============
- if test ! -d 'Xbae/examples'; then
- echo 'x - creating directory Xbae/examples'
- mkdir 'Xbae/examples'
- fi
- if test ! -d 'Xbae/examples/Mri'; then
- echo 'x - creating directory Xbae/examples/Mri'
- mkdir 'Xbae/examples/Mri'
- fi
- if test -f 'Xbae/examples/Mri/Mri.c' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/Mri/Mri.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/Mri/Mri.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/Mri/Mri.c' &&
- /*
- X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
- X * All rights reserved
- X * Permission to use, copy, modify and distribute this material for
- X * any purpose and without fee is hereby granted, provided that the
- X * above copyright notice and this permission notice appear in all
- X * copies, and that the name of Bellcore not be used in advertising
- X * or publicity pertaining to this material without the specific,
- X * prior written permission of an authorized representative of
- X * Bellcore.
- X *
- X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
- X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
- X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE
- X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
- X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
- X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
- X * ING TO THE SOFTWARE.
- X */
- X
- #include <Xm/Xm.h>
- #include <Wc/WcCreate.h>
- #include <Xbae/Matrix.h>
- #include <Xbae/Caption.h>
- X
- #define RCO(name, func) WcRegisterConstructor(app, name, func)
- #define RCN(name, class) WcRegisterClassName(app, name, class)
- #define RCP(name, class) WcRegisterClassPtr(app, name, class)
- X
- extern void MriRegisterMotif();
- X
- void
- main(argc, argv)
- int argc;
- char *argv[];
- {
- X Widget toplevel;
- X XtAppContext app;
- X
- X toplevel = XtAppInitialize(&app, "Mri",
- X NULL, 0,
- X &argc, argv,
- X NULL,
- X NULL, 0);
- X
- X MriRegisterMotif(app);
- X
- X RCN("XbaeMatrix", xbaeMatrixWidgetClass);
- X RCP("xbaeMatrixWidgetClass", xbaeMatrixWidgetClass);
- X RCN("XbaeCaption", xbaeCaptionWidgetClass);
- X RCP("xbaeCaptionWidgetClass", xbaeCaptionWidgetClass);
- X
- X WcWidgetCreation(toplevel);
- X XtRealizeWidget(toplevel);
- X XtAppMainLoop(app);
- }
- SHAR_EOF
- chmod 0644 Xbae/examples/Mri/Mri.c ||
- echo 'restore of Xbae/examples/Mri/Mri.c failed'
- Wc_c="`wc -c < 'Xbae/examples/Mri/Mri.c'`"
- test 1964 -eq "$Wc_c" ||
- echo 'Xbae/examples/Mri/Mri.c: original size 1964, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/Mri/Caption.ad ==============
- if test -f 'Xbae/examples/Mri/Caption.ad' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/Mri/Caption.ad (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/Mri/Caption.ad (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/Mri/Caption.ad' &&
- Mri.wcChildren: cw
- X
- *cw.wcClassName: XbaeCaption
- *cw.labelString: List\nWidget\nCaption
- *cw.labelAlignment: top
- *cw.labelTextAlignment: alignment_end
- *cw.wcChildren: list
- X
- *list.wcConstructor: XmCreateScrolledList
- *list.itemCount: 5
- *list.items: Item one, Item two, Item three, Item four, Item five
- *list.visibleItemCount: 10
- SHAR_EOF
- chmod 0644 Xbae/examples/Mri/Caption.ad ||
- echo 'restore of Xbae/examples/Mri/Caption.ad failed'
- Wc_c="`wc -c < 'Xbae/examples/Mri/Caption.ad'`"
- test 329 -eq "$Wc_c" ||
- echo 'Xbae/examples/Mri/Caption.ad: original size 329, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/Mri/Imakefile ==============
- if test -f 'Xbae/examples/Mri/Imakefile' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/Mri/Imakefile (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/Mri/Imakefile (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/Mri/Imakefile' &&
- #include "../../Xbae.tmpl"
- X
- X LOCAL_LDFLAGS = -L../../src
- X LOCAL_LIBRARIES = -lXbae -lXmp -lXm -lWc -lXt -lX11
- X DEPLIBS =
- X INCLUDES = -I../../src
- X DEFINES = -D_NO_PROTO
- X
- UninstalledSimpleProgramTarget(Mri)
- SHAR_EOF
- chmod 0644 Xbae/examples/Mri/Imakefile ||
- echo 'restore of Xbae/examples/Mri/Imakefile failed'
- Wc_c="`wc -c < 'Xbae/examples/Mri/Imakefile'`"
- test 230 -eq "$Wc_c" ||
- echo 'Xbae/examples/Mri/Imakefile: original size 230, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/Mri/Matrix.ad ==============
- if test -f 'Xbae/examples/Mri/Matrix.ad' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/Mri/Matrix.ad (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/Mri/Matrix.ad (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/Mri/Matrix.ad' &&
- Mri.wcChildren: mw
- X
- *mw.wcClassName: XbaeMatrix
- *mw.rows: 5
- *mw.columns: 10
- *mw.visibleRows: 3
- *mw.visibleColumns: 5
- *mw.columnLabels: Col1,Col2,Col3,Col4,Col5,\
- X Col6,Col7,Col8,Col9,Last\nCol10
- *mw.columnWidths: 10,5,10,5,15,10,5,10,5,25
- *mw.rowLabels: Row1,Row2,Row3,Row4,Row5
- X
- *mw.rowLabelAlignment: alignment_center
- *mw.columnLabelAlignments: alignment_center,\
- X alignment_beginning,\
- X alignment_beginning,\
- X alignment_end,\
- X alignment_beginning,\
- X alignment_center,\
- X alignment_end,\
- X alignment_beginning,\
- X alignment_end,\
- X alignment_center
- X
- *mw.columnAlignments: alignment_center,\
- X alignment_end,\
- X alignment_beginning,\
- X alignment_center,\
- X alignment_end,\
- X alignment_beginning,\
- X alignment_beginning,\
- X alignment_end,\
- X alignment_end,\
- X alignment_center
- SHAR_EOF
- chmod 0644 Xbae/examples/Mri/Matrix.ad ||
- echo 'restore of Xbae/examples/Mri/Matrix.ad failed'
- Wc_c="`wc -c < 'Xbae/examples/Mri/Matrix.ad'`"
- test 827 -eq "$Wc_c" ||
- echo 'Xbae/examples/Mri/Matrix.ad: original size 827, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/add/add.c ==============
- if test ! -d 'Xbae/examples/add'; then
- echo 'x - creating directory Xbae/examples/add'
- mkdir 'Xbae/examples/add'
- fi
- if test -f 'Xbae/examples/add/add.c' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/add/add.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/add/add.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/add/add.c' &&
- /*
- X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
- X * All rights reserved
- X * Permission to use, copy, modify and distribute this material for
- X * any purpose and without fee is hereby granted, provided that the
- X * above copyright notice and this permission notice appear in all
- X * copies, and that the name of Bellcore not be used in advertising
- X * or publicity pertaining to this material without the specific,
- X * prior written permission of an authorized representative of
- X * Bellcore.
- X *
- X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
- X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
- X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE
- X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
- X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
- X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
- X * ING TO THE SOFTWARE.
- X */
- X
- #include <stdio.h>
- #include <Xm/Form.h>
- #include <Xm/RowColumn.h>
- #include <Xm/PushB.h>
- #include <Xm/Scale.h>
- #include <Xbae/Matrix.h>
- X
- /*
- X * Add multiple rows or columns at a time.
- X * Use option menu to choose whether to add rows or columns.
- X * Use the scale to choose how many to add.
- X * Select a cell with Shift-Button1 to select the row or column to add after.
- X */
- X
- void LoadMatrix();
- void RowOrientationCB(), ColumnOrientationCB(), AddCB(), SetNumberCB();
- void SetPositionCB();
- X
- typedef enum {
- X RowOrientation,
- X ColumnOrientation
- } Orientation;
- typedef struct {
- X Widget matrix;
- X Orientation orientation;
- X int number;
- X int row, column;
- X int num_rows, num_columns;
- } AddDataRec, *AddData;
- X
- main(argc, argv)
- int argc;
- char *argv[];
- {
- X Widget toplevel, form, rc, menu, row, column, option, number, add;
- X AddDataRec addData;
- X XtAppContext app;
- X Arg args[2];
- X int n;
- X
- X toplevel = XtVaAppInitialize(&app, "Add",
- X NULL, 0,
- X &argc, argv,
- X NULL,
- X NULL);
- X
- X /*
- X * Create a Form to hold everything
- X */
- X form = XtCreateManagedWidget("form",
- X xmFormWidgetClass, toplevel,
- X NULL, 0);
- X
- X rc = XtCreateManagedWidget("rc",
- X xmRowColumnWidgetClass, form,
- X NULL, 0);
- X
- X /*
- X * Create a menu for use in an OptionMenu
- X */
- X menu = XmCreatePulldownMenu(rc, "menu", NULL, 0);
- X
- X /*
- X * Create a menu button to select row orientation
- X */
- X row = XtVaCreateManagedWidget("row",
- X xmPushButtonWidgetClass, menu,
- X NULL);
- X XtAddCallback(row, XmNactivateCallback, RowOrientationCB,
- X (XtPointer)&addData);
- X
- X /*
- X * Create a menu button to select column orientation
- X */
- X column = XtVaCreateManagedWidget("column",
- X xmPushButtonWidgetClass, menu,
- X NULL);
- X XtAddCallback(column, XmNactivateCallback, ColumnOrientationCB,
- X (XtPointer)&addData);
- X
- X /*
- X * Setup and create the option menu
- X */
- X n = 0;
- X XtSetArg(args[n], XmNsubMenuId, menu); n++;
- X XtSetArg(args[n], XmNmenuHistory, row); n++;
- X option = XmCreateOptionMenu(rc, "option", args, n);
- X XtManageChild(option);
- X
- X addData.orientation = RowOrientation;
- X
- X /*
- X * Create a scale to determine how many to add
- X */
- X number = XtVaCreateManagedWidget("number",
- X xmScaleWidgetClass,rc,
- X XmNvalue, 1,
- X XmNleftAttachment, XmATTACH_WIDGET,
- X XmNleftWidget, option,
- X XmNbottomAttachment,XmATTACH_OPPOSITE_WIDGET,
- X XmNbottomWidget, option,
- X NULL);
- X XtAddCallback(number, XmNvalueChangedCallback, SetNumberCB,
- X (XtPointer)&addData);
- X addData.number = 1;
- X
- X /*
- X * Create a button to do the adding
- X */
- X add = XtVaCreateManagedWidget("add",
- X xmPushButtonWidgetClass,rc,
- X XmNleftAttachment, XmATTACH_WIDGET,
- X XmNleftWidget, number,
- X XmNbottomAttachment,XmATTACH_OPPOSITE_WIDGET,
- X XmNbottomWidget, number,
- X NULL);
- X XtAddCallback(add, XmNactivateCallback, AddCB, (XtPointer)&addData);
- X
- X /*
- X * Create a Matrix widget.
- X */
- X addData.matrix =
- X XtVaCreateManagedWidget("mw",
- X xbaeMatrixWidgetClass, form,
- X XmNleftAttachment, XmATTACH_FORM,
- X XmNrightAttachment, XmATTACH_FORM,
- X XmNbottomAttachment, XmATTACH_FORM,
- X XmNtopAttachment, XmATTACH_WIDGET,
- X XmNtopWidget, rc,
- X NULL);
- X XtAddCallback(addData.matrix, XmNselectCellCallback, SetPositionCB,
- X (XtPointer)&addData);
- X XtVaGetValues(addData.matrix,
- X XmNrows, &addData.num_rows,
- X XmNcolumns, &addData.num_columns,
- X NULL);
- X addData.row = 0;
- X addData.column = 0;
- X
- X /*
- X * Load the matrix with default values
- X */
- X LoadMatrix(&addData);
- X
- X XtRealizeWidget(toplevel);
- X XtAppMainLoop(app);
- }
- X
- /* ARGSUSED */
- void
- RowOrientationCB(w, addData, call_data)
- Widget w;
- AddData addData;
- XXtPointer call_data;
- {
- X if (addData->orientation != RowOrientation) {
- X addData->orientation = RowOrientation;
- X XbaeMatrixDeselectColumn(addData->matrix, addData->column);
- X }
- }
- X
- /* ARGSUSED */
- void
- ColumnOrientationCB(w, addData, call_data)
- Widget w;
- AddData addData;
- XXtPointer call_data;
- {
- X if (addData->orientation != ColumnOrientation) {
- X addData->orientation = ColumnOrientation;
- X XbaeMatrixDeselectRow(addData->matrix, addData->row);
- X }
- }
- X
- /* ARGSUSED */
- void
- AddCB(w, addData, call_data)
- Widget w;
- AddData addData;
- XXtPointer call_data;
- {
- X String *rows, *columns;
- X short *widths;
- X char buf[BUFSIZ];
- X int i, j, length;
- X
- X /*
- X * Add rows or columns
- X */
- X switch (addData->orientation) {
- X
- X case RowOrientation:
- X rows = (String *) XtMalloc(addData->num_columns * addData->number *
- X sizeof(String));
- X for (i = 0; i < addData->number; i++)
- X for (j = 0; j < addData->num_columns; j++) {
- X sprintf(buf, "addrow %d, %d", i, j);
- X rows[i * addData->num_columns + j] = XtNewString(buf);
- X }
- X
- X XbaeMatrixAddRows(addData->matrix, addData->row + 1, rows, NULL, NULL,
- X addData->number);
- X
- X length = addData->num_columns * addData->number;
- X for (i = 0; i < length; i++)
- X XtFree(rows[i]);
- X XtFree((XtPointer)rows);
- X
- X addData->num_rows += addData->number;
- X break;
- X
- X case ColumnOrientation:
- X widths = (short *) XtMalloc(addData->number * sizeof(short));
- X for (i = 0; i < addData->number; i++)
- X widths[i] = 15;
- X
- X columns = (String *) XtMalloc(addData->num_rows * addData->number *
- X sizeof(String));
- X for (i = 0; i < addData->num_rows; i++)
- X for (j = 0; j < addData->number; j++) {
- X sprintf(buf, "addcol %d, %d", i, j);
- X columns[i * addData->number + j] = XtNewString(buf);
- X }
- X
- X XbaeMatrixAddColumns(addData->matrix, addData->column + 1, columns,
- X NULL, widths, NULL, NULL, NULL, NULL,
- X addData->number);
- X
- X XtFree((XtPointer)widths);
- X length = addData->num_rows * addData->number;
- X for (i = 0; i < length; i++)
- X XtFree(columns[i]);
- X XtFree((XtPointer)columns);
- X
- X addData->num_columns += addData->number;
- X break;
- X }
- }
- X
- /* ARGSUSED */
- void
- SetNumberCB(w, addData, call_data)
- Widget w;
- AddData addData;
- XXmScaleCallbackStruct *call_data;
- {
- X addData->number = call_data->value;
- }
- X
- /* ARGSUSED */
- void
- SetPositionCB(w, addData, call_data)
- Widget w;
- AddData addData;
- XXbaeMatrixSelectCellCallbackStruct *call_data;
- {
- X switch (addData->orientation) {
- X case RowOrientation:
- X XbaeMatrixDeselectRow(addData->matrix, addData->row);
- X addData->row = call_data->row;
- X addData->column = call_data->column;
- X XbaeMatrixSelectRow(addData->matrix, addData->row);
- X break;
- X case ColumnOrientation:
- X XbaeMatrixDeselectColumn(addData->matrix, addData->column);
- X addData->row = call_data->row;
- X addData->column = call_data->column;
- X XbaeMatrixSelectColumn(addData->matrix, addData->column);
- X break;
- X }
- }
- X
- void
- LoadMatrix(addData)
- AddData addData;
- {
- X int i, j;
- X char buf[BUFSIZ];
- X String *rowArrays, **cells;
- X
- X cells = (String **)XtMalloc(addData->num_rows * sizeof(String *));
- X rowArrays = (String *)XtMalloc(addData->num_rows * addData->num_columns *
- X sizeof(String));
- X
- X for (i = 0; i < addData->num_rows; i++) {
- X cells[i] = &rowArrays[i * addData->num_columns];
- X for (j = 0; j < addData->num_columns; j++) {
- X sprintf(buf, "%d, %d", i, j);
- X rowArrays[i * addData->num_columns + j] = XtNewString(buf);
- X }
- X }
- X
- X XtVaSetValues(addData->matrix,
- X XmNcells, cells,
- X NULL);
- X
- X for (i = 0; i < addData->num_rows; i++)
- X for (j = 0; j < addData->num_columns; j++)
- X XtFree(rowArrays[i * addData->num_columns + j]);
- X
- X XtFree((XtPointer) rowArrays);
- X XtFree((XtPointer) cells);
- }
- SHAR_EOF
- chmod 0644 Xbae/examples/add/add.c ||
- echo 'restore of Xbae/examples/add/add.c failed'
- Wc_c="`wc -c < 'Xbae/examples/add/add.c'`"
- test 8694 -eq "$Wc_c" ||
- echo 'Xbae/examples/add/add.c: original size 8694, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/add/Add.ad ==============
- if test -f 'Xbae/examples/add/Add.ad' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/add/Add.ad (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/add/Add.ad (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/add/Add.ad' &&
- *rc.orientation: horizontal
- X
- *number.showValue: True
- *number.orientation: horizontal
- *number.maximum: 10
- X
- *add.labelString: Add
- *row.labelString: Add rows
- *column.labelString: Add columns
- X
- *mw.rows: 7
- *mw.columns: 5
- *mw.columnWidths: 15, 15, 15, 15, 15
- *mw.translations: #override\n\
- X Shift <Btn1Down>: SelectCell()
- SHAR_EOF
- chmod 0644 Xbae/examples/add/Add.ad ||
- echo 'restore of Xbae/examples/add/Add.ad failed'
- Wc_c="`wc -c < 'Xbae/examples/add/Add.ad'`"
- test 320 -eq "$Wc_c" ||
- echo 'Xbae/examples/add/Add.ad: original size 320, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/add/Imakefile ==============
- if test -f 'Xbae/examples/add/Imakefile' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/add/Imakefile (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/add/Imakefile (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/add/Imakefile' &&
- #include "../../Xbae.tmpl"
- X
- X LOCAL_LDFLAGS = -L../../src
- X LOCAL_LIBRARIES = -lXbae -lXm -lXt -lX11
- X DEPLIBS =
- X INCLUDES = -I../../src
- X DEFINES = -D_NO_PROTO
- X
- UninstalledSimpleProgramTarget(add)
- SHAR_EOF
- chmod 0644 Xbae/examples/add/Imakefile ||
- echo 'restore of Xbae/examples/add/Imakefile failed'
- Wc_c="`wc -c < 'Xbae/examples/add/Imakefile'`"
- test 219 -eq "$Wc_c" ||
- echo 'Xbae/examples/add/Imakefile: original size 219, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/caption/Caption.ad ==============
- if test ! -d 'Xbae/examples/caption'; then
- echo 'x - creating directory Xbae/examples/caption'
- mkdir 'Xbae/examples/caption'
- fi
- if test -f 'Xbae/examples/caption/Caption.ad' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/caption/Caption.ad (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/caption/Caption.ad (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/caption/Caption.ad' &&
- *button1.labelString: Text, caption right
- *button2.labelString: ButtonBox, caption top center
- *button3.labelString: ButtonBox, multiline caption left
- *button4.labelString: Text, caption left
- *button5.labelString: Double toggle boxes
- X
- !
- ! Caption 1 example
- !
- X
- *caption1.allowShellResize: True
- *caption1*fontList: -adobe-helvetica-*-r-*-*-*-180-*-*-*-*-*-*
- *caption1*text.resizeWidth: True
- X
- *caption1*cw.labelString: Caption
- *caption1*cw.labelPosition: right
- *caption1*cw.labelAlignment: center
- *caption1*cw.spacing: 30
- X
- X
- X
- !
- ! Caption 2 example
- !
- X
- *caption2*fontList: -adobe-helvetica-*-r-*-*-*-180-*-*-*-*-*-*
- X
- ! Position the caption at the to center of the Frame and offset it
- ! so that it overlaps slightly.
- *caption2*cw.wcClassName: XbaeCaption
- *caption2*cw.labelString: Caption
- *caption2*cw.labelPosition: top
- *caption2*cw.labelAlignment: center
- *caption2*cw.labelOffset: -15
- X
- *caption2*cw.Offset: 10
- *caption2*cw.leftAttachment: attach_form
- *caption2*cw.rightAttachment: attach_form
- *caption2*cw.bottomAttachment: attach_form
- *caption2*cw.topAttachment: attach_form
- X
- *caption2*frame.marginWidth: 15
- *caption2*frame.marginHeight: 15
- *caption2*frame.shadowThickness:4
- X
- *caption2*rc.orientation: vertical
- X
- *caption2*button.labelString: PushButton
- X
- X
- X
- !
- ! Caption 3 example
- !
- X
- *caption3*fontList: -adobe-helvetica-*-r-*-*-*-180-*-*-*-*-*-*
- X
- *caption3*cw.wcClassName: XbaeCaption
- *caption3*cw.labelString: Multi\nLine\nCaption
- *caption3*cw.labelPosition: left
- *caption3*cw.labelAlignment: top
- *caption3*cw.labelOffset: 5
- *caption3*cw.labelTextAlignment:alignment_end
- X
- *caption3*cw.Offset: 10
- *caption3*cw.leftAttachment: attach_form
- *caption3*cw.rightAttachment: attach_form
- *caption3*cw.bottomAttachment: attach_form
- *caption3*cw.topAttachment: attach_form
- X
- *caption3*frame.marginWidth: 15
- *caption3*frame.marginHeight: 15
- *caption3*frame.shadowThickness:4
- X
- *caption3*rc.orientation: vertical
- X
- *caption3*button.labelString: PushButton
- X
- X
- X
- !
- ! Caption 4 example
- !
- X
- *caption4*fontList: -adobe-helvetica-*-r-*-*-*-180-*-*-*-*-*-*
- *caption4*cw.labelString: Caption:
- *caption4*cw.labelOffset: 5
- *caption4*text.columns: 10
- X
- X
- X
- !
- ! Caption 5 example
- !
- X
- *caption5*fontList: -adobe-helvetica-*-r-*-*-*-180-*-*-*-*-*-*
- X
- *caption5*cw1.labelString: ToggleBox 1
- *caption5*cw1.labelPosition:top
- *caption5*cw1.labelAlignment:left
- *caption5*cw1.labelOffset: -15
- X
- *caption5*cw1.Offset: 10
- *caption5*cw1.leftAttachment: attach_form
- *caption5*cw1.rightAttachment: attach_form
- *caption5*cw1.topAttachment: attach_form
- *caption5*cw1.bottomAttachment: attach_position
- *caption5*cw1.bottomPosition: 50
- X
- *caption5*cw2.labelString: ToggleBox 2
- *caption5*cw2.labelPosition: top
- *caption5*cw2.labelAlignment: left
- *caption5*cw2.labelOffset: -15
- X
- *caption5*cw2.Offset: 10
- *caption5*cw2.leftAttachment: attach_form
- *caption5*cw2.rightAttachment: attach_form
- *caption5*cw2.bottomAttachment: attach_form
- *caption5*cw2.topAttachment: attach_position
- *caption5*cw2.topPosition: 50
- X
- *caption5*frame.marginWidth: 15
- *caption5*frame.marginHeight: 15
- *caption5*frame.shadowThickness:4
- X
- *caption5*button.labelString: Toggle
- SHAR_EOF
- chmod 0644 Xbae/examples/caption/Caption.ad ||
- echo 'restore of Xbae/examples/caption/Caption.ad failed'
- Wc_c="`wc -c < 'Xbae/examples/caption/Caption.ad'`"
- test 3099 -eq "$Wc_c" ||
- echo 'Xbae/examples/caption/Caption.ad: original size 3099, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Xbae/examples/caption/caption.c ==============
- if test -f 'Xbae/examples/caption/caption.c' -a X"$1" != X"-c"; then
- echo 'x - skipping Xbae/examples/caption/caption.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Xbae/examples/caption/caption.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Xbae/examples/caption/caption.c' &&
- /*
- X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
- X * All rights reserved
- X * Permission to use, copy, modify and distribute this material for
- X * any purpose and without fee is hereby granted, provided that the
- X * above copyright notice and this permission notice appear in all
- X * copies, and that the name of Bellcore not be used in advertising
- X * or publicity pertaining to this material without the specific,
- X * prior written permission of an authorized representative of
- X * Bellcore.
- X *
- X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
- X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
- X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE
- X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
- X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
- X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
- X * ING TO THE SOFTWARE.
- X */
- X
- #include <Xbae/Caption.h>
- #include <Xm/DialogS.h>
- #include <Xm/TextF.h>
- #include <Xm/Form.h>
- #include <Xm/Frame.h>
- #include <Xm/RowColumn.h>
- #include <Xm/PushB.h>
- #include <Xm/ToggleB.h>
- X
- /*
- X * Some examples of Captions use
- X */
- X
- void popupCaptionTextF(), popupCaptionFrame(), popupCaptionToggle();
- SHAR_EOF
- true || echo 'restore of Xbae/examples/caption/caption.c failed'
- fi
- echo 'End of Xbae part 10'
- echo 'File Xbae/examples/caption/caption.c is continued in part 11'
- echo 11 > _shar_seq_.tmp
- exit 0
- --
- --
- Molecular Simulations, Inc. mail: dcmartin@msi.com
- 796 N. Pastoria Avenue uucp: uunet!dcmartin
- Sunnyvale, California 94086 at&t: 408/522-9236
-