1/*
2
3Copyright 1989, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26
27*/
28
29/*
30 * Author:  Davor Matic, MIT X Consortium
31 */
32
33
34#ifndef _Bitmap_h
35#define _Bitmap_h
36
37/****************************************************************
38 *
39 * Bitmap widget
40 *
41 ****************************************************************/
42
43#include <X11/Xaw/Simple.h>
44
45/* Resources:
46
47 Name		     Class		RepType		Default Value
48 ----		     -----		-------		-------------
49 background	     Background		Pixel		XtDefaultBackground
50 foreground          Foredround         Pixel           XtDefaultForeground
51 highlight           Highlight          Pixel           XtDefaultForeground
52 frame               Frame              Pixel           XtDefaultForeground
53 border		     BorderColor	Pixel		XtDefaultForeground
54 borderWidth	     BorderWidth	Dimension	1
55 mappedWhenManaged   MappedWhenManaged	Boolean		True
56 resize              Resize             Boolean         True
57 sensitive	     Sensitive		Boolean		True
58 width		     Width		Dimension	0
59 height		     Height		Dimension	0
60 size                Size               String          32x32
61 squareWidht         SquareWidht        Dimension       16
62 squareHeight        SquareHeight       Dimension       16
63 x		     Position		Position	320
64 y		     Position		Position	320
65 xHot                XHot               Position        NotSet
66 yHot                YHot               Position        NotSet
67 margin              Margin             Dimension       16
68 grid                Grid               Boolean         True
69 gridTolerance       GridTolerance      Dimension       8
70 dashed              Dashed             Boolean         True
71 dashes              Dashes             Bitmap          XtUnspecifiedPixmap
72 stippled            Stippled           Boolean         True
73 stipple             Stipple            Bitmap          XtUnspecifiedPixmap
74 proportional        Proportional       Boolean         True
75 axes                Axes               Boolean         True
76 button1Function     Button1Function    ButtonFunction  Set
77 button2Function     Button2Function    ButtonFunction  Invert
78 button3Function     Button3Function    ButtonFunction  Clear
79 button4Function     Button4Function    ButtonFunction  Invert
80 button5Function     Button5Function    ButtonFunction  Invert
81 filename            Filename           String          None
82 basename            Basename           String          None
83*/
84
85/* define any special resource names here that are not in <X11/StringDefs.h> */
86
87#define XtNbitmapResource "bitmapResource"
88#define XtNstipple "stipple"
89#define XtNstippled "stippled"
90#define XtNdashes "dashes"
91#define XtNdashed "dashed"
92#define XtNgrid "grid"
93#define XtNgridTolerance "gridTolerance"
94#define XtNaxes "axes"
95#define XtNbitmapSize "bitmapSize"
96#define XtNsize "size"
97#define XtNsquareWidth "squareWidth"
98#define XtNsquareHeight "squareHeight"
99#define XtNxHot "xHot"
100#define XtNyHot "yHot"
101#define XtNbutton1Function "button1Function"
102#define XtNbutton2Function "button2Function"
103#define XtNbutton3Function "button3Function"
104#define XtNbutton4Function "button4Function"
105#define XtNbutton5Function "button5Function"
106#define XtNfilename "filename"
107#define XtNbasename "basename"
108#define XtNmouseForeground "mouseForeground"
109#define XtNmouseBackground "mouseBackground"
110#define XtNframe "frame"
111#define XtNmargin "margin"
112#define XtNproportional "proportional"
113
114#define XtCBitmapResource "BitmapResource"
115#define XtCHighlight "Highlight"
116#define XtCStipple "Stipple"
117#define XtCStippled "Stippled"
118#define XtCDashes "Dashes"
119#define XtCDashed "Dashed"
120#define XtCGrid "Grid"
121#define XtCGridTolerance "GridTolerance"
122#define XtCAxes "Axes"
123#define XtBitmapSize "BitmapSize"
124#define XtCSize "Size"
125#define XtCSquareWidth "SquareWidth"
126#define XtCSquareHeight "SquareHeight"
127#define XtCXHot "XHot"
128#define XtCYHot "YHot"
129#define XtCButton1Function "Button1Function"
130#define XtCButton2Function "Button2Function"
131#define XtCButton3Function "Button3Function"
132#define XtCButton4Function "Button4Function"
133#define XtCButton5Function "Button5Function"
134#define XtCFilename "Filename"
135#define XtCBasename "Basename"
136#define XtCFrame "Frame"
137#ifndef XtCMargin
138#define XtCMargin "Margin"
139#endif
140#define XtCProportional "Proportional"
141
142#define XtRButtonFunction "ButtonFunction"
143
144/* bitmap defines */
145
146#define NotSet   -1
147#define Clear     0
148#define Set       1
149#define Invert    2
150#define Highlight 3
151#define On        True
152#define Off       False
153
154#define XtClear "clear"
155#define XtSet "set"
156#define XtInvert "invert"
157
158#define MarkRequest "MarkRequest"
159#define StoreRequest "StoreRequest"
160#define RestoreRequest "RestoreRequest"
161#define CopyRequest "CopyRequest"
162#define MoveRequest "MoveRequest"
163#define PointRequest "PointRequest"
164#define LineRequest "LineRequest"
165#define CurveRequest "CurveRequest"
166#define RectangleRequest "RectangleRequest"
167#define FilledRectangleRequest "FilledRectangleRequest"
168#define CircleRequest "CircleRequest"
169#define FilledCircleRequest "FilledCircleRequest"
170#define FloodFillRequest "FloodFillRequest"
171#define HotSpotRequest "HotSpotRequest"
172#define ZoomInRequest "ZoomInRequest"
173#define PasteRequest "PasteRequest"
174#define ImmediateCopyRequest "ImmediateCopyRequest"
175#define ImmediateMoveRequest "ImmediateMoveRequest"
176
177/* bitmap exports */
178
179typedef struct _BWRequestRec BWRequestRec;
180typedef const char *BWRequest;
181
182/* declare specific BitmapWidget class and instance datatypes */
183
184typedef struct _BitmapClassRec *BitmapWidgetClass;
185typedef struct _BitmapRec      *BitmapWidget;
186/* declare the class constant */
187
188extern WidgetClass bitmapWidgetClass;
189
190extern Boolean BWEngageRequest(Widget w, BWRequest name, Boolean trap,
191			       XtPointer call_data, Cardinal call_data_size);
192extern Boolean BWTerminateRequest(Widget w, Boolean cont);
193
194extern void BWUp ( Widget w );
195extern void BWDown ( Widget w );
196extern void BWLeft ( Widget w );
197extern void BWRight ( Widget w );
198extern void BWRotateRight ( Widget w );
199extern void BWRotateLeft ( Widget w );
200extern void BWSwitchGrid ( Widget w );
201extern void BWGrid ( Widget w, Boolean _switch );
202extern void BWSwitchDashed ( Widget w );
203extern void BWDashed ( Widget w, Boolean _switch );
204extern void BWSwitchAxes ( Widget w );
205extern void BWAxes ( Widget w, Boolean _switch );
206extern void BWRedrawAxes( Widget w );
207extern void BWDrawLine ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value );
208extern void BWDrawRectangle ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value );
209extern void BWDrawFilledRectangle ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value );
210extern void BWDrawCircle ( Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value );
211extern void BWDrawFilledCircle ( Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value );
212extern void BWFloodFill ( Widget w, Position x, Position y, int value );
213extern void BWMark ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y );
214extern void BWMarkAll ( Widget w );
215extern void BWUnmark ( Widget w );
216extern void BWSelect ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, Time btime );
217extern void BWStore ( Widget w );
218extern void BWStoreToBuffer ( Widget w );
219extern void BWUndo ( Widget w );
220extern void BWResize ( Widget w, Dimension width, Dimension height );
221extern void BWClip ( Widget w, Position x, Position y, Dimension width, Dimension height );
222extern void BWUnclip ( Widget w );
223extern void BWGrabSelection ( Widget w, Time btime );
224extern void BWRequestSelection ( Widget w, Time btime, Boolean wait );
225extern void BWSetChanged ( Widget w );
226extern Boolean BWQueryChanged ( Widget w );
227extern int BWReadFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString basename );
228extern int BWWriteFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString basename );
229extern String BWUnparseStatus ( Widget w );
230extern _XtString BWGetFilename ( Widget w, _XtString *str );
231extern _XtString BWGetBasename ( Widget w, _XtString *str );
232extern void BWChangeBasename ( Widget w, _Xconst _XtString str );
233extern void BWRemoveAllRequests ( Widget w );
234extern void BWClearHotSpot ( Widget w );
235extern Boolean BWQueryMarked ( Widget w );
236extern void BWFold ( Widget w );
237extern void BWClear ( Widget w );
238extern void BWSet ( Widget w );
239extern void BWInvert ( Widget w );
240extern void BWFlipHoriz ( Widget w );
241extern void BWFlipVert ( Widget w );
242extern void BWClearMarked ( Widget w );
243extern Boolean BWAddRequest ( Widget w, BWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size );
244extern void BWChangeNotify ( Widget w );
245extern Pixmap BWGetUnzoomedPixmap ( Widget w );
246extern void BWClearChanged ( Widget w );
247extern Boolean BWQueryStored ( Widget w );
248extern Boolean BWQueryStippled ( Widget w );
249extern void BWSwitchStippled ( Widget w );
250extern void BWRedrawMark ( Widget w );
251extern Boolean BWQueryAxes ( Widget w );
252extern void BWHighlightAxes ( Widget w );
253extern _XtString BWGetFilepath ( Widget w, _XtString *str );
254extern void BWZoomOut ( Widget w );
255extern void BWZoomMarked ( Widget w );
256extern void BWRescale ( Widget w, Dimension width, Dimension height );
257extern Boolean BWQueryZooming ( Widget w );
258extern void BWRedrawGrid ( Widget w, Position x, Position y, Dimension width, Dimension height );
259extern void BWRedrawSquares ( Widget w, Position x, Position y, Dimension width, Dimension height );
260extern void BWRedrawHotSpot ( Widget w );
261extern void BWSetHotSpot(Widget w, Position x, Position y);
262extern Boolean BWQueryGrid ( Widget w );
263extern Boolean BWQueryDashed ( Widget w );
264extern Boolean BWQueryProportional ( Widget w );
265extern void BWSwitchProportional ( Widget w );
266extern void BWDrawGrid ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y );
267extern void BWChangeFilename ( Widget w, _Xconst _XtString str );
268extern Boolean BWParseSize ( String size, Dimension *width, Dimension *height );
269extern Boolean BWQuerySelection ( Widget w, Time btime );
270extern int BWStoreFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString *basename );
271extern void BWNotify ( Widget w, XtActionProc proc );
272extern void BWTMark ( Widget w, XEvent *event, String *params, Cardinal *num_params  );
273extern void BWTMarkAll ( Widget w, XEvent *event, String *params, Cardinal *num_params );
274extern void BWTUnmark ( Widget w, XEvent *event, String *params, Cardinal *num_params );
275extern void BWTPaste ( Widget w, XEvent *event, String *params, Cardinal *num_params );
276extern void BWDebug ( Widget w, XEvent *event, String *params, Cardinal *num_params );
277extern void BWAbort ( Widget w );
278extern Boolean BWRemoveRequest ( Widget w );
279extern void BWRedraw ( Widget w );
280extern Pixmap BWGetPixmap( Widget w );
281
282#endif /* _Bitmap_h */
283
284
285