2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: IconWindow.c /main/13 1996/10/15 10:07:48 mustafa $ */
24 /************************************<+>*************************************
25 ****************************************************************************
29 * COMPONENT_NAME: Desktop File Manager (dtfile)
31 * Description: Processing functions for callbacks from the
34 * FUNCTIONS: CheckForBtnUp
39 * FM_XmHighlightBorder
40 * FM_XmUnhighlightBorder
41 * FileWindowExposeCallback
42 * FileWindowInputCallback
43 * FileWindowMapCallback
44 * FileWindowResizeCallback
45 * GetSelectionRectangle
49 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
50 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
51 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
52 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
54 ****************************************************************************
55 ************************************<+>*************************************/
60 #include <Xm/VirtKeys.h>
62 #include <sys/types.h>
67 #include <Dt/Connect.h>
68 #include <Dt/DtNlUtils.h>
69 #include <Dt/Action.h>
71 #include <X11/cursorfont.h>
72 #include <X11/Xutil.h>
73 #include <X11/keysymdef.h>
74 #include <Xm/PrimitiveP.h> /* For HighlightBorder & UnhighlightBorder */
84 /* For HightlightBorder & UnhighlightBorder */
85 externalref XmPrimitiveClassRec xmPrimitiveClassRec;
87 Boolean TurnOnTextName;
89 /******** Static Function Declarations ********/
91 static Boolean CheckForBtnUp(
95 static void GetSelectionRectangle(
99 FileMgrRec *file_mgr_rec,
100 FileMgrData *file_mgr_data,
101 Boolean toggleSelect) ;
102 static void DrawRectangle(
110 static void ProcessSelection(
111 FileMgrData * file_mgr_data,
113 Boolean toggleSelect,
114 XButtonEvent *event) ;
116 static void FM_XmHighlightBorder(Widget w);
117 static void FM_XmUnhighlightBorder(Widget w);
119 static XmGadget InputForGadget(
125 /******** End Static Function Declarations ********/
128 /************************************************************************
130 * FileWindowExposeCallback
131 * Callback function invoked upon an exposure event occuring
132 * in the file display area.
134 ************************************************************************/
137 FileWindowExposeCallback(
139 XtPointer client_data,
140 XtPointer call_data )
142 FileMgrRec * file_mgr_rec;
143 DialogData * dialog_data;
144 FileMgrData * file_mgr_data;
145 XmDrawingAreaCallbackStruct * da_cbs;
148 file_mgr_rec = (FileMgrRec *) client_data;
149 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
151 /* Check for the view already being closed */
153 if (dialog_data == NULL) return;
155 file_mgr_data = (FileMgrData *) dialog_data->data;
156 da_cbs = (XmDrawingAreaCallbackStruct * )call_data;
158 /* if necessary, redraw tree lines */
159 if (da_cbs->reason == XmCR_EXPOSE &&
160 file_mgr_data->show_type == MULTIPLE_DIRECTORY)
162 XExposeEvent *event = (XExposeEvent *)da_cbs->event;
163 if (event && event->type == Expose)
164 RedrawTreeLines(w, event->x, event->y, event->width, event->height,
165 event->count, file_mgr_rec, file_mgr_data);
167 RedrawTreeLines(w, 0, 0, 999999, 999999, 0, file_mgr_rec, file_mgr_data);
175 /************************************************************************
177 * FileWindowResizeCallback
178 * Callback function invoked upon a resize of the file display area.
180 ************************************************************************/
183 FileWindowResizeCallback(
185 XtPointer client_data,
188 FileMgrRec * file_mgr_rec;
189 DialogData * dialog_data;
190 FileMgrData * file_mgr_data;
192 if (event->type == ConfigureNotify)
194 XConfigureEvent * cevent = (XConfigureEvent *) event;
196 file_mgr_rec = (FileMgrRec *) client_data;
199 * If the incoming size is different than the current size of the
200 * scrolled window, then ignore this event, since it means that our
201 * size has changed since this configure notify event was generated;
202 * we'll wait for the next one to arrive, and try again.
204 if ((file_mgr_rec->scroll_window->core.height != cevent->height) ||
205 (file_mgr_rec->scroll_window->core.width != cevent->width))
210 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
211 if(dialog_data != NULL)
213 file_mgr_data = (FileMgrData *) dialog_data->data;
215 LayoutFileIcons (file_mgr_rec, file_mgr_data, False, False);
221 /************************************************************************
223 * FileWindowMapCallback
224 * Callback function invoked upon a map or unmap of a file
227 ************************************************************************/
230 FileWindowMapCallback(
232 XtPointer client_data,
235 FileMgrRec * file_mgr_rec;
236 DialogData * dialog_data;
237 FileMgrData * file_mgr_data;
239 file_mgr_rec = (FileMgrRec *) client_data;
240 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
241 if(dialog_data != NULL)
243 file_mgr_data = (FileMgrData *) dialog_data->data;
245 if (event->type == MapNotify)
247 file_mgr_data->mapped = True;
248 FileWindowMapUnmap( file_mgr_data );
250 else if (event->type == UnmapNotify)
252 file_mgr_data->mapped = False;
253 FileWindowMapUnmap( file_mgr_data );
260 /************************************************************************
262 * FileWindowInputCallback
263 * Callback function invoked upon input occuring in the
264 * file display area, file icon, or within a desktop icon.
266 ************************************************************************/
269 FileWindowInputCallback(
271 XtPointer client_data,
274 static Boolean first = True;
275 static KeySym PlusKeysym, MinusKeySym;
276 static KeySym ActivateKeysym, SpaceKeysym;
277 static XmKeyBinding SelectBindings;
278 static int NumSelectKeys = 0;
280 FileMgrRec * file_mgr_rec;
281 XmAnyCallbackStruct * callback;
282 DialogData * dialog_data;
283 FileMgrData * file_mgr_data;
284 DirectorySet * directoryData;
286 XButtonPressedEvent *event;
290 FileViewData * fileViewData = NULL;
292 DesktopRec * desktopRec;
298 /* Do nothing if a Button 2 drag is already ramping up */
302 /* Determine if this is a desktop icon or a regular icon */
305 for (i = 0; i < desktop_data->numIconsUsed; i++)
307 if (desktop_data->desktopWindows[i] == (DesktopRec *)client_data)
309 desktopRec = (DesktopRec *)client_data;
313 if (desktopRec == NULL)
315 file_mgr_rec = (FileMgrRec *) client_data;
316 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
317 file_mgr_data = (FileMgrData *) dialog_data->data;
320 file_mgr_data = NULL;
322 callback = (XmAnyCallbackStruct *) call_data;
323 new_event = (XEvent *)callback->event;
325 if (new_event->type == ButtonPress)
327 XButtonEvent *bevent = (XButtonEvent *)new_event;
328 desktop_data->event = *bevent;
330 else if (new_event->type == KeyPress || new_event->type == KeyRelease)
334 /* set up the the keysyms we are looking for */
335 PlusKeysym = XStringToKeysym("plus");
336 MinusKeySym = XStringToKeysym("minus");
338 NumSelectKeys = XmeVirtualToActualKeysyms(XtDisplay(w),
342 ActivateKeysym = XK_Return;
343 SpaceKeysym = XStringToKeysym("space");
347 kevent = (XKeyEvent *)new_event;
348 if (kevent->state & ShiftMask)
354 keysym = XLookupKeysym(kevent, offset);
356 XmTranslateKey( kevent->display, kevent->keycode, offset?ShiftMask:0,
360 /* in tree mode '+' and '-' keys expand and collaps tree branches */
361 if (!desktopRec && new_event->type == KeyPress &&
362 (keysym == PlusKeysym || keysym == MinusKeySym))
364 /* ignore +/- keys if not in tree mode */
365 if (file_mgr_data->show_type != MULTIPLE_DIRECTORY)
368 /* get the gadget that received the input */
369 if (keybdFocusPolicy == XmEXPLICIT)
370 eventIcon = (Widget) XmGetFocusWidget(w);
372 eventIcon = (Widget) InputForGadget(w, kevent->x, kevent->y);
373 if (eventIcon == NULL)
376 /* find the widget in the file_list */
378 for (i = -1; i < file_mgr_data->directory_count && !found; i++)
380 for (j = 0; j < file_mgr_data->directory_set[i]->file_count; j++)
382 fileViewData = file_mgr_data->directory_set[i]->file_view_data[j];
383 if (fileViewData->widget == eventIcon ||
384 fileViewData->treebtn == eventIcon)
392 /* if found, expand the branch */
393 if (found && fileViewData->file_data->is_subdir)
395 XmDropSiteStartUpdate(w);
396 DirTreeExpand(file_mgr_data, fileViewData, (keysym == PlusKeysym));
397 DrawCurrentDirectory (file_mgr_rec->current_directory,
398 file_mgr_rec, file_mgr_data);
399 LayoutFileIcons(file_mgr_rec, file_mgr_data, False, True);
400 XmDropSiteEndUpdate(w);
401 RedrawTreeLines(w, -w->core.x, -w->core.y,
402 XtParent(w)->core.width, XtParent(w)->core.height,
403 0, file_mgr_rec, file_mgr_data);
407 else if (new_event->type == ButtonPress || (new_event->type == KeyPress &&
408 keybdFocusPolicy == XmEXPLICIT))
410 /* Any button event unposts the rename text field */
413 else if( file_mgr_data )
415 if( file_mgr_data->fast_cd_enabled )
416 UnpostTextPath( file_mgr_data );
418 UnpostTextField( file_mgr_data );
421 if (new_event->type == KeyPress)
423 /* We have a KeyPress: need to check to see if the press is
424 "return", "space", "select". If it is, need to select the Icon
427 if (keysym == XK_Escape)
429 /* an escape unposts the name change text widget */
433 UnpostTextField(file_mgr_data);
436 else if ( keysym != ActivateKeysym
437 && keysym != SpaceKeysym
438 && keysym != osfXK_Delete
439 && keysym != osfXK_EndLine
440 && keysym != osfXK_BeginLine
441 && keysym != osfXK_PageLeft
442 && keysym != osfXK_PageUp
443 && keysym != osfXK_PageDown
444 && keysym != osfXK_PageRight
445 && keysym != osfXK_Menu )
447 Boolean select = FALSE;
450 for (i = 0; !select && (i < NumSelectKeys); i++)
451 select = (keysym == SelectBindings[i].keysym);
458 eventIcon = desktopRec->iconGadget;
460 eventIcon = (Widget) XmGetFocusWidget(file_mgr_rec->file_window);
461 event = (XButtonPressedEvent *)new_event;
465 event = (XButtonPressedEvent *)new_event;
466 if(event->button != Button1)
468 if(event->button == bMenuButton && desktopRec == NULL)
469 FmPopup (NULL, NULL, (XEvent *)event, file_mgr_data);
472 eventIcon = (Widget) InputForGadget(w, event->x, event->y);
476 * If the event occurred in an icon, then we are either doing
477 * a selection or a drag. If it started in the file window, then
478 * we can only be doing a region selection.
480 if (eventIcon != NULL)
483 * If this icon is currently selected, then we can't yet tell
484 * whether the user is starting a drag operation, or simply
485 * redoing the icon selection; we must wait for either the
486 * drag threshold to be surpassed, or the button up event.
489 /* Map the icon into its fileViewData structure */
490 /* Check for desktop icon first */
493 for (i = 0; i<desktop_data->numIconsUsed; i++)
495 if (desktop_data->desktopWindows[i]->iconGadget == eventIcon)
497 fileViewData = desktop_data->desktopWindows[i]->file_view_data;
504 /* Not a desktop icon */
505 XtSetArg(args[0], XmNuserData, (XtPointer) &directoryData);
506 XtGetValues(eventIcon, args, 1);
507 if( directoryData != NULL )
509 for (i = 0; i < directoryData->file_count; i++)
511 if (directoryData->file_view_data[i]->widget == eventIcon &&
512 directoryData->file_view_data[i]->displayed)
514 fileViewData = directoryData->file_view_data[i];
521 if (((file_mgr_rec && FileIsSelected(file_mgr_data, fileViewData)) ||
522 (desktopRec && DTFileIsSelected(desktopRec, fileViewData))) &&
523 event->type == ButtonPress)
525 /* Need to wait to determine what to do */
527 B1DragPossible = True;
528 initialDragX = event->x;
529 initialDragY = event->y;
531 if((file_mgr_rec && FileIsSelected(file_mgr_data, fileViewData)) &&
532 file_mgr_data->selected_file_count > 1)
534 if (PositioningEnabledInView(file_mgr_data))
537 FileViewData ** selection_list;
539 top = GetTopOfStack(file_mgr_data);
540 if(top != NULL && top->file_view_data != fileViewData)
542 ObjectPtr savetop, next, prev;
545 while(top != NULL && top->file_view_data != fileViewData)
558 top->stacking_order = 1;
561 for(i = 2; top->prev != NULL; i++)
563 top->stacking_order = i;
564 if(top->next == NULL)
569 top = GetTopOfStack(file_mgr_data);
570 RedrawOneGadget(top->file_view_data->widget,NULL,NULL);
574 /* now make it the top of the selection list */
575 /* Force selection list order to match stacking order */
576 selection_list = (FileViewData **)XtMalloc(
577 sizeof(FileViewData *) *
578 (file_mgr_data->selected_file_count + 1));
581 if(top->file_view_data != NULL)
582 selection_list[i++] = top->file_view_data;
583 for(j = 0;i < file_mgr_data->selected_file_count; j++,i++)
585 if(top->file_view_data !=
586 file_mgr_data->selection_list[j])
587 selection_list[i] = file_mgr_data->selection_list[j];
591 selection_list[i] = NULL;
592 XtFree((char *)file_mgr_data->selection_list);
593 file_mgr_data->selection_list = selection_list;
600 * The icon is not currently selected, so we will select it.
601 * It is still possible that the user may initiate a drag.
603 ProcessBtnUp = False;
604 if (event->type == ButtonPress)
606 B1DragPossible = True;
607 initialDragX = event->x;
608 initialDragY = event->y;
612 B1DragPossible = False;
621 DtActionArg * action_args;
624 if( desktopRec == NULL
625 && file_mgr_rec != NULL )
627 if( file_mgr_data->selected_file_count
629 && FileIsSelected(file_mgr_data, fileViewData) )
631 _DtBuildActionArgsWithSelectedFiles(
632 file_mgr_data->selection_list,
633 file_mgr_data->selected_file_count,
634 &action_args, &arg_count );
638 _DtBuildActionArgsWithSelectedFiles( &fileViewData, 1,
642 DtActionInvoke( file_mgr_rec->shell, TRASH_ACTION,
643 action_args, arg_count, NULL, NULL,
644 trash_dir, True, NULL, NULL );
646 else if( desktopRec != NULL )
648 int selectedCount = desktop_data->workspaceData[desktopRec->workspace_num - 1]->files_selected;
651 _DtBuildActionArgsWithDTSelectedFiles(
652 desktop_data->workspaceData[desktopRec->workspace_num - 1]->selectedDTWindows,
654 &action_args, &arg_count );
658 _DtBuildActionArgsWithSelectedFiles( &fileViewData, 1,
662 DtActionInvoke( desktopRec->shell, TRASH_ACTION,
663 action_args, arg_count, NULL, NULL,
664 trash_dir, True, NULL, NULL );
666 _DtFreeActionArgs( action_args, arg_count );
670 if(file_mgr_data) /* if not, then it is a desktop object */
671 FmPopup( NULL, (XtPointer)fileViewData,
672 (XEvent *)event, file_mgr_data );
676 && file_mgr_data->show_type != MULTIPLE_DIRECTORY )
680 child = XmGetFocusWidget(file_mgr_rec->file_window);
683 FileViewData * focusIcon = NULL;
684 FileViewData **order_list;
687 order_list = ((IconLayoutData *)file_mgr_data->layout_data)->order_list;
688 order_count = ((IconLayoutData *)file_mgr_data->layout_data)->order_count;
690 for (i = 0; i < order_count; ++i)
692 if (order_list[i]->filtered)
695 if( order_list[i]->widget == child
696 && !order_list[i]->need_update )
699 int y = order_list[i]->y;
701 focusIcon = order_list[i];
703 for( j = i+1; j < order_count; ++j )
705 if (order_list[j]->filtered)
708 if( order_list[j]->y == y )
709 focusIcon = order_list[j];
716 XmProcessTraversal( focusIcon->widget, XmTRAVERSE_CURRENT );
720 case osfXK_BeginLine:
722 && file_mgr_data->show_type != MULTIPLE_DIRECTORY )
726 child = XmGetFocusWidget(file_mgr_rec->file_window);
729 FileViewData * focusIcon = NULL;
730 FileViewData **order_list;
733 order_list = ((IconLayoutData *)file_mgr_data->layout_data)->order_list;
734 order_count = ((IconLayoutData *)file_mgr_data->layout_data)->order_count;
736 for (i = 0; i < order_count; ++i)
738 if (order_list[i]->filtered)
741 if( order_list[i]->widget == child
742 && !order_list[i]->need_update )
745 int y = order_list[i]->y;
747 focusIcon = order_list[i];
749 for( j = i-1; j >= 0; --j )
751 if (order_list[j]->filtered)
754 if( order_list[j]->y == y )
755 focusIcon = order_list[j];
762 XmProcessTraversal( focusIcon->widget, XmTRAVERSE_CURRENT );
769 if( VerticalScrollbarIsVisible(
770 file_mgr_rec->vertical_scroll_bar,
771 file_mgr_rec->scroll_window))
775 p = (String) XtMalloc(sizeof(char *));
777 XtCallActionProc( file_mgr_rec->vertical_scroll_bar,
778 "PageUpOrLeft", new_event,
787 if( VerticalScrollbarIsVisible(
788 file_mgr_rec->vertical_scroll_bar,
789 file_mgr_rec->scroll_window))
793 p = (String) XtMalloc(sizeof(char *));
795 XtCallActionProc( file_mgr_rec->vertical_scroll_bar,
796 "PageDownOrRight", new_event, &p, 1 );
803 ProcessDTSelection(desktopRec, (XButtonEvent *)event);
805 ProcessSelection( file_mgr_data, eventIcon,
806 ((event->state & ControlMask) != 0),
807 (XButtonEvent *)event);
814 /* In file window - start region select */
815 /* There are no region selects for desktop icons */
816 ProcessBtnUp = False;
817 B1DragPossible = False;
820 if (desktopRec == NULL)
822 ProcessSelection(file_mgr_data, NULL,
823 ((event->state & ControlMask) != 0),
824 (XButtonEvent *)event);
828 else if(new_event->type == ButtonRelease || (new_event->type == KeyRelease &&
829 keybdFocusPolicy == XmEXPLICIT))
831 if(new_event->type == KeyRelease)
833 if (keysym != osfXK_Select)
836 event = (XButtonPressedEvent *)new_event;
840 event = (XButtonPressedEvent *)new_event;
841 if(event->button != Button1)
845 * When a button 1 up event is received, we will first see if the
846 * select occurred in the icon's title; if so, then we will post
847 * the rename text field. If the icon in which the button down
848 * occurred was not already selected, then all of the selection
849 * work was done at button 1 down time, so there is nothing left
850 * for us to do but return. However, if the icon was already
851 * selected, then we could not do any select processing at button
852 * down time, because the user may have been trying to initate
853 * a drag request; this can't be determined until either the drag
854 * threshold is surpassed, or the button up occurs.
856 if (((initialDragX >= 0) && (initialDragY >= 0)) &&
857 (eventIcon = (Widget) InputForGadget(w, initialDragX,
861 * If processing was postponed until the button up, then do it now.
863 B1DragPossible = False;
868 tmpEvent.xbutton = *event;
869 tmpEvent.xbutton.x = initialDragX;
870 tmpEvent.xbutton.y = initialDragY;
874 ProcessDTSelection(desktopRec, (XButtonEvent *)&tmpEvent);
878 ProcessSelection(file_mgr_data, eventIcon,
879 ((event->state & ControlMask) != 0),
880 (XButtonEvent *)&tmpEvent);
886 * If the select occurred in the title portion of the icon, then
887 * put up a text edit field, which can be used to change the name
888 * of the icon. The last field '0' means its not on the Desktop.
890 if (_DtIconSelectInTitle(eventIcon, (Position)initialDragX,
891 (Position)initialDragY) && ProcessBtnUpCD)
893 /* Map the icon into its fileViewData structure */
894 /* Check for desktop icon first */
897 for (i = 0; i<desktop_data->numIconsUsed; i++)
899 if (desktop_data->desktopWindows[i]->iconGadget == eventIcon)
902 desktop_data->desktopWindows[i]->file_view_data;
909 /* Not a desktop icon */
910 XtSetArg(args[0], XmNuserData, (XtPointer) &directoryData);
911 XtGetValues(eventIcon, args, 1);
912 for (i = 0; i < directoryData->file_count; i++)
914 if (directoryData->file_view_data[i]->widget == eventIcon &&
915 directoryData->file_view_data[i]->displayed)
917 fileViewData = directoryData->file_view_data[i];
925 CreateNameChangeDialog(eventIcon, fileViewData,
926 (XtPointer)desktopRec, DESKTOP);
928 else if( file_mgr_data->view != BY_NAME )
930 /* We don't allow users to rename when they are viewing a
931 directory in 'By Name Only' mode.
932 Because clicking on the label is the only way for them
933 to select a file. Popup a text widget to allow rename
934 would be very confusing
936 if( file_mgr_data->view != BY_ATTRIBUTES
937 || ( file_mgr_data->view == BY_ATTRIBUTES
938 && TurnOnTextName ) )
939 CreateNameChangeDialog(eventIcon, fileViewData,
940 (XtPointer)file_mgr_data, NOT_DESKTOP);
948 B1DragPossible = False;
949 B2DragPossible = False;
950 ProcessBtnUp = False;
952 ProcessBtnUpCD = True;
954 else if(new_event->type == KeyPress)
956 if (keysym == XK_Escape)
958 /* an escape unposts the name change text widget */
962 UnpostTextField(file_mgr_data);
970 * When a select operation terminates, we need to find the real button
971 * up event, so that we can get the correct (x,y) for where the select
981 if ((event->type == ButtonRelease) && (event->xbutton.button == Button1))
988 /************************************************************************
990 * GetSelectionRectangle
992 ************************************************************************/
995 GetSelectionRectangle(
999 FileMgrRec *file_mgr_rec,
1000 FileMgrData *file_mgr_data,
1001 Boolean toggleSelect)
1004 static GC draw_gc = 0;
1005 XGCValues gc_values;
1007 Region widget_region;
1008 Region intersect_region;
1009 Region redraw_region;
1011 static XRectangle return_rect;
1014 int virt_width, virt_height;
1021 int pixmap_x, pixmap_y, pixmap_x1, pixmap_y1;
1022 int directory_count;
1024 Window root, sub_win;
1028 XmManagerWidget file_window;
1029 Dimension current_file_window_width, sw_width;
1030 Dimension current_file_window_height, sw_height;
1031 Dimension file_window_width, file_window_height;
1032 Dimension max_width, max_height;
1033 Dimension min_width, min_height;
1036 int vb_slide_size = 0;
1038 int vb_pg_inc_ret = 0;
1040 int hb_slide_size = 0;
1042 int hb_pg_inc_ret = 0;
1043 Boolean vsbVisible = False;
1044 Boolean hsbVisible = False;
1045 DirectorySet ** directory_set;
1046 FileViewData *file_view_data;
1049 Dimension highlightThickness, shadowThickness;
1050 Dimension width, height;
1051 Dimension marginWidth, marginHeight;
1052 Dimension pixmapWidth, pixmapHeight;
1053 Dimension stringWidth, stringHeight;
1054 unsigned char pixmapPosition;
1055 unsigned char alignment;
1059 /* Get the horizontal and vertical scrollbars. */
1060 XtSetArg (args[0], XmNhorizontalScrollBar, &hb);
1061 XtSetArg (args[1], XmNverticalScrollBar, &vb);
1062 XtSetArg (args[2], XmNwidth, &sw_width);
1063 XtSetArg (args[3], XmNheight, &sw_height);
1064 XtGetValues (file_mgr_rec->scroll_window, args, 4);
1066 file_window = (XmManagerWidget)file_mgr_rec->file_window;
1067 XtSetArg (args[0], XmNwidth, &file_window_width);
1068 XtSetArg (args[1], XmNheight, &file_window_height);
1069 XtGetValues ((Widget)file_window, args, 2);
1070 file_window_width--;
1071 file_window_height--;
1073 if (VerticalScrollbarIsVisible(vb, file_mgr_rec->scroll_window))
1076 current_file_window_width = sw_width - vb->core.width - 12;
1080 current_file_window_width = sw_width - 9;
1083 if (HorizontalScrollbarIsVisible(hb, file_mgr_rec->scroll_window))
1086 current_file_window_height = sw_height - hb->core.height - 12;
1090 current_file_window_height = sw_height - 9;
1095 XmScrollBarGetValues(vb, &vb_val_ret, &vb_slide_size,
1096 &vb_inc_ret, &vb_pg_inc_ret);
1097 min_height = vb_val_ret;
1098 max_height = current_file_window_height + min_height;
1102 max_height = current_file_window_height;
1108 XmScrollBarGetValues(hb, &hb_val_ret, &hb_slide_size,
1109 &hb_inc_ret, &hb_pg_inc_ret);
1110 min_width = hb_val_ret;
1111 max_width = current_file_window_width + min_width;
1115 max_width = current_file_window_width;
1119 /* Get the gc to be used to draw the bounding rectangle */
1123 unsigned int white_pixel;
1125 screen = XDefaultScreenOfDisplay (display);
1126 gc_values.function = GXxor;
1128 white_pixel = WhitePixelOfScreen (screen);
1131 gc_values.foreground = white_pixel;
1132 gc_values.background = BlackPixelOfScreen (screen);
1136 gc_values.background = white_pixel;
1137 gc_values.foreground = BlackPixelOfScreen (screen);
1141 XCreateGC (display, window,
1142 GCForeground | GCBackground | GCFunction, &gc_values);
1145 widget_region = XCreateRegion();
1146 intersect_region = XCreateRegion();
1147 redraw_region = XCreateRegion();
1149 x1 = x2 = old_x = event->x;
1150 y1 = y2 = old_y = event->y;
1152 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1154 while (1) /* Set up a loop to catch the select up point. */
1156 XQueryPointer (display, window, &root, &sub_win,
1157 &win_x, &win_y, &x2, &y2, &mask);
1159 if ((mask & Button1Mask) == 0)
1161 /* Undraw the last rectangle we drew */
1164 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1167 * The real bound of the rectangle is contained in the button up
1168 * event; you can't use the pointer position, because if the system
1169 * is slow, then by the time we query the mouse, the button may have
1170 * been long ago release, and the pointer subsequently moved.
1172 if (XPeekIfEvent(display, &btnUpEvent,(Bool (*)())CheckForBtnUp, NULL))
1174 x2 = btnUpEvent.xbutton.x;
1175 y2 = btnUpEvent.xbutton.y;
1180 if( x2 < 0 ) x2 = 0;
1181 if( y2 < 0 ) y2 = 0;
1183 if ((x2 > old_x && !hsbVisible && (Dimension)old_x < file_window_width) ||
1184 (x2 > old_x && hsbVisible && (Dimension)(hb_val_ret +
1185 hb_slide_size) < (Dimension)(file_window_width + 1)) ||
1186 (x2 < old_x && !hsbVisible && old_x > 0) ||
1187 (x2 < old_x && hsbVisible && hb_val_ret >= 0) ||
1188 (y2 > old_y && !vsbVisible && (Dimension)old_y < file_window_height) ||
1189 (y2 > old_y && vsbVisible && (Dimension)(vb_val_ret +
1190 vb_slide_size) < (Dimension)(file_window_height + 1)) ||
1191 (y2 < old_y && !vsbVisible && old_y > 0) ||
1192 (y2 < old_y && vsbVisible && vb_val_ret >= 0))
1194 DrawRectangle (display, window, draw_gc, x1, y1, old_x, old_y);
1195 if((Dimension)x2 >= max_width)
1199 hb_val_ret += (x2 - max_width);
1200 if((Dimension)(hb_val_ret + hb_slide_size) <= (Dimension)(file_window_width + 1))
1202 XmScrollBarSetValues(hb, hb_val_ret, hb_slide_size,
1203 hb_inc_ret, hb_pg_inc_ret, True);
1204 min_width = (x2 - max_width) + min_width;
1206 XmUpdateDisplay ((Widget)file_window);
1208 else if((Dimension)(hb_val_ret + hb_slide_size) > (Dimension)(file_window_width + 1) &&
1209 (Dimension)(hb_val_ret - (x2 - max_width)) <
1210 (Dimension)(file_window_width - hb_slide_size))
1212 XmScrollBarSetValues(hb,
1213 file_window_width - hb_slide_size + 1,
1214 hb_slide_size, hb_inc_ret, hb_pg_inc_ret, True);
1215 temp = (file_window_width - hb_slide_size + 1) - hb_val_ret;
1216 hb_val_ret = file_window_width - hb_slide_size + 1;
1217 min_width = temp + min_width;
1218 max_width = temp + max_width;
1219 XmUpdateDisplay ((Widget)file_window);
1220 x2 = file_window_width;
1224 hb_val_ret = file_window_width - hb_slide_size + 1;
1225 x2 = max_width = file_window_width;
1226 min_width = max_width - current_file_window_width;
1233 if((Dimension)x2 > current_file_window_width)
1234 x2 = current_file_window_width;
1238 if((Dimension)x2 > file_window_width)
1239 x2 = file_window_width;
1243 else if((Dimension)x2 < min_width)
1249 hb_val_ret -= (min_width - x2);
1252 XmScrollBarSetValues(hb, hb_val_ret, hb_slide_size,
1253 hb_inc_ret, hb_pg_inc_ret, True);
1254 max_width = max_width - (min_width - x2);
1256 XmUpdateDisplay (file_mgr_rec->file_window);
1258 else if((hb_val_ret < 0) &&
1259 ((int)(hb_val_ret + (min_width - x2)) >= (int)0))
1261 XmScrollBarSetValues(hb, 0, hb_slide_size,
1262 hb_inc_ret, hb_pg_inc_ret, True);
1263 max_width = current_file_window_width;
1264 XmUpdateDisplay ((Widget)file_window);
1265 x2 = hb_val_ret = min_width = 0;
1269 hb_val_ret = min_width = x2 = 0;
1270 max_width = current_file_window_width;
1286 if((Dimension)y2 > max_height)
1290 vb_val_ret += (y2 - max_height);
1291 if((Dimension)(vb_val_ret + vb_slide_size) <= (Dimension)(file_window_height + 1))
1293 XmScrollBarSetValues(vb, vb_val_ret, vb_slide_size,
1294 vb_inc_ret, vb_pg_inc_ret, True);
1295 min_height = (y2 - max_height) + min_height;
1297 XmUpdateDisplay ((Widget)file_window);
1299 else if((Dimension)(vb_val_ret + vb_slide_size) > (Dimension)(file_window_height + 1) &&
1300 (Dimension)(vb_val_ret - (y2 - max_height)) <
1301 (Dimension)(file_window_height + 1 - vb_slide_size))
1303 XmScrollBarSetValues(vb,
1304 file_window_height + 1 - vb_slide_size,
1305 vb_slide_size, vb_inc_ret, vb_pg_inc_ret, True);
1306 temp = (file_window_height + 1 - vb_slide_size) - vb_val_ret;
1307 vb_val_ret = file_window_height + 1 - vb_slide_size;
1308 min_height = temp + min_height;
1309 max_height = temp + max_height;
1310 XmUpdateDisplay ((Widget)file_window);
1311 y2 = file_window_height;
1315 vb_val_ret = file_window_height + 1 - vb_slide_size;
1316 y2 = max_height = file_window_height;
1317 min_height = max_height - current_file_window_height;
1324 if((Dimension)y2 > current_file_window_height)
1325 y2 = current_file_window_height;
1329 if((Dimension)y2 > file_window_height)
1330 y2 = file_window_height;
1334 else if((Dimension)y2 < min_height)
1340 vb_val_ret -= (min_height - y2);
1343 XmScrollBarSetValues(vb, vb_val_ret, vb_slide_size,
1344 vb_inc_ret, vb_pg_inc_ret, True);
1345 max_height = max_height - (min_height - y2);
1347 XmUpdateDisplay (file_mgr_rec->file_window);
1349 else if(vb_val_ret < 0 &&
1350 ((int)(vb_val_ret + (min_height - y2)) >= (int)0))
1352 XmScrollBarSetValues(vb, 0, vb_slide_size,
1353 vb_inc_ret, vb_pg_inc_ret, True);
1354 max_height = current_file_window_height;
1355 XmUpdateDisplay ((Widget)file_window);
1356 y2 = vb_val_ret = min_height = 0;
1360 vb_val_ret = min_height = y2 = 0;
1361 max_height = current_file_window_height;
1398 virt_width = x4 - x3 + 1;
1399 virt_height = y4 - y3 + 1;
1402 return_rect.x = (short)virt_x;
1403 return_rect.y = (short)virt_y;
1404 return_rect.width = (unsigned short)virt_width;
1405 return_rect.height = (unsigned short)virt_height;
1406 region = XCreateRegion();
1407 XUnionRectWithRegion (&return_rect, region, region);
1409 /* Run through the gadget set to cause each icon within the */
1410 /* rectangle to be selected. */
1412 if (file_mgr_data->show_type == SINGLE_DIRECTORY)
1413 directory_count = 1;
1415 directory_count = file_mgr_data->directory_count;
1417 directory_set = file_mgr_data->directory_set;
1420 for (i = 0; i < directory_count; i++)
1422 for (j = 0; j < directory_set[i]->file_count; j++)
1426 file_view_data = directory_set[i]->order_list[j];
1428 if (!file_view_data->displayed || file_view_data->need_update)
1431 g = (DtIconGadget) file_view_data->widget;
1433 highlightThickness = g->gadget.highlight_thickness;
1434 shadowThickness = g->gadget.shadow_thickness;
1439 marginWidth = g->icon.cache->margin_width;
1440 marginHeight = g->icon.cache->margin_height;
1441 pixmapPosition = g->icon.cache->pixmap_position;
1442 alignment = g->icon.cache->alignment;
1444 pixmapWidth = g->icon.pixmap_width;
1445 pixmapHeight = g->icon.pixmap_height;
1446 stringWidth = g->icon.string_width;
1447 stringHeight = g->icon.cache->string_height;
1449 switch ((int) pixmapPosition)
1452 if (alignment == XmALIGNMENT_BEGINNING)
1453 pixmap_x = x + highlightThickness;
1454 else if(alignment == XmALIGNMENT_CENTER)
1456 if(stringWidth >= pixmapWidth)
1457 pixmap_x = x + highlightThickness +
1458 ((Dimension)(stringWidth - pixmapWidth)/(Dimension)2);
1460 pixmap_x = x + highlightThickness;
1465 pixmap_x = x + highlightThickness;
1468 pixmap_y = y + pixmapHeight;
1469 pixmap_x = pixmap_x + pixmapWidth;
1471 pixmap_x1 = pixmap_x + pixmapWidth;
1472 pixmap_y1 = pixmap_y + pixmapHeight;
1475 if(XPointInRegion(region, pixmap_x, pixmap_y)
1477 && XPointInRegion(region, pixmap_x1, pixmap_y1)
1481 if (toggleSelect == True &&
1482 FileIsSelected (file_mgr_data, file_view_data))
1483 DeselectFile (file_mgr_data, file_view_data, True);
1486 if(!FileIsSelected (file_mgr_data, file_view_data))
1487 SelectFile (file_mgr_data, file_view_data);
1490 else if (FileIsSelected (file_mgr_data, file_view_data))
1491 DeselectFile (file_mgr_data, file_view_data, True);
1494 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1495 XDestroyRegion (region);
1499 XDestroyRegion (widget_region);
1500 XDestroyRegion (intersect_region);
1501 XDestroyRegion (redraw_region);
1508 /************************************************************************
1511 * DrawRectangle takes two points as input and draws a rectangle with
1512 * a line width and height of 1 around the rectangle generated
1513 * by the two points. The rectangle is drawn XOR so that it
1516 ************************************************************************/
1531 unsigned int height;
1555 XDrawRectangle (display, window, gc, x, y, width, height);
1557 if (width > 2 && height > 2)
1558 XDrawRectangle (display, window, gc, x + 1, y + 1, width - 2, height - 2);
1563 * Given a widget, create a region describing the area occupied by the
1564 * widget; it may be a simple rectangle, or a compound region composed
1565 * of two rectangles (the pixmap and the label).
1569 WidgetRectToRegion (
1570 FileMgrData * file_mgr_data,
1574 XRectangle widget_rect;
1575 XRectangle pRect, lRect;
1576 unsigned char flags;
1577 static Region temp_region = NULL;
1579 /* Empty the region */
1580 if (temp_region == NULL)
1581 temp_region = XCreateRegion();
1582 XSubtractRegion(temp_region, temp_region, region);
1587 /* Tree mode and attribute views do not support compound icons */
1588 if ((file_mgr_data->show_type != SINGLE_DIRECTORY) ||
1589 (file_mgr_data->view == BY_ATTRIBUTES))
1591 widget_rect.x = (short)w->core.x;
1592 widget_rect.y = (short)w->core.y;
1593 widget_rect.width = (unsigned short)w->core.width;
1594 widget_rect.height = (unsigned short)w->core.height;
1596 XUnionRectWithRegion(&widget_rect, region, region);
1600 _DtIconGetIconRects((DtIconGadget)w, &flags, &pRect, &lRect);
1602 if (flags & XmPIXMAP_RECT)
1603 XUnionRectWithRegion(&pRect, region, region);
1605 if (flags & XmLABEL_RECT)
1606 XUnionRectWithRegion(&lRect, region, region);
1613 FileMgrData * file_mgr_data,
1615 Boolean toggleSelect,
1616 XButtonEvent * event)
1618 XRectangle * selection_rect;
1619 XRectangle widget_rect;
1620 DirectorySet ** directory_set;
1621 int directory_count;
1624 Region widget_region;
1625 Region intersect_region;
1626 Region redraw_region;
1627 FileMgrRec * file_mgr_rec;
1628 FileViewData * file_view_data;
1630 file_mgr_rec = (FileMgrRec *)file_mgr_data->file_mgr_rec;
1632 /* User is starting a new selection; clear all old ones */
1635 DeselectAllFiles (file_mgr_data);
1636 file_mgr_data->selected_file_count = 0;
1638 XFlush (XtDisplay (file_mgr_rec->file_window));
1639 XmUpdateDisplay (file_mgr_rec->file_window);
1642 /* Get the rectangle to be used as the selection area */
1643 if (icon == NULL && event->type == ButtonPress)
1645 /* User is starting a region select */
1646 GetSelectionRectangle (XtDisplay(file_mgr_rec->file_window),
1647 (Window) XtWindow(file_mgr_rec->file_window),
1648 event, file_mgr_rec, file_mgr_data,
1653 /* User did a single select either through keyboard or mouse */
1654 if(event->type == KeyPress)
1656 widget_rect.x = (short)icon->core.x;
1657 widget_rect.y = (short)icon->core.y;
1658 widget_rect.width = (short)icon->core.width;
1659 widget_rect.height = (short)icon->core.height;
1663 widget_rect.x = (short)event->x;
1664 widget_rect.y = (short)event->y;
1665 widget_rect.width = 1;
1666 widget_rect.height = 1;
1668 selection_rect = &widget_rect;
1670 region = XCreateRegion();
1671 widget_region = XCreateRegion();
1672 intersect_region = XCreateRegion();
1673 redraw_region = XCreateRegion();
1675 XUnionRectWithRegion (selection_rect, region, region);
1678 /* Run through the gadget set to cause each icon within the */
1679 /* rectangle to be selected. */
1681 if (file_mgr_data->show_type == SINGLE_DIRECTORY)
1684 directory_count = 1;
1688 directory_count = file_mgr_data->directory_count;
1692 directory_set = file_mgr_data->directory_set;
1695 for (; i < directory_count; i++)
1697 if (PositioningEnabledInView(file_mgr_data))
1699 ObjectPtr top = GetTopOfStack(file_mgr_data);
1700 int next_position = 0;
1703 * Stacking order requires us to handle this specially. Objects
1704 * must be searched in top to bottom order when determining if
1705 * they are in the selection rectangle, but they must be drawn
1706 * bottom to top, to guarantee that the visuals are correct.
1709 /* Find set of selected objects */
1712 if(top->file_view_data == NULL)
1718 if (!top->file_view_data->displayed)
1724 WidgetRectToRegion(file_mgr_data, top->file_view_data->widget,
1726 XIntersectRegion(region, widget_region, intersect_region);
1728 if (!XEmptyRegion(intersect_region))
1731 FileIsSelected (file_mgr_data, top->file_view_data))
1733 DeselectFile(file_mgr_data, top->file_view_data, True);
1735 XUnionRegion(widget_region, redraw_region, redraw_region);
1740 * We don't want to change the icon yet, because we
1741 * need to do it in bottom to top order.
1744 RepositionUpInStack(file_mgr_data, top->stacking_order,
1748 /* Higher item 'cover' lower ones */
1749 XSubtractRegion(region, widget_region, region);
1755 /* Now, select any newly selected files */
1756 if (next_position > 0)
1758 /* Find where to start the redraw from */
1759 top = GetTopOfStack(file_mgr_data);
1760 while (next_position - 1 > 0)
1768 if(top->file_view_data != NULL)
1769 SelectFile(file_mgr_data, top->file_view_data);
1774 if (!XEmptyRegion(redraw_region))
1775 RepaintDesktop(file_mgr_data, NULL, redraw_region);
1777 RegisterDesktopHotspots(file_mgr_data, file_mgr_rec);
1782 for (j = 0; j < directory_set[i]->file_count; j++)
1784 file_view_data = directory_set[i]->order_list[j];
1786 if (!file_view_data->displayed)
1789 WidgetRectToRegion(file_mgr_data, file_view_data->widget,
1791 XIntersectRegion (region, widget_region, intersect_region);
1793 if (!XEmptyRegion (intersect_region))
1795 if (toggleSelect == True &&
1796 FileIsSelected (file_mgr_data, file_view_data))
1797 DeselectFile (file_mgr_data, file_view_data, True);
1800 SelectFile (file_mgr_data, file_view_data);
1801 if(file_mgr_data->view == BY_ATTRIBUTES)
1804 * Need to determine whether the click was in the
1807 XRectangle textExtent;
1809 XmFontList fontList;
1810 XmString fileNameString;
1811 DtIconGadget g = (DtIconGadget)file_view_data->widget;
1813 _DtIconGetTextExtent_r(file_view_data->widget,
1816 XtVaGetValues( file_view_data->widget,
1821 fileNameString = XmStringCreateLocalized( file_view_data->file_data->file_name );
1822 textExtent.width = XmStringWidth( fontList, fileNameString );
1823 XmStringFree( fileNameString );
1825 (unsigned short)file_view_data->widget->core.height;
1827 textExtent.x = (short)file_view_data->widget->core.x
1828 + g->icon.pixmap_width
1829 + g->icon.cache->margin_width
1830 + g->icon.cache->spacing;
1832 textExtent.y = (short)file_view_data->widget->core.y;
1834 tmp_region = XCreateRegion();
1835 XUnionRectWithRegion (&textExtent,
1836 tmp_region, tmp_region);
1838 XSubtractRegion (widget_region, tmp_region, tmp_region);
1840 XIntersectRegion (region, tmp_region, intersect_region);
1841 if (XEmptyRegion (intersect_region))
1842 TurnOnTextName = True;
1844 TurnOnTextName = False;
1845 XDestroyRegion (tmp_region);
1853 XDestroyRegion (region);
1854 XDestroyRegion (widget_region);
1855 XDestroyRegion (intersect_region);
1856 XDestroyRegion (redraw_region);
1860 if(file_mgr_data != trashFileMgrData)
1862 if (file_mgr_data->selected_file_count == 0)
1863 ActivateNoSelect (file_mgr_rec);
1864 else if (file_mgr_data->selected_file_count == 1)
1866 ActivateSingleSelect (file_mgr_rec,
1867 file_mgr_data->selection_list[0]->file_data->logical_type);
1870 ActivateMultipleSelect (file_mgr_rec);
1873 SensitizeTrashBtns();
1875 ProcessBtnUp = False;
1882 FileViewData *file_view_data,
1883 FileMgrData *file_mgr_data,
1886 int n, num_rectangles;
1888 Dimension highlightThickness, shadowThickness;
1889 Dimension half_shadowThickness;
1890 Dimension marginWidth, marginHeight;
1891 Dimension pixmapWidth, pixmapHeight;
1892 Dimension stringWidth, stringHeight;
1894 XRectangle rect[10];
1895 unsigned char pixmapPosition;
1896 unsigned char alignment;
1897 Position adj_x, adj_y;
1900 DtIconGadget g = (DtIconGadget)w;
1903 gc = ((XmManagerWidget)(g->object.parent))->manager.highlight_GC;
1908 DrawShadowTh(w, gc, DESKTOP);
1913 /* in in as placed mode need to cycle the icons so the traversal
1914 box doesn't chop up the icons */
1915 if(type == NOT_DESKTOP && file_view_data != NULL)
1917 if (PositioningEnabledInView(file_mgr_data))
1919 top = GetTopOfStack(file_mgr_data);
1920 if(top != NULL && top->file_view_data != file_view_data)
1922 ObjectPtr savetop, next, prev;
1926 while(top != NULL && top->file_view_data != file_view_data)
1938 top->next = savetop;
1939 top->stacking_order = 1;
1940 savetop->prev = top;
1942 for(i = 2; top->prev != NULL; i++)
1944 top->stacking_order = i;
1945 if(top->next == NULL)
1950 RedrawOneGadget(w, NULL, NULL);
1957 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
1958 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
1959 XtSetArg (args[n], XmNx, &x); n++;
1960 XtSetArg (args[n], XmNy, &y); n++;
1961 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
1962 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
1963 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
1964 XtSetArg (args[n], XmNalignment, &alignment); n++;
1965 XtGetValues (w, args, n);
1967 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
1968 pixmapWidth = g->icon.pixmap_width;
1969 pixmapHeight = g->icon.pixmap_height;
1970 stringWidth = g->icon.string_width;
1971 stringHeight = g->icon.cache->string_height;
1973 adj_x = shadowThickness + highlightThickness + marginWidth;
1974 adj_y = shadowThickness + highlightThickness + marginHeight;
1976 if(shadowThickness != 0)
1977 half_shadowThickness = shadowThickness/2;
1979 half_shadowThickness = 0;
1982 switch ((int) pixmapPosition)
1985 if (alignment == XmALIGNMENT_BEGINNING)
1988 rect[num_rectangles].x = x;
1989 rect[num_rectangles].y = y;
1990 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
1991 rect[num_rectangles++].height = highlightThickness;
1993 if(stringWidth > pixmapWidth)
1996 rect[num_rectangles].x = x + pixmapWidth +
1997 (2 * adj_x) - highlightThickness;
1998 rect[num_rectangles].y = y;
1999 rect[num_rectangles].width = highlightThickness;
2000 rect[num_rectangles++].height = pixmapHeight + spacing;
2003 rect[num_rectangles].x = x + pixmapWidth +
2004 (2 * adj_x) - highlightThickness;
2005 rect[num_rectangles].y = y + pixmapHeight + spacing;
2006 rect[num_rectangles].width = stringWidth -
2007 pixmapWidth + highlightThickness;
2008 rect[num_rectangles++].height = highlightThickness;
2011 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2012 - highlightThickness;
2013 rect[num_rectangles].y = y + pixmapHeight + spacing;
2014 rect[num_rectangles].width = highlightThickness;
2015 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2020 rect[num_rectangles].x = x + pixmapWidth +
2021 (2 * adj_x) - highlightThickness;
2022 rect[num_rectangles].y = y;
2023 rect[num_rectangles].width = highlightThickness;
2024 rect[num_rectangles++].height = pixmapHeight + (2 * adj_y) -
2028 rect[num_rectangles].x = x + stringWidth +
2029 (2 * adj_x) - highlightThickness;
2030 rect[num_rectangles].y = y + pixmapHeight + (2 * adj_y) -
2032 rect[num_rectangles].width = pixmapWidth -
2033 stringWidth + highlightThickness;
2034 rect[num_rectangles++].height = highlightThickness;
2038 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2039 - highlightThickness;
2040 rect[num_rectangles].y = y + pixmapHeight + (2 * adj_y) -
2042 rect[num_rectangles].width = highlightThickness;
2043 rect[num_rectangles++].height = spacing + stringHeight +
2048 rect[num_rectangles].x = x;
2049 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2050 spacing + (2 * adj_y) - highlightThickness;
2051 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2052 rect[num_rectangles++].height = highlightThickness;
2055 rect[num_rectangles].x = x;
2056 rect[num_rectangles].y = y;
2057 rect[num_rectangles].width = highlightThickness;
2058 rect[num_rectangles++].height = pixmapHeight +
2059 stringHeight + spacing + (2 * adj_y);
2062 else if (alignment == XmALIGNMENT_CENTER)
2064 if(stringWidth > pixmapWidth)
2067 rect[num_rectangles].x = x
2068 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
2069 rect[num_rectangles].y = y;
2070 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
2071 rect[num_rectangles++].height = highlightThickness;
2074 rect[num_rectangles].x = x
2075 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2078 - highlightThickness;
2079 rect[num_rectangles].y = y;
2080 rect[num_rectangles].width = highlightThickness;
2081 rect[num_rectangles++].height = pixmapHeight + spacing;
2084 rect[num_rectangles].x = x
2085 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2088 - highlightThickness;
2089 rect[num_rectangles].y = y + pixmapHeight + spacing;
2090 rect[num_rectangles].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2091 + (Dimension)(stringWidth - pixmapWidth)%(Dimension)2;
2092 rect[num_rectangles++].height = highlightThickness;
2095 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2096 - highlightThickness;
2097 rect[num_rectangles].y = y + pixmapHeight + spacing;
2098 rect[num_rectangles].width = highlightThickness;
2099 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2102 rect[num_rectangles].x = x;
2103 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2104 spacing + (2 * adj_y) - highlightThickness;
2105 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2106 rect[num_rectangles++].height = highlightThickness;
2109 rect[num_rectangles].x = x;
2110 rect[num_rectangles].y = y + pixmapHeight + spacing;
2111 rect[num_rectangles].width = highlightThickness;
2112 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2115 rect[num_rectangles].x = x;
2116 rect[num_rectangles].y = y + pixmapHeight + spacing;
2117 rect[num_rectangles].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2118 + highlightThickness;
2119 rect[num_rectangles++].height = highlightThickness;
2122 rect[num_rectangles].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
2123 rect[num_rectangles].y = y;
2124 rect[num_rectangles].width = highlightThickness;
2125 rect[num_rectangles++].height = pixmapHeight + spacing;
2130 rect[num_rectangles].x = x;
2131 rect[num_rectangles].y = y;
2132 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
2133 rect[num_rectangles++].height = highlightThickness;
2136 rect[num_rectangles].x = x + pixmapWidth + (2 * adj_x) -
2138 rect[num_rectangles].y = y;
2139 rect[num_rectangles].width = highlightThickness;
2140 rect[num_rectangles++].height = pixmapHeight + spacing +
2141 2 * highlightThickness;
2144 rect[num_rectangles].x = x + pixmapWidth + adj_x -
2145 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness;
2146 rect[num_rectangles].y = y + pixmapHeight + spacing +
2147 highlightThickness + 1;
2148 rect[num_rectangles].width = (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2150 rect[num_rectangles++].height = highlightThickness;
2153 rect[num_rectangles].x = x + stringWidth + adj_x +
2154 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness;
2155 rect[num_rectangles].y = y + pixmapHeight + spacing
2156 + highlightThickness + 1;
2157 rect[num_rectangles].width = highlightThickness;
2158 rect[num_rectangles++].height = stringHeight + (2 * adj_y)
2159 - highlightThickness - 1;
2162 rect[num_rectangles].x = x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2;
2163 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2164 spacing + (2 * adj_y) - highlightThickness;
2165 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2166 rect[num_rectangles++].height = highlightThickness;
2169 rect[num_rectangles].x = x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2;
2170 rect[num_rectangles].y = y + pixmapHeight + spacing +
2171 highlightThickness + 1;
2172 rect[num_rectangles].width = highlightThickness;
2173 rect[num_rectangles++].height = stringHeight + (2 * adj_y)
2174 - highlightThickness - 1;
2177 rect[num_rectangles].x = x;
2178 rect[num_rectangles].y = y + pixmapHeight + spacing +
2179 highlightThickness + 1;
2180 rect[num_rectangles].width = (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2182 rect[num_rectangles++].height = highlightThickness;
2185 rect[num_rectangles].x = x;
2186 rect[num_rectangles].y = y;
2187 rect[num_rectangles].width = highlightThickness;
2188 rect[num_rectangles++].height = pixmapHeight + spacing +
2189 2 * highlightThickness;
2193 FM_XmHighlightBorder ((Widget)w);
2196 if((Dimension)(stringHeight + 4) >= pixmapHeight)
2197 FM_XmHighlightBorder ((Widget)w);
2201 rect[num_rectangles].x = x;
2202 rect[num_rectangles].y = y;
2203 rect[num_rectangles].width = adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2204 rect[num_rectangles++].height = highlightThickness;
2207 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2208 rect[num_rectangles].y = y;
2209 rect[num_rectangles].width = highlightThickness;
2210 rect[num_rectangles++].height = (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2213 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2214 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2215 rect[num_rectangles].width = spacing/2 + stringWidth + adj_x;
2216 rect[num_rectangles++].height = highlightThickness;
2219 rect[num_rectangles].x = x + adj_x + pixmapWidth + spacing +
2220 stringWidth + adj_x - highlightThickness;
2221 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2222 rect[num_rectangles].width = highlightThickness;
2223 rect[num_rectangles++].height = stringHeight + 2*adj_y;
2226 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2227 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2228 stringHeight + 2*adj_y - highlightThickness;
2229 rect[num_rectangles].width = spacing/2 + stringWidth + adj_x;
2230 rect[num_rectangles++].height = highlightThickness;
2233 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2234 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2235 stringHeight + 2*adj_y;
2236 rect[num_rectangles].width = highlightThickness;
2237 rect[num_rectangles++].height = pixmapHeight - stringHeight -
2238 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2241 rect[num_rectangles].x = x;
2242 rect[num_rectangles].y = y + pixmapHeight + 2*adj_y -
2244 rect[num_rectangles].width = adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2245 rect[num_rectangles++].height = highlightThickness;
2248 rect[num_rectangles].x = x;
2249 rect[num_rectangles].y = y;
2250 rect[num_rectangles].width = highlightThickness;
2251 rect[num_rectangles++].height = pixmapHeight + 2*adj_y;
2254 case XmPIXMAP_BOTTOM:
2255 case XmPIXMAP_RIGHT:
2256 FM_XmHighlightBorder ((Widget)w);
2262 XFillRectangles (XtDisplay (w), XtWindow (w), gc, &rect[0], num_rectangles);
2272 Dimension highlightThickness, shadowThickness;
2273 Dimension half_shadowThickness;
2274 Dimension marginWidth, marginHeight;
2275 Dimension pixmapWidth, pixmapHeight;
2276 Dimension stringWidth, stringHeight;
2278 unsigned char pixmapPosition;
2279 unsigned char alignment;
2280 Position adj_x, adj_y;
2282 DtIconGadget g = (DtIconGadget)w;
2288 DrawShadowTh(w, NULL, DESKTOP);
2294 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
2295 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
2296 XtSetArg (args[n], XmNx, &x); n++;
2297 XtSetArg (args[n], XmNy, &y); n++;
2298 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
2299 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
2300 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
2301 XtSetArg (args[n], XmNalignment, &alignment); n++;
2302 XtGetValues (w, args, n);
2304 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
2305 pixmapWidth = g->icon.pixmap_width;
2306 pixmapHeight = g->icon.pixmap_height;
2307 stringWidth = g->icon.string_width;
2308 stringHeight = g->icon.cache->string_height;
2310 adj_x = shadowThickness + highlightThickness + marginWidth;
2311 adj_y = shadowThickness + highlightThickness + marginHeight;
2313 if(shadowThickness != 0)
2314 half_shadowThickness = shadowThickness/2;
2316 half_shadowThickness = 0;
2318 switch ((int) pixmapPosition)
2321 if (alignment == XmALIGNMENT_BEGINNING)
2324 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2325 pixmapWidth + (2 * adj_x), highlightThickness, False);
2327 if(stringWidth > pixmapWidth)
2330 XClearArea (XtDisplay (w), XtWindow (w),
2331 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2332 y, highlightThickness,
2333 pixmapHeight + spacing,
2337 XClearArea (XtDisplay (w), XtWindow (w),
2338 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2339 y + pixmapHeight + spacing,
2340 stringWidth - pixmapWidth + highlightThickness,
2345 XClearArea (XtDisplay (w), XtWindow (w),
2346 x + stringWidth + (2 * adj_x) - highlightThickness,
2347 y + pixmapHeight + spacing,
2349 stringHeight + (2 * adj_y),
2355 XClearArea (XtDisplay (w), XtWindow (w),
2356 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2357 y, highlightThickness,
2358 pixmapHeight + (2 * adj_y) - half_shadowThickness,
2362 XClearArea (XtDisplay (w), XtWindow (w),
2363 x + stringWidth + (2 * adj_x) - highlightThickness,
2364 y + pixmapHeight + (2 * adj_y) - highlightThickness,
2365 pixmapWidth - stringWidth + highlightThickness,
2370 XClearArea (XtDisplay (w), XtWindow (w),
2371 x + stringWidth + (2 * adj_x) - highlightThickness,
2372 y + pixmapHeight + (2 * adj_y) -
2373 half_shadowThickness,
2375 spacing + stringHeight + highlightThickness,
2380 XClearArea (XtDisplay (w), XtWindow (w), x,
2381 y + pixmapHeight + stringHeight +
2382 spacing + (2 * adj_y) - highlightThickness,
2383 stringWidth + (2 * adj_y),
2388 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2390 pixmapHeight + stringHeight + spacing + (2 * adj_y),
2394 else if (alignment == XmALIGNMENT_CENTER)
2396 if(stringWidth > pixmapWidth)
2399 XClearArea (XtDisplay (w), XtWindow (w),
2400 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2, y,
2401 pixmapWidth + (2 * adj_x),
2406 XClearArea (XtDisplay (w), XtWindow (w),
2407 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + pixmapWidth +
2408 (2 * adj_x) - highlightThickness,
2409 y, highlightThickness, pixmapHeight + spacing,
2413 XClearArea (XtDisplay (w), XtWindow (w),
2414 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + pixmapWidth +
2415 (2 * adj_x) - highlightThickness,
2416 y + pixmapHeight + spacing,
2417 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
2418 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2,
2423 XClearArea (XtDisplay (w), XtWindow (w),
2424 x + stringWidth + (2 * adj_x) - highlightThickness,
2425 y + pixmapHeight + spacing, highlightThickness,
2426 stringHeight + (2 * adj_y),
2430 XClearArea (XtDisplay (w), XtWindow (w), x,
2431 y + pixmapHeight + stringHeight +
2432 spacing + (2 * adj_y) - highlightThickness,
2433 stringWidth + (2 * adj_y), highlightThickness,
2437 XClearArea (XtDisplay (w), XtWindow (w), x,
2438 y + pixmapHeight + spacing, highlightThickness,
2439 stringHeight + (2 * adj_y),
2443 XClearArea (XtDisplay (w), XtWindow (w), x,
2444 y + pixmapHeight + spacing,
2445 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + highlightThickness,
2450 XClearArea (XtDisplay (w), XtWindow (w),
2451 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2,
2452 y, highlightThickness, pixmapHeight + spacing,
2458 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2459 pixmapWidth + (2 * adj_x), highlightThickness,
2463 XClearArea (XtDisplay (w), XtWindow (w),
2464 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2465 y, highlightThickness,
2466 pixmapHeight + spacing + 2 * highlightThickness,
2470 XClearArea (XtDisplay (w), XtWindow (w),
2471 x + pixmapWidth + adj_x + highlightThickness -
2472 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2473 y + pixmapHeight + spacing + highlightThickness + 1,
2474 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness,
2479 XClearArea (XtDisplay (w), XtWindow (w),
2480 x + stringWidth + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2481 adj_x + highlightThickness,
2482 y + pixmapHeight + spacing + highlightThickness + 1,
2484 stringHeight + (2 * adj_y) - highlightThickness -1,
2488 XClearArea (XtDisplay (w), XtWindow (w),
2489 x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2490 y + pixmapHeight + stringHeight +
2491 spacing + (2 * adj_y) - highlightThickness,
2492 stringWidth + (2 * adj_y),
2497 XClearArea (XtDisplay (w), XtWindow (w),
2498 x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2499 y + pixmapHeight + spacing + highlightThickness + 1,
2501 stringHeight + (2 * adj_y) - highlightThickness - 1,
2505 XClearArea (XtDisplay (w), XtWindow (w), x,
2506 y + pixmapHeight + spacing + highlightThickness + 1,
2507 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness,
2512 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2514 pixmapHeight + spacing + 2 * highlightThickness,
2520 FM_XmUnhighlightBorder ((Widget)w);
2523 if((Dimension)(stringHeight + 4) >= pixmapHeight)
2524 FM_XmUnhighlightBorder ((Widget)w);
2528 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2529 adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2534 XClearArea (XtDisplay (w), XtWindow (w),
2535 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2538 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2542 XClearArea (XtDisplay (w), XtWindow (w),
2543 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2544 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2545 spacing/2 + stringWidth + adj_x,
2550 XClearArea (XtDisplay (w), XtWindow (w),
2551 x + adj_x + pixmapWidth + spacing +
2552 stringWidth + adj_x - highlightThickness,
2553 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2555 stringHeight + 2*adj_y,
2559 XClearArea (XtDisplay (w), XtWindow (w),
2560 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2561 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2562 stringHeight + 2*adj_y - highlightThickness,
2563 spacing/2 + stringWidth + adj_x,
2568 XClearArea (XtDisplay (w), XtWindow (w),
2569 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2570 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2571 stringHeight + 2*adj_y,
2573 pixmapHeight - stringHeight -
2574 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2578 XClearArea (XtDisplay (w), XtWindow (w), x,
2579 y + pixmapHeight + 2*adj_y - highlightThickness,
2580 adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2585 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2587 pixmapHeight + 2*adj_y,
2591 case XmPIXMAP_BOTTOM:
2592 case XmPIXMAP_RIGHT:
2593 FM_XmUnhighlightBorder ((Widget)w);
2607 Dimension highlightThickness, shadowThickness;
2608 Dimension width, height;
2609 Dimension marginWidth, marginHeight;
2610 Dimension pixmapWidth, pixmapHeight;
2611 Dimension stringWidth, stringHeight;
2613 unsigned char pixmapPosition;
2614 unsigned char alignment;
2615 unsigned char shadowType;
2616 GC top_gc, bottom_gc ;
2618 XRectangle rect[10];
2619 DtIconGadget g = (DtIconGadget)w;
2620 XmManagerWidget mgr = (XmManagerWidget)XtParent(w);
2621 Boolean s_out = NULL,
2627 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
2628 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
2629 XtSetArg (args[n], XmNx, &x); n++;
2630 XtSetArg (args[n], XmNy, &y); n++;
2631 XtSetArg (args[n], XmNwidth, &width); n++;
2632 XtSetArg (args[n], XmNheight, &height); n++;
2633 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
2634 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
2635 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
2636 XtSetArg (args[n], XmNalignment, &alignment); n++;
2637 XtSetArg (args[n], XmNshadowType, &shadowType); n++;
2638 XtGetValues (w, args, n);
2640 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
2641 pixmapWidth = g->icon.pixmap_width;
2642 pixmapHeight = g->icon.pixmap_height;
2643 stringWidth = g->icon.string_width;
2644 stringHeight = g->icon.cache->string_height;
2646 /* Get shadow attributes.
2648 s_out = (shadowType == XmSHADOW_OUT || shadowType == XmSHADOW_ETCHED_OUT)
2650 s_etched = (shadowType == XmSHADOW_ETCHED_IN ||
2651 shadowType == XmSHADOW_ETCHED_OUT)
2656 if(shadowType == XmSHADOW_ETCHED_OUT)
2659 ? mgr->manager.top_shadow_GC : mgr->manager.bottom_shadow_GC;
2661 ? mgr->manager.bottom_shadow_GC : mgr->manager.top_shadow_GC;
2666 ? mgr->manager.top_shadow_GC : mgr->manager.bottom_shadow_GC;
2668 ? mgr->manager.bottom_shadow_GC : mgr->manager.top_shadow_GC;
2672 top_gc = bottom_gc = gc;
2678 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
2679 x + highlightThickness,
2680 y + highlightThickness,
2681 width - 2*highlightThickness,
2682 height - 2*highlightThickness,
2683 shadowThickness, XmSHADOW_IN);
2687 int half_shadowThickness;
2690 if (shadowThickness <= 0) return;
2691 if (shadowThickness > (Dimension)(width / 2)) shadowThickness = width / 2;
2692 if (shadowThickness > (Dimension)(height / 2)) shadowThickness = height / 2;
2693 if (shadowThickness <= 0) return;
2695 shadowThickness = (shadowThickness % 2) ?
2696 (shadowThickness-1) : (shadowThickness);
2698 half_shadowThickness = shadowThickness / 2;
2699 switch ((int) pixmapPosition)
2702 if (alignment == XmALIGNMENT_BEGINNING)
2704 if(type == NOT_DESKTOP)
2708 rect[num_rects].x = x + highlightThickness;
2709 rect[num_rects].y = y + highlightThickness;
2710 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
2711 (2 * marginWidth) - half_shadowThickness;
2712 rect[num_rects++].height = half_shadowThickness;
2715 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2716 (2 * marginWidth) + shadowThickness;
2717 rect[num_rects].y = y + highlightThickness;
2718 rect[num_rects].width = half_shadowThickness;
2719 rect[num_rects++].height = pixmapHeight + marginHeight +
2720 spacing/2 + shadowThickness +
2721 half_shadowThickness;
2723 if(stringWidth > pixmapWidth)
2726 rect[num_rects].x = x + highlightThickness +
2728 pixmapWidth + (2 * marginWidth);
2729 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2731 rect[num_rects].width = stringWidth - pixmapWidth +
2732 marginWidth - half_shadowThickness;
2733 rect[num_rects++].height = half_shadowThickness;
2736 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
2737 + shadowThickness + highlightThickness;
2738 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2740 rect[num_rects].width = half_shadowThickness;
2741 rect[num_rects++].height = stringHeight +
2742 (2*marginHeight) + half_shadowThickness;
2747 rect[num_rects].x = x + highlightThickness + stringWidth +
2748 (2 * marginWidth) + shadowThickness;
2749 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2750 shadowThickness + half_shadowThickness;
2751 rect[num_rects].width = pixmapWidth - stringWidth +
2752 marginHeight - half_shadowThickness;
2753 rect[num_rects++].height = half_shadowThickness;
2756 rect[num_rects].x = x + highlightThickness + stringWidth +
2757 (2 * marginWidth) + shadowThickness;
2758 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2759 shadowThickness + half_shadowThickness;
2760 rect[num_rects].width = half_shadowThickness;
2761 rect[num_rects++].height = stringHeight +
2766 rect[num_rects].x = x + highlightThickness;
2767 rect[num_rects].y = y + highlightThickness + pixmapHeight +
2768 stringHeight + spacing + (2*marginHeight) + shadowThickness;
2769 if(stringWidth > pixmapWidth)
2770 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2771 shadowThickness + half_shadowThickness;
2773 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2774 shadowThickness + half_shadowThickness;
2775 rect[num_rects++].height = half_shadowThickness;
2778 rect[num_rects].x = x + highlightThickness;
2779 rect[num_rects].y = y + highlightThickness;
2780 rect[num_rects].width = half_shadowThickness;
2781 rect[num_rects++].height = pixmapHeight + stringHeight +
2782 spacing + (2 * marginHeight) + shadowThickness;
2784 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
2785 &rect[0], num_rects);
2789 rect[num_rects].x = x + highlightThickness +
2790 half_shadowThickness;
2791 rect[num_rects].y = y + highlightThickness +
2792 half_shadowThickness;
2793 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
2794 half_shadowThickness;
2795 rect[num_rects++].height = half_shadowThickness;
2797 if(stringWidth > pixmapWidth)
2800 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2801 shadowThickness + (2 * marginWidth) +
2802 half_shadowThickness;
2803 rect[num_rects].y = y + highlightThickness;
2804 rect[num_rects].width = half_shadowThickness;
2805 if(highlightThickness == 0)
2806 rect[num_rects++].height = pixmapHeight + marginHeight+
2807 shadowThickness + (spacing/2)
2808 + half_shadowThickness;
2810 rect[num_rects++].height = pixmapHeight + marginHeight+
2814 rect[num_rects].x = x + highlightThickness +
2816 pixmapWidth + (2 * marginWidth);
2817 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2818 shadowThickness + half_shadowThickness;
2819 rect[num_rects].width = stringWidth - pixmapWidth +
2820 marginWidth - shadowThickness;
2821 rect[num_rects++].height = half_shadowThickness;
2824 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
2825 shadowThickness + half_shadowThickness
2826 + highlightThickness;
2827 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2829 rect[num_rects].width = half_shadowThickness;
2830 if(highlightThickness == 0)
2831 rect[num_rects++].height = stringHeight +
2832 (2*marginHeight) + half_shadowThickness;
2834 rect[num_rects++].height = stringHeight +
2835 (2*marginHeight) + shadowThickness
2836 + half_shadowThickness;
2842 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2843 shadowThickness + (2 * marginWidth) +
2844 half_shadowThickness;
2845 rect[num_rects].y = y + highlightThickness;
2846 rect[num_rects].width = half_shadowThickness;
2847 rect[num_rects++].height = pixmapHeight + marginHeight +
2848 shadowThickness + (spacing/2)
2849 + half_shadowThickness;
2851 rect[num_rects].x = x + highlightThickness + stringWidth +
2852 (2 * marginWidth) + shadowThickness +
2853 half_shadowThickness;
2854 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2856 rect[num_rects].width = pixmapWidth - stringWidth +
2857 marginHeight - half_shadowThickness;
2858 rect[num_rects++].height = half_shadowThickness;
2861 rect[num_rects].x = x + highlightThickness + stringWidth +
2862 (2 * marginWidth) + shadowThickness +
2863 half_shadowThickness;
2864 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2866 rect[num_rects].width = half_shadowThickness;
2867 rect[num_rects++].height = stringHeight +
2868 (2*marginHeight) + half_shadowThickness;
2872 rect[num_rects].x = x + highlightThickness;
2873 rect[num_rects].y = y + highlightThickness + pixmapHeight +
2874 stringHeight + spacing + (2*marginHeight) +
2875 shadowThickness + half_shadowThickness;
2876 if(stringWidth > pixmapWidth)
2877 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2878 half_shadowThickness + shadowThickness;
2880 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2881 (2*shadowThickness);
2882 rect[num_rects++].height = half_shadowThickness;
2885 rect[num_rects].x = x + highlightThickness +
2886 half_shadowThickness;
2887 rect[num_rects].y = y + highlightThickness +
2888 half_shadowThickness;
2889 rect[num_rects].width = half_shadowThickness;
2890 rect[num_rects++].height = pixmapHeight + stringHeight +
2891 spacing + (2 * marginHeight) + half_shadowThickness;
2893 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
2894 &rect[0], num_rects);
2900 rect[num_rects].x = x + highlightThickness;
2901 rect[num_rects].y = y + highlightThickness;
2902 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
2903 (2 * marginWidth) + half_shadowThickness;
2904 rect[num_rects++].height = half_shadowThickness;
2907 rect[num_rects].x = x + highlightThickness +
2908 half_shadowThickness;
2909 rect[num_rects].y = y + highlightThickness +
2910 half_shadowThickness;
2911 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
2913 rect[num_rects++].height = half_shadowThickness;
2915 if(stringWidth > pixmapWidth)
2918 rect[num_rects].x = x + highlightThickness +
2920 pixmapWidth + (2 * marginWidth);
2921 rect[num_rects].y = y + highlightThickness +
2922 pixmapHeight + marginHeight +
2923 half_shadowThickness;
2924 rect[num_rects].width = stringWidth - pixmapWidth +
2925 marginWidth + half_shadowThickness;
2926 rect[num_rects++].height = half_shadowThickness;
2929 rect[num_rects].x = x + highlightThickness +
2931 pixmapWidth + (2 * marginWidth);
2932 rect[num_rects].y = y + highlightThickness +
2933 pixmapHeight + marginHeight
2935 rect[num_rects].width = stringWidth - pixmapWidth +
2937 rect[num_rects++].height = half_shadowThickness;
2941 rect[num_rects].x = x + highlightThickness;
2942 rect[num_rects].y = y + highlightThickness;
2943 rect[num_rects].width = half_shadowThickness;
2944 rect[num_rects++].height = pixmapHeight + stringHeight +
2945 spacing + (2 * marginHeight) + shadowThickness +
2946 half_shadowThickness;
2949 rect[num_rects].x = x + highlightThickness +
2950 half_shadowThickness;
2951 rect[num_rects].y = y + highlightThickness +
2952 half_shadowThickness;
2953 rect[num_rects].width = half_shadowThickness;
2954 rect[num_rects++].height = pixmapHeight + stringHeight +
2955 spacing + (2 * marginHeight) + half_shadowThickness;
2957 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
2958 &rect[0], num_rects);
2962 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2963 (2 * marginWidth) + shadowThickness;
2964 rect[num_rects].y = y + highlightThickness +
2965 half_shadowThickness;
2966 rect[num_rects].width = half_shadowThickness;
2967 if(stringWidth > pixmapWidth)
2969 if(highlightThickness == 0)
2970 rect[num_rects++].height = pixmapHeight + marginHeight
2973 rect[num_rects++].height = pixmapHeight + marginHeight
2978 if(highlightThickness == 0)
2979 rect[num_rects++].height = pixmapHeight + marginHeight
2980 + spacing/2 + half_shadowThickness + shadowThickness;
2982 rect[num_rects++].height = pixmapHeight + marginHeight
2983 + spacing/2 + half_shadowThickness;
2987 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2988 shadowThickness + (2 * marginWidth) + half_shadowThickness;
2989 rect[num_rects].y = y + highlightThickness;
2990 rect[num_rects].width = half_shadowThickness;
2991 if(stringWidth > pixmapWidth)
2993 if(highlightThickness == 0)
2994 rect[num_rects++].height = pixmapHeight + marginHeight +
2997 rect[num_rects++].height = pixmapHeight + marginHeight +
2998 half_shadowThickness;
3002 if(highlightThickness == 0)
3003 rect[num_rects++].height = pixmapHeight + marginHeight +
3004 shadowThickness + (spacing/2)
3005 + half_shadowThickness;
3007 rect[num_rects++].height = pixmapHeight + marginHeight +
3008 shadowThickness + shadowThickness;
3012 if(stringWidth > pixmapWidth)
3014 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
3015 + shadowThickness + highlightThickness;
3019 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3020 (2 * marginWidth) + shadowThickness;
3022 rect[num_rects].y = y + highlightThickness +
3023 pixmapHeight + 2*marginHeight +
3024 half_shadowThickness;
3025 rect[num_rects].width = half_shadowThickness;
3026 rect[num_rects++].height = stringHeight + highlightThickness +
3027 (2*marginHeight) + 2*shadowThickness;
3030 if(stringWidth > pixmapWidth)
3032 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
3033 shadowThickness + half_shadowThickness + highlightThickness;
3037 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3038 shadowThickness + (2 * marginWidth) + half_shadowThickness;
3040 rect[num_rects].y = y + highlightThickness +
3041 pixmapHeight + 2*marginHeight;
3042 rect[num_rects].width = half_shadowThickness;
3043 rect[num_rects++].height = stringHeight +
3044 highlightThickness +
3045 (2*marginHeight) + shadowThickness +
3046 half_shadowThickness;
3049 rect[num_rects].x = x + highlightThickness +
3050 half_shadowThickness;
3051 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3052 stringHeight + spacing + (2*marginHeight) + shadowThickness;
3053 if(stringWidth > pixmapWidth)
3054 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3057 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3059 rect[num_rects++].height = half_shadowThickness;
3061 rect[num_rects].x = x + highlightThickness;
3062 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3063 stringHeight + spacing + (2*marginHeight) +
3064 shadowThickness + half_shadowThickness;
3065 if(stringWidth > pixmapWidth)
3066 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3067 half_shadowThickness + shadowThickness;
3069 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3070 (2*shadowThickness);
3071 rect[num_rects++].height = half_shadowThickness;
3073 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3074 &rect[0], num_rects);
3078 else if (alignment == XmALIGNMENT_CENTER && type == DESKTOP)
3080 if(stringWidth > pixmapWidth)
3085 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3087 rect[num_rects].y = y + highlightThickness;
3088 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3089 (2 * marginWidth) + half_shadowThickness;
3090 rect[num_rects++].height = half_shadowThickness;
3093 rect[num_rects].x = x + highlightThickness +
3094 (Dimension)(stringWidth -pixmapWidth)/(Dimension)2 + half_shadowThickness;
3095 rect[num_rects].y = y + highlightThickness +
3096 half_shadowThickness;
3097 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3099 rect[num_rects++].height = half_shadowThickness;
3102 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3103 highlightThickness + shadowThickness +
3104 pixmapWidth + (2 * marginWidth);
3105 rect[num_rects].y = y + highlightThickness +
3106 pixmapHeight + marginHeight +
3107 half_shadowThickness;
3108 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3109 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2 +
3110 marginWidth + half_shadowThickness;
3111 rect[num_rects++].height = half_shadowThickness;
3114 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3115 highlightThickness + shadowThickness +
3116 pixmapWidth + (2 * marginWidth);
3117 rect[num_rects].y = y + highlightThickness +
3118 pixmapHeight + marginHeight
3120 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3121 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2 +
3123 rect[num_rects++].height = half_shadowThickness;
3126 rect[num_rects].x = x + highlightThickness;
3127 rect[num_rects].y = y + highlightThickness +
3128 pixmapHeight + 2*marginHeight +
3129 half_shadowThickness;
3130 rect[num_rects].width = half_shadowThickness;
3131 rect[num_rects++].height = stringHeight + highlightThickness +
3132 (2*marginHeight) + 2*shadowThickness;
3134 /* 6 */ rect[num_rects].x = x + highlightThickness +
3135 half_shadowThickness;
3136 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3138 rect[num_rects].width = half_shadowThickness;
3139 rect[num_rects++].height = stringHeight +
3140 highlightThickness +
3141 (2*marginHeight) + shadowThickness +
3142 half_shadowThickness;
3145 rect[num_rects].x = x + highlightThickness;
3146 rect[num_rects].y = y + highlightThickness +
3147 pixmapHeight + marginHeight +
3148 half_shadowThickness;
3149 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3150 half_shadowThickness;
3151 rect[num_rects++].height = half_shadowThickness;
3154 rect[num_rects].x = x + highlightThickness;
3155 rect[num_rects].y = y + highlightThickness +
3156 pixmapHeight + marginHeight +
3158 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3161 rect[num_rects++].height = half_shadowThickness;
3164 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3166 rect[num_rects].y = y + highlightThickness;
3167 rect[num_rects].width = half_shadowThickness;
3168 if(highlightThickness == 0)
3169 rect[num_rects++].height = pixmapHeight + marginHeight
3172 rect[num_rects++].height = pixmapHeight + marginHeight
3176 rect[num_rects].x = x + highlightThickness +
3177 (Dimension)(stringWidth -pixmapWidth)/(Dimension)2 + half_shadowThickness;
3178 rect[num_rects].y = y + highlightThickness +
3179 half_shadowThickness;
3180 rect[num_rects].width = half_shadowThickness;
3181 if(highlightThickness == 0)
3182 rect[num_rects++].height = pixmapHeight + marginHeight +
3185 rect[num_rects++].height = pixmapHeight + marginHeight +
3186 half_shadowThickness;
3188 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3189 &rect[0], num_rects);
3193 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3194 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3195 (2 * marginWidth) + shadowThickness;
3196 rect[num_rects].y = y + highlightThickness
3197 + half_shadowThickness;
3198 rect[num_rects].width = half_shadowThickness;
3199 if(highlightThickness == 0)
3200 rect[num_rects++].height = pixmapHeight + marginHeight
3203 rect[num_rects++].height = pixmapHeight + marginHeight
3207 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3208 shadowThickness + (2 * marginWidth) + half_shadowThickness +
3209 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
3210 rect[num_rects].y = y + highlightThickness;
3211 rect[num_rects].width = half_shadowThickness;
3212 if(highlightThickness == 0)
3213 rect[num_rects++].height = pixmapHeight + marginHeight +
3216 rect[num_rects++].height = pixmapHeight + marginHeight +
3217 half_shadowThickness;
3220 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
3221 + shadowThickness + highlightThickness;
3222 rect[num_rects].y = y + highlightThickness +
3223 pixmapHeight + 2*marginHeight +
3224 half_shadowThickness;
3225 rect[num_rects].width = half_shadowThickness;
3226 rect[num_rects++].height = stringHeight + highlightThickness +
3227 (2*marginHeight) + 2*shadowThickness;
3230 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
3231 shadowThickness + half_shadowThickness + highlightThickness;
3232 rect[num_rects].y = y + highlightThickness +
3233 pixmapHeight + 2*marginHeight;
3234 rect[num_rects].width = half_shadowThickness;
3235 rect[num_rects++].height = stringHeight +
3236 highlightThickness +
3237 (2*marginHeight) + shadowThickness +
3238 half_shadowThickness;
3241 rect[num_rects].x = x + highlightThickness +
3242 half_shadowThickness;
3243 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3244 stringHeight + spacing + (2*marginHeight) + shadowThickness;
3245 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3247 rect[num_rects++].height = half_shadowThickness;
3249 rect[num_rects].x = x + highlightThickness;
3250 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3251 stringHeight + spacing + (2*marginHeight) +
3252 shadowThickness + half_shadowThickness;
3253 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3254 half_shadowThickness + shadowThickness;
3255 rect[num_rects++].height = half_shadowThickness;
3257 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3258 &rect[0], num_rects);
3265 rect[num_rects].x = x + highlightThickness;
3266 rect[num_rects].y = y + highlightThickness;
3267 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3268 (2 * marginWidth) + half_shadowThickness;
3269 rect[num_rects++].height = half_shadowThickness;
3272 rect[num_rects].x = x + highlightThickness +
3273 half_shadowThickness;
3274 rect[num_rects].y = y + highlightThickness +
3275 half_shadowThickness;
3276 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3278 rect[num_rects++].height = half_shadowThickness;
3281 rect[num_rects].x = x + highlightThickness;
3282 rect[num_rects].y = y + highlightThickness;
3283 rect[num_rects].width = half_shadowThickness;
3284 rect[num_rects++].height = 2 * highlightThickness +
3285 pixmapHeight + stringHeight + 2 * marginWidth +
3289 rect[num_rects].x = x + highlightThickness +
3290 half_shadowThickness;
3291 rect[num_rects].y = y + highlightThickness +
3292 half_shadowThickness;
3293 rect[num_rects].width = half_shadowThickness;
3294 rect[num_rects++].height = 2 * highlightThickness +
3295 pixmapHeight + stringHeight +
3296 2 * marginWidth + spacing -
3297 half_shadowThickness;
3299 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3300 &rect[0], num_rects);
3304 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3305 (2 * marginWidth) + shadowThickness;
3306 rect[num_rects].y = y + highlightThickness
3307 + half_shadowThickness;
3308 rect[num_rects].width = half_shadowThickness;
3309 rect[num_rects++].height = 2 * highlightThickness +
3310 pixmapHeight + stringHeight + 2 * marginWidth +
3311 spacing - half_shadowThickness;
3314 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3315 shadowThickness + (2 * marginWidth) + half_shadowThickness;
3317 rect[num_rects].y = y + highlightThickness;
3318 rect[num_rects].width = half_shadowThickness;
3319 rect[num_rects++].height = 2 * highlightThickness +
3320 pixmapHeight + stringHeight +
3321 2 * marginWidth + spacing;
3324 rect[num_rects].x = x + highlightThickness +
3325 half_shadowThickness;
3326 rect[num_rects].y = y + 2 * highlightThickness +
3327 pixmapHeight + stringHeight + spacing +
3329 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3330 (2 * marginWidth) + half_shadowThickness;
3331 rect[num_rects++].height = half_shadowThickness;
3334 rect[num_rects].x = x + highlightThickness;
3335 rect[num_rects].y = y + 2 * highlightThickness +
3336 pixmapHeight + stringHeight + spacing +
3337 2 * marginHeight + half_shadowThickness;
3338 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3340 rect[num_rects++].height = half_shadowThickness;
3341 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3342 &rect[0], num_rects);
3346 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
3347 x + highlightThickness,
3348 y + highlightThickness,
3349 width - 2*highlightThickness,
3350 height - 2*highlightThickness,
3351 shadowThickness, XmSHADOW_IN);
3354 if(type == NOT_DESKTOP)
3356 if((Dimension)(stringHeight+5) >= (Dimension)pixmapHeight)
3360 rect[num_rects].x = x + highlightThickness;
3361 rect[num_rects].y = y + highlightThickness;
3362 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3363 shadowThickness + 2*marginWidth;
3364 rect[num_rects++].height = half_shadowThickness;
3367 rect[num_rects].x = x + pixmapWidth + stringWidth + spacing +
3368 shadowThickness + 2*marginWidth +
3370 rect[num_rects].y = y + highlightThickness;
3371 rect[num_rects].width = half_shadowThickness;
3372 rect[num_rects++].height = stringHeight + 2*marginHeight +
3373 shadowThickness + half_shadowThickness;
3376 rect[num_rects].x = x + highlightThickness;
3377 rect[num_rects].y = y + highlightThickness + stringHeight +
3378 2*marginHeight + shadowThickness;
3379 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3380 shadowThickness + 2*marginWidth;
3381 rect[num_rects++].height = half_shadowThickness;
3384 rect[num_rects].x = x + highlightThickness;
3385 rect[num_rects].y = y + highlightThickness;
3386 rect[num_rects].width = half_shadowThickness;
3387 rect[num_rects++].height = stringHeight + 2*marginHeight +
3388 shadowThickness + half_shadowThickness;
3390 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3391 &rect[0], num_rects);
3395 rect[num_rects].x = x + highlightThickness +
3396 half_shadowThickness;
3397 rect[num_rects].y = y + highlightThickness +
3398 half_shadowThickness;
3399 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3400 half_shadowThickness + 2*marginWidth;
3401 rect[num_rects++].height = half_shadowThickness;
3404 rect[num_rects].x = x + highlightThickness +
3405 half_shadowThickness + pixmapWidth +
3406 stringWidth + spacing + shadowThickness +
3408 rect[num_rects].y = y + highlightThickness;
3409 rect[num_rects].width = half_shadowThickness;
3410 rect[num_rects++].height = stringHeight + 2*marginHeight +
3414 rect[num_rects].x = x + highlightThickness;
3416 rect[num_rects].y = y + highlightThickness + stringHeight +
3417 2*marginHeight + shadowThickness +
3418 half_shadowThickness;
3419 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3420 2*shadowThickness + 2*marginWidth;
3421 rect[num_rects++].height = half_shadowThickness;
3424 rect[num_rects].x = x + highlightThickness +
3425 half_shadowThickness;
3426 rect[num_rects].y = y + highlightThickness +
3427 half_shadowThickness;
3428 rect[num_rects].width = half_shadowThickness;
3429 rect[num_rects++].height = stringHeight + 2*marginHeight +
3430 half_shadowThickness;
3432 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3433 &rect[0], num_rects);
3440 rect[num_rects].x = x + highlightThickness;
3441 rect[num_rects].y = y + highlightThickness;
3442 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3443 (2 * marginWidth) - half_shadowThickness;
3444 rect[num_rects++].height = half_shadowThickness;
3447 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3448 2*shadowThickness + 2*marginWidth -
3450 rect[num_rects].y = y + highlightThickness;
3451 rect[num_rects].width = half_shadowThickness;
3452 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3453 marginHeight - half_shadowThickness;
3456 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3457 2*shadowThickness + 2*marginWidth -
3459 rect[num_rects].y = y + highlightThickness +
3460 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3461 marginHeight -shadowThickness;
3462 rect[num_rects].width = stringWidth + marginWidth +
3464 rect[num_rects++].height = half_shadowThickness;
3467 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3468 2*shadowThickness + 3*marginWidth
3469 + stringWidth - half_shadowThickness;
3470 rect[num_rects].y = y + highlightThickness +
3471 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3472 half_shadowThickness;
3473 rect[num_rects].width = half_shadowThickness;
3474 rect[num_rects++].height = stringHeight + 2*marginHeight +
3475 half_shadowThickness;
3478 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3479 2*shadowThickness + 2*marginWidth -
3481 rect[num_rects].y = y + highlightThickness +
3482 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3483 stringHeight + 2*marginHeight +
3485 rect[num_rects].width = stringWidth + marginWidth +
3487 rect[num_rects++].height = half_shadowThickness;
3490 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3491 2*shadowThickness + 2*marginWidth -
3493 rect[num_rects].y = y + highlightThickness +
3494 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3495 stringHeight + 2*marginHeight +
3497 rect[num_rects].width = half_shadowThickness;
3498 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3502 rect[num_rects].x = x + highlightThickness;
3503 rect[num_rects].y = y + highlightThickness +
3504 pixmapHeight + 2*marginHeight + shadowThickness;
3505 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3506 (2 * marginWidth) - half_shadowThickness;
3507 rect[num_rects++].height = half_shadowThickness;
3510 rect[num_rects].x = x + highlightThickness;
3511 rect[num_rects].y = y + highlightThickness;
3512 rect[num_rects].width = half_shadowThickness;
3513 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3516 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3517 &rect[0], num_rects);
3521 rect[num_rects].x = x + highlightThickness +
3522 half_shadowThickness;
3523 rect[num_rects].y = y + highlightThickness +
3524 half_shadowThickness;
3525 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3526 half_shadowThickness;
3527 rect[num_rects++].height = half_shadowThickness;
3530 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3531 2*marginWidth + shadowThickness +
3532 half_shadowThickness;
3533 rect[num_rects].y = y + highlightThickness;
3534 rect[num_rects].width = half_shadowThickness;
3535 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3536 marginHeight - shadowThickness;
3539 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3540 2*marginWidth + shadowThickness;
3541 rect[num_rects].y = y + highlightThickness +
3542 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3543 half_shadowThickness;
3544 rect[num_rects].width = stringWidth + marginWidth +
3545 half_shadowThickness;
3546 rect[num_rects++].height = half_shadowThickness;
3549 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3550 3*marginWidth + 2*shadowThickness +
3552 rect[num_rects].y = y + highlightThickness +
3553 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2);
3555 rect[num_rects].width = half_shadowThickness;
3556 rect[num_rects++].height = stringHeight + 2*marginHeight +
3560 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3561 2*marginWidth + shadowThickness +
3562 half_shadowThickness;
3563 rect[num_rects].y = y + highlightThickness +
3564 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3565 2*marginHeight + shadowThickness +
3566 stringHeight + half_shadowThickness;
3567 rect[num_rects].width = stringWidth + marginWidth +
3569 rect[num_rects++].height = half_shadowThickness;
3572 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3573 2*marginWidth + shadowThickness +
3574 half_shadowThickness;
3575 rect[num_rects].y = y + highlightThickness +
3576 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3577 2*marginHeight + shadowThickness +
3578 stringHeight + half_shadowThickness;
3579 rect[num_rects].width = half_shadowThickness;
3580 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3583 rect[num_rects].x = x + highlightThickness;
3584 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3585 2*marginHeight + shadowThickness +
3586 half_shadowThickness;
3587 rect[num_rects].width = pixmapWidth + 2*marginWidth +
3589 rect[num_rects++].height = half_shadowThickness;
3592 rect[num_rects].x = x + highlightThickness +
3593 half_shadowThickness;
3594 rect[num_rects].y = y + highlightThickness +
3595 half_shadowThickness;
3596 rect[num_rects].width = half_shadowThickness;
3597 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3598 half_shadowThickness;
3600 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3601 &rect[0], num_rects);
3607 if((Dimension)(stringHeight+5) >= pixmapHeight)
3611 rect[num_rects].x = x + highlightThickness;
3612 rect[num_rects].y = y + highlightThickness;
3613 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3614 2*shadowThickness + 2*marginWidth;
3615 rect[num_rects++].height = half_shadowThickness;
3618 rect[num_rects].x = x + highlightThickness +
3619 half_shadowThickness;
3620 rect[num_rects].y = y + highlightThickness +
3621 half_shadowThickness;
3622 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3623 shadowThickness + 2*marginWidth;
3624 rect[num_rects++].height = half_shadowThickness;
3627 rect[num_rects].x = x + highlightThickness;
3628 rect[num_rects].y = y + highlightThickness;
3629 rect[num_rects].width = half_shadowThickness;
3630 if(pixmapHeight > stringHeight)
3631 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3634 rect[num_rects++].height = stringHeight + 2*marginHeight +
3638 rect[num_rects].x = x + highlightThickness +
3639 half_shadowThickness;
3640 rect[num_rects].y = y + highlightThickness +
3641 half_shadowThickness;
3642 rect[num_rects].width = half_shadowThickness;
3643 if(pixmapHeight > stringHeight)
3644 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3645 half_shadowThickness;
3647 rect[num_rects++].height = stringHeight + 2*marginHeight +
3648 half_shadowThickness;
3650 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3651 &rect[0], num_rects);
3655 rect[num_rects].x = x + pixmapWidth + stringWidth + spacing +
3656 shadowThickness + 2*marginWidth +
3658 rect[num_rects].y = y + highlightThickness +
3660 rect[num_rects].width = half_shadowThickness;
3661 if(pixmapHeight > stringHeight)
3662 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3665 rect[num_rects++].height = stringHeight + 2*marginHeight +
3669 rect[num_rects].x = x + highlightThickness +
3670 half_shadowThickness + pixmapWidth +
3671 stringWidth + spacing + shadowThickness +
3673 rect[num_rects].y = y + highlightThickness +
3674 half_shadowThickness;
3675 rect[num_rects].width = half_shadowThickness;
3676 if(pixmapHeight > stringHeight)
3677 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3680 rect[num_rects++].height = stringHeight + 2*marginHeight +
3684 rect[num_rects].x = x + highlightThickness +
3685 half_shadowThickness;
3686 if(pixmapHeight > stringHeight)
3687 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3688 2*marginHeight + shadowThickness;
3690 rect[num_rects].y = y + highlightThickness + stringHeight +
3691 2*marginHeight + shadowThickness;
3692 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3693 shadowThickness + 2*marginWidth -
3694 half_shadowThickness;
3695 rect[num_rects++].height = half_shadowThickness;
3698 rect[num_rects].x = x + highlightThickness;
3700 if(pixmapHeight > stringHeight)
3701 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3702 2*marginHeight + shadowThickness +
3703 half_shadowThickness;
3705 rect[num_rects].y = y + highlightThickness + stringHeight +
3706 2*marginHeight + shadowThickness +
3707 half_shadowThickness;
3708 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3709 2*shadowThickness + 2*marginWidth;
3710 rect[num_rects++].height = half_shadowThickness;
3712 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3713 &rect[0], num_rects);
3719 rect[num_rects].x = x + highlightThickness;
3720 rect[num_rects].y = y + highlightThickness;
3721 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3722 (2 * marginWidth) + half_shadowThickness;
3723 rect[num_rects++].height = half_shadowThickness;
3726 rect[num_rects].x = x + highlightThickness +
3727 half_shadowThickness;
3728 rect[num_rects].y = y + highlightThickness +
3729 half_shadowThickness;
3730 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3732 rect[num_rects++].height = half_shadowThickness;
3735 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3736 2*shadowThickness + 2*marginWidth -
3738 rect[num_rects].y = y + highlightThickness +
3739 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3740 marginHeight -shadowThickness;
3741 rect[num_rects].width = stringWidth + marginWidth +
3743 rect[num_rects++].height = half_shadowThickness;
3746 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3747 2*marginWidth + shadowThickness;
3748 rect[num_rects].y = y + highlightThickness +
3749 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3750 half_shadowThickness;
3751 rect[num_rects].width = stringWidth + marginWidth +
3752 half_shadowThickness;
3753 rect[num_rects++].height = half_shadowThickness;
3756 rect[num_rects].x = x + highlightThickness;
3757 rect[num_rects].y = y + highlightThickness;
3758 rect[num_rects].width = half_shadowThickness;
3759 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3763 rect[num_rects].x = x + highlightThickness +
3764 half_shadowThickness;
3765 rect[num_rects].y = y + highlightThickness +
3766 half_shadowThickness;
3767 rect[num_rects].width = half_shadowThickness;
3768 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3771 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3772 &rect[0], num_rects);
3776 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3777 2*shadowThickness + 2*marginWidth -
3779 rect[num_rects].y = y + highlightThickness + shadowThickness;
3780 rect[num_rects].width = half_shadowThickness;
3781 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3782 marginHeight - half_shadowThickness -
3786 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3787 2*marginWidth + shadowThickness +
3788 half_shadowThickness;
3789 rect[num_rects].y = y + highlightThickness +
3790 half_shadowThickness;
3791 rect[num_rects].width = half_shadowThickness;
3792 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3793 marginHeight - half_shadowThickness -
3797 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3798 2*shadowThickness + 3*marginWidth
3799 + stringWidth - half_shadowThickness;
3800 rect[num_rects].y = y + highlightThickness +
3801 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3802 half_shadowThickness;
3803 rect[num_rects].width = half_shadowThickness;
3804 rect[num_rects++].height = stringHeight + 2*marginHeight +
3805 half_shadowThickness;
3808 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3809 3*marginWidth + 2*shadowThickness +
3811 rect[num_rects].y = y + highlightThickness +
3812 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2);
3814 rect[num_rects].width = half_shadowThickness;
3815 rect[num_rects++].height = stringHeight + 2*marginHeight +
3819 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3820 2*shadowThickness + 2*marginWidth -
3822 rect[num_rects].y = y + highlightThickness +
3823 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3824 stringHeight + 2*marginHeight +
3826 rect[num_rects].width = stringWidth + marginWidth +
3828 rect[num_rects++].height = half_shadowThickness;
3831 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3832 2*marginWidth + shadowThickness +
3833 half_shadowThickness;
3834 rect[num_rects].y = y + highlightThickness +
3835 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3836 2*marginHeight + shadowThickness +
3837 stringHeight + half_shadowThickness;
3838 rect[num_rects].width = stringWidth + marginWidth +
3840 rect[num_rects++].height = half_shadowThickness;
3843 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3844 2*shadowThickness + 2*marginWidth -
3846 rect[num_rects].y = y + highlightThickness +
3847 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3848 stringHeight + 2*marginHeight +
3850 rect[num_rects].width = half_shadowThickness;
3851 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3855 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3856 2*marginWidth + shadowThickness +
3857 half_shadowThickness;
3858 rect[num_rects].y = y + highlightThickness +
3859 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3860 2*marginHeight + shadowThickness +
3861 stringHeight + half_shadowThickness;
3862 rect[num_rects].width = half_shadowThickness;
3863 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3867 rect[num_rects].x = x + highlightThickness + shadowThickness;
3868 rect[num_rects].y = y + highlightThickness +
3869 pixmapHeight + 2*marginHeight + shadowThickness;
3870 rect[num_rects].width = pixmapWidth + shadowThickness +
3871 (2 * marginWidth) - half_shadowThickness;
3872 rect[num_rects++].height = half_shadowThickness;
3875 rect[num_rects].x = x + highlightThickness +
3876 half_shadowThickness;
3877 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3878 2*marginHeight + shadowThickness +
3879 half_shadowThickness;
3880 rect[num_rects].width = pixmapWidth + 2*marginWidth +
3881 shadowThickness + half_shadowThickness;
3882 rect[num_rects++].height = half_shadowThickness;
3884 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3885 &rect[0], num_rects);
3889 case XmPIXMAP_BOTTOM:
3890 case XmPIXMAP_RIGHT:
3891 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
3892 x + highlightThickness,
3893 y + highlightThickness,
3894 width - 2*highlightThickness,
3895 height - 2*highlightThickness,
3896 shadowThickness, XmSHADOW_IN);
3905 FM_XmHighlightBorder(
3908 if( XmIsPrimitive( w) ) {
3909 (*(xmPrimitiveClassRec.primitive_class.border_highlight))( w) ;
3911 if( XmIsGadget( w) ) {
3912 (*(xmGadgetClassRec.gadget_class.border_highlight))( w) ;
3919 FM_XmUnhighlightBorder(
3922 if( XmIsPrimitive( w) )
3924 (*(xmPrimitiveClassRec.primitive_class.border_unhighlight))( w) ;
3927 { if( XmIsGadget( w) )
3929 (*(xmGadgetClassRec.gadget_class.border_unhighlight))( w) ;
3943 widget = XmObjectAtPoint (wid, x, y);
3945 if (!widget || !XtIsSensitive (widget))
3946 return ((XmGadget) NULL);
3948 return ((XmGadget) widget);