2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
30 /* $XConsortium: DNDDemo.h /main/4 1995/10/27 10:43:48 rswiston $ */
32 * (c) Copyright 1987, 1988, 1989 HEWLETT-PACKARD COMPANY */
36 * Header file for the program DNDDemo.
40 #include <X11/Xatom.h>
41 #include <X11/Intrinsic.h>
43 #include <Xm/AtomMgr.h>
45 #include <Xm/DrawingA.h>
46 #include <Xm/SeparatoG.h>
48 #include <Xm/RowColumn.h>
50 #include <Xm/MessageB.h>
51 #include <Xm/DragDrop.h>
52 #include <Xm/Screen.h>
55 /* The following is used to layout the color labels */
58 #define BOX_X_OFFSET 95
59 #define BOX_Y_OFFSET 35
60 #define BOX_X_MARGIN 10
61 #define BOX_Y_MARGIN 10
63 /* The following are used in setting up the drag icons */
65 #define ICON_HEIGHT 32
66 #define SMALL_ICON_WIDTH 16
67 #define SMALL_ICON_HEIGHT 16
71 /* Some scales or text entry field could be added to change this value */
73 #define RECT_HEIGHT 50
75 /* The following defines could be setup as application resources */
76 #define RECT_START_COLOR "black"
77 #define HIGHLIGHT_THICKNESS 3
78 #define HIGHLIGHT_COLOR "Black" /* this is equivalent to gray60
80 #define DRAW_AREA_BG_COLOR "white"
81 #define DRAW_AREA_FG_COLOR "black" /* 5127 fix */
82 #define LABEL1_COLOR "#ff5026" /* a slight softer shade of red,
84 #define LABEL2_COLOR "orange"
85 #define LABEL3_COLOR "yellow"
86 #define LABEL4_COLOR "violet"
87 #define LABEL5_COLOR "#00C3ff" /* a blue green color,
89 #define LABEL6_COLOR "green"
91 #define VALID_CURSOR_FG_COLOR "black"
92 #define INVALID_CURSOR_FG_COLOR "maroon"
93 #define NONE_CURSOR_FG_COLOR "maroon"
97 * This struct is used to contain information about each rectangle
98 * to use in the dislay routines
100 typedef struct _RectStruct {
106 Pixmap pixmap; /* currently not in use */
107 } RectStruct, *RectPtr;
109 /* This struct is used to hold global application information */
110 typedef struct _AppInfoRec {
111 GC rectGC; /* graphic context used to draw the rectangles */
112 Pixel currentColor; /* color that is currently in the GC */
113 RectPtr *rectDpyTable; /* the rectangle display table */
114 int rectsAllocd; /* keeps track of how much the above
115 table has been alloc'd */
116 int numRects; /* the number of rects that are visible */
117 RectPtr highlightRect; /* the current highlighted rectangle */
118 RectPtr clearRect; /* the rectangle that is being moved */
119 Boolean doMove; /* indicates that a move is being performed */
120 Boolean creatingRect; /* indicates that a rect create is being
122 unsigned char operation;/* indicates the drop help operation */
123 unsigned int maxCursorWidth; /* the maximum allowable cursor width */
124 unsigned int maxCursorHeight; /* the maximum allowable cursor height */
129 } AppInfoRec, *AppInfo;
132 * This struct is used to pass information
133 * from the dropProc to the transferProc
135 typedef struct _DropTransferRec {
139 } DropTransferRec, *DropTransfer;
142 * This struct is used to pass information
143 * from the rectangle dragStart proc to it's associated
146 typedef struct _DragConvertRec {
149 } DragConvertRec, *DragConvertPtr;
153 extern void InitializeAppInfo(void );
154 extern void StartRect(Widget , XEvent *, String *, Cardinal *);
155 extern void ExtendRect(Widget , XEvent *, String *, Cardinal *);
156 extern void EndRect(Widget , XEvent *, String *, Cardinal *);
157 extern RectPtr RectCreate(Position , Position , Dimension ,
158 Dimension , Pixel , Pixmap );
159 extern RectPtr RectFind(Position , Position );
160 extern void RectSetColor(RectPtr , Display *, Window , Pixel );
161 extern Pixel RectGetColor(RectPtr );
162 extern Pixmap GetBitmapFromRect(Widget , RectPtr , Pixel , Pixel ,
163 Dimension *, Dimension *);
164 extern void RectHide(Display *, Window , RectPtr );
165 extern void RectFree(RectPtr );
166 extern void RedrawRectangles(Widget );
167 extern void RectDrawStippled(Display *, Window , RectPtr );
168 extern void RectHighlight(Widget , RectPtr );
169 extern void RectUnhighlight(Widget );
170 extern void RectSetPixmap(RectPtr , Display *, Window , Pixmap );
171 extern void RectRegister(RectPtr , Position , Position );
172 extern void InitializeRectDpyTable(void );
173 extern void CreateLayout(void );
174 extern void CreateRectGC(void );
175 extern Pixel GetColor(char *);
176 extern void ColorRect(Widget , XEvent *, String *, Cardinal *);
180 /* The following character arrays hold the bits for
181 * the source and state icons for both 32x32 and 16x16 drag icons.
182 * The source is a color palatte icon and the state is a paint brush icon.
184 extern unsigned char SOURCE_ICON_BITS[];
185 extern unsigned char SOURCE_ICON_MASK[];
186 extern unsigned char STATE_ICON_BITS[];
187 extern unsigned char STATE_ICON_MASK[];
188 extern unsigned char INVALID_ICON_BITS[];
189 extern unsigned char SMALL_SOURCE_ICON_BITS[];
190 extern unsigned char SMALL_SOURCE_ICON_MASK[];
191 extern unsigned char SMALL_STATE_ICON_BITS[];
192 extern unsigned char SMALL_STATE_ICON_MASK[];
193 extern unsigned char SMALL_INVALID_ICON_BITS[];
195 /* The folowing character arrays are for use with the drop help
196 * dialogs. For internationalization, message catalogs should
197 * replace these static declarations.
199 extern char HELP_MSG1[];
200 extern char HELP_MSG2[];
201 extern char HELP_MSG3[];
202 extern char HELP_MSG4[];
203 extern char HELP_MSG5[];
206 /* Globals variables */
207 extern AppInfo appInfo;
208 extern Widget topLevel;
209 extern Widget drawingArea;
210 extern Widget helpDialog;
211 extern Widget helpLabel, helpMenu;
212 extern XtAppContext appContext;