1 /*
2  * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
3  * Copyright(c) 1995-99 Andrew Lister
4  * Copyright (c) 1999-2002, 2004 by the LessTif Developers.
5  *
6  *                        All rights reserved
7  * Permission to use, copy, modify and distribute this material for
8  * any purpose and without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies, and that the name of Bellcore not be used in advertising
11  * or publicity pertaining to this material without the specific,
12  * prior written permission of an authorized representative of
13  * Bellcore.
14  *
15  * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
16  * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
17  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18  * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
19  * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
20  * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
21  * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
22  * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
23  * ING TO THE SOFTWARE.
24  *
25  * $Id: Utils.h,v 1.45 2006/05/16 19:59:53 tobiasoed Exp $
26  */
27 
28 /*
29  * Utils.h created by Andrew Lister (6 August, 1995)
30  */
31 #ifndef _Xbae_Utils_h
32 #define _Xbae_Utils_h
33 
34 #include <X11/Intrinsic.h>
35 #include <Xbae/MatrixP.h>
36 
37 #include <Xbae/Macros.h>
38 
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 void xbaeGetColumnPositions(XbaeMatrixWidget);
45 void xbaeGetRowPositions(XbaeMatrixWidget);
46 int xbaeCheckRowPosition(XbaeMatrixWidget mw, int row);
47 int xbaeCheckColumnPosition(XbaeMatrixWidget mw, int column);
48 
49 int xbaeTopRow(XbaeMatrixWidget mw);
50 int xbaeBottomRow(XbaeMatrixWidget mw);
51 int xbaeLeftColumn(XbaeMatrixWidget mw);
52 int xbaeRightColumn(XbaeMatrixWidget mw);
53 void xbaeGetVisibleRows(XbaeMatrixWidget, int *, int *);
54 void xbaeGetVisibleColumns(XbaeMatrixWidget, int *, int *);
55 void xbaeGetVisibleCells(XbaeMatrixWidget mw, int *, int *, int *, int *);
56 
57 int xbaeCalculateHorizOrigin(XbaeMatrixWidget mw, int left_column);
58 int xbaeCalculateVertOrigin(XbaeMatrixWidget mw, int top_row);
59 
60 Boolean xbaeIsRowVisible(XbaeMatrixWidget, int);
61 Boolean xbaeIsColumnVisible(XbaeMatrixWidget, int);
62 Boolean xbaeIsCellVisible(XbaeMatrixWidget, int, int);
63 
64 void xbaeMakeRowVisible(XbaeMatrixWidget, int);
65 void xbaeMakeColumnVisible(XbaeMatrixWidget, int);
66 void xbaeMakeCellVisible(XbaeMatrixWidget, int, int);
67 
68 void xbaeComputeSize(XbaeMatrixWidget, Boolean, Boolean);
69 int xbaeCalculateLabelMaxLength(XbaeMatrixWidget mw, String *labels, XmString *xmlabels, int n_labels);
70 int xbaeCalculateLabelMaxLines(String *labels, XmString *xmlabels, int n_labels);
71 
72 XbaeMatrixWidget xbaeEventToMatrixWidget(Widget w, XEvent *event);
73 XbaeMatrixWidget xbaeEventToMatrixXY(Widget w, XEvent *event, int *x, int *y);
74 int xbaeEventToRowColumn(Widget w, XEvent * event, int *row, int *column, int *x, int *y);
75 
76 int xbaeMatrixXtoColumn(XbaeMatrixWidget mw,int *x, int *column);
77 int xbaeMatrixYtoRow(XbaeMatrixWidget mw,int *y, int *row);
78 int xbaeMatrixXYToRowCol(XbaeMatrixWidget mw,
79     int *x, int *y, int *row,int *column);
80 
81 int xbaeColumnToMatrixX(XbaeMatrixWidget mw, int column);
82 int xbaeRowToMatrixY(XbaeMatrixWidget mw, int row);
83 Widget xbaeRowColToClipXY(XbaeMatrixWidget, int, int, int *, int *);
84 
85 void xbaeHideCellWidget(XbaeMatrixWidget mw, Widget cw);
86 void xbaePositionCellWidget(XbaeMatrixWidget mw, int row, int column);
87 void xbaeHideTextField(XbaeMatrixWidget mw);
88 void xbaePositionTextField(XbaeMatrixWidget mw);
89 void xbaeSetInitialFocus(XbaeMatrixWidget mw);
90 
91 void xbaeSaneRectangle(XbaeMatrixWidget mw, XRectangle *rect_p,int rs, int cs, int re, int ce);
92 
93 void xbaeObjectLock(Widget);
94 void xbaeObjectUnlock(Widget);
95 
96 void xbaeScrollRows(XbaeMatrixWidget, int step);
97 void xbaeScrollColumns(XbaeMatrixWidget, int step);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* _Xbae_Utils_h */
104