1 | /* |
---|
2 | * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC. |
---|
3 | * ALL RIGHTS RESERVED |
---|
4 | */ |
---|
5 | /* |
---|
6 | * Motif Release 1.2.3 |
---|
7 | */ |
---|
8 | #ifdef REV_INFO |
---|
9 | #ifndef lint |
---|
10 | static char rcsid[] = "$RCSfile: WmIconBox.c,v $ $Revision: 1.1.1.1 $ $Date: 1997-03-25 09:12:20 $" |
---|
11 | #endif |
---|
12 | #endif |
---|
13 | /* |
---|
14 | * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */ |
---|
15 | |
---|
16 | /* |
---|
17 | * Included Files: |
---|
18 | */ |
---|
19 | |
---|
20 | #include <X11/StringDefs.h> |
---|
21 | #include <X11/Intrinsic.h> |
---|
22 | #include <X11/Shell.h> |
---|
23 | #include <X11/Xutil.h> |
---|
24 | #include <X11/Vendor.h> |
---|
25 | |
---|
26 | #include <X11/keysymdef.h> |
---|
27 | #include <X11/keysym.h> |
---|
28 | |
---|
29 | |
---|
30 | #include <Xm/Xm.h> |
---|
31 | #include <Xm/DialogS.h> |
---|
32 | #include <Xm/Frame.h> |
---|
33 | #include <Xm/Label.h> |
---|
34 | #include <Xm/PushB.h> |
---|
35 | #include <Xm/DrawnB.h> |
---|
36 | #include <Xm/ScrolledW.h> |
---|
37 | #include <Xm/BulletinB.h> |
---|
38 | #include <Xm/ToggleB.h> |
---|
39 | |
---|
40 | #define MWM_NEED_IIMAGE |
---|
41 | #define MWM_NEED_GREYED75 |
---|
42 | #define MWM_NEED_SLANT2 |
---|
43 | #include "WmIBitmap.h" |
---|
44 | |
---|
45 | #include "WmGlobal.h" |
---|
46 | #include "WmResNames.h" |
---|
47 | |
---|
48 | #include <stdio.h> |
---|
49 | |
---|
50 | #ifndef MAX |
---|
51 | #define MAX(a,b) ((b)>(a)?(b):(a)) |
---|
52 | #endif |
---|
53 | |
---|
54 | /* |
---|
55 | * include extern functions |
---|
56 | */ |
---|
57 | |
---|
58 | #include "WmIconBox.h" |
---|
59 | #include "WmCDInfo.h" |
---|
60 | #include "WmError.h" |
---|
61 | #include "WmEvent.h" |
---|
62 | #include "WmFunction.h" |
---|
63 | #include "WmIDecor.h" |
---|
64 | #include "WmIPlace.h" |
---|
65 | #include "WmImage.h" |
---|
66 | #include "WmManage.h" |
---|
67 | #include "WmMenu.h" |
---|
68 | #include "WmResParse.h" |
---|
69 | #include "WmResource.h" |
---|
70 | #include "WmWinInfo.h" |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | /* |
---|
76 | * Global Variables: |
---|
77 | */ |
---|
78 | |
---|
79 | |
---|
80 | Pixel select_color; |
---|
81 | Pixmap greyedPixmap; |
---|
82 | |
---|
83 | int frameShadowThickness; |
---|
84 | int firstTime = 1; |
---|
85 | Cardinal insertPosition = 0; |
---|
86 | #define DEFAULT_ICON_BOX_TITLE "Icons" |
---|
87 | |
---|
88 | |
---|
89 | /*************************************<->************************************* |
---|
90 | * |
---|
91 | * InitIconBox (pSD) |
---|
92 | * |
---|
93 | * |
---|
94 | * Description: |
---|
95 | * ----------- |
---|
96 | * This function controls creation of icon boxes |
---|
97 | * |
---|
98 | * |
---|
99 | *************************************<->***********************************/ |
---|
100 | #ifdef _NO_PROTO |
---|
101 | void InitIconBox (pSD) |
---|
102 | WmScreenData *pSD; |
---|
103 | #else /* _NO_PROTO */ |
---|
104 | void InitIconBox (WmScreenData *pSD) |
---|
105 | #endif /* _NO_PROTO */ |
---|
106 | |
---|
107 | { |
---|
108 | /* |
---|
109 | * Start the process of making the icon boxes |
---|
110 | */ |
---|
111 | |
---|
112 | |
---|
113 | |
---|
114 | ManageWindow (pSD, NULL, MANAGEW_ICON_BOX); |
---|
115 | |
---|
116 | if (pSD->fadeNormalIcon) |
---|
117 | { |
---|
118 | MakeFadeIconGC (pSD); |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | } /* END OF FUNCTION InitIconBox */ |
---|
123 | |
---|
124 | |
---|
125 | |
---|
126 | /*************************************<->************************************* |
---|
127 | * |
---|
128 | * MakeIconBox (pWS, pCD); |
---|
129 | * |
---|
130 | * |
---|
131 | * Description: |
---|
132 | * ----------- |
---|
133 | * |
---|
134 | * |
---|
135 | * |
---|
136 | * Inputs: |
---|
137 | * ------ |
---|
138 | * pWS = pointer to workspace data |
---|
139 | * pCD = a pointer to ClientData |
---|
140 | * |
---|
141 | * |
---|
142 | * Outputs: |
---|
143 | * ------- |
---|
144 | * |
---|
145 | * Return = (Boolean) True iff successful. |
---|
146 | * |
---|
147 | * |
---|
148 | * Comments: |
---|
149 | * -------- |
---|
150 | * If fails, frees the ClientData structure pointed to by pCD. |
---|
151 | * |
---|
152 | *************************************<->***********************************/ |
---|
153 | |
---|
154 | #ifdef _NO_PROTO |
---|
155 | Boolean MakeIconBox (pWS, pCD) |
---|
156 | WmWorkspaceData *pWS; |
---|
157 | ClientData *pCD; |
---|
158 | |
---|
159 | #else /* _NO_PROTO */ |
---|
160 | Boolean MakeIconBox (WmWorkspaceData *pWS, ClientData *pCD) |
---|
161 | #endif /* _NO_PROTO */ |
---|
162 | { |
---|
163 | IconBoxData *pIBD; |
---|
164 | |
---|
165 | |
---|
166 | /* |
---|
167 | * Make an icon box and return the pCD |
---|
168 | */ |
---|
169 | |
---|
170 | if (pCD) |
---|
171 | { |
---|
172 | if (!(pIBD = (IconBoxData *)XtMalloc (sizeof (IconBoxData)))) |
---|
173 | { |
---|
174 | /* |
---|
175 | * We need a pointer to icon box data to add to the |
---|
176 | * list of icon boxes linked to pWS->pIconBox. If |
---|
177 | * we can't allocate space we need to free the space |
---|
178 | * allocated for the ClientData structure |
---|
179 | */ |
---|
180 | |
---|
181 | Warning ("Insufficient memory to create icon box data"); |
---|
182 | XtFree ((char *)pCD); |
---|
183 | return (FALSE); |
---|
184 | } |
---|
185 | |
---|
186 | InitializeIconBoxData (pWS, pIBD); |
---|
187 | InitializeClientData (pCD, pIBD); |
---|
188 | |
---|
189 | if (!(pIBD->IPD.placeList = |
---|
190 | (IconInfo *)XtMalloc (pIBD->IPD.totalPlaces * sizeof (IconInfo)))) |
---|
191 | { |
---|
192 | Warning ("Insufficient memory to create icon box data"); |
---|
193 | XtFree ((char *)pIBD); |
---|
194 | XtFree ((char *)pCD); |
---|
195 | return (FALSE); |
---|
196 | } |
---|
197 | memset (pIBD->IPD.placeList, NULL, |
---|
198 | pIBD->IPD.totalPlaces * sizeof (IconInfo)); |
---|
199 | |
---|
200 | /* |
---|
201 | * Make the top level shell for this icon box |
---|
202 | */ |
---|
203 | MakeShell (pWS, pIBD); |
---|
204 | |
---|
205 | |
---|
206 | /* |
---|
207 | * Make the scrolled window for this icon box |
---|
208 | */ |
---|
209 | |
---|
210 | MakeScrolledWindow (pWS, pIBD); |
---|
211 | |
---|
212 | /* |
---|
213 | * Make the row column manager for this icon box |
---|
214 | */ |
---|
215 | MakeBulletinBoard (pWS, pIBD); |
---|
216 | |
---|
217 | /* |
---|
218 | * Realize the widget tree and set client data fields |
---|
219 | */ |
---|
220 | |
---|
221 | RealizeIconBox (pWS, pIBD, pCD); |
---|
222 | |
---|
223 | /* |
---|
224 | * Link the new icon box to list of icon boxes |
---|
225 | */ |
---|
226 | AddNewBox (pWS, pIBD); |
---|
227 | } |
---|
228 | |
---|
229 | return (TRUE); |
---|
230 | |
---|
231 | } /* END OF FUNCTION MakeIconBox */ |
---|
232 | |
---|
233 | |
---|
234 | |
---|
235 | /*************************************<->************************************* |
---|
236 | * |
---|
237 | * MakeShell (pWS, pIBD) |
---|
238 | * |
---|
239 | * |
---|
240 | * Description: |
---|
241 | * ----------- |
---|
242 | * |
---|
243 | * |
---|
244 | * |
---|
245 | * Inputs: |
---|
246 | * ------ |
---|
247 | * pWS = pointer to workspace data |
---|
248 | * |
---|
249 | * pIBD = pointer to IconBoxData |
---|
250 | * |
---|
251 | * XXinput = ... |
---|
252 | * |
---|
253 | * |
---|
254 | * Outputs: |
---|
255 | * ------- |
---|
256 | * |
---|
257 | * pIBD->shellWidget |
---|
258 | * |
---|
259 | * |
---|
260 | * Comments: |
---|
261 | * -------- |
---|
262 | * XXComments ... |
---|
263 | * |
---|
264 | *************************************<->***********************************/ |
---|
265 | |
---|
266 | #ifdef _NO_PROTO |
---|
267 | void MakeShell (pWS, pIBD) |
---|
268 | WmWorkspaceData *pWS; |
---|
269 | IconBoxData *pIBD; |
---|
270 | |
---|
271 | #else /* _NO_PROTO */ |
---|
272 | void MakeShell (WmWorkspaceData *pWS, IconBoxData *pIBD) |
---|
273 | #endif /* _NO_PROTO */ |
---|
274 | { |
---|
275 | |
---|
276 | Arg setArgs[20]; |
---|
277 | int i; |
---|
278 | |
---|
279 | /* |
---|
280 | * Create top level application shell for icon box |
---|
281 | */ |
---|
282 | |
---|
283 | i=0; |
---|
284 | |
---|
285 | XtSetArg (setArgs[i], XmNallowShellResize, (XtArgVal)True); i++; |
---|
286 | |
---|
287 | XtSetArg (setArgs[i], XmNborderWidth, (XtArgVal)0); i++; |
---|
288 | |
---|
289 | XtSetArg (setArgs[i], XmNkeyboardFocusPolicy, (XtArgVal)XmEXPLICIT); i++; |
---|
290 | |
---|
291 | if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW)))) |
---|
292 | { |
---|
293 | XtSetArg (setArgs[i], XmNbackground, |
---|
294 | (XtArgVal) pWS->pSD->clientAppearance.background ); i++; |
---|
295 | XtSetArg (setArgs[i], XmNforeground, |
---|
296 | (XtArgVal) pWS->pSD->clientAppearance.foreground ); i++; |
---|
297 | } |
---|
298 | XtSetArg (setArgs[i], XmNmappedWhenManaged, (XtArgVal)False); i++; |
---|
299 | XtSetArg (setArgs[i], XmNdialogStyle, (XtArgVal)XmDIALOG_MODELESS); i++; |
---|
300 | XtSetArg (setArgs[i], XmNdepth, |
---|
301 | (XtArgVal) DefaultDepth (DISPLAY, pWS->pSD->screen)); i++; |
---|
302 | XtSetArg (setArgs[i], XmNscreen, |
---|
303 | (XtArgVal) ScreenOfDisplay (DISPLAY, pWS->pSD->screen)); i++; |
---|
304 | |
---|
305 | pIBD->shellWidget = (Widget) XtCreatePopupShell (WmNiconBox, |
---|
306 | topLevelShellWidgetClass, |
---|
307 | pWS->workspaceTopLevelW, |
---|
308 | (ArgList)setArgs, i); |
---|
309 | |
---|
310 | } /* END OF FUNCTION MakeShell */ |
---|
311 | |
---|
312 | |
---|
313 | |
---|
314 | /*************************************<->************************************* |
---|
315 | * |
---|
316 | * MakeScrolledWindow (pWS, pIBD) |
---|
317 | * |
---|
318 | * |
---|
319 | * Description: |
---|
320 | * ----------- |
---|
321 | * |
---|
322 | * |
---|
323 | * |
---|
324 | * Inputs: |
---|
325 | * ------ |
---|
326 | * pWS = pointer to workspace data |
---|
327 | * pIBD = pointer to IconBoxData |
---|
328 | * XXinput = ... |
---|
329 | * |
---|
330 | * |
---|
331 | * Outputs: |
---|
332 | * ------- |
---|
333 | * |
---|
334 | * Return = pIBD with the pIBD->scrolledWidget set |
---|
335 | * |
---|
336 | * |
---|
337 | * Comments: |
---|
338 | * -------- |
---|
339 | * XXComments ... |
---|
340 | * |
---|
341 | *************************************<->***********************************/ |
---|
342 | |
---|
343 | #ifdef _NO_PROTO |
---|
344 | void MakeScrolledWindow (pWS, pIBD) |
---|
345 | WmWorkspaceData *pWS; |
---|
346 | IconBoxData *pIBD; |
---|
347 | |
---|
348 | #else /* _NO_PROTO */ |
---|
349 | void MakeScrolledWindow (WmWorkspaceData *pWS, IconBoxData *pIBD) |
---|
350 | #endif /* _NO_PROTO */ |
---|
351 | { |
---|
352 | |
---|
353 | Arg setArgs[20]; |
---|
354 | int i; |
---|
355 | |
---|
356 | /* |
---|
357 | * Create frame widget to give the scrolled window |
---|
358 | * an external bevel |
---|
359 | */ |
---|
360 | |
---|
361 | i=0; |
---|
362 | /* |
---|
363 | if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW)))) |
---|
364 | { |
---|
365 | XtSetArg (setArgs[i], XmNbackground, |
---|
366 | (XtArgVal) pWS->pSD->clientAppearance.background ); i++; |
---|
367 | XtSetArg (setArgs[i], XmNforeground, |
---|
368 | (XtArgVal) pWS->pSD->clientAppearance.foreground ); i++; |
---|
369 | } |
---|
370 | */ |
---|
371 | XtSetArg (setArgs[i], XmNborderWidth, (XtArgVal) 0 ); i++; |
---|
372 | XtSetArg (setArgs[i], XmNmarginWidth, (XtArgVal) 0 ); i++; |
---|
373 | XtSetArg (setArgs[i], XmNmarginHeight, (XtArgVal) 0 ); i++; |
---|
374 | XtSetArg (setArgs[i], XmNshadowType, (XtArgVal) XmSHADOW_OUT); i++; |
---|
375 | XtSetArg (setArgs[i], XmNshadowThickness, |
---|
376 | (XtArgVal) frameShadowThickness); i++; |
---|
377 | pIBD->frameWidget = XtCreateManagedWidget ("IBframe", |
---|
378 | xmFrameWidgetClass, |
---|
379 | pIBD->shellWidget, |
---|
380 | (ArgList)setArgs, i); |
---|
381 | |
---|
382 | /* |
---|
383 | * Create scrolled window to hold row column manager |
---|
384 | */ |
---|
385 | |
---|
386 | i=0; |
---|
387 | |
---|
388 | XtSetArg (setArgs[i], XmNscrollingPolicy , (XtArgVal) XmAUTOMATIC ); i++; |
---|
389 | |
---|
390 | XtSetArg (setArgs[i], XmNborderWidth , (XtArgVal) 0 ); i++; |
---|
391 | XtSetArg (setArgs[i], XmNspacing , (XtArgVal) IB_MARGIN_WIDTH ); i++; |
---|
392 | |
---|
393 | if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW)))) |
---|
394 | { |
---|
395 | XtSetArg (setArgs[i], XmNbackground, |
---|
396 | (XtArgVal) pWS->pSD->clientAppearance.background ); i++; |
---|
397 | XtSetArg (setArgs[i], XmNforeground, |
---|
398 | (XtArgVal) pWS->pSD->clientAppearance.foreground ); i++; |
---|
399 | } |
---|
400 | /* |
---|
401 | * do we want to get these from a resource or set it here |
---|
402 | * to control the appearance of the iconBox |
---|
403 | */ |
---|
404 | |
---|
405 | XtSetArg (setArgs[i], XmNscrolledWindowMarginWidth, (XtArgVal) 3); i++; |
---|
406 | XtSetArg (setArgs[i], XmNscrolledWindowMarginHeight, (XtArgVal) 3); i++; |
---|
407 | XtSetArg (setArgs[i], XmNshadowThickness, |
---|
408 | (XtArgVal) FRAME_EXTERNAL_SHADOW_WIDTH); i++; |
---|
409 | |
---|
410 | XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy,(XtArgVal) XmSTATIC ); i++; |
---|
411 | XtSetArg (setArgs[i], XmNvisualPolicy, (XtArgVal) XmVARIABLE ); i++; |
---|
412 | |
---|
413 | pIBD->scrolledWidget = XtCreateManagedWidget ("IBsWindow", |
---|
414 | xmScrolledWindowWidgetClass, |
---|
415 | pIBD->frameWidget, |
---|
416 | (ArgList)setArgs, i); |
---|
417 | |
---|
418 | #ifndef MOTIF_ONE_DOT_ONE |
---|
419 | XtAddCallback(pIBD->scrolledWidget, XmNtraverseObscuredCallback, |
---|
420 | (XtCallbackProc) IconScrollVisibleCallback, (caddr_t)NULL); |
---|
421 | #endif |
---|
422 | |
---|
423 | XtAddEventHandler(pIBD->scrolledWidget, |
---|
424 | StructureNotifyMask, |
---|
425 | False, |
---|
426 | (XtEventHandler)UpdateIncrements, |
---|
427 | (caddr_t) pIBD); |
---|
428 | |
---|
429 | |
---|
430 | |
---|
431 | } /* END OF FUNCTION MakeScrolledWindow */ |
---|
432 | |
---|
433 | |
---|
434 | |
---|
435 | /*************************************<->************************************* |
---|
436 | * |
---|
437 | * MakeBulletinBoard (pWS, pIBD) |
---|
438 | * |
---|
439 | * |
---|
440 | * Description: |
---|
441 | * ----------- |
---|
442 | * |
---|
443 | * |
---|
444 | * |
---|
445 | * Inputs: |
---|
446 | * ------ |
---|
447 | * pWS = pointer to workspace data |
---|
448 | * pIBD = pointer to IconBoxData |
---|
449 | * |
---|
450 | * XXinput = ... |
---|
451 | * |
---|
452 | * |
---|
453 | * Outputs: |
---|
454 | * ------- |
---|
455 | * |
---|
456 | * Return = pIBD with the pIBD->bBoardWidget |
---|
457 | * |
---|
458 | * |
---|
459 | * Comments: |
---|
460 | * -------- |
---|
461 | * XXComments ... |
---|
462 | * |
---|
463 | *************************************<->***********************************/ |
---|
464 | |
---|
465 | #ifdef _NO_PROTO |
---|
466 | void MakeBulletinBoard (pWS, pIBD) |
---|
467 | WmWorkspaceData *pWS; |
---|
468 | IconBoxData *pIBD; |
---|
469 | |
---|
470 | #else /* _NO_PROTO */ |
---|
471 | void MakeBulletinBoard (WmWorkspaceData *pWS, IconBoxData *pIBD) |
---|
472 | #endif /* _NO_PROTO */ |
---|
473 | { |
---|
474 | |
---|
475 | int i; |
---|
476 | Arg setArgs[20]; |
---|
477 | |
---|
478 | /* |
---|
479 | * Create bulletin board to hold icons |
---|
480 | */ |
---|
481 | |
---|
482 | i=0; |
---|
483 | XtSetArg (setArgs[i], XmNborderWidth , 0); i++; |
---|
484 | |
---|
485 | XtSetArg (setArgs[i], XmNshadowThickness,(XtArgVal) 0); i++; |
---|
486 | if (!(Monochrome (XtScreen (pWS->pSD->screenTopLevelW)))) |
---|
487 | { |
---|
488 | XtSetArg (setArgs[i], XmNforeground, |
---|
489 | (XtArgVal) pWS->pSD->clientAppearance.background ); i++; |
---|
490 | XtSetArg (setArgs[i], XmNbottomShadowColor, |
---|
491 | (XtArgVal) pWS->pSD->clientAppearance.bottomShadowColor ); i++; |
---|
492 | XtSetArg (setArgs[i], XmNtopShadowColor, |
---|
493 | (XtArgVal) pWS->pSD->clientAppearance.topShadowColor ); i++; |
---|
494 | } |
---|
495 | |
---|
496 | XtSetArg (setArgs[i], XmNspacing , 0); i++; |
---|
497 | XtSetArg (setArgs[i], XmNmarginHeight , 0); i++; |
---|
498 | XtSetArg (setArgs[i], XmNmarginWidth , 0); i++; |
---|
499 | |
---|
500 | XtSetArg (setArgs[i], XmNdialogStyle, (XtArgVal) XmDIALOG_WORK_AREA); i++; |
---|
501 | |
---|
502 | XtSetArg (setArgs[i], XmNresizePolicy, (XtArgVal) XmRESIZE_NONE); i++; |
---|
503 | XtSetArg (setArgs[i], XmNdefaultPosition , (XtArgVal) False); i++; |
---|
504 | |
---|
505 | XtSetArg (setArgs[i], XtNinsertPosition , InsertPosition); i++; |
---|
506 | |
---|
507 | pIBD->bBoardWidget = XtCreateManagedWidget ("IBbBoard", |
---|
508 | xmBulletinBoardWidgetClass, |
---|
509 | pIBD->scrolledWidget, |
---|
510 | (ArgList)setArgs, i); |
---|
511 | |
---|
512 | } /* END OF FUNCTION MakeBulletinBoard */ |
---|
513 | |
---|
514 | |
---|
515 | |
---|
516 | /*************************************<->************************************* |
---|
517 | * |
---|
518 | * RealizeIconBox (pWS, pIBD, pCD) |
---|
519 | * |
---|
520 | * |
---|
521 | * Description: |
---|
522 | * ----------- |
---|
523 | * |
---|
524 | * |
---|
525 | * |
---|
526 | * Inputs: |
---|
527 | * ------ |
---|
528 | * pWS = pointer to workspace data |
---|
529 | * |
---|
530 | * pIBD = pointer to IconBoxData |
---|
531 | * |
---|
532 | * pCD = pointer to ClientData |
---|
533 | * |
---|
534 | * |
---|
535 | * Outputs: |
---|
536 | * ------- |
---|
537 | * |
---|
538 | |
---|
539 | * Return = pIBD with the pIBD->shellWin set |
---|
540 | * Return = pIBD with the pIBD->scrolledWin set |
---|
541 | * Return = pIBD with the pIBD->bBoardWin set |
---|
542 | |
---|
543 | * |
---|
544 | * Return = pCD with appropriate fields set |
---|
545 | * |
---|
546 | * |
---|
547 | * Comments: |
---|
548 | * -------- |
---|
549 | * XXComments ... |
---|
550 | * |
---|
551 | *************************************<->***********************************/ |
---|
552 | |
---|
553 | #ifdef _NO_PROTO |
---|
554 | void RealizeIconBox (pWS, pIBD, pCD) |
---|
555 | WmWorkspaceData *pWS; |
---|
556 | IconBoxData *pIBD; |
---|
557 | ClientData *pCD; |
---|
558 | |
---|
559 | #else /* _NO_PROTO */ |
---|
560 | void RealizeIconBox (WmWorkspaceData *pWS, IconBoxData *pIBD, ClientData *pCD) |
---|
561 | #endif /* _NO_PROTO */ |
---|
562 | { |
---|
563 | |
---|
564 | int i; |
---|
565 | Arg getArgs[10]; |
---|
566 | Arg setArgs[2]; |
---|
567 | Widget clipWidget; |
---|
568 | Pixmap bgPixmap; |
---|
569 | Pixmap defaultImage; |
---|
570 | |
---|
571 | |
---|
572 | XtRealizeWidget (pIBD->shellWidget); |
---|
573 | |
---|
574 | pCD->client = XtWindow (pIBD->shellWidget); |
---|
575 | |
---|
576 | /* |
---|
577 | * This will set the scrolling granularity for the icon box |
---|
578 | */ |
---|
579 | |
---|
580 | SetGeometry (pWS, pCD, pIBD); |
---|
581 | |
---|
582 | /* |
---|
583 | * Point to the iconBox |
---|
584 | */ |
---|
585 | |
---|
586 | pIBD->pCD_iconBox = pCD; |
---|
587 | pCD->thisIconBox = pIBD; |
---|
588 | /* |
---|
589 | * get the background color of the bulletin board for |
---|
590 | * greyed icon work |
---|
591 | */ |
---|
592 | |
---|
593 | i=0; |
---|
594 | XtSetArg (setArgs[i], XmNbackground, (XtArgVal) select_color ); i++; |
---|
595 | XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i); |
---|
596 | |
---|
597 | |
---|
598 | i=0; |
---|
599 | XtSetArg (getArgs[i], XmNbackgroundPixmap, (XtArgVal) &bgPixmap ); i++; |
---|
600 | XtGetValues (pIBD->bBoardWidget, getArgs, i); |
---|
601 | |
---|
602 | i=0; |
---|
603 | XtSetArg (getArgs[i], XmNclipWindow, (XtArgVal) &clipWidget ); i++; |
---|
604 | XtGetValues (pIBD->scrolledWidget, getArgs, i); |
---|
605 | |
---|
606 | /* |
---|
607 | * Set the background of the clip window for the scrolled |
---|
608 | * window so the default widget background doesn't flash |
---|
609 | */ |
---|
610 | |
---|
611 | i = 0; |
---|
612 | XtSetArg(setArgs[i], XmNbackground, (XtArgVal) select_color); i++; |
---|
613 | XtSetValues (clipWidget, (ArgList) setArgs, i); |
---|
614 | |
---|
615 | |
---|
616 | /* |
---|
617 | * Save the clipWidget id to use in constraining icon moves in box |
---|
618 | */ |
---|
619 | |
---|
620 | pIBD->clipWidget = clipWidget; |
---|
621 | |
---|
622 | MakeShrinkWrapIconsGC (pWS->pSD, bgPixmap); |
---|
623 | |
---|
624 | |
---|
625 | if (pWS->pSD->iconDecoration & ICON_IMAGE_PART) |
---|
626 | { |
---|
627 | /* |
---|
628 | * Make a pixmap to use when iconWindows are unmapped |
---|
629 | */ |
---|
630 | defaultImage = XCreateBitmapFromData (DISPLAY, pWS->pSD->rootWindow, |
---|
631 | (char*)iImage_bits, iImage_width, |
---|
632 | iImage_height); |
---|
633 | |
---|
634 | pWS->pSD->defaultPixmap = MakeIconPixmap (pCD, |
---|
635 | defaultImage, |
---|
636 | NULL, iImage_width, |
---|
637 | iImage_height, 1); |
---|
638 | } |
---|
639 | |
---|
640 | |
---|
641 | } /* END OF FUNCTION RealizeIconBox */ |
---|
642 | |
---|
643 | |
---|
644 | |
---|
645 | /*************************************<->************************************* |
---|
646 | * |
---|
647 | * AddNewBox (pWS, pIBD) |
---|
648 | * |
---|
649 | * |
---|
650 | * Description: |
---|
651 | * ----------- |
---|
652 | * |
---|
653 | * |
---|
654 | * |
---|
655 | * Inputs: |
---|
656 | * ------ |
---|
657 | * pWS = pointer to workspace data |
---|
658 | * |
---|
659 | * pIBD = pointer to IconBoxData |
---|
660 | * |
---|
661 | * |
---|
662 | * Outputs: |
---|
663 | * ------- |
---|
664 | * |
---|
665 | * |
---|
666 | * Comments: |
---|
667 | * -------- |
---|
668 | * Finds the last iconbox on the list starting at pWS->pIconBox and |
---|
669 | * adds the new icon box to the end of the list. |
---|
670 | * |
---|
671 | *************************************<->***********************************/ |
---|
672 | |
---|
673 | #ifdef _NO_PROTO |
---|
674 | void AddNewBox (pWS, pIBD) |
---|
675 | WmWorkspaceData *pWS; |
---|
676 | IconBoxData *pIBD; |
---|
677 | |
---|
678 | #else /* _NO_PROTO */ |
---|
679 | void AddNewBox (WmWorkspaceData *pWS, IconBoxData *pIBD) |
---|
680 | #endif /* _NO_PROTO */ |
---|
681 | { |
---|
682 | |
---|
683 | IconBoxData *pibd; |
---|
684 | |
---|
685 | if (pWS->pIconBox) |
---|
686 | { |
---|
687 | pibd = pWS->pIconBox; |
---|
688 | |
---|
689 | while (pibd->pNextIconBox) |
---|
690 | { |
---|
691 | pibd = pibd->pNextIconBox; |
---|
692 | } |
---|
693 | |
---|
694 | pibd->pNextIconBox = pIBD; |
---|
695 | } |
---|
696 | else |
---|
697 | { |
---|
698 | pWS->pIconBox = pIBD; |
---|
699 | } |
---|
700 | |
---|
701 | |
---|
702 | } /* END OF FUNCTION AddNewBox */ |
---|
703 | |
---|
704 | |
---|
705 | |
---|
706 | /*************************************<->************************************* |
---|
707 | * |
---|
708 | * InitializeIconBoxData (pWS, pIBD) |
---|
709 | * |
---|
710 | * |
---|
711 | * Description: |
---|
712 | * ----------- |
---|
713 | * |
---|
714 | * |
---|
715 | * |
---|
716 | * Inputs: |
---|
717 | * ------ |
---|
718 | * pWS = pointer to Workspace Data |
---|
719 | * |
---|
720 | * pIBD = pointer to IconBoxData |
---|
721 | * |
---|
722 | * |
---|
723 | * Outputs: |
---|
724 | * ------- |
---|
725 | * |
---|
726 | * |
---|
727 | * Comments: |
---|
728 | * -------- |
---|
729 | * Initializes all pIBD fields to NULL |
---|
730 | * |
---|
731 | *************************************<->***********************************/ |
---|
732 | |
---|
733 | #ifdef _NO_PROTO |
---|
734 | void InitializeIconBoxData (pWS, pIBD) |
---|
735 | WmWorkspaceData *pWS; |
---|
736 | IconBoxData *pIBD; |
---|
737 | |
---|
738 | #else /* _NO_PROTO */ |
---|
739 | void InitializeIconBoxData (WmWorkspaceData *pWS, IconBoxData *pIBD) |
---|
740 | #endif /* _NO_PROTO */ |
---|
741 | { |
---|
742 | int mask; |
---|
743 | int X; |
---|
744 | int Y; |
---|
745 | unsigned int width; |
---|
746 | unsigned int height; |
---|
747 | int sW, sH; |
---|
748 | |
---|
749 | frameShadowThickness = FRAME_INTERNAL_SHADOW_WIDTH; |
---|
750 | |
---|
751 | pIBD->numberOfIcons = 0; |
---|
752 | pIBD->currentRow = 0; |
---|
753 | pIBD->currentCol = 0; |
---|
754 | pIBD->lastRow = 0; |
---|
755 | pIBD->lastCol = 0; |
---|
756 | pIBD->IPD.placeList = NULL; |
---|
757 | |
---|
758 | pIBD->scrolledWidget = NULL; |
---|
759 | pIBD->bBoardWidget = NULL; |
---|
760 | pIBD->clipWidget = NULL; |
---|
761 | |
---|
762 | ToLower ((unsigned char *) pWS->pSD->iconBoxSBDisplayPolicy); |
---|
763 | |
---|
764 | if (!((!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "all")) || |
---|
765 | (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "vertical")) || |
---|
766 | (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "horizontal")))) |
---|
767 | { |
---|
768 | strcpy(pWS->pSD->iconBoxSBDisplayPolicy, "all"); |
---|
769 | } |
---|
770 | |
---|
771 | |
---|
772 | |
---|
773 | /* |
---|
774 | * this will be set by the iconPlacement resource if |
---|
775 | * iconBoxGeometry width and height are not specified |
---|
776 | */ |
---|
777 | |
---|
778 | if (pWS->pSD->iconBoxGeometry == NULL) /* not set by user */ |
---|
779 | { |
---|
780 | /* |
---|
781 | * Use the iconPlacement resource |
---|
782 | */ |
---|
783 | |
---|
784 | if (pWS->pSD->iconPlacement & |
---|
785 | (ICON_PLACE_TOP_PRIMARY | ICON_PLACE_BOTTOM_PRIMARY)) |
---|
786 | { |
---|
787 | pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY; |
---|
788 | pIBD->IPD.placementCols = 1; |
---|
789 | pIBD->IPD.placementRows = 6; |
---|
790 | } |
---|
791 | else |
---|
792 | { |
---|
793 | pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY; |
---|
794 | pIBD->IPD.placementCols = 6; |
---|
795 | pIBD->IPD.placementRows = 1; |
---|
796 | } |
---|
797 | |
---|
798 | } |
---|
799 | else |
---|
800 | { |
---|
801 | mask = XParseGeometry(pWS->pSD->iconBoxGeometry, &X, &Y, |
---|
802 | &width, &height); |
---|
803 | |
---|
804 | if ((mask & WidthValue) && (width > 0)) |
---|
805 | { |
---|
806 | pIBD->IPD.placementCols = (int)width; |
---|
807 | } |
---|
808 | else |
---|
809 | { |
---|
810 | pIBD->IPD.placementCols = 6; |
---|
811 | } |
---|
812 | |
---|
813 | if ((mask & HeightValue) && (height > 0)) |
---|
814 | { |
---|
815 | pIBD->IPD.placementRows = (int)height; |
---|
816 | } |
---|
817 | else |
---|
818 | { |
---|
819 | pIBD->IPD.placementRows = 1; |
---|
820 | } |
---|
821 | |
---|
822 | /* |
---|
823 | * Set orientation |
---|
824 | */ |
---|
825 | |
---|
826 | if (pIBD->IPD.placementRows <= pIBD->IPD.placementCols) |
---|
827 | { |
---|
828 | pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY; |
---|
829 | } |
---|
830 | else |
---|
831 | { |
---|
832 | pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY; |
---|
833 | } |
---|
834 | } |
---|
835 | |
---|
836 | |
---|
837 | /* |
---|
838 | * Override orientation if iconBoxSBDisplayPolicy is set to |
---|
839 | * horizontal or vertical |
---|
840 | */ |
---|
841 | |
---|
842 | if (!(strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "vertical"))) |
---|
843 | { |
---|
844 | pIBD->IPD.iconPlacement = ICON_PLACE_LEFT_PRIMARY; |
---|
845 | } |
---|
846 | else if (!(strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "horizontal"))) |
---|
847 | { |
---|
848 | pIBD->IPD.iconPlacement = ICON_PLACE_TOP_PRIMARY; |
---|
849 | } |
---|
850 | |
---|
851 | |
---|
852 | |
---|
853 | |
---|
854 | /* |
---|
855 | * set initial size of placement space to size of screen |
---|
856 | */ |
---|
857 | |
---|
858 | sW = DisplayWidth (DISPLAY, pWS->pSD->screen) / pWS->pSD->iconWidth; |
---|
859 | sH = DisplayHeight (DISPLAY, pWS->pSD->screen) / pWS->pSD->iconHeight; |
---|
860 | |
---|
861 | pIBD->IPD.totalPlaces = sW * sH; |
---|
862 | |
---|
863 | pIBD->IPD.onRootWindow = False; |
---|
864 | |
---|
865 | /* |
---|
866 | * The icon box does not live in an icon box in this version |
---|
867 | */ |
---|
868 | |
---|
869 | pIBD->pNextIconBox =NULL; |
---|
870 | |
---|
871 | |
---|
872 | } /* END OF FUNCTION InitializeIconBoxData */ |
---|
873 | |
---|
874 | |
---|
875 | |
---|
876 | /*************************************<->************************************* |
---|
877 | * |
---|
878 | * SetIconBoxInfo (pWS, pCD) |
---|
879 | * |
---|
880 | * |
---|
881 | * Description: |
---|
882 | * ----------- |
---|
883 | * |
---|
884 | * Inputs: |
---|
885 | * ------ |
---|
886 | * pCD |
---|
887 | * |
---|
888 | * |
---|
889 | * Comments: |
---|
890 | * -------- |
---|
891 | * |
---|
892 | *************************************<->***********************************/ |
---|
893 | |
---|
894 | #ifdef _NO_PROTO |
---|
895 | void SetIconBoxInfo (pWS, pCD) |
---|
896 | WmWorkspaceData *pWS; |
---|
897 | ClientData *pCD; |
---|
898 | #else /* _NO_PROTO */ |
---|
899 | void SetIconBoxInfo (WmWorkspaceData *pWS, ClientData *pCD) |
---|
900 | #endif /* _NO_PROTO */ |
---|
901 | { |
---|
902 | pCD->clientClass = WmCIconBox; |
---|
903 | pCD->clientName = pWS->pSD->iconBoxName; |
---|
904 | ProcessClientResources (pCD); |
---|
905 | |
---|
906 | } /* END OF FUNCTION SetIconBoxInfo */ |
---|
907 | |
---|
908 | |
---|
909 | |
---|
910 | /*************************************<->************************************* |
---|
911 | * |
---|
912 | * InitializeClientData (pCD) |
---|
913 | * |
---|
914 | * |
---|
915 | * Description: |
---|
916 | * ----------- |
---|
917 | * |
---|
918 | * |
---|
919 | * |
---|
920 | * Inputs: |
---|
921 | * ------ |
---|
922 | * pCD |
---|
923 | * |
---|
924 | * |
---|
925 | * Outputs: |
---|
926 | * ------- |
---|
927 | * |
---|
928 | * |
---|
929 | * Comments: |
---|
930 | * -------- |
---|
931 | * Initializes geometry, etc. fields |
---|
932 | * |
---|
933 | *************************************<->***********************************/ |
---|
934 | |
---|
935 | #ifdef _NO_PROTO |
---|
936 | void InitializeClientData (pCD, pIBD) |
---|
937 | ClientData *pCD; |
---|
938 | IconBoxData *pIBD; |
---|
939 | |
---|
940 | #else /* _NO_PROTO */ |
---|
941 | void InitializeClientData (ClientData *pCD, IconBoxData *pIBD) |
---|
942 | #endif /* _NO_PROTO */ |
---|
943 | { |
---|
944 | pCD->internalBevel = FRAME_INTERNAL_SHADOW_WIDTH; |
---|
945 | |
---|
946 | pCD->clientX = 0; |
---|
947 | pCD->clientY = 0; |
---|
948 | |
---|
949 | pCD->clientFlags |= ICON_BOX ; |
---|
950 | |
---|
951 | pCD->widthInc = pIBD->IPD.iPlaceW = ICON_WIDTH(pCD) |
---|
952 | + IB_SPACING |
---|
953 | + (2 * IB_MARGIN_WIDTH); |
---|
954 | |
---|
955 | pCD->heightInc = pIBD->IPD.iPlaceH = ICON_HEIGHT(pCD) |
---|
956 | + IB_SPACING |
---|
957 | + (2 * IB_MARGIN_HEIGHT); |
---|
958 | |
---|
959 | pCD->clientWidth = pIBD->IPD.placementCols * pCD->widthInc; |
---|
960 | pCD->clientHeight = pIBD->IPD.placementRows * pCD->heightInc; |
---|
961 | |
---|
962 | if (!(pCD->pSD->iconBoxTitle)) |
---|
963 | { |
---|
964 | pCD->pSD->iconBoxTitle = |
---|
965 | XmStringCreateLtoR(DEFAULT_ICON_BOX_TITLE, |
---|
966 | XmFONTLIST_DEFAULT_TAG); |
---|
967 | } |
---|
968 | |
---|
969 | pCD->clientTitle = pCD->pSD->iconBoxTitle; |
---|
970 | pCD->iconTitle = pCD->pSD->iconBoxTitle; |
---|
971 | |
---|
972 | } /* END OF FUNCTION InitializeClientData */ |
---|
973 | |
---|
974 | |
---|
975 | |
---|
976 | /*************************************<->************************************* |
---|
977 | * |
---|
978 | * MakeShrinkWrapIconsGC (pSD, bgPixmap) |
---|
979 | * |
---|
980 | * |
---|
981 | * Description: |
---|
982 | * ----------- |
---|
983 | * Make an graphic context to shrink the icons in the icon box |
---|
984 | * box that are not in the MINIMIZED_STATE. |
---|
985 | * |
---|
986 | * |
---|
987 | * Inputs: |
---|
988 | * ------ |
---|
989 | * pSD - pointer to screen data |
---|
990 | * |
---|
991 | * Outputs: |
---|
992 | * ------- |
---|
993 | * Modifies global data |
---|
994 | * |
---|
995 | * Comments: |
---|
996 | * -------- |
---|
997 | * |
---|
998 | * |
---|
999 | *************************************<->***********************************/ |
---|
1000 | |
---|
1001 | #ifdef _NO_PROTO |
---|
1002 | void MakeShrinkWrapIconsGC (pSD, bgPixmap) |
---|
1003 | WmScreenData *pSD; |
---|
1004 | Pixmap bgPixmap; |
---|
1005 | #else /* _NO_PROTO */ |
---|
1006 | void MakeShrinkWrapIconsGC (WmScreenData *pSD, Pixmap bgPixmap) |
---|
1007 | #endif /* _NO_PROTO */ |
---|
1008 | { |
---|
1009 | |
---|
1010 | XtGCMask copyMask; |
---|
1011 | |
---|
1012 | |
---|
1013 | if (!pSD->shrinkWrapGC) |
---|
1014 | { |
---|
1015 | pSD->shrinkWrapGC = XCreateGC (DISPLAY, pSD->rootWindow, 0, |
---|
1016 | (XGCValues *) NULL); |
---|
1017 | |
---|
1018 | copyMask = ~0L; |
---|
1019 | |
---|
1020 | XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC, |
---|
1021 | copyMask, pSD->shrinkWrapGC); |
---|
1022 | |
---|
1023 | if (bgPixmap != XmUNSPECIFIED_PIXMAP) |
---|
1024 | { |
---|
1025 | XSetTile (DISPLAY, pSD->shrinkWrapGC, bgPixmap); |
---|
1026 | XSetFillStyle (DISPLAY, pSD->shrinkWrapGC, FillTiled); |
---|
1027 | XSetBackground (DISPLAY, pSD->shrinkWrapGC, select_color); |
---|
1028 | } |
---|
1029 | else |
---|
1030 | { |
---|
1031 | XSetForeground (DISPLAY, pSD->shrinkWrapGC, select_color); |
---|
1032 | } |
---|
1033 | } |
---|
1034 | |
---|
1035 | } /* END OF FUNCTION MakeShrinkWrapIconsGC */ |
---|
1036 | |
---|
1037 | |
---|
1038 | |
---|
1039 | /*************************************<->************************************* |
---|
1040 | * |
---|
1041 | * MakeFadeIconGC (pSD) |
---|
1042 | * |
---|
1043 | * |
---|
1044 | * Description: |
---|
1045 | * ----------- |
---|
1046 | * Make an graphic context for "greying" the icons in the icon |
---|
1047 | * box that are not in the MINIMIZED_STATE. |
---|
1048 | * |
---|
1049 | * |
---|
1050 | * Inputs: |
---|
1051 | * ------ |
---|
1052 | * pSD = pointer to screen data |
---|
1053 | * |
---|
1054 | * Outputs: |
---|
1055 | * ------- |
---|
1056 | * Modifies global data |
---|
1057 | * |
---|
1058 | * Comments: |
---|
1059 | * -------- |
---|
1060 | * |
---|
1061 | * |
---|
1062 | *************************************<->***********************************/ |
---|
1063 | |
---|
1064 | #ifdef _NO_PROTO |
---|
1065 | void MakeFadeIconGC (pSD) |
---|
1066 | |
---|
1067 | WmScreenData *pSD; |
---|
1068 | #else /* _NO_PROTO */ |
---|
1069 | void MakeFadeIconGC (WmScreenData *pSD) |
---|
1070 | #endif /* _NO_PROTO */ |
---|
1071 | { |
---|
1072 | |
---|
1073 | XtGCMask copyMask; |
---|
1074 | static Pixmap tmpFontClipMask; |
---|
1075 | |
---|
1076 | |
---|
1077 | pSD->fadeIconGC = XCreateGC (DISPLAY, pSD->rootWindow, 0, |
---|
1078 | (XGCValues *) NULL); |
---|
1079 | pSD->fadeIconTextGC = XCreateGC (DISPLAY, pSD->rootWindow, 0, |
---|
1080 | (XGCValues *) NULL); |
---|
1081 | |
---|
1082 | copyMask = ~0L; |
---|
1083 | |
---|
1084 | XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC, |
---|
1085 | copyMask, pSD->fadeIconGC); |
---|
1086 | |
---|
1087 | XCopyGC (DISPLAY, pSD->iconAppearance.inactiveGC, |
---|
1088 | copyMask, pSD->fadeIconTextGC); |
---|
1089 | |
---|
1090 | tmpFontClipMask = XCreateBitmapFromData (DISPLAY, pSD->rootWindow, |
---|
1091 | (char*)greyed75_bits, greyed75_width, greyed75_height); |
---|
1092 | |
---|
1093 | greyedPixmap = XCreateBitmapFromData (DISPLAY, pSD->rootWindow, |
---|
1094 | (char*)slant2_bits, slant2_width, slant2_height); |
---|
1095 | |
---|
1096 | XSetStipple (DISPLAY, pSD->fadeIconTextGC, tmpFontClipMask); |
---|
1097 | XSetFillStyle (DISPLAY, pSD->fadeIconTextGC, FillStippled); |
---|
1098 | |
---|
1099 | XSetStipple (DISPLAY, pSD->fadeIconGC, greyedPixmap); |
---|
1100 | XSetFillStyle (DISPLAY, pSD->fadeIconGC, FillStippled); |
---|
1101 | XSetForeground (DISPLAY, pSD->fadeIconGC, select_color); |
---|
1102 | |
---|
1103 | } /* END OF FUNCTION MakeFadeIconGC */ |
---|
1104 | |
---|
1105 | |
---|
1106 | |
---|
1107 | /*************************************<->************************************* |
---|
1108 | * |
---|
1109 | * SetGeometry (pWS, pCD, pIBD) |
---|
1110 | * |
---|
1111 | * |
---|
1112 | * Description: |
---|
1113 | * ----------- |
---|
1114 | * |
---|
1115 | * |
---|
1116 | * |
---|
1117 | * Inputs: |
---|
1118 | * ------ |
---|
1119 | * pIBD = pointer to IconBoxData |
---|
1120 | * pCD = pointer to ClientData |
---|
1121 | * XXinput = ... |
---|
1122 | * |
---|
1123 | * |
---|
1124 | * Outputs: |
---|
1125 | * ------- |
---|
1126 | * |
---|
1127 | * |
---|
1128 | * |
---|
1129 | * |
---|
1130 | * Comments: |
---|
1131 | * -------- |
---|
1132 | * XXComments ... |
---|
1133 | * |
---|
1134 | *************************************<->***********************************/ |
---|
1135 | |
---|
1136 | #ifdef _NO_PROTO |
---|
1137 | void SetGeometry(pWS, pCD, pIBD) |
---|
1138 | WmWorkspaceData *pWS; |
---|
1139 | ClientData *pCD; |
---|
1140 | IconBoxData *pIBD; |
---|
1141 | |
---|
1142 | #else /* _NO_PROTO */ |
---|
1143 | void SetGeometry (WmWorkspaceData *pWS, ClientData *pCD, IconBoxData *pIBD) |
---|
1144 | #endif /* _NO_PROTO */ |
---|
1145 | { |
---|
1146 | |
---|
1147 | int i; |
---|
1148 | Arg setArgs[10]; |
---|
1149 | |
---|
1150 | int mask; |
---|
1151 | int X; |
---|
1152 | int Y; |
---|
1153 | unsigned int width; |
---|
1154 | unsigned int height; |
---|
1155 | unsigned int boxdim, tmpMin; |
---|
1156 | int diff; |
---|
1157 | unsigned long decoration; |
---|
1158 | |
---|
1159 | /* |
---|
1160 | * Set horizontal and vertical scrolling granularity |
---|
1161 | */ |
---|
1162 | |
---|
1163 | SetGranularity (pWS, pCD, pIBD ); |
---|
1164 | |
---|
1165 | /* |
---|
1166 | * Set the initial width and height of the icon box bulletin board |
---|
1167 | */ |
---|
1168 | |
---|
1169 | i=0; |
---|
1170 | XtSetArg (setArgs[i], XmNwidth, (XtArgVal) pCD->clientWidth); i++; |
---|
1171 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) pCD->clientHeight); i++; |
---|
1172 | XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i); |
---|
1173 | |
---|
1174 | /* |
---|
1175 | * Adjust icon box window height for height of |
---|
1176 | * horizontal scroll bar etc. |
---|
1177 | */ |
---|
1178 | |
---|
1179 | pCD->clientHeight = pCD->clientHeight + pCD->baseHeight; |
---|
1180 | pCD->maxHeight = pCD->clientHeight; |
---|
1181 | |
---|
1182 | /* |
---|
1183 | * Adjust iconbox window width for width of |
---|
1184 | * vertical scroll bar etc. |
---|
1185 | */ |
---|
1186 | |
---|
1187 | pCD->clientWidth = pCD->clientWidth + pCD->baseWidth; |
---|
1188 | pCD->maxWidth = pCD->clientWidth; |
---|
1189 | |
---|
1190 | |
---|
1191 | /* |
---|
1192 | * Check that minWidth is large enough to disallow overlap |
---|
1193 | * of title bar gadgets |
---|
1194 | */ |
---|
1195 | |
---|
1196 | /* compute for minimum frame size */ |
---|
1197 | if ((decoration = pCD->decor) & MWM_DECOR_TITLE) |
---|
1198 | { |
---|
1199 | boxdim = InitTitleBarHeight(pCD); /* macro not valid yet */ |
---|
1200 | tmpMin = boxdim + |
---|
1201 | ((decoration & MWM_DECOR_MENU) ? boxdim : 0) + |
---|
1202 | ((decoration & MWM_DECOR_MINIMIZE) ? boxdim : 0) + |
---|
1203 | ((decoration & MWM_DECOR_MAXIMIZE) ? boxdim : 0) - |
---|
1204 | 2*(pCD->matteWidth); |
---|
1205 | } |
---|
1206 | else { |
---|
1207 | tmpMin = 0; |
---|
1208 | } |
---|
1209 | |
---|
1210 | /* Make: |
---|
1211 | * minWidth >= tmpMin |
---|
1212 | * minWidth >= max (baseWidth, widthInc) > 0 |
---|
1213 | * & an integral number of widthInc from baseWidth. |
---|
1214 | */ |
---|
1215 | |
---|
1216 | if (pCD->minWidth < tmpMin) |
---|
1217 | { |
---|
1218 | if ((diff = ((tmpMin - pCD->baseWidth)%pCD->widthInc)) != 0) |
---|
1219 | { |
---|
1220 | pCD->minWidth = tmpMin + pCD->widthInc - diff; |
---|
1221 | } |
---|
1222 | else |
---|
1223 | { |
---|
1224 | pCD->minWidth = tmpMin; |
---|
1225 | } |
---|
1226 | } |
---|
1227 | |
---|
1228 | if (pCD->minWidth < pCD->baseWidth) |
---|
1229 | { |
---|
1230 | pCD->minWidth = pCD->baseWidth; |
---|
1231 | } |
---|
1232 | |
---|
1233 | if (pCD->minWidth == 0) |
---|
1234 | { |
---|
1235 | pCD->minWidth = pCD->widthInc; |
---|
1236 | } |
---|
1237 | else if ((diff = ((pCD->minWidth - pCD->baseWidth)%pCD->widthInc)) != 0) |
---|
1238 | { |
---|
1239 | pCD->minWidth += pCD->widthInc - diff; |
---|
1240 | } |
---|
1241 | |
---|
1242 | |
---|
1243 | |
---|
1244 | if (pCD->clientWidth < pCD->minWidth) |
---|
1245 | { |
---|
1246 | pCD->clientWidth = pCD->minWidth; |
---|
1247 | } |
---|
1248 | |
---|
1249 | pIBD->IPD.placementCols = (int)((pCD->clientWidth - pCD->baseWidth) |
---|
1250 | / pCD->widthInc); |
---|
1251 | |
---|
1252 | |
---|
1253 | /* |
---|
1254 | * Make: |
---|
1255 | * |
---|
1256 | * maxWidth >= minWidth |
---|
1257 | * & an integral number of widthInc from baseWidth. |
---|
1258 | */ |
---|
1259 | |
---|
1260 | if (pCD->maxWidth < pCD->minWidth) |
---|
1261 | { |
---|
1262 | pCD->maxWidth = pCD->minWidth; |
---|
1263 | } |
---|
1264 | |
---|
1265 | pCD->maxWidthLimit = pCD->maxWidth; |
---|
1266 | |
---|
1267 | pCD->maxWidth -= ((pCD->maxWidth - pCD->baseWidth)% pCD->widthInc); |
---|
1268 | |
---|
1269 | pCD->maxHeightLimit = pCD->maxHeight; |
---|
1270 | |
---|
1271 | |
---|
1272 | /* |
---|
1273 | * Set the initial width and height of the icon box bulletin board |
---|
1274 | */ |
---|
1275 | |
---|
1276 | i=0; |
---|
1277 | XtSetArg (setArgs[i], XmNwidth, (XtArgVal) pCD->clientWidth |
---|
1278 | - pCD->baseWidth ); i++; |
---|
1279 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) pCD->clientHeight |
---|
1280 | - pCD->baseHeight ); i++; |
---|
1281 | XtSetValues (pIBD->bBoardWidget, (ArgList) setArgs, i); |
---|
1282 | |
---|
1283 | |
---|
1284 | /* |
---|
1285 | * Set the initial width and height of the icon box scrolled Window |
---|
1286 | */ |
---|
1287 | |
---|
1288 | i=0; |
---|
1289 | XtSetArg (setArgs[i], XmNwidth, (XtArgVal) |
---|
1290 | (pCD->clientWidth - (2 * frameShadowThickness))); i++; |
---|
1291 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) |
---|
1292 | (pCD->clientHeight - (2 * frameShadowThickness))); i++; |
---|
1293 | |
---|
1294 | XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i); |
---|
1295 | |
---|
1296 | |
---|
1297 | |
---|
1298 | /* |
---|
1299 | * Call SetFrameInfo with fake X and Y so we can get clientOffset |
---|
1300 | */ |
---|
1301 | |
---|
1302 | pCD->xBorderWidth = 0; |
---|
1303 | SetFrameInfo (pCD); |
---|
1304 | |
---|
1305 | |
---|
1306 | /* |
---|
1307 | * Set initial placement of icon box |
---|
1308 | */ |
---|
1309 | |
---|
1310 | mask = XParseGeometry(pCD->pSD->iconBoxGeometry, |
---|
1311 | &X, &Y, &width, &height); |
---|
1312 | |
---|
1313 | if (mask & XValue) |
---|
1314 | { |
---|
1315 | if (mask & XNegative) |
---|
1316 | { |
---|
1317 | pCD->clientX = X |
---|
1318 | + DisplayWidth(DISPLAY, SCREEN_FOR_CLIENT(pCD)) |
---|
1319 | - pCD->clientWidth |
---|
1320 | - pCD->clientOffset.x; |
---|
1321 | } |
---|
1322 | else |
---|
1323 | { |
---|
1324 | pCD->clientX = X + pCD->clientOffset.x; |
---|
1325 | } |
---|
1326 | } |
---|
1327 | else |
---|
1328 | { |
---|
1329 | pCD->clientX = pCD->clientOffset.x; |
---|
1330 | } |
---|
1331 | |
---|
1332 | if (mask & YValue) |
---|
1333 | { |
---|
1334 | if (mask & YNegative) |
---|
1335 | { |
---|
1336 | pCD->clientY = Y |
---|
1337 | + DisplayHeight(DISPLAY, SCREEN_FOR_CLIENT(pCD)) |
---|
1338 | - pCD->clientHeight |
---|
1339 | - pCD->clientOffset.x ; |
---|
1340 | } |
---|
1341 | else |
---|
1342 | { |
---|
1343 | pCD->clientY = Y + pCD->clientOffset.y; |
---|
1344 | } |
---|
1345 | } |
---|
1346 | else |
---|
1347 | { |
---|
1348 | pCD->clientY = pCD->clientOffset.x |
---|
1349 | + DisplayHeight(DISPLAY, SCREEN_FOR_CLIENT(pCD)) |
---|
1350 | - pCD->clientHeight; |
---|
1351 | } |
---|
1352 | |
---|
1353 | |
---|
1354 | PlaceFrameOnScreen (pCD, &pCD->clientX, &pCD->clientY, pCD->clientWidth, |
---|
1355 | pCD->clientHeight); |
---|
1356 | pCD->clientX -= (wmGD.positionIsFrame |
---|
1357 | ? pCD->clientOffset.x |
---|
1358 | : 0); |
---|
1359 | |
---|
1360 | pCD->clientY -= (wmGD.positionIsFrame |
---|
1361 | ? pCD->clientOffset.y |
---|
1362 | : 0); |
---|
1363 | |
---|
1364 | |
---|
1365 | i=0; |
---|
1366 | |
---|
1367 | XtSetArg (setArgs[i], XmNx, (XtArgVal) pCD->clientX); i++; |
---|
1368 | XtSetArg (setArgs[i], XmNy, (XtArgVal) pCD->clientY); i++; |
---|
1369 | |
---|
1370 | XtSetValues (pIBD->shellWidget, (ArgList) setArgs, i); |
---|
1371 | |
---|
1372 | pCD->maxX = pCD->clientX; |
---|
1373 | pCD->maxY = pCD->clientY; |
---|
1374 | |
---|
1375 | |
---|
1376 | } /* END OF FUNCTION SetGeometry */ |
---|
1377 | |
---|
1378 | |
---|
1379 | |
---|
1380 | /*************************************<->************************************* |
---|
1381 | * |
---|
1382 | * SetGranularity (pWS, pCD, pIBD ) |
---|
1383 | * |
---|
1384 | * |
---|
1385 | * Description: |
---|
1386 | * ----------- |
---|
1387 | * |
---|
1388 | * |
---|
1389 | * |
---|
1390 | * Inputs: |
---|
1391 | * ------ |
---|
1392 | * pIBD = pointer to IconBoxData |
---|
1393 | * pCD = pointer to ClientData |
---|
1394 | * XXinput = ... |
---|
1395 | * |
---|
1396 | * |
---|
1397 | * Outputs: |
---|
1398 | * ------- |
---|
1399 | * |
---|
1400 | * |
---|
1401 | * |
---|
1402 | * |
---|
1403 | * Comments: |
---|
1404 | * -------- |
---|
1405 | * XXComments ... |
---|
1406 | * |
---|
1407 | *************************************<->***********************************/ |
---|
1408 | |
---|
1409 | #ifdef _NO_PROTO |
---|
1410 | void SetGranularity(pWS, pCD, pIBD) |
---|
1411 | WmWorkspaceData *pWS; |
---|
1412 | ClientData *pCD; |
---|
1413 | IconBoxData *pIBD; |
---|
1414 | |
---|
1415 | #else /* _NO_PROTO */ |
---|
1416 | void SetGranularity (WmWorkspaceData *pWS, ClientData *pCD, IconBoxData *pIBD) |
---|
1417 | #endif /* _NO_PROTO */ |
---|
1418 | { |
---|
1419 | |
---|
1420 | int i; |
---|
1421 | Dimension hScrollBarHeight = 0; |
---|
1422 | Dimension hBarHeight = 0; |
---|
1423 | Dimension vScrollBarWidth = 0; |
---|
1424 | Dimension vBarWidth = 0; |
---|
1425 | |
---|
1426 | Dimension spacing; |
---|
1427 | short shadowThickness; |
---|
1428 | short marginWidth; |
---|
1429 | short marginHeight; |
---|
1430 | |
---|
1431 | short hShighlightThickness; |
---|
1432 | short vShighlightThickness; |
---|
1433 | |
---|
1434 | Arg setArgs[10]; |
---|
1435 | Arg getArgs[10]; |
---|
1436 | |
---|
1437 | i=0; |
---|
1438 | |
---|
1439 | |
---|
1440 | |
---|
1441 | XtSetArg(getArgs[i], XmNspacing, (XtArgVal) &spacing ); i++; |
---|
1442 | XtSetArg(getArgs[i], XmNshadowThickness, (XtArgVal) &shadowThickness); i++; |
---|
1443 | XtSetArg(getArgs[i], XmNscrolledWindowMarginWidth, |
---|
1444 | (XtArgVal) &marginWidth); i++; |
---|
1445 | XtSetArg(getArgs[i], XmNscrolledWindowMarginHeight, |
---|
1446 | (XtArgVal) &marginHeight); i++; |
---|
1447 | XtSetArg (getArgs[i], XmNverticalScrollBar, |
---|
1448 | (XtArgVal) &pIBD->vScrollBar); i++; |
---|
1449 | XtSetArg(getArgs[i], XmNhorizontalScrollBar, |
---|
1450 | (XtArgVal) &pIBD->hScrollBar); i++; |
---|
1451 | XtGetValues (pIBD->scrolledWidget, getArgs, i); |
---|
1452 | |
---|
1453 | |
---|
1454 | if (strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "vertical")) |
---|
1455 | { |
---|
1456 | |
---|
1457 | /* |
---|
1458 | * Set horizontal scrolling granularity |
---|
1459 | */ |
---|
1460 | i=0; |
---|
1461 | XtSetArg (getArgs[i], XmNheight, (XtArgVal) &hBarHeight ); i++; |
---|
1462 | XtSetArg (getArgs[i], XmNhighlightThickness, |
---|
1463 | (XtArgVal) &hShighlightThickness); i++; |
---|
1464 | XtGetValues (pIBD->hScrollBar, getArgs, i); |
---|
1465 | |
---|
1466 | |
---|
1467 | i=0; |
---|
1468 | XtSetArg(setArgs[i], XmNincrement, (XtArgVal) pCD->widthInc); i++; |
---|
1469 | XtSetArg (setArgs[i], XmNhighlightThickness , |
---|
1470 | IB_HIGHLIGHT_BORDER); i++; |
---|
1471 | XtSetArg(setArgs[i], XmNheight, |
---|
1472 | (XtArgVal) (hBarHeight - (2 * hShighlightThickness)) + |
---|
1473 | (2 * IB_HIGHLIGHT_BORDER)); i++; |
---|
1474 | |
---|
1475 | XtSetValues (pIBD->hScrollBar, (ArgList) setArgs, i); |
---|
1476 | |
---|
1477 | /* |
---|
1478 | * Get hScrollBarHeight and troughColor |
---|
1479 | */ |
---|
1480 | |
---|
1481 | i=0; |
---|
1482 | XtSetArg (getArgs[i], XmNtroughColor, (XtArgVal) &select_color ); i++; |
---|
1483 | XtSetArg (getArgs[i], XmNheight, (XtArgVal) &hScrollBarHeight ); i++; |
---|
1484 | XtGetValues (pIBD->hScrollBar, getArgs, i); |
---|
1485 | |
---|
1486 | } |
---|
1487 | |
---|
1488 | |
---|
1489 | if (strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "horizontal")) |
---|
1490 | { |
---|
1491 | |
---|
1492 | /* |
---|
1493 | * Set vertical scrolling granularity |
---|
1494 | */ |
---|
1495 | i=0; |
---|
1496 | XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &vBarWidth ); i++; |
---|
1497 | XtSetArg (getArgs[i], XmNhighlightThickness, |
---|
1498 | (XtArgVal) &vShighlightThickness); i++; |
---|
1499 | XtGetValues (pIBD->vScrollBar, getArgs, i); |
---|
1500 | |
---|
1501 | |
---|
1502 | i=0; |
---|
1503 | XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->heightInc); i++; |
---|
1504 | XtSetArg (setArgs[i], XmNhighlightThickness , |
---|
1505 | IB_HIGHLIGHT_BORDER); i++; |
---|
1506 | XtSetArg(setArgs[i], XmNwidth, |
---|
1507 | (XtArgVal) (vBarWidth - (2 * vShighlightThickness)) + |
---|
1508 | (2 * IB_HIGHLIGHT_BORDER)); i++; |
---|
1509 | |
---|
1510 | XtSetValues (pIBD->vScrollBar, (ArgList) setArgs, i); |
---|
1511 | |
---|
1512 | /* |
---|
1513 | * Get vScrollBarWidth |
---|
1514 | */ |
---|
1515 | |
---|
1516 | i=0; |
---|
1517 | XtSetArg (getArgs[i], XmNtroughColor, (XtArgVal) &select_color ); i++; |
---|
1518 | XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &vScrollBarWidth ); i++; |
---|
1519 | XtGetValues (pIBD->vScrollBar, getArgs, i); |
---|
1520 | } |
---|
1521 | |
---|
1522 | |
---|
1523 | |
---|
1524 | if (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "vertical")) |
---|
1525 | { |
---|
1526 | XtUnmanageChild(pIBD->hScrollBar); |
---|
1527 | hScrollBarHeight = 0; |
---|
1528 | |
---|
1529 | i=0; |
---|
1530 | XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy, |
---|
1531 | (XtArgVal) XmAS_NEEDED ); i++; |
---|
1532 | XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i); |
---|
1533 | |
---|
1534 | } |
---|
1535 | else if (!strcmp(pWS->pSD->iconBoxSBDisplayPolicy , "horizontal")) |
---|
1536 | { |
---|
1537 | XtUnmanageChild(pIBD->vScrollBar); |
---|
1538 | vScrollBarWidth = 0; |
---|
1539 | |
---|
1540 | i=0; |
---|
1541 | XtSetArg (setArgs[i], XmNscrollBarDisplayPolicy, |
---|
1542 | (XtArgVal) XmAS_NEEDED ); i++; |
---|
1543 | XtSetValues (pIBD->scrolledWidget, (ArgList) setArgs, i); |
---|
1544 | } |
---|
1545 | |
---|
1546 | |
---|
1547 | |
---|
1548 | |
---|
1549 | pCD->baseWidth = IB_SPACING |
---|
1550 | + 2 * IB_HIGHLIGHT_BORDER |
---|
1551 | + spacing |
---|
1552 | + (int) vScrollBarWidth |
---|
1553 | + 2 * frameShadowThickness |
---|
1554 | + (int) 2 * marginWidth |
---|
1555 | + (marginWidth > 0 |
---|
1556 | ? 2 * (int) shadowThickness |
---|
1557 | : shadowThickness); |
---|
1558 | |
---|
1559 | |
---|
1560 | |
---|
1561 | pCD->baseHeight = IB_SPACING |
---|
1562 | + 2 * IB_HIGHLIGHT_BORDER |
---|
1563 | + spacing |
---|
1564 | + (int) hScrollBarHeight |
---|
1565 | + 2 * frameShadowThickness |
---|
1566 | + (int) 2 * marginHeight |
---|
1567 | + (marginHeight > 0 |
---|
1568 | ? 2 * (int) shadowThickness |
---|
1569 | : shadowThickness); |
---|
1570 | |
---|
1571 | pCD->minWidth = pCD->baseWidth + pCD->widthInc; |
---|
1572 | pCD->minHeight = pCD->baseHeight + pCD->heightInc; |
---|
1573 | |
---|
1574 | pCD->maxWidth = pCD->minWidth; |
---|
1575 | |
---|
1576 | pCD->maxHeight = pCD->minHeight; |
---|
1577 | |
---|
1578 | } /* END OF FUNCTION SetGranularity */ |
---|
1579 | |
---|
1580 | |
---|
1581 | |
---|
1582 | /*************************************<->************************************* |
---|
1583 | * |
---|
1584 | * GetIconBoxMenuItems () |
---|
1585 | * |
---|
1586 | * |
---|
1587 | * Description: |
---|
1588 | * ----------- |
---|
1589 | * XXDescription ... |
---|
1590 | * |
---|
1591 | *************************************<->***********************************/ |
---|
1592 | |
---|
1593 | MenuItem *GetIconBoxMenuItems (pSD) |
---|
1594 | |
---|
1595 | WmScreenData *pSD; |
---|
1596 | |
---|
1597 | { |
---|
1598 | |
---|
1599 | return(ParseMwmMenuStr (pSD, |
---|
1600 | (unsigned char *)"\"Pack Icons\" _P Shift Alt<Key>F7 f.pack_icons\n")); |
---|
1601 | |
---|
1602 | } /* END OF FUNCTION GetIconBoxMenuItems */ |
---|
1603 | |
---|
1604 | |
---|
1605 | |
---|
1606 | /*************************************<->************************************* |
---|
1607 | * |
---|
1608 | * MapIconBoxes () |
---|
1609 | * |
---|
1610 | * |
---|
1611 | * Description: |
---|
1612 | * ----------- |
---|
1613 | * |
---|
1614 | * |
---|
1615 | * |
---|
1616 | * Inputs: |
---|
1617 | * ------ |
---|
1618 | * |
---|
1619 | * |
---|
1620 | * Outputs: |
---|
1621 | * ------- |
---|
1622 | * |
---|
1623 | * |
---|
1624 | * Comments: |
---|
1625 | * -------- |
---|
1626 | * Maps all iconboxes on the list starting at pWS->pIconBox |
---|
1627 | * |
---|
1628 | *************************************<->***********************************/ |
---|
1629 | |
---|
1630 | #ifdef _NO_PROTO |
---|
1631 | void MapIconBoxes (pWS) |
---|
1632 | |
---|
1633 | WmWorkspaceData *pWS; |
---|
1634 | #else /* _NO_PROTO */ |
---|
1635 | void MapIconBoxes (WmWorkspaceData *pWS) |
---|
1636 | #endif /* _NO_PROTO */ |
---|
1637 | { |
---|
1638 | |
---|
1639 | IconBoxData *pibd; |
---|
1640 | |
---|
1641 | if (pWS->pIconBox) |
---|
1642 | { |
---|
1643 | pibd = pWS->pIconBox; |
---|
1644 | |
---|
1645 | while (pibd) |
---|
1646 | { |
---|
1647 | XtPopup(pibd->shellWidget, XtGrabNone); |
---|
1648 | F_Raise (NULL, pibd->pCD_iconBox, (XEvent *)NULL); |
---|
1649 | XMapWindow (DISPLAY, pibd->pCD_iconBox->clientFrameWin); |
---|
1650 | pibd = pibd->pNextIconBox; |
---|
1651 | } |
---|
1652 | } |
---|
1653 | |
---|
1654 | |
---|
1655 | } /* END OF FUNCTION MapIconBoxes */ |
---|
1656 | |
---|
1657 | |
---|
1658 | |
---|
1659 | |
---|
1660 | |
---|
1661 | |
---|
1662 | /******************************<->************************************* |
---|
1663 | * |
---|
1664 | * InsertIconIntoBox |
---|
1665 | * |
---|
1666 | * Inputs |
---|
1667 | * ------ |
---|
1668 | * pCD - pointer to data for client to insert |
---|
1669 | * |
---|
1670 | * Description: |
---|
1671 | * ----------- |
---|
1672 | * XXDescription ... |
---|
1673 | * |
---|
1674 | *************************************<->***********************************/ |
---|
1675 | |
---|
1676 | #ifdef _NO_PROTO |
---|
1677 | Boolean InsertIconIntoBox(pIBD, pCD) |
---|
1678 | IconBoxData *pIBD; |
---|
1679 | ClientData *pCD; |
---|
1680 | |
---|
1681 | #else /* _NO_PROTO */ |
---|
1682 | Boolean InsertIconIntoBox (IconBoxData *pIBD, ClientData *pCD) |
---|
1683 | #endif /* _NO_PROTO */ |
---|
1684 | { |
---|
1685 | |
---|
1686 | Boolean rval = False; |
---|
1687 | Arg setArgs[20]; |
---|
1688 | int i; |
---|
1689 | int iconWidth, iconHeight; |
---|
1690 | IconBoxData *tmpPointerToIconBox; |
---|
1691 | Widget iconWidget; |
---|
1692 | IconInfo *pIconInfo; |
---|
1693 | |
---|
1694 | /* |
---|
1695 | * If we go to multiple icon boxes, find the box this client |
---|
1696 | * wants to live in. For now, we only have one, so point to |
---|
1697 | * the first one. |
---|
1698 | */ |
---|
1699 | |
---|
1700 | tmpPointerToIconBox = pIBD; |
---|
1701 | |
---|
1702 | if (pCD->client) |
---|
1703 | { |
---|
1704 | |
---|
1705 | P_ICON_BOX(pCD) = tmpPointerToIconBox; |
---|
1706 | |
---|
1707 | iconWidth = ICON_WIDTH(pCD) |
---|
1708 | + (2 * IB_MARGIN_WIDTH); |
---|
1709 | |
---|
1710 | iconHeight = ICON_HEIGHT(pCD) |
---|
1711 | + (2 * IB_MARGIN_HEIGHT); |
---|
1712 | |
---|
1713 | pIconInfo = InsertIconInfo (P_ICON_BOX(pCD), pCD, (Widget) NULL); |
---|
1714 | |
---|
1715 | if (pIconInfo) |
---|
1716 | { |
---|
1717 | P_ICON_BOX(pCD)->numberOfIcons++; |
---|
1718 | |
---|
1719 | i = 0; |
---|
1720 | XtSetArg (setArgs[i], XmNbackground, |
---|
1721 | (XtArgVal) ICON_APPEARANCE(pCD).background ); i++; |
---|
1722 | XtSetArg (setArgs[i], XmNforeground, |
---|
1723 | (XtArgVal) ICON_APPEARANCE(pCD).foreground ); i++; |
---|
1724 | |
---|
1725 | XtSetArg (setArgs[i], XmNx , (XtArgVal) ICON_X(pCD)); i++; |
---|
1726 | XtSetArg (setArgs[i], XmNy , (XtArgVal) ICON_Y(pCD)); i++; |
---|
1727 | |
---|
1728 | XtSetArg (setArgs[i], XmNwidth , (XtArgVal) iconWidth); i++; |
---|
1729 | XtSetArg (setArgs[i], XmNheight , (XtArgVal) iconHeight); i++; |
---|
1730 | |
---|
1731 | XtSetArg (setArgs[i], XmNborderWidth , (XtArgVal) 0); i++; |
---|
1732 | |
---|
1733 | XtSetArg (setArgs[i], XmNhighlightThickness , |
---|
1734 | IB_HIGHLIGHT_BORDER); i++; |
---|
1735 | |
---|
1736 | XtSetArg (setArgs[i], XmNmarginHeight , (XtArgVal) 0); i++; |
---|
1737 | XtSetArg (setArgs[i], XmNmarginWidth , (XtArgVal) 0); i++; |
---|
1738 | /* |
---|
1739 | * Use type XmString so we don't get a message from XmLabel |
---|
1740 | */ |
---|
1741 | XtSetArg (setArgs[i], XmNlabelType, (XtArgVal) XmSTRING); i++; |
---|
1742 | |
---|
1743 | XtSetArg (setArgs[i], XmNrecomputeSize, (XtArgVal) False); i++; |
---|
1744 | |
---|
1745 | XtSetArg (setArgs[i], XmNtraversalOn, (XtArgVal) True); i++; |
---|
1746 | |
---|
1747 | XtSetArg (setArgs[i], XmNpushButtonEnabled, (XtArgVal) False); i++; |
---|
1748 | |
---|
1749 | XtSetArg (setArgs[i], XmNshadowThickness, (XtArgVal) 0); i++; |
---|
1750 | |
---|
1751 | iconWidget = XtCreateManagedWidget("iconInIconBox", |
---|
1752 | xmDrawnButtonWidgetClass, |
---|
1753 | P_ICON_BOX(pCD)->bBoardWidget, |
---|
1754 | (ArgList)setArgs, i); |
---|
1755 | |
---|
1756 | pIconInfo->theWidget = iconWidget; |
---|
1757 | |
---|
1758 | ICON_FRAME_WIN(pCD) = XtWindow (iconWidget); |
---|
1759 | |
---|
1760 | XtAddCallback (iconWidget, XmNactivateCallback, |
---|
1761 | (XtCallbackProc) IconActivateCallback, (caddr_t)NULL); |
---|
1762 | |
---|
1763 | XtAddEventHandler(iconWidget, |
---|
1764 | SELECT_BUTTON_MOTION_MASK, |
---|
1765 | False, |
---|
1766 | (XtEventHandler)HandleIconBoxButtonMotion, |
---|
1767 | NULL); |
---|
1768 | |
---|
1769 | XtAddEventHandler(iconWidget, |
---|
1770 | DMANIP_BUTTON_MOTION_MASK, |
---|
1771 | False, |
---|
1772 | (XtEventHandler)HandleIconBoxButtonMotion, |
---|
1773 | NULL); |
---|
1774 | |
---|
1775 | XtAddEventHandler(iconWidget, |
---|
1776 | KeyPressMask, |
---|
1777 | False, |
---|
1778 | (XtEventHandler)HandleIconBoxIconKeyPress, |
---|
1779 | NULL); |
---|
1780 | |
---|
1781 | |
---|
1782 | |
---|
1783 | if (ICON_DECORATION(pCD) & ICON_ACTIVE_LABEL_PART) |
---|
1784 | { |
---|
1785 | XtAddEventHandler(iconWidget, |
---|
1786 | FocusChangeMask, |
---|
1787 | False, |
---|
1788 | (XtEventHandler)ChangeActiveIconboxIconText, |
---|
1789 | NULL); |
---|
1790 | |
---|
1791 | if (pCD->pSD->activeLabelParent != pCD->pSD->rootWindow) |
---|
1792 | { |
---|
1793 | XRaiseWindow (DISPLAY, pCD->pSD->activeIconTextWin); |
---|
1794 | } |
---|
1795 | } |
---|
1796 | |
---|
1797 | ResetIconBoxMaxSize(P_ICON_BOX(pCD)->pCD_iconBox, |
---|
1798 | P_ICON_BOX(pCD)->bBoardWidget); |
---|
1799 | |
---|
1800 | ResetArrowButtonIncrements (P_ICON_BOX(pCD)->pCD_iconBox); |
---|
1801 | |
---|
1802 | rval = True; |
---|
1803 | } |
---|
1804 | } |
---|
1805 | return(rval); |
---|
1806 | |
---|
1807 | } /* END FUNCTION InsertIconIntoBox() */ |
---|
1808 | |
---|
1809 | |
---|
1810 | |
---|
1811 | /*************************************<->************************************* |
---|
1812 | * |
---|
1813 | * InsertIconInfo (pIBD, pCD, theWidget) |
---|
1814 | * |
---|
1815 | * |
---|
1816 | * Description: |
---|
1817 | * ----------- |
---|
1818 | * Finds next available spot and inserts the icon |
---|
1819 | * |
---|
1820 | * |
---|
1821 | * Inputs: |
---|
1822 | * ------ |
---|
1823 | * pIBD - pointer to icon box data |
---|
1824 | * pCD - pointer to client data for this client |
---|
1825 | * theWidget - widget containing the icon (may be null) |
---|
1826 | * |
---|
1827 | * Outputs: |
---|
1828 | * ------- |
---|
1829 | * |
---|
1830 | * Comments: |
---|
1831 | * -------- |
---|
1832 | * |
---|
1833 | *************************************<->***********************************/ |
---|
1834 | |
---|
1835 | IconInfo *InsertIconInfo (pIBD, pCD, theWidget) |
---|
1836 | |
---|
1837 | IconBoxData *pIBD; |
---|
1838 | ClientData *pCD; |
---|
1839 | Widget theWidget; |
---|
1840 | |
---|
1841 | { |
---|
1842 | IconInfo *pII; |
---|
1843 | int place; |
---|
1844 | int amt, i; |
---|
1845 | Arg setArgs[3]; |
---|
1846 | Arg getArgs[4]; |
---|
1847 | Dimension clipWidth, clipHeight; |
---|
1848 | |
---|
1849 | place = GetNextIconPlace (&pIBD->IPD); |
---|
1850 | if (place == NO_ICON_PLACE) |
---|
1851 | { |
---|
1852 | if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY) |
---|
1853 | { |
---|
1854 | amt = pIBD->IPD.placementCols; /* add a new row */ |
---|
1855 | } |
---|
1856 | else |
---|
1857 | { |
---|
1858 | amt = pIBD->IPD.placementRows; /* add a new column */ |
---|
1859 | } |
---|
1860 | |
---|
1861 | if (!ExtendIconList (pIBD, amt)) |
---|
1862 | { |
---|
1863 | Warning ("Insufficient memory to create icon box data"); |
---|
1864 | return (NULL); |
---|
1865 | } |
---|
1866 | |
---|
1867 | if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY) |
---|
1868 | { |
---|
1869 | pIBD->IPD.placementRows++; |
---|
1870 | } |
---|
1871 | else |
---|
1872 | { |
---|
1873 | pIBD->IPD.placementCols++; |
---|
1874 | } |
---|
1875 | place = GetNextIconPlace (&pIBD->IPD); |
---|
1876 | } |
---|
1877 | |
---|
1878 | insertPosition = place; |
---|
1879 | |
---|
1880 | /* |
---|
1881 | * Update icon info values |
---|
1882 | */ |
---|
1883 | |
---|
1884 | pII = &pIBD->IPD.placeList[place]; |
---|
1885 | pII->theWidget = theWidget; |
---|
1886 | |
---|
1887 | pII->pCD = pCD; |
---|
1888 | |
---|
1889 | ICON_PLACE(pCD) = place; |
---|
1890 | |
---|
1891 | CvtIconPlaceToPosition (&pIBD->IPD, ICON_PLACE(pCD), |
---|
1892 | &ICON_X(pCD), &ICON_Y(pCD)); |
---|
1893 | |
---|
1894 | |
---|
1895 | /* update next free position */ |
---|
1896 | |
---|
1897 | pIBD->currentCol = ICON_X(pCD) / pIBD->pCD_iconBox->widthInc; |
---|
1898 | pIBD->currentRow = ICON_Y(pCD) / pIBD->pCD_iconBox->heightInc; |
---|
1899 | |
---|
1900 | |
---|
1901 | /* |
---|
1902 | * Increase bboard size if necessary |
---|
1903 | */ |
---|
1904 | i = 0; |
---|
1905 | XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &clipWidth ); i++; |
---|
1906 | XtSetArg (getArgs[i], XmNheight, (XtArgVal) &clipHeight ); i++; |
---|
1907 | XtGetValues (pIBD->clipWidget, getArgs, i); |
---|
1908 | |
---|
1909 | i = 0; |
---|
1910 | if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY) |
---|
1911 | { |
---|
1912 | if (pIBD->currentCol > pIBD->lastCol) |
---|
1913 | { |
---|
1914 | pIBD->lastCol = pIBD->currentCol; |
---|
1915 | } |
---|
1916 | |
---|
1917 | if (pIBD->currentRow > pIBD->lastRow) |
---|
1918 | { |
---|
1919 | pIBD->lastRow = pIBD->currentRow; |
---|
1920 | if (clipHeight <= (pII->pCD->iconY + pIBD->pCD_iconBox->heightInc)) |
---|
1921 | { |
---|
1922 | /* |
---|
1923 | * Increase bulletin board height as needed. |
---|
1924 | */ |
---|
1925 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) |
---|
1926 | pII->pCD->iconY + pIBD->pCD_iconBox->heightInc); i++; |
---|
1927 | } |
---|
1928 | } |
---|
1929 | } |
---|
1930 | else |
---|
1931 | { |
---|
1932 | if (pIBD->currentCol > pIBD->lastCol) |
---|
1933 | { |
---|
1934 | pIBD->lastCol = pIBD->currentCol; |
---|
1935 | if (clipWidth <= (pII->pCD->iconX + pIBD->pCD_iconBox->widthInc)) |
---|
1936 | { |
---|
1937 | /* |
---|
1938 | * Increase bulletin board width as needed |
---|
1939 | */ |
---|
1940 | XtSetArg (setArgs[i], XmNwidth, |
---|
1941 | (XtArgVal) pII->pCD->iconX + |
---|
1942 | pIBD->pCD_iconBox->widthInc); i++; |
---|
1943 | } |
---|
1944 | } |
---|
1945 | |
---|
1946 | if (pIBD->currentRow > pIBD->lastRow) |
---|
1947 | { |
---|
1948 | pIBD->lastRow = pIBD->currentRow; |
---|
1949 | } |
---|
1950 | } |
---|
1951 | |
---|
1952 | if (i > 0) |
---|
1953 | { |
---|
1954 | XtSetValues (pIBD->bBoardWidget, setArgs, i); |
---|
1955 | } |
---|
1956 | |
---|
1957 | return(pII); |
---|
1958 | |
---|
1959 | |
---|
1960 | |
---|
1961 | } /* END OF FUNCTION InsertIconInfo */ |
---|
1962 | |
---|
1963 | |
---|
1964 | |
---|
1965 | /*************************************<->************************************* |
---|
1966 | * |
---|
1967 | * DeleteIconFromBox |
---|
1968 | * |
---|
1969 | * |
---|
1970 | * Description: |
---|
1971 | * ----------- |
---|
1972 | * XXDescription ... |
---|
1973 | * |
---|
1974 | *************************************<->***********************************/ |
---|
1975 | |
---|
1976 | #ifdef _NO_PROTO |
---|
1977 | void DeleteIconFromBox (pIBD, pCD) |
---|
1978 | IconBoxData *pIBD; |
---|
1979 | ClientData *pCD; |
---|
1980 | #else /* _NO_PROTO */ |
---|
1981 | void DeleteIconFromBox (IconBoxData *pIBD, ClientData *pCD) |
---|
1982 | #endif /* _NO_PROTO */ |
---|
1983 | { |
---|
1984 | Widget theChild; |
---|
1985 | ClientData *pCD_tmp; |
---|
1986 | Arg args[4]; |
---|
1987 | Dimension clipWidth, clipHeight; |
---|
1988 | Dimension oldWidth, oldHeight; |
---|
1989 | int newWidth, newHeight; |
---|
1990 | int i, newCols, newRows; |
---|
1991 | |
---|
1992 | i = 0; |
---|
1993 | XtSetArg (args[i], XmNwidth, (XtArgVal) &oldWidth ); i++; |
---|
1994 | XtSetArg (args[i], XmNheight, (XtArgVal) &oldHeight ); i++; |
---|
1995 | XtGetValues (pIBD->bBoardWidget, args, i); |
---|
1996 | |
---|
1997 | i = 0; |
---|
1998 | XtSetArg (args[i], XmNwidth, (XtArgVal) &clipWidth); i++; |
---|
1999 | XtSetArg (args[i], XmNheight, (XtArgVal) &clipHeight ); i++; |
---|
2000 | XtGetValues (pIBD->clipWidget, args, i); |
---|
2001 | |
---|
2002 | clipHeight /= pIBD->pCD_iconBox->heightInc; |
---|
2003 | clipWidth /= pIBD->pCD_iconBox->widthInc; |
---|
2004 | |
---|
2005 | /* |
---|
2006 | * find context of the activeIconTextWin to get pCD and then |
---|
2007 | * if it is the same as this client, hide it. |
---|
2008 | */ |
---|
2009 | |
---|
2010 | if (!(XFindContext (DISPLAY, pCD->pSD->activeIconTextWin, |
---|
2011 | wmGD.windowContextType, (caddr_t *)&pCD_tmp))) |
---|
2012 | { |
---|
2013 | if (pCD == pCD_tmp) |
---|
2014 | { |
---|
2015 | /* hide activeIconTextWin */ |
---|
2016 | HideActiveIconText ((WmScreenData *)NULL); |
---|
2017 | } |
---|
2018 | } |
---|
2019 | |
---|
2020 | DeleteIconInfo (P_ICON_BOX(pCD), pCD); |
---|
2021 | |
---|
2022 | pCD->pIconBox->numberOfIcons--; |
---|
2023 | |
---|
2024 | theChild = XtWindowToWidget (DISPLAY, ICON_FRAME_WIN(pCD)); |
---|
2025 | XtUnmanageChild (theChild); |
---|
2026 | |
---|
2027 | XtDestroyWidget (theChild); |
---|
2028 | |
---|
2029 | /* update last row and col */ |
---|
2030 | |
---|
2031 | SetNewBounds (pIBD); |
---|
2032 | |
---|
2033 | /* resize Bulletin board (so scroll bars show correctly */ |
---|
2034 | i = 0; |
---|
2035 | |
---|
2036 | if (clipWidth <= pIBD->lastCol + 1) |
---|
2037 | { |
---|
2038 | newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc; |
---|
2039 | XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++; |
---|
2040 | newCols = newWidth / pIBD->pCD_iconBox->widthInc; |
---|
2041 | } |
---|
2042 | else |
---|
2043 | { |
---|
2044 | newWidth = clipWidth * pIBD->pCD_iconBox->widthInc; |
---|
2045 | XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++; |
---|
2046 | newCols = newWidth / pIBD->pCD_iconBox->widthInc; |
---|
2047 | } |
---|
2048 | |
---|
2049 | if (clipHeight <= pIBD->lastRow + 1) |
---|
2050 | { |
---|
2051 | /* set height of bboard */ |
---|
2052 | newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc; |
---|
2053 | XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2054 | newRows = newHeight / pIBD->pCD_iconBox->heightInc; |
---|
2055 | } |
---|
2056 | else |
---|
2057 | { |
---|
2058 | newHeight = clipHeight * pIBD->pCD_iconBox->heightInc; |
---|
2059 | XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2060 | newRows = newHeight / pIBD->pCD_iconBox->heightInc; |
---|
2061 | } |
---|
2062 | |
---|
2063 | if (i > 0 && ExpandVirtualSpace(pIBD, newWidth, newHeight)) |
---|
2064 | { |
---|
2065 | XtSetValues (pIBD->bBoardWidget, args, i); |
---|
2066 | RealignIconList (pIBD, newCols, newRows); |
---|
2067 | pIBD->IPD.placementCols = newCols; |
---|
2068 | pIBD->IPD.placementRows = newRows; |
---|
2069 | } |
---|
2070 | |
---|
2071 | |
---|
2072 | /* reset max size for icon box */ |
---|
2073 | ResetIconBoxMaxSize(pIBD->pCD_iconBox, pIBD->bBoardWidget); |
---|
2074 | |
---|
2075 | ResetArrowButtonIncrements (pIBD->pCD_iconBox); |
---|
2076 | |
---|
2077 | } /* END FUNCTION DeleteIconFromBox */ |
---|
2078 | |
---|
2079 | |
---|
2080 | |
---|
2081 | /*************************************<->************************************* |
---|
2082 | * |
---|
2083 | * DeleteIconInfo (pIBD, pCD) |
---|
2084 | * |
---|
2085 | * |
---|
2086 | * Description: |
---|
2087 | * ----------- |
---|
2088 | * Deletes an icon info record from the icon box list based on the |
---|
2089 | * client data pointer. |
---|
2090 | * |
---|
2091 | * |
---|
2092 | * Inputs: |
---|
2093 | * ------ |
---|
2094 | * pIBD - pointer to icon box data |
---|
2095 | * pCD - pointer to client data |
---|
2096 | * |
---|
2097 | * Outputs: |
---|
2098 | * ------- |
---|
2099 | * |
---|
2100 | * |
---|
2101 | * Comments: |
---|
2102 | * -------- |
---|
2103 | * o The deleted item is freed |
---|
2104 | * o Is pCD the correct key???? !!! |
---|
2105 | * |
---|
2106 | *************************************<->***********************************/ |
---|
2107 | #ifdef _NO_PROTO |
---|
2108 | void DeleteIconInfo (pIBD, pCD) |
---|
2109 | |
---|
2110 | IconBoxData *pIBD; |
---|
2111 | ClientData *pCD; |
---|
2112 | #else /* _NO_PROTO */ |
---|
2113 | void DeleteIconInfo (IconBoxData *pIBD, ClientData *pCD) |
---|
2114 | #endif /* _NO_PROTO */ |
---|
2115 | { |
---|
2116 | int ix, count; |
---|
2117 | IconInfo *pII; |
---|
2118 | |
---|
2119 | /* find first matching entry in list */ |
---|
2120 | |
---|
2121 | pII = &pIBD->IPD.placeList[0]; |
---|
2122 | count = pIBD->IPD.totalPlaces; |
---|
2123 | |
---|
2124 | for (ix = 0; ix < count && pII->pCD != pCD; ix++, pII++) |
---|
2125 | { |
---|
2126 | } |
---|
2127 | |
---|
2128 | if (ix < count) |
---|
2129 | { |
---|
2130 | /* found it, zero the entry out */ |
---|
2131 | pII->theWidget = NULL; |
---|
2132 | pII->pCD = NULL; |
---|
2133 | } |
---|
2134 | |
---|
2135 | |
---|
2136 | } /* END FUNCTION DeleteIconInfo */ |
---|
2137 | |
---|
2138 | |
---|
2139 | |
---|
2140 | /*************************************<->************************************* |
---|
2141 | * |
---|
2142 | * ResetIconBoxMaxSize(pCD, bBoardWidget) |
---|
2143 | * |
---|
2144 | * |
---|
2145 | * Description: |
---|
2146 | * ----------- |
---|
2147 | * XXDescription ... |
---|
2148 | * |
---|
2149 | *************************************<->***********************************/ |
---|
2150 | |
---|
2151 | #ifdef _NO_PROTO |
---|
2152 | void ResetIconBoxMaxSize (pCD, bBoardWidget) |
---|
2153 | ClientData *pCD; |
---|
2154 | Widget bBoardWidget; |
---|
2155 | #else /* _NO_PROTO */ |
---|
2156 | void ResetIconBoxMaxSize (ClientData *pCD, Widget bBoardWidget) |
---|
2157 | #endif /* _NO_PROTO */ |
---|
2158 | { |
---|
2159 | int i; |
---|
2160 | Arg getArgs[3]; |
---|
2161 | Dimension newWidth; |
---|
2162 | Dimension newHeight; |
---|
2163 | |
---|
2164 | i=0; |
---|
2165 | XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &newWidth ); i++; |
---|
2166 | XtSetArg (getArgs[i], XmNheight, (XtArgVal) &newHeight ); i++; |
---|
2167 | XtGetValues (bBoardWidget, getArgs, i); |
---|
2168 | |
---|
2169 | pCD->maxWidth = newWidth + pCD->baseWidth; |
---|
2170 | |
---|
2171 | pCD->maxHeight = newHeight + pCD->baseHeight; |
---|
2172 | |
---|
2173 | pCD->maxX = pCD->clientX; |
---|
2174 | pCD->maxY = pCD->clientY; |
---|
2175 | PlaceFrameOnScreen (pCD, &pCD->maxX, &pCD->maxY, |
---|
2176 | pCD->maxWidth, pCD->maxHeight); |
---|
2177 | |
---|
2178 | } /* END OF FUNCTION ResetIconBoxMaxSize */ |
---|
2179 | |
---|
2180 | |
---|
2181 | |
---|
2182 | /*************************************<->************************************* |
---|
2183 | * |
---|
2184 | * CheckIconBoxSize(pIBD) |
---|
2185 | * |
---|
2186 | * |
---|
2187 | * Description: |
---|
2188 | * ----------- |
---|
2189 | * XXDescription ... |
---|
2190 | * |
---|
2191 | *************************************<->***********************************/ |
---|
2192 | |
---|
2193 | #ifdef _NO_PROTO |
---|
2194 | Boolean CheckIconBoxSize (pIBD) |
---|
2195 | IconBoxData *pIBD; |
---|
2196 | #else /* _NO_PROTO */ |
---|
2197 | Boolean CheckIconBoxSize (IconBoxData *pIBD) |
---|
2198 | #endif /* _NO_PROTO */ |
---|
2199 | { |
---|
2200 | int i; |
---|
2201 | Arg getArgs[3]; |
---|
2202 | Arg setArgs[3]; |
---|
2203 | Dimension oldWidth; |
---|
2204 | Dimension oldHeight; |
---|
2205 | Dimension newWidth; |
---|
2206 | Dimension newHeight; |
---|
2207 | int oldCol, oldRow; |
---|
2208 | Boolean rval = True; |
---|
2209 | |
---|
2210 | i=0; |
---|
2211 | XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &oldWidth ); i++; |
---|
2212 | XtSetArg (getArgs[i], XmNheight, (XtArgVal) &oldHeight ); i++; |
---|
2213 | XtGetValues (pIBD->bBoardWidget, getArgs, i); |
---|
2214 | |
---|
2215 | newWidth = oldWidth; |
---|
2216 | newHeight = oldHeight; |
---|
2217 | oldCol = oldWidth / pIBD->pCD_iconBox->widthInc; |
---|
2218 | oldRow = oldHeight / pIBD->pCD_iconBox->heightInc; |
---|
2219 | |
---|
2220 | /* |
---|
2221 | * Increase bboard size if necessary |
---|
2222 | */ |
---|
2223 | |
---|
2224 | i = 0; |
---|
2225 | if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY) |
---|
2226 | { |
---|
2227 | if (oldRow < pIBD->lastRow + 1) |
---|
2228 | { |
---|
2229 | /* |
---|
2230 | * increase bulletin board height as needed |
---|
2231 | */ |
---|
2232 | newHeight = (pIBD->lastRow * pIBD->pCD_iconBox->heightInc) |
---|
2233 | + pIBD->pCD_iconBox->heightInc; |
---|
2234 | |
---|
2235 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight); i++; |
---|
2236 | } |
---|
2237 | } |
---|
2238 | else |
---|
2239 | { |
---|
2240 | if (oldCol < pIBD->lastCol + 1) |
---|
2241 | { |
---|
2242 | /* |
---|
2243 | * increase bulletin board width as needed |
---|
2244 | */ |
---|
2245 | newWidth = (pIBD->lastCol * pIBD->pCD_iconBox->widthInc) |
---|
2246 | + pIBD->pCD_iconBox->widthInc; |
---|
2247 | |
---|
2248 | XtSetArg (setArgs[i], XmNwidth, newWidth); i++; |
---|
2249 | } |
---|
2250 | } |
---|
2251 | |
---|
2252 | if (i > 0) |
---|
2253 | { |
---|
2254 | if (! ExpandVirtualSpace(pIBD, newWidth, newHeight)) |
---|
2255 | { |
---|
2256 | /* |
---|
2257 | * The user has resized the iconbox larger than |
---|
2258 | * memory will allow. Don't honor the resize request |
---|
2259 | */ |
---|
2260 | rval = False; |
---|
2261 | return(rval); |
---|
2262 | } |
---|
2263 | XtSetValues (pIBD->bBoardWidget, setArgs, i); |
---|
2264 | } |
---|
2265 | |
---|
2266 | ResetIconBoxMaxSize(pIBD->pCD_iconBox, pIBD->bBoardWidget); |
---|
2267 | |
---|
2268 | |
---|
2269 | return(rval); |
---|
2270 | |
---|
2271 | } /* END OF FUNCTION CheckIconBoxSize */ |
---|
2272 | |
---|
2273 | |
---|
2274 | |
---|
2275 | /*************************************<->************************************* |
---|
2276 | * |
---|
2277 | * CheckIconBoxResize(pCD, changedValues) |
---|
2278 | * |
---|
2279 | * |
---|
2280 | * Description: |
---|
2281 | * ----------- |
---|
2282 | * XXDescription ... |
---|
2283 | * |
---|
2284 | *************************************<->***********************************/ |
---|
2285 | |
---|
2286 | #ifdef _NO_PROTO |
---|
2287 | void CheckIconBoxResize(pCD, changedValues, newWidth, newHeight) |
---|
2288 | ClientData *pCD; |
---|
2289 | unsigned int changedValues; |
---|
2290 | int newWidth; |
---|
2291 | int newHeight; |
---|
2292 | #else /* _NO_PROTO */ |
---|
2293 | void CheckIconBoxResize (ClientData *pCD, unsigned int changedValues, int newWidth, int newHeight) |
---|
2294 | #endif /* _NO_PROTO */ |
---|
2295 | { |
---|
2296 | |
---|
2297 | Boolean packVert = False; |
---|
2298 | Boolean packHorz = False; |
---|
2299 | WmScreenData *pSD; |
---|
2300 | |
---|
2301 | IconBoxData *pIBD; |
---|
2302 | IconPlacementData *pIPD; |
---|
2303 | int i, newCols, newRows; |
---|
2304 | Arg getArgs[3]; |
---|
2305 | Arg setArgs[3]; |
---|
2306 | Dimension oldWidth; |
---|
2307 | Dimension oldHeight; |
---|
2308 | |
---|
2309 | pIPD = &pCD->thisIconBox->IPD; |
---|
2310 | pIBD = pCD->thisIconBox; |
---|
2311 | |
---|
2312 | pSD = &(wmGD.Screens[SCREEN_FOR_CLIENT(pCD)]); |
---|
2313 | |
---|
2314 | |
---|
2315 | i=0; |
---|
2316 | XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &oldWidth ); i++; |
---|
2317 | XtSetArg (getArgs[i], XmNheight, (XtArgVal) &oldHeight ); i++; |
---|
2318 | XtGetValues (pIBD->bBoardWidget, getArgs, i); |
---|
2319 | |
---|
2320 | newCols = pIPD->placementCols; |
---|
2321 | newRows = pIPD->placementRows; |
---|
2322 | newWidth = newWidth - pCD->baseWidth; |
---|
2323 | newHeight = newHeight - pCD->baseHeight; |
---|
2324 | |
---|
2325 | i = 0; |
---|
2326 | |
---|
2327 | if (changedValues & CWWidth) |
---|
2328 | { |
---|
2329 | /* |
---|
2330 | * There was a change in Width, see if we need to change the |
---|
2331 | * bulletin board |
---|
2332 | */ |
---|
2333 | if (newWidth > oldWidth) |
---|
2334 | { |
---|
2335 | newCols = newWidth / pCD->widthInc; |
---|
2336 | XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++; |
---|
2337 | } |
---|
2338 | |
---|
2339 | if (newWidth < oldWidth) |
---|
2340 | { |
---|
2341 | if ((!strcmp(pSD->iconBoxSBDisplayPolicy, "vertical")) && |
---|
2342 | (newWidth / pCD->widthInc < pIBD->lastCol + 1)) |
---|
2343 | { |
---|
2344 | XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++; |
---|
2345 | newCols = newWidth / pCD->widthInc; |
---|
2346 | packVert = True; |
---|
2347 | } |
---|
2348 | else if (newWidth / pCD->widthInc < pIBD->lastCol + 1) |
---|
2349 | { |
---|
2350 | newWidth = (pIBD->lastCol +1) * pCD->widthInc; |
---|
2351 | XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++; |
---|
2352 | } |
---|
2353 | else |
---|
2354 | { |
---|
2355 | newCols = newWidth / pCD->widthInc; |
---|
2356 | XtSetArg (setArgs[i], XmNwidth, (XtArgVal) newWidth ); i++; |
---|
2357 | } |
---|
2358 | } |
---|
2359 | } |
---|
2360 | else |
---|
2361 | { |
---|
2362 | newWidth = oldWidth; |
---|
2363 | } |
---|
2364 | |
---|
2365 | if (changedValues & CWHeight) |
---|
2366 | { |
---|
2367 | /* |
---|
2368 | * There was a change in Height, see if we need to change the |
---|
2369 | * bulletin board |
---|
2370 | */ |
---|
2371 | if (newHeight > oldHeight) |
---|
2372 | { |
---|
2373 | newRows = newHeight / pCD->heightInc; |
---|
2374 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2375 | } |
---|
2376 | |
---|
2377 | if (newHeight < oldHeight) |
---|
2378 | { |
---|
2379 | if ((!strcmp(pSD->iconBoxSBDisplayPolicy, "horizontal")) && |
---|
2380 | (newHeight / pCD->heightInc < pIBD->lastRow + 1)) |
---|
2381 | { |
---|
2382 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2383 | newRows = newHeight / pCD->heightInc; |
---|
2384 | packHorz = True; |
---|
2385 | } |
---|
2386 | else if (newHeight / pCD->heightInc < pIBD->lastRow + 1) |
---|
2387 | { |
---|
2388 | newHeight = (pIBD->lastRow + 1) * pCD->heightInc; |
---|
2389 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2390 | } |
---|
2391 | else |
---|
2392 | { |
---|
2393 | newRows = newHeight / pCD->heightInc; |
---|
2394 | XtSetArg (setArgs[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2395 | } |
---|
2396 | } |
---|
2397 | } |
---|
2398 | else |
---|
2399 | { |
---|
2400 | newHeight = oldHeight; |
---|
2401 | } |
---|
2402 | |
---|
2403 | if ( i >0 && ExpandVirtualSpace(pIBD, newWidth, newHeight)) |
---|
2404 | { |
---|
2405 | XtSetValues (pIBD->bBoardWidget, setArgs, i); |
---|
2406 | } |
---|
2407 | |
---|
2408 | RealignIconList (pIBD, newCols, newRows); |
---|
2409 | |
---|
2410 | pIPD->placementCols = newCols; |
---|
2411 | pIPD->placementRows = newRows; |
---|
2412 | |
---|
2413 | ResetIconBoxMaxSize(pCD, pIBD->bBoardWidget); |
---|
2414 | |
---|
2415 | /* |
---|
2416 | * Pack the icon box if there are icons that can no longer |
---|
2417 | * be scrolled to due to iconBoxSBDisplayPolicy. |
---|
2418 | */ |
---|
2419 | if (packVert) |
---|
2420 | { |
---|
2421 | PackIconBox (pIBD, packVert, False , newWidth, 0); |
---|
2422 | } |
---|
2423 | else if (packHorz) |
---|
2424 | { |
---|
2425 | PackIconBox (pIBD, False, packHorz , 0, newHeight); |
---|
2426 | } |
---|
2427 | |
---|
2428 | |
---|
2429 | } /* END OF FUNCTION CheckIconBoxResize */ |
---|
2430 | |
---|
2431 | |
---|
2432 | |
---|
2433 | /*************************************<->************************************* |
---|
2434 | * |
---|
2435 | * ExpandVirtualSpace (pIBD, newWidth, newHeight) |
---|
2436 | * |
---|
2437 | * |
---|
2438 | * Description: |
---|
2439 | * ----------- |
---|
2440 | * Add virtural space (really the icon list ) |
---|
2441 | * |
---|
2442 | * |
---|
2443 | * Inputs: |
---|
2444 | * ------ |
---|
2445 | * pIBD - ptr to icon box data |
---|
2446 | * |
---|
2447 | * |
---|
2448 | * Outputs: |
---|
2449 | * ------- |
---|
2450 | * Return - True if successful, False otherwise |
---|
2451 | * |
---|
2452 | * Comments: |
---|
2453 | * -------- |
---|
2454 | * |
---|
2455 | *************************************<->***********************************/ |
---|
2456 | |
---|
2457 | #ifdef _NO_PROTO |
---|
2458 | Boolean ExpandVirtualSpace (pIBD, newWidth, newHeight) |
---|
2459 | IconBoxData *pIBD; |
---|
2460 | int newWidth; |
---|
2461 | int newHeight; |
---|
2462 | #else /* _NO_PROTO */ |
---|
2463 | Boolean ExpandVirtualSpace (IconBoxData *pIBD, int newWidth, int newHeight) |
---|
2464 | #endif /* _NO_PROTO */ |
---|
2465 | { |
---|
2466 | Boolean rval = True; |
---|
2467 | int newSize; |
---|
2468 | int increment; |
---|
2469 | |
---|
2470 | newSize = (newWidth / pIBD->pCD_iconBox->widthInc) * |
---|
2471 | (newHeight / pIBD->pCD_iconBox->heightInc); |
---|
2472 | |
---|
2473 | if (newSize > pIBD->IPD.totalPlaces ) |
---|
2474 | { |
---|
2475 | increment = newSize - pIBD->IPD.totalPlaces; |
---|
2476 | rval = ExtendIconList (pIBD, increment); |
---|
2477 | } |
---|
2478 | |
---|
2479 | return (rval); |
---|
2480 | |
---|
2481 | } /* END OF FUNCTION ExpandVirtualSpace */ |
---|
2482 | |
---|
2483 | |
---|
2484 | |
---|
2485 | /*************************************<->************************************* |
---|
2486 | * |
---|
2487 | * ExtendIconList (pIBD, incr); |
---|
2488 | * |
---|
2489 | * |
---|
2490 | * Description: |
---|
2491 | * ----------- |
---|
2492 | * Add space to the icon list |
---|
2493 | * |
---|
2494 | * |
---|
2495 | * Inputs: |
---|
2496 | * ------ |
---|
2497 | * pIBD - ptr to icon box data |
---|
2498 | * incr - number of cells to add |
---|
2499 | * |
---|
2500 | * |
---|
2501 | * Outputs: |
---|
2502 | * ------- |
---|
2503 | * Return - True if successful, False otherwise |
---|
2504 | * |
---|
2505 | * Comments: |
---|
2506 | * -------- |
---|
2507 | * |
---|
2508 | *************************************<->***********************************/ |
---|
2509 | |
---|
2510 | #ifdef _NO_PROTO |
---|
2511 | Boolean ExtendIconList (pIBD, incr) |
---|
2512 | IconBoxData *pIBD; |
---|
2513 | int incr; |
---|
2514 | #else /* _NO_PROTO */ |
---|
2515 | Boolean ExtendIconList (IconBoxData *pIBD, int incr) |
---|
2516 | #endif /* _NO_PROTO */ |
---|
2517 | { |
---|
2518 | Boolean rval; |
---|
2519 | int newSize; |
---|
2520 | IconInfo *pTmp; |
---|
2521 | |
---|
2522 | newSize = pIBD->IPD.totalPlaces + incr; |
---|
2523 | |
---|
2524 | if ((pTmp = (IconInfo *) XtMalloc (newSize*sizeof(IconInfo))) != NULL) |
---|
2525 | { |
---|
2526 | /* copy data */ |
---|
2527 | memcpy (pTmp, pIBD->IPD.placeList, |
---|
2528 | pIBD->IPD.totalPlaces*sizeof(IconInfo)); |
---|
2529 | memset (&pTmp[pIBD->IPD.totalPlaces], NULL, incr*sizeof(IconInfo)); |
---|
2530 | |
---|
2531 | /* out with the old, in with the new */ |
---|
2532 | XtFree ((char *)pIBD->IPD.placeList); |
---|
2533 | pIBD->IPD.placeList = pTmp; |
---|
2534 | pIBD->IPD.totalPlaces = newSize; |
---|
2535 | rval = True; |
---|
2536 | } |
---|
2537 | else |
---|
2538 | { |
---|
2539 | rval = False; |
---|
2540 | } |
---|
2541 | |
---|
2542 | return (rval); |
---|
2543 | } /* END OF FUNCTION ExtendIconList */ |
---|
2544 | |
---|
2545 | |
---|
2546 | |
---|
2547 | /*************************************<->************************************* |
---|
2548 | * |
---|
2549 | * PackIconBox(pIBD, packVert, packHorz, passedInWidth, passedInHeight) |
---|
2550 | * |
---|
2551 | * |
---|
2552 | * Description: |
---|
2553 | * ----------- |
---|
2554 | * Packs the icons in the icon box |
---|
2555 | * |
---|
2556 | * |
---|
2557 | * Inputs: |
---|
2558 | * ------ |
---|
2559 | * pIBD - pointer to icon box data |
---|
2560 | * |
---|
2561 | * |
---|
2562 | * Outputs: |
---|
2563 | * ------- |
---|
2564 | * |
---|
2565 | * |
---|
2566 | * Comments: |
---|
2567 | * -------- |
---|
2568 | * |
---|
2569 | *************************************<->***********************************/ |
---|
2570 | #ifdef _NO_PROTO |
---|
2571 | void PackIconBox (pIBD, packVert, packHorz, passedInWidth, passedInHeight) |
---|
2572 | |
---|
2573 | IconBoxData *pIBD; |
---|
2574 | Boolean packVert; |
---|
2575 | Boolean packHorz; |
---|
2576 | int passedInWidth; |
---|
2577 | int passedInHeight; |
---|
2578 | |
---|
2579 | #else /* _NO_PROTO */ |
---|
2580 | void PackIconBox (IconBoxData *pIBD, Boolean packVert, Boolean packHorz, int passedInWidth, int passedInHeight) |
---|
2581 | #endif /* _NO_PROTO */ |
---|
2582 | { |
---|
2583 | IconInfo *pII_2, *pII_1; |
---|
2584 | int ix1, ix2; |
---|
2585 | int count; |
---|
2586 | int newX, newY; |
---|
2587 | ClientData *pCD_tmp, *pMyCD; |
---|
2588 | int hasActiveText = 1; |
---|
2589 | Arg args[4]; |
---|
2590 | Dimension majorDimension, minorDimension; |
---|
2591 | Dimension oldWidth, oldHeight; |
---|
2592 | int newWidth, newHeight; |
---|
2593 | int i; |
---|
2594 | Boolean rippling = False; |
---|
2595 | |
---|
2596 | i = 0; |
---|
2597 | XtSetArg (args[i], XmNwidth, (XtArgVal) &oldWidth ); i++; |
---|
2598 | XtSetArg (args[i], XmNheight, (XtArgVal) &oldHeight ); i++; |
---|
2599 | XtGetValues (pIBD->bBoardWidget, args, i); |
---|
2600 | |
---|
2601 | /* |
---|
2602 | * packing to visual space, first update IconBoxData |
---|
2603 | */ |
---|
2604 | |
---|
2605 | i = 0; |
---|
2606 | |
---|
2607 | if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY) |
---|
2608 | { |
---|
2609 | XtSetArg (args[i], XmNwidth, (XtArgVal) &majorDimension ); i++; |
---|
2610 | XtSetArg (args[i], XmNheight, (XtArgVal) &minorDimension ); i++; |
---|
2611 | XtGetValues (pIBD->clipWidget, args, i); |
---|
2612 | if (packVert) |
---|
2613 | { |
---|
2614 | majorDimension = passedInWidth; |
---|
2615 | } |
---|
2616 | |
---|
2617 | minorDimension /= pIBD->pCD_iconBox->heightInc; |
---|
2618 | majorDimension /= pIBD->pCD_iconBox->widthInc; |
---|
2619 | if (majorDimension != pIBD->IPD.placementCols) |
---|
2620 | { |
---|
2621 | pIBD->IPD.placementCols = majorDimension; |
---|
2622 | } |
---|
2623 | } |
---|
2624 | else |
---|
2625 | { |
---|
2626 | XtSetArg (args[i], XmNheight, (XtArgVal) &majorDimension ); i++; |
---|
2627 | XtSetArg (args[i], XmNwidth, (XtArgVal) &minorDimension ); i++; |
---|
2628 | XtGetValues (pIBD->clipWidget, args, i); |
---|
2629 | if (packHorz) |
---|
2630 | { |
---|
2631 | majorDimension = passedInHeight; |
---|
2632 | } |
---|
2633 | |
---|
2634 | minorDimension /= pIBD->pCD_iconBox->widthInc; |
---|
2635 | majorDimension /= pIBD->pCD_iconBox->heightInc; |
---|
2636 | if (majorDimension != pIBD->IPD.placementRows) |
---|
2637 | { |
---|
2638 | pIBD->IPD.placementRows = majorDimension; |
---|
2639 | } |
---|
2640 | } |
---|
2641 | |
---|
2642 | /* |
---|
2643 | * find context of the activeIconTextWin to get pCD and then |
---|
2644 | * if it is the same as this client, hide it. |
---|
2645 | */ |
---|
2646 | |
---|
2647 | pMyCD = pIBD->pCD_iconBox; |
---|
2648 | if (ICON_DECORATION(pMyCD) & ICON_ACTIVE_LABEL_PART) |
---|
2649 | { |
---|
2650 | if (XFindContext (DISPLAY, pMyCD->pSD->activeIconTextWin, |
---|
2651 | wmGD.windowContextType, (caddr_t *)&pCD_tmp)) |
---|
2652 | { |
---|
2653 | hasActiveText = 0; |
---|
2654 | } |
---|
2655 | } |
---|
2656 | |
---|
2657 | pII_2 = pII_1 = pIBD->IPD.placeList; |
---|
2658 | ix1 = ix2 = 0; |
---|
2659 | count = pIBD->IPD.totalPlaces; |
---|
2660 | |
---|
2661 | while (ix1 < count) |
---|
2662 | { |
---|
2663 | if (!rippling && (pII_2->pCD != NULL)) |
---|
2664 | { |
---|
2665 | /* |
---|
2666 | * We need to start rippling the icons into new positions if |
---|
2667 | * their (x,y) position changed |
---|
2668 | */ |
---|
2669 | CvtIconPlaceToPosition (&pIBD->IPD, pII_2->pCD->iconPlace, |
---|
2670 | &newX, &newY); |
---|
2671 | |
---|
2672 | rippling = ((newX != pII_2->pCD->iconX) || |
---|
2673 | (newY != pII_2->pCD->iconY)); |
---|
2674 | } |
---|
2675 | |
---|
2676 | if ((pII_2->pCD == NULL) || rippling) |
---|
2677 | { |
---|
2678 | /* find next one to move */ |
---|
2679 | while ((ix1 < count) && (pII_1->pCD == NULL)) |
---|
2680 | { |
---|
2681 | ix1++; |
---|
2682 | pII_1++; |
---|
2683 | } |
---|
2684 | |
---|
2685 | if ((ix1 < count) && (pII_1->pCD != NULL)) |
---|
2686 | { |
---|
2687 | if (ix1 != ix2) |
---|
2688 | { |
---|
2689 | MoveIconInfo (&pIBD->IPD, ix1, ix2); |
---|
2690 | } |
---|
2691 | |
---|
2692 | CvtIconPlaceToPosition (&pIBD->IPD, ix2, &newX, &newY); |
---|
2693 | |
---|
2694 | pII_2->pCD->iconX = newX; |
---|
2695 | pII_2->pCD->iconY = newY; |
---|
2696 | |
---|
2697 | if (hasActiveText && (pII_2->pCD == pCD_tmp)) |
---|
2698 | { |
---|
2699 | /* hide activeIconTextWin first */ |
---|
2700 | HideActiveIconText ((WmScreenData *)NULL); |
---|
2701 | XtMoveWidget (pII_2->theWidget, newX, newY); |
---|
2702 | ShowActiveIconText (pII_2->pCD); |
---|
2703 | } |
---|
2704 | else |
---|
2705 | { |
---|
2706 | XtMoveWidget (pII_2->theWidget, newX, newY); |
---|
2707 | } |
---|
2708 | } |
---|
2709 | } |
---|
2710 | |
---|
2711 | if (ix1 < count) |
---|
2712 | { |
---|
2713 | ix2++; |
---|
2714 | pII_2++; |
---|
2715 | } |
---|
2716 | |
---|
2717 | ix1++; |
---|
2718 | pII_1++; |
---|
2719 | } |
---|
2720 | |
---|
2721 | /* update last row and col */ |
---|
2722 | |
---|
2723 | SetNewBounds (pIBD); |
---|
2724 | |
---|
2725 | /* resize Bulletin board (so scroll bars show correctly */ |
---|
2726 | i = 0; |
---|
2727 | if (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY) |
---|
2728 | { |
---|
2729 | if (majorDimension <= pIBD->lastCol + 1) |
---|
2730 | { |
---|
2731 | newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc; |
---|
2732 | XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++; |
---|
2733 | } |
---|
2734 | else |
---|
2735 | { |
---|
2736 | newWidth = oldWidth; |
---|
2737 | } |
---|
2738 | |
---|
2739 | if (minorDimension <= pIBD->lastRow + 1) |
---|
2740 | { |
---|
2741 | /* set height of bboard */ |
---|
2742 | newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc; |
---|
2743 | XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2744 | } |
---|
2745 | else |
---|
2746 | { |
---|
2747 | newHeight = minorDimension * pIBD->pCD_iconBox->heightInc; |
---|
2748 | XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2749 | } |
---|
2750 | } |
---|
2751 | else |
---|
2752 | { |
---|
2753 | if (majorDimension <= pIBD->lastRow + 1) |
---|
2754 | { |
---|
2755 | newHeight = (pIBD->lastRow + 1) * pIBD->pCD_iconBox->heightInc; |
---|
2756 | XtSetArg (args[i], XmNheight, (XtArgVal) newHeight ); i++; |
---|
2757 | } |
---|
2758 | else |
---|
2759 | { |
---|
2760 | newHeight = oldHeight; |
---|
2761 | } |
---|
2762 | |
---|
2763 | if (minorDimension <= pIBD->lastCol + 1) |
---|
2764 | { |
---|
2765 | /* set width of bboard */ |
---|
2766 | newWidth = (pIBD->lastCol + 1) * pIBD->pCD_iconBox->widthInc; |
---|
2767 | XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++; |
---|
2768 | } |
---|
2769 | else |
---|
2770 | { |
---|
2771 | newWidth = minorDimension * pIBD->pCD_iconBox->widthInc; |
---|
2772 | XtSetArg (args[i], XmNwidth, (XtArgVal) newWidth); i++; |
---|
2773 | } |
---|
2774 | } |
---|
2775 | |
---|
2776 | if (i > 0 && ExpandVirtualSpace(pIBD, newWidth, newHeight)) |
---|
2777 | { |
---|
2778 | XtSetValues (pIBD->bBoardWidget, args, i); |
---|
2779 | } |
---|
2780 | |
---|
2781 | |
---|
2782 | /* reset max size for icon box */ |
---|
2783 | |
---|
2784 | ResetIconBoxMaxSize (pIBD->pCD_iconBox, pIBD->bBoardWidget); |
---|
2785 | |
---|
2786 | ResetArrowButtonIncrements (pIBD->pCD_iconBox); |
---|
2787 | |
---|
2788 | } /* END FUNCTION PackIconBox */ |
---|
2789 | |
---|
2790 | |
---|
2791 | /*************************************<->************************************* |
---|
2792 | * |
---|
2793 | * RealignIconList (pIBD, newRows, newCols) |
---|
2794 | * |
---|
2795 | * |
---|
2796 | * Description: |
---|
2797 | * ----------- |
---|
2798 | * Realigns the icon list according to the new virtual space dimensions |
---|
2799 | * |
---|
2800 | * |
---|
2801 | * Inputs: |
---|
2802 | * ------ |
---|
2803 | * pIBD - ptr to icon box data |
---|
2804 | * newRows - new number of rows |
---|
2805 | * newCols - new number of columns |
---|
2806 | * |
---|
2807 | * |
---|
2808 | * Outputs: |
---|
2809 | * ------- |
---|
2810 | * |
---|
2811 | * Comments: |
---|
2812 | * -------- |
---|
2813 | * o The placement data structure contains the old values. |
---|
2814 | * |
---|
2815 | *************************************<->***********************************/ |
---|
2816 | |
---|
2817 | #ifdef _NO_PROTO |
---|
2818 | void RealignIconList (pIBD, newCols, newRows) |
---|
2819 | |
---|
2820 | IconBoxData *pIBD; |
---|
2821 | int newRows, newCols; |
---|
2822 | #else /* _NO_PROTO */ |
---|
2823 | void RealignIconList (IconBoxData *pIBD, int newCols, int newRows) |
---|
2824 | #endif /* _NO_PROTO */ |
---|
2825 | { |
---|
2826 | int c1, c2, ix1, ix2; |
---|
2827 | int oldRows, oldCols; |
---|
2828 | IconPlacementData ipdNew; |
---|
2829 | IconInfo *pII; |
---|
2830 | |
---|
2831 | /* |
---|
2832 | * create new icon placement data for ease of calling conversion |
---|
2833 | * routines. |
---|
2834 | */ |
---|
2835 | ipdNew.onRootWindow = pIBD->IPD.onRootWindow; |
---|
2836 | ipdNew.iconPlacement = pIBD->IPD.iconPlacement; |
---|
2837 | ipdNew.placementRows = newRows; |
---|
2838 | ipdNew.placementCols = newCols; |
---|
2839 | ipdNew.iPlaceW = pIBD->IPD.iPlaceW; |
---|
2840 | ipdNew.iPlaceH = pIBD->IPD.iPlaceH; |
---|
2841 | ipdNew.placeList = pIBD->IPD.placeList; |
---|
2842 | ipdNew.totalPlaces = pIBD->IPD.totalPlaces; |
---|
2843 | |
---|
2844 | oldRows = pIBD->IPD.placementRows; |
---|
2845 | oldCols = pIBD->IPD.placementCols; |
---|
2846 | |
---|
2847 | /* |
---|
2848 | * Use the new organization and placement discipline to |
---|
2849 | * determine how to move the icon info data around. |
---|
2850 | */ |
---|
2851 | if (((oldRows < newRows) && |
---|
2852 | (pIBD->IPD.iconPlacement & ICON_PLACE_TOP_PRIMARY)) || |
---|
2853 | ((oldCols < newCols) && |
---|
2854 | (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY))) |
---|
2855 | { |
---|
2856 | /* |
---|
2857 | * work backwards |
---|
2858 | */ |
---|
2859 | for (ix1 = pIBD->IPD.totalPlaces - 1, |
---|
2860 | pII = &pIBD->IPD.placeList[ix1]; ix1 >= 0; ix1--, pII--) |
---|
2861 | { |
---|
2862 | if (pII->pCD != NULL) |
---|
2863 | { |
---|
2864 | CvtIconPlaceToPosition (&pIBD->IPD, ix1, &c1, &c2); |
---|
2865 | ix2 = CvtIconPositionToPlace (&ipdNew, c1, c2); |
---|
2866 | if (ix1 != ix2) |
---|
2867 | { |
---|
2868 | MoveIconInfo (&pIBD->IPD, ix1, ix2); |
---|
2869 | } |
---|
2870 | } |
---|
2871 | } |
---|
2872 | } |
---|
2873 | else |
---|
2874 | if (((oldRows > newRows) && |
---|
2875 | (pIBD->IPD.iconPlacement & ICON_PLACE_TOP_PRIMARY)) || |
---|
2876 | ((oldCols > newCols) && |
---|
2877 | (pIBD->IPD.iconPlacement & ICON_PLACE_LEFT_PRIMARY))) |
---|
2878 | { |
---|
2879 | /* |
---|
2880 | * work forwards |
---|
2881 | */ |
---|
2882 | for (ix1 = 0, pII = &pIBD->IPD.placeList[ix1]; |
---|
2883 | ix1 < pIBD->IPD.totalPlaces; ix1++, pII++) |
---|
2884 | { |
---|
2885 | if (pII->pCD != NULL) |
---|
2886 | { |
---|
2887 | CvtIconPlaceToPosition (&pIBD->IPD, ix1, &c1, &c2); |
---|
2888 | ix2 = CvtIconPositionToPlace (&ipdNew, c1, c2); |
---|
2889 | if (ix1 != ix2) |
---|
2890 | { |
---|
2891 | MoveIconInfo (&pIBD->IPD, ix1, ix2); |
---|
2892 | } |
---|
2893 | } |
---|
2894 | } |
---|
2895 | } |
---|
2896 | |
---|
2897 | /* |
---|
2898 | * update info in placement structure to reflect new reality |
---|
2899 | */ |
---|
2900 | pIBD->IPD.placementRows = newRows; |
---|
2901 | pIBD->IPD.placementCols = newCols; |
---|
2902 | |
---|
2903 | } /* END OF FUNCTION RealignIconList */ |
---|
2904 | |
---|
2905 | |
---|
2906 | |
---|
2907 | |
---|
2908 | /*************************************<->************************************* |
---|
2909 | * |
---|
2910 | * SetNewBounds (pIBD) |
---|
2911 | * |
---|
2912 | * |
---|
2913 | * Description: |
---|
2914 | * ----------- |
---|
2915 | * |
---|
2916 | * |
---|
2917 | * Inputs: |
---|
2918 | * ------ |
---|
2919 | * |
---|
2920 | * |
---|
2921 | * Outputs: |
---|
2922 | * ------- |
---|
2923 | * |
---|
2924 | * Comments: |
---|
2925 | * -------- |
---|
2926 | * |
---|
2927 | *************************************<->***********************************/ |
---|
2928 | |
---|
2929 | #ifdef _NO_PROTO |
---|
2930 | void SetNewBounds (pIBD) |
---|
2931 | |
---|
2932 | IconBoxData *pIBD; |
---|
2933 | |
---|
2934 | #else /* _NO_PROTO */ |
---|
2935 | void SetNewBounds (IconBoxData *pIBD) |
---|
2936 | #endif /* _NO_PROTO */ |
---|
2937 | { |
---|
2938 | |
---|
2939 | int i; |
---|
2940 | int X = 0; |
---|
2941 | int Y = 0; |
---|
2942 | CompositeWidget cw; |
---|
2943 | WidgetList children; |
---|
2944 | |
---|
2945 | cw = (CompositeWidget) pIBD->bBoardWidget; |
---|
2946 | children = cw->composite.children; |
---|
2947 | |
---|
2948 | for (i = 0; i < cw->composite.num_children; i++) |
---|
2949 | { |
---|
2950 | if (children[i]->core.x > X) |
---|
2951 | { |
---|
2952 | X = children[i]->core.x; |
---|
2953 | } |
---|
2954 | if (children[i]->core.y > Y) |
---|
2955 | { |
---|
2956 | Y = children[i]->core.y; |
---|
2957 | } |
---|
2958 | } |
---|
2959 | |
---|
2960 | pIBD->lastCol = X / pIBD->pCD_iconBox->widthInc; |
---|
2961 | pIBD->lastRow = Y / pIBD->pCD_iconBox->heightInc; |
---|
2962 | |
---|
2963 | } /* END OF FUNCTION SetNewBounds */ |
---|
2964 | |
---|
2965 | |
---|
2966 | |
---|
2967 | /*************************************<->************************************* |
---|
2968 | * |
---|
2969 | * InsertPosition (w) |
---|
2970 | * |
---|
2971 | * |
---|
2972 | * Description: |
---|
2973 | * ----------- |
---|
2974 | * This procedure is passed to the bulletin board at create time |
---|
2975 | * to be used when a child is inserted into the bulletin board |
---|
2976 | * |
---|
2977 | * |
---|
2978 | *************************************<->***********************************/ |
---|
2979 | #ifdef _NO_PROTO |
---|
2980 | Cardinal InsertPosition (w) |
---|
2981 | Widget w; |
---|
2982 | |
---|
2983 | #else /* _NO_PROTO */ |
---|
2984 | Cardinal InsertPosition (Widget w) |
---|
2985 | #endif /* _NO_PROTO */ |
---|
2986 | { |
---|
2987 | return (insertPosition); |
---|
2988 | |
---|
2989 | } /* END OF FUNCTION InsertPosition */ |
---|
2990 | |
---|
2991 | |
---|
2992 | |
---|
2993 | /*************************************<->************************************* |
---|
2994 | * |
---|
2995 | * ShowClientIconState (); |
---|
2996 | * |
---|
2997 | * |
---|
2998 | * Description: |
---|
2999 | * ----------- |
---|
3000 | * XXDescription ... |
---|
3001 | * |
---|
3002 | *************************************<->***********************************/ |
---|
3003 | |
---|
3004 | #ifdef _NO_PROTO |
---|
3005 | void ShowClientIconState (pCD, newState) |
---|
3006 | ClientData *pCD; |
---|
3007 | int newState; |
---|
3008 | #else /* _NO_PROTO */ |
---|
3009 | void ShowClientIconState (ClientData *pCD, int newState) |
---|
3010 | #endif /* _NO_PROTO */ |
---|
3011 | { |
---|
3012 | |
---|
3013 | /* |
---|
3014 | * Changing the appearance of an icon window in the box to |
---|
3015 | * reflect the client's state |
---|
3016 | */ |
---|
3017 | |
---|
3018 | if ((newState == MINIMIZED_STATE) && (pCD->iconWindow)) |
---|
3019 | XMapRaised (DISPLAY, pCD->iconWindow); |
---|
3020 | |
---|
3021 | if (((newState == NORMAL_STATE) || (newState == MAXIMIZED_STATE )) |
---|
3022 | && (pCD->iconWindow)) |
---|
3023 | { |
---|
3024 | XUnmapWindow (DISPLAY, pCD->iconWindow); |
---|
3025 | } |
---|
3026 | |
---|
3027 | } /* END FUNCTION ShowClientIconState */ |
---|
3028 | |
---|
3029 | |
---|
3030 | |
---|
3031 | #ifndef MOTIF_ONE_DOT_ONE |
---|
3032 | /*************************************<->************************************* |
---|
3033 | * |
---|
3034 | * IconScrollVisibleCallback |
---|
3035 | * |
---|
3036 | * |
---|
3037 | * Description: |
---|
3038 | * ----------- |
---|
3039 | * for each icon in the icon box |
---|
3040 | * |
---|
3041 | *************************************<->***********************************/ |
---|
3042 | |
---|
3043 | #ifdef _NO_PROTO |
---|
3044 | void IconScrollVisibleCallback(w, client_data, call_data) |
---|
3045 | Widget w; |
---|
3046 | caddr_t client_data; |
---|
3047 | XmAnyCallbackStruct *call_data; |
---|
3048 | |
---|
3049 | #else /* _NO_PROTO */ |
---|
3050 | void IconScrollVisibleCallback (Widget w, caddr_t client_data, XmAnyCallbackStruct *call_data) |
---|
3051 | #endif /* _NO_PROTO */ |
---|
3052 | { |
---|
3053 | XmTraverseObscuredCallbackStruct *vis_data; |
---|
3054 | |
---|
3055 | vis_data = (XmTraverseObscuredCallbackStruct *) call_data; |
---|
3056 | |
---|
3057 | XmScrollVisible(ACTIVE_WS->pIconBox->scrolledWidget, |
---|
3058 | vis_data->traversal_destination, |
---|
3059 | 0,0); |
---|
3060 | /* |
---|
3061 | IB_MARGIN_WIDTH, IB_MARGIN_HEIGHT); |
---|
3062 | */ |
---|
3063 | } /* END OF FUNCTION IconScrollVisibleCallback */ |
---|
3064 | |
---|
3065 | #endif |
---|
3066 | |
---|
3067 | |
---|
3068 | /*************************************<->************************************* |
---|
3069 | * |
---|
3070 | * IconActivateCallback |
---|
3071 | * |
---|
3072 | * |
---|
3073 | * Description: |
---|
3074 | * ----------- |
---|
3075 | * for each icon in the icon box |
---|
3076 | * |
---|
3077 | *************************************<->***********************************/ |
---|
3078 | |
---|
3079 | #ifdef _NO_PROTO |
---|
3080 | void IconActivateCallback(w, client_data, call_data) |
---|
3081 | Widget w; |
---|
3082 | caddr_t client_data; |
---|
3083 | XmAnyCallbackStruct *call_data; |
---|
3084 | |
---|
3085 | #else /* _NO_PROTO */ |
---|
3086 | void IconActivateCallback (Widget w, caddr_t client_data, XmAnyCallbackStruct *call_data) |
---|
3087 | #endif /* _NO_PROTO */ |
---|
3088 | { |
---|
3089 | ClientData *pCD; |
---|
3090 | Window theIcon; |
---|
3091 | |
---|
3092 | theIcon = XtWindow(w); |
---|
3093 | |
---|
3094 | /* |
---|
3095 | * find context to get pCD and then carry out |
---|
3096 | * default action. |
---|
3097 | */ |
---|
3098 | |
---|
3099 | if (!(XFindContext (DISPLAY, theIcon, |
---|
3100 | wmGD.windowContextType, (caddr_t *)&pCD))) |
---|
3101 | { |
---|
3102 | F_Restore_And_Raise ((String)NULL, pCD, (XEvent *)NULL ); |
---|
3103 | /* F_Normalize_And_Raise ((String)NULL, pCD, (XEvent *)NULL ); |
---|
3104 | */ } |
---|
3105 | |
---|
3106 | } /* END OF FUNCTION IconActivateCallback */ |
---|
3107 | |
---|
3108 | |
---|
3109 | |
---|
3110 | /*************************************<->************************************* |
---|
3111 | * |
---|
3112 | * UpdateIncrements |
---|
3113 | * |
---|
3114 | * |
---|
3115 | * Description: |
---|
3116 | * ----------- |
---|
3117 | * XXDescription ... |
---|
3118 | * |
---|
3119 | *************************************<->***********************************/ |
---|
3120 | |
---|
3121 | #ifdef _NO_PROTO |
---|
3122 | void UpdateIncrements (sWidget, pIBD, event) |
---|
3123 | Widget sWidget; |
---|
3124 | IconBoxData *pIBD; |
---|
3125 | XConfigureEvent *event; |
---|
3126 | |
---|
3127 | #else /* _NO_PROTO */ |
---|
3128 | void UpdateIncrements (Widget sWidget, IconBoxData *pIBD, XConfigureEvent *event) |
---|
3129 | #endif /* _NO_PROTO */ |
---|
3130 | { |
---|
3131 | ResetArrowButtonIncrements (pIBD->pCD_iconBox); |
---|
3132 | |
---|
3133 | } /* END OF FUNCTION UpdateIncrements */ |
---|
3134 | |
---|
3135 | |
---|
3136 | /*************************************<->************************************* |
---|
3137 | * |
---|
3138 | * ResetArrowButtonIncrements(pCD) |
---|
3139 | * |
---|
3140 | *************************************<->***********************************/ |
---|
3141 | |
---|
3142 | #ifdef _NO_PROTO |
---|
3143 | void ResetArrowButtonIncrements(pCD) |
---|
3144 | ClientData *pCD; |
---|
3145 | #else /* _NO_PROTO */ |
---|
3146 | void ResetArrowButtonIncrements (ClientData *pCD) |
---|
3147 | #endif /* _NO_PROTO */ |
---|
3148 | { |
---|
3149 | int i; |
---|
3150 | Arg setArgs[2]; |
---|
3151 | |
---|
3152 | i=0; |
---|
3153 | XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->heightInc); i++; |
---|
3154 | XtSetValues (pCD->thisIconBox->vScrollBar, (ArgList) setArgs, i); |
---|
3155 | |
---|
3156 | i=0; |
---|
3157 | XtSetArg (setArgs[i], XmNincrement, (XtArgVal) pCD->widthInc); i++; |
---|
3158 | XtSetValues (pCD->thisIconBox->hScrollBar, (ArgList) setArgs, i); |
---|
3159 | |
---|
3160 | } /* END OF FUNCTION ResetArrowButtonIncrements */ |
---|
3161 | |
---|
3162 | |
---|
3163 | |
---|
3164 | /*************************************<->************************************* |
---|
3165 | * |
---|
3166 | * ChangeActiveIconboxIconText |
---|
3167 | * |
---|
3168 | * |
---|
3169 | * Description: |
---|
3170 | * ----------- |
---|
3171 | * XXDescription ... |
---|
3172 | * |
---|
3173 | *************************************<->***********************************/ |
---|
3174 | |
---|
3175 | #ifdef _NO_PROTO |
---|
3176 | void ChangeActiveIconboxIconText (icon, dummy, event) |
---|
3177 | Widget icon; |
---|
3178 | caddr_t dummy; |
---|
3179 | XFocusChangeEvent *event; |
---|
3180 | |
---|
3181 | #else /* _NO_PROTO */ |
---|
3182 | void ChangeActiveIconboxIconText (Widget icon, caddr_t dummy, XFocusChangeEvent *event) |
---|
3183 | #endif /* _NO_PROTO */ |
---|
3184 | { |
---|
3185 | |
---|
3186 | ClientData *pCD; |
---|
3187 | Window theIcon; |
---|
3188 | |
---|
3189 | /* |
---|
3190 | * find context to get pCD and then hide or show active icon text. |
---|
3191 | * Show/hide the active icon text only if the icon box is not |
---|
3192 | * iconified. |
---|
3193 | */ |
---|
3194 | |
---|
3195 | theIcon = XtWindow(icon); |
---|
3196 | |
---|
3197 | if (!(XFindContext (DISPLAY, theIcon, |
---|
3198 | wmGD.windowContextType, (caddr_t *)&pCD)) && |
---|
3199 | P_ICON_BOX(pCD) && |
---|
3200 | P_ICON_BOX(pCD)->pCD_iconBox && |
---|
3201 | P_ICON_BOX(pCD)->pCD_iconBox->clientState != MINIMIZED_STATE) |
---|
3202 | { |
---|
3203 | if (event->type == FocusIn) |
---|
3204 | { |
---|
3205 | if (event->send_event) |
---|
3206 | { |
---|
3207 | ShowActiveIconText (pCD); |
---|
3208 | } |
---|
3209 | } |
---|
3210 | else |
---|
3211 | { |
---|
3212 | if (event->send_event) |
---|
3213 | { |
---|
3214 | HideActiveIconText (pCD->pSD); |
---|
3215 | } |
---|
3216 | } |
---|
3217 | } |
---|
3218 | |
---|
3219 | } /* END OF FUNCTION ChangeActiveIconboxIconText */ |
---|
3220 | |
---|
3221 | |
---|
3222 | |
---|
3223 | /*************************************<->************************************* |
---|
3224 | * |
---|
3225 | * HandleIconBoxIconKeyPress |
---|
3226 | * |
---|
3227 | * |
---|
3228 | * Description: |
---|
3229 | * ----------- |
---|
3230 | * This event handler catches keyevents for icons in the icon box and |
---|
3231 | * passes them on to the standard key handling routine for mwm. |
---|
3232 | * |
---|
3233 | *************************************<->***********************************/ |
---|
3234 | |
---|
3235 | #ifdef _NO_PROTO |
---|
3236 | void HandleIconBoxIconKeyPress (icon, dummy, keyEvent) |
---|
3237 | Widget icon; |
---|
3238 | caddr_t dummy; |
---|
3239 | XKeyEvent *keyEvent; |
---|
3240 | |
---|
3241 | #else /* _NO_PROTO */ |
---|
3242 | void HandleIconBoxIconKeyPress (Widget icon, caddr_t dummy, XKeyEvent *keyEvent) |
---|
3243 | #endif /* _NO_PROTO */ |
---|
3244 | { |
---|
3245 | |
---|
3246 | Context context; |
---|
3247 | ClientData *pCD; |
---|
3248 | Window theIcon; |
---|
3249 | |
---|
3250 | /* |
---|
3251 | * find context to get pCD and then post menu show active icon text. |
---|
3252 | */ |
---|
3253 | |
---|
3254 | theIcon = XtWindow(icon); |
---|
3255 | if (!(XFindContext (DISPLAY, theIcon, |
---|
3256 | wmGD.windowContextType, (caddr_t *)&pCD))) |
---|
3257 | { |
---|
3258 | keyEvent->window = ICON_FRAME_WIN(pCD); |
---|
3259 | |
---|
3260 | if (pCD->clientState == MINIMIZED_STATE) |
---|
3261 | { |
---|
3262 | context = F_SUBCONTEXT_IB_IICON; |
---|
3263 | pCD->grabContext = F_SUBCONTEXT_IB_IICON; |
---|
3264 | } |
---|
3265 | else |
---|
3266 | { |
---|
3267 | context = F_SUBCONTEXT_IB_WICON; |
---|
3268 | pCD->grabContext = F_SUBCONTEXT_IB_WICON; |
---|
3269 | } |
---|
3270 | |
---|
3271 | if(!(HandleKeyPress (keyEvent, ACTIVE_PSD->keySpecs, |
---|
3272 | True, context, False, pCD))) |
---|
3273 | { |
---|
3274 | keyEvent->window = 0; |
---|
3275 | keyEvent->type = 0; |
---|
3276 | } |
---|
3277 | |
---|
3278 | } |
---|
3279 | |
---|
3280 | } /* END OF FUNCTION HandleIconBoxIconKeyPress */ |
---|
3281 | |
---|
3282 | |
---|
3283 | /*************************************<->************************************* |
---|
3284 | * |
---|
3285 | * HandleIconBoxButtonMotion |
---|
3286 | * |
---|
3287 | * |
---|
3288 | * Description: |
---|
3289 | * ----------- |
---|
3290 | * Event handler for button motion events on icon frame window in |
---|
3291 | * in icon box. |
---|
3292 | * |
---|
3293 | * |
---|
3294 | * Inputs: |
---|
3295 | * ------ |
---|
3296 | * icon - widget for icon frame |
---|
3297 | * client_data - extra client data |
---|
3298 | * pev - ptr to event |
---|
3299 | * |
---|
3300 | * |
---|
3301 | * Outputs: |
---|
3302 | * ------- |
---|
3303 | * |
---|
3304 | * |
---|
3305 | * Comments: |
---|
3306 | * -------- |
---|
3307 | * o This is added to make sure that ButtonXMotion gets added to the |
---|
3308 | * event mask for icons in the icon box. |
---|
3309 | * |
---|
3310 | *************************************<->***********************************/ |
---|
3311 | |
---|
3312 | #ifdef _NO_PROTO |
---|
3313 | void HandleIconBoxButtonMotion (icon, client_data, pev) |
---|
3314 | Widget icon; |
---|
3315 | caddr_t client_data; |
---|
3316 | XEvent *pev; |
---|
3317 | |
---|
3318 | #else /* _NO_PROTO */ |
---|
3319 | void HandleIconBoxButtonMotion (Widget icon, caddr_t client_data, XEvent *pev) |
---|
3320 | #endif /* _NO_PROTO */ |
---|
3321 | { |
---|
3322 | |
---|
3323 | } /* END OF FUNCTION HandleIconBoxButtonMotion */ |
---|
3324 | |
---|
3325 | |
---|
3326 | |
---|
3327 | /*************************************<->************************************* |
---|
3328 | * |
---|
3329 | * GetIconBoxIconRootXY (pCD, pX, pY) |
---|
3330 | * |
---|
3331 | * |
---|
3332 | * Description: |
---|
3333 | * ----------- |
---|
3334 | * |
---|
3335 | * |
---|
3336 | * Inputs: |
---|
3337 | * ------ |
---|
3338 | * pCD - pointer to client data |
---|
3339 | * pX - pointer to X return value |
---|
3340 | * pY - pointer to Y return value |
---|
3341 | * |
---|
3342 | * Outputs: |
---|
3343 | * ------- |
---|
3344 | * |
---|
3345 | * |
---|
3346 | * Comments: |
---|
3347 | * -------- |
---|
3348 | * o returns root-window coords |
---|
3349 | * |
---|
3350 | *************************************<->***********************************/ |
---|
3351 | #ifdef _NO_PROTO |
---|
3352 | void GetIconBoxIconRootXY (pCD, pX, pY) |
---|
3353 | |
---|
3354 | ClientData *pCD; |
---|
3355 | int *pX, *pY; |
---|
3356 | #else /* _NO_PROTO */ |
---|
3357 | void GetIconBoxIconRootXY (ClientData *pCD, int *pX, int *pY) |
---|
3358 | #endif /* _NO_PROTO */ |
---|
3359 | { |
---|
3360 | |
---|
3361 | Window child; |
---|
3362 | |
---|
3363 | if (pCD->pSD->useIconBox && P_ICON_BOX(pCD)) |
---|
3364 | { |
---|
3365 | XTranslateCoordinates(DISPLAY, |
---|
3366 | XtWindow(P_ICON_BOX(pCD)->bBoardWidget), |
---|
3367 | ROOT_FOR_CLIENT(pCD), |
---|
3368 | ICON_X(pCD) + IB_MARGIN_WIDTH, |
---|
3369 | ICON_Y(pCD) + IB_MARGIN_HEIGHT, |
---|
3370 | pX, pY, &child); |
---|
3371 | |
---|
3372 | } |
---|
3373 | else |
---|
3374 | { |
---|
3375 | *pX = *pY = 0; |
---|
3376 | } |
---|
3377 | } /* END FUNCTION GetIconBoxIconRootXY */ |
---|
3378 | |
---|
3379 | |
---|
3380 | /*************************************<->************************************* |
---|
3381 | * |
---|
3382 | * IconVisible (pCD) |
---|
3383 | * |
---|
3384 | * |
---|
3385 | * Description: |
---|
3386 | * ----------- |
---|
3387 | * |
---|
3388 | * Inputs: |
---|
3389 | * ------ |
---|
3390 | * pCD - pointer to client data |
---|
3391 | * |
---|
3392 | * Outputs: |
---|
3393 | * ------- |
---|
3394 | * |
---|
3395 | * |
---|
3396 | * Comments: |
---|
3397 | * -------- |
---|
3398 | * |
---|
3399 | *************************************<->***********************************/ |
---|
3400 | #ifdef _NO_PROTO |
---|
3401 | Boolean IconVisible (pCD) |
---|
3402 | ClientData *pCD; |
---|
3403 | #else /* _NO_PROTO */ |
---|
3404 | Boolean IconVisible (ClientData *pCD) |
---|
3405 | #endif /* _NO_PROTO */ |
---|
3406 | { |
---|
3407 | |
---|
3408 | /* |
---|
3409 | * May use icon->core.visible field if that gets fixed and |
---|
3410 | * we want to accept the Intrinsics idea of what is visible. |
---|
3411 | */ |
---|
3412 | |
---|
3413 | Boolean rval = True; |
---|
3414 | |
---|
3415 | |
---|
3416 | |
---|
3417 | int i; |
---|
3418 | Arg getArgs[5]; |
---|
3419 | |
---|
3420 | Dimension tmpWidth = 0; |
---|
3421 | Dimension tmpHeight = 0; |
---|
3422 | Position clipX = 0; |
---|
3423 | Position clipY = 0; |
---|
3424 | Position tmpX = 0; |
---|
3425 | Position tmpY = 0; |
---|
3426 | int iconX, iconY; |
---|
3427 | |
---|
3428 | i=0; |
---|
3429 | XtSetArg (getArgs[i], XmNwidth, (XtArgVal) &tmpWidth ); i++; |
---|
3430 | XtSetArg (getArgs[i], XmNheight, (XtArgVal) &tmpHeight ); i++; |
---|
3431 | XtSetArg (getArgs[i], XmNx, (XtArgVal) &tmpX ); i++; |
---|
3432 | XtSetArg (getArgs[i], XmNy, (XtArgVal) &tmpY ); i++; |
---|
3433 | XtGetValues (P_ICON_BOX(pCD)->clipWidget, getArgs, i); |
---|
3434 | XtTranslateCoords(P_ICON_BOX(pCD)->scrolledWidget, |
---|
3435 | tmpX, tmpY, |
---|
3436 | &clipX, &clipY); |
---|
3437 | |
---|
3438 | GetIconBoxIconRootXY(pCD, &iconX, &iconY); |
---|
3439 | |
---|
3440 | |
---|
3441 | /* |
---|
3442 | * demand at least 2 pixels of the |
---|
3443 | * real icon (not drawnButton) be showing |
---|
3444 | */ |
---|
3445 | |
---|
3446 | if (iconX + 2 > ((int)clipX + (int)tmpWidth)) |
---|
3447 | { |
---|
3448 | return(False); |
---|
3449 | } |
---|
3450 | if (iconY + 2 > ((int)clipY + (int)tmpHeight)) |
---|
3451 | { |
---|
3452 | return(False); |
---|
3453 | } |
---|
3454 | |
---|
3455 | if ((iconX + (ICON_WIDTH(pCD) -2)) < (int)clipX) |
---|
3456 | { |
---|
3457 | return(False); |
---|
3458 | } |
---|
3459 | if ((iconY + (ICON_HEIGHT(pCD) -2)) < (int)clipY) |
---|
3460 | { |
---|
3461 | return(False); |
---|
3462 | } |
---|
3463 | |
---|
3464 | return(rval); |
---|
3465 | |
---|
3466 | } /* END OF FUNCTION IconVisible */ |
---|
3467 | |
---|
3468 | /*************************************<->************************************* |
---|
3469 | * |
---|
3470 | * WmXmStringToString (xmString |
---|
3471 | * |
---|
3472 | * |
---|
3473 | * Description: |
---|
3474 | * ----------- |
---|
3475 | * |
---|
3476 | * |
---|
3477 | * Inputs: |
---|
3478 | * ------ |
---|
3479 | * |
---|
3480 | * Outputs: |
---|
3481 | * ------- |
---|
3482 | * |
---|
3483 | * |
---|
3484 | * Comments: |
---|
3485 | * -------- |
---|
3486 | * Return the ascii part of the first segment of an XmString |
---|
3487 | * If xmString is NULL, then do nothing |
---|
3488 | * |
---|
3489 | *************************************<->***********************************/ |
---|
3490 | |
---|
3491 | #ifdef _NO_PROTO |
---|
3492 | String WmXmStringToString (xmString) |
---|
3493 | XmString xmString; |
---|
3494 | #else /* _NO_PROTO */ |
---|
3495 | String WmXmStringToString (XmString xmString) |
---|
3496 | #endif /* _NO_PROTO */ |
---|
3497 | { |
---|
3498 | XmStringContext xmStrContext; |
---|
3499 | char *asciiString = NULL; |
---|
3500 | XmStringCharSet ibTitleCharset; |
---|
3501 | XmStringDirection ibTitleDirection; |
---|
3502 | Boolean separator; |
---|
3503 | |
---|
3504 | if (xmString) |
---|
3505 | { |
---|
3506 | XmStringInitContext (&xmStrContext, xmString); |
---|
3507 | |
---|
3508 | XmStringGetNextSegment (xmStrContext, &asciiString, |
---|
3509 | &ibTitleCharset, &ibTitleDirection, |
---|
3510 | &separator); |
---|
3511 | |
---|
3512 | if (ibTitleCharset != NULL) |
---|
3513 | { |
---|
3514 | XtFree ((char *)ibTitleCharset); |
---|
3515 | } |
---|
3516 | |
---|
3517 | XmStringFreeContext (xmStrContext); |
---|
3518 | } |
---|
3519 | |
---|
3520 | return(asciiString); |
---|
3521 | |
---|
3522 | } /* END OF FUNCTION WmXmStringToString */ |
---|