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 ************************************<+>*************************************/
61 #include <Xm/VirtKeys.h>
62 #include <Xm/ScrollBar.h>
64 #include <sys/types.h>
69 #include <Dt/Connect.h>
70 #include <Dt/DtNlUtils.h>
71 #include <Dt/Action.h>
73 #include <X11/cursorfont.h>
74 #include <X11/Xutil.h>
78 #include <X11/keysymdef.h>
79 #include <Xm/PrimitiveP.h> /* For HighlightBorder & UnhighlightBorder */
88 #include "SharedProcs.h"
90 /* For HightlightBorder & UnhighlightBorder */
91 externalref XmPrimitiveClassRec xmPrimitiveClassRec;
93 Boolean TurnOnTextName;
95 /******** Static Function Declarations ********/
97 static Boolean CheckForBtnUp(
101 static void GetSelectionRectangle(
105 FileMgrRec *file_mgr_rec,
106 FileMgrData *file_mgr_data,
107 Boolean toggleSelect) ;
108 static void DrawRectangle(
116 static void ProcessSelection(
117 FileMgrData * file_mgr_data,
119 Boolean toggleSelect,
120 XButtonEvent *event) ;
122 static void FM_XmHighlightBorder(Widget w);
123 static void FM_XmUnhighlightBorder(Widget w);
125 static XmGadget InputForGadget(
131 /******** End Static Function Declarations ********/
134 /************************************************************************
136 * FileWindowExposeCallback
137 * Callback function invoked upon an exposure event occuring
138 * in the file display area.
140 ************************************************************************/
143 FileWindowExposeCallback(
145 XtPointer client_data,
146 XtPointer call_data )
148 FileMgrRec * file_mgr_rec;
149 DialogData * dialog_data;
150 FileMgrData * file_mgr_data;
151 XmDrawingAreaCallbackStruct * da_cbs;
154 file_mgr_rec = (FileMgrRec *) client_data;
155 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
157 /* Check for the view already being closed */
159 if (dialog_data == NULL) return;
161 file_mgr_data = (FileMgrData *) dialog_data->data;
162 da_cbs = (XmDrawingAreaCallbackStruct * )call_data;
164 /* if necessary, redraw tree lines */
165 if (da_cbs->reason == XmCR_EXPOSE &&
166 file_mgr_data->show_type == MULTIPLE_DIRECTORY)
168 XExposeEvent *event = (XExposeEvent *)da_cbs->event;
169 if (event && event->type == Expose)
170 RedrawTreeLines(w, event->x, event->y, event->width, event->height,
171 event->count, file_mgr_rec, file_mgr_data);
173 RedrawTreeLines(w, 0, 0, 999999, 999999, 0, file_mgr_rec, file_mgr_data);
181 /************************************************************************
183 * FileWindowResizeCallback
184 * Callback function invoked upon a resize of the file display area.
186 ************************************************************************/
189 FileWindowResizeCallback(
191 XtPointer client_data,
194 FileMgrRec * file_mgr_rec;
195 DialogData * dialog_data;
196 FileMgrData * file_mgr_data;
198 if (event->type == ConfigureNotify)
200 XConfigureEvent * cevent = (XConfigureEvent *) event;
202 file_mgr_rec = (FileMgrRec *) client_data;
205 * If the incoming size is different than the current size of the
206 * scrolled window, then ignore this event, since it means that our
207 * size has changed since this configure notify event was generated;
208 * we'll wait for the next one to arrive, and try again.
210 if ((file_mgr_rec->scroll_window->core.height != cevent->height) ||
211 (file_mgr_rec->scroll_window->core.width != cevent->width))
216 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
217 if(dialog_data != NULL)
219 file_mgr_data = (FileMgrData *) dialog_data->data;
221 LayoutFileIcons (file_mgr_rec, file_mgr_data, False, False);
227 /************************************************************************
229 * FileWindowMapCallback
230 * Callback function invoked upon a map or unmap of a file
233 ************************************************************************/
236 FileWindowMapCallback(
238 XtPointer client_data,
241 FileMgrRec * file_mgr_rec;
242 DialogData * dialog_data;
243 FileMgrData * file_mgr_data;
245 file_mgr_rec = (FileMgrRec *) client_data;
246 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
247 if(dialog_data != NULL)
249 file_mgr_data = (FileMgrData *) dialog_data->data;
251 if (event->type == MapNotify)
253 file_mgr_data->mapped = True;
254 FileWindowMapUnmap( file_mgr_data );
256 else if (event->type == UnmapNotify)
258 file_mgr_data->mapped = False;
259 FileWindowMapUnmap( file_mgr_data );
266 /************************************************************************
268 * FileWindowInputCallback
269 * Callback function invoked upon input occuring in the
270 * file display area, file icon, or within a desktop icon.
272 ************************************************************************/
275 FileWindowInputCallback(
277 XtPointer client_data,
280 static Boolean first = True;
281 static KeySym PlusKeysym, MinusKeySym;
282 static KeySym ActivateKeysym, SpaceKeysym;
283 static XmKeyBinding SelectBindings;
284 static int NumSelectKeys = 0;
286 FileMgrRec * file_mgr_rec;
287 XmAnyCallbackStruct * callback;
288 DialogData * dialog_data;
289 FileMgrData * file_mgr_data;
290 DirectorySet * directoryData;
292 XButtonPressedEvent *event;
296 FileViewData * fileViewData = NULL;
298 DesktopRec * desktopRec;
304 /* Do nothing if a Button 2 drag is already ramping up */
308 /* Determine if this is a desktop icon or a regular icon */
311 for (i = 0; i < desktop_data->numIconsUsed; i++)
313 if (desktop_data->desktopWindows[i] == (DesktopRec *)client_data)
315 desktopRec = (DesktopRec *)client_data;
319 if (desktopRec == NULL)
321 file_mgr_rec = (FileMgrRec *) client_data;
322 dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec);
323 file_mgr_data = (FileMgrData *) dialog_data->data;
326 file_mgr_data = NULL;
328 callback = (XmAnyCallbackStruct *) call_data;
329 new_event = (XEvent *)callback->event;
331 if (new_event->type == ButtonPress)
333 XButtonEvent *bevent = (XButtonEvent *)new_event;
334 desktop_data->event = *bevent;
336 else if (new_event->type == KeyPress || new_event->type == KeyRelease)
340 /* set up the the keysyms we are looking for */
341 PlusKeysym = XStringToKeysym("plus");
342 MinusKeySym = XStringToKeysym("minus");
344 NumSelectKeys = XmeVirtualToActualKeysyms(XtDisplay(w),
348 ActivateKeysym = XK_Return;
349 SpaceKeysym = XStringToKeysym("space");
353 kevent = (XKeyEvent *)new_event;
354 if (kevent->state & ShiftMask)
360 keysym = XLookupKeysym(kevent, offset);
362 XmTranslateKey( kevent->display, kevent->keycode, offset?ShiftMask:0,
366 /* in tree mode '+' and '-' keys expand and collaps tree branches */
367 if (!desktopRec && new_event->type == KeyPress &&
368 (keysym == PlusKeysym || keysym == MinusKeySym))
370 /* ignore +/- keys if not in tree mode */
371 if (file_mgr_data->show_type != MULTIPLE_DIRECTORY)
374 /* get the gadget that received the input */
375 if (keybdFocusPolicy == XmEXPLICIT)
376 eventIcon = (Widget) XmGetFocusWidget(w);
378 eventIcon = (Widget) InputForGadget(w, kevent->x, kevent->y);
379 if (eventIcon == NULL)
382 /* find the widget in the file_list */
384 for (i = -1; i < file_mgr_data->directory_count && !found; i++)
386 for (j = 0; j < file_mgr_data->directory_set[i]->file_count; j++)
388 fileViewData = file_mgr_data->directory_set[i]->file_view_data[j];
389 if (fileViewData->widget == eventIcon ||
390 fileViewData->treebtn == eventIcon)
398 /* if found, expand the branch */
399 if (found && fileViewData->file_data->is_subdir)
401 XmDropSiteStartUpdate(w);
402 DirTreeExpand(file_mgr_data, fileViewData, (keysym == PlusKeysym));
403 DrawCurrentDirectory (file_mgr_rec->current_directory,
404 file_mgr_rec, file_mgr_data);
405 LayoutFileIcons(file_mgr_rec, file_mgr_data, False, True);
406 XmDropSiteEndUpdate(w);
407 RedrawTreeLines(w, -w->core.x, -w->core.y,
408 XtParent(w)->core.width, XtParent(w)->core.height,
409 0, file_mgr_rec, file_mgr_data);
413 else if (new_event->type == ButtonPress || (new_event->type == KeyPress &&
414 keybdFocusPolicy == XmEXPLICIT))
416 /* Any button event unposts the rename text field */
419 else if( file_mgr_data )
421 if( file_mgr_data->fast_cd_enabled )
422 UnpostTextPath( file_mgr_data );
424 UnpostTextField( file_mgr_data );
427 if (new_event->type == KeyPress)
429 /* We have a KeyPress: need to check to see if the press is
430 "return", "space", "select". If it is, need to select the Icon
433 if (keysym == XK_Escape)
435 /* an escape unposts the name change text widget */
439 UnpostTextField(file_mgr_data);
442 else if ( keysym != ActivateKeysym
443 && keysym != SpaceKeysym
444 && keysym != osfXK_Delete
445 && keysym != osfXK_EndLine
446 && keysym != osfXK_BeginLine
447 && keysym != osfXK_PageLeft
448 && keysym != osfXK_PageUp
449 && keysym != osfXK_PageDown
450 && keysym != osfXK_PageRight
451 && keysym != osfXK_Menu )
453 Boolean select = FALSE;
456 for (i = 0; !select && (i < NumSelectKeys); i++)
457 select = (keysym == SelectBindings[i].keysym);
464 eventIcon = desktopRec->iconGadget;
466 eventIcon = (Widget) XmGetFocusWidget(file_mgr_rec->file_window);
467 event = (XButtonPressedEvent *)new_event;
471 event = (XButtonPressedEvent *)new_event;
472 if(event->button != Button1)
474 if(event->button == bMenuButton && desktopRec == NULL)
475 FmPopup (NULL, NULL, (XEvent *)event, file_mgr_data);
478 eventIcon = (Widget) InputForGadget(w, event->x, event->y);
482 * If the event occurred in an icon, then we are either doing
483 * a selection or a drag. If it started in the file window, then
484 * we can only be doing a region selection.
486 if (eventIcon != NULL)
489 * If this icon is currently selected, then we can't yet tell
490 * whether the user is starting a drag operation, or simply
491 * redoing the icon selection; we must wait for either the
492 * drag threshold to be surpassed, or the button up event.
495 /* Map the icon into its fileViewData structure */
496 /* Check for desktop icon first */
499 for (i = 0; i<desktop_data->numIconsUsed; i++)
501 if (desktop_data->desktopWindows[i]->iconGadget == eventIcon)
503 fileViewData = desktop_data->desktopWindows[i]->file_view_data;
510 /* Not a desktop icon */
511 XtSetArg(args[0], XmNuserData, (XtPointer) &directoryData);
512 XtGetValues(eventIcon, args, 1);
513 if( directoryData != NULL )
515 for (i = 0; i < directoryData->file_count; i++)
517 if (directoryData->file_view_data[i]->widget == eventIcon &&
518 directoryData->file_view_data[i]->displayed)
520 fileViewData = directoryData->file_view_data[i];
527 if (((file_mgr_rec && FileIsSelected(file_mgr_data, fileViewData)) ||
528 (desktopRec && DTFileIsSelected(desktopRec, fileViewData))) &&
529 event->type == ButtonPress)
531 /* Need to wait to determine what to do */
533 B1DragPossible = True;
534 initialDragX = event->x;
535 initialDragY = event->y;
537 if((file_mgr_rec && FileIsSelected(file_mgr_data, fileViewData)) &&
538 file_mgr_data->selected_file_count > 1)
540 if (PositioningEnabledInView(file_mgr_data))
543 FileViewData ** selection_list;
545 top = GetTopOfStack(file_mgr_data);
546 if(top != NULL && top->file_view_data != fileViewData)
548 ObjectPtr savetop, next, prev;
551 while(top != NULL && top->file_view_data != fileViewData)
564 top->stacking_order = 1;
567 for(i = 2; top->prev != NULL; i++)
569 top->stacking_order = i;
570 if(top->next == NULL)
575 top = GetTopOfStack(file_mgr_data);
576 RedrawOneGadget(top->file_view_data->widget,NULL,NULL);
580 /* now make it the top of the selection list */
581 /* Force selection list order to match stacking order */
582 selection_list = (FileViewData **)XtMalloc(
583 sizeof(FileViewData *) *
584 (file_mgr_data->selected_file_count + 1));
587 if(top->file_view_data != NULL)
588 selection_list[i++] = top->file_view_data;
589 for(j = 0;i < file_mgr_data->selected_file_count; j++,i++)
591 if(top->file_view_data !=
592 file_mgr_data->selection_list[j])
593 selection_list[i] = file_mgr_data->selection_list[j];
597 selection_list[i] = NULL;
598 XtFree((char *)file_mgr_data->selection_list);
599 file_mgr_data->selection_list = selection_list;
606 * The icon is not currently selected, so we will select it.
607 * It is still possible that the user may initiate a drag.
609 ProcessBtnUp = False;
610 if (event->type == ButtonPress)
612 B1DragPossible = True;
613 initialDragX = event->x;
614 initialDragY = event->y;
618 B1DragPossible = False;
627 DtActionArg * action_args;
630 if( desktopRec == NULL
631 && file_mgr_rec != NULL )
633 if( file_mgr_data->selected_file_count
635 && FileIsSelected(file_mgr_data, fileViewData) )
637 _DtBuildActionArgsWithSelectedFiles(
638 file_mgr_data->selection_list,
639 file_mgr_data->selected_file_count,
640 &action_args, &arg_count );
644 _DtBuildActionArgsWithSelectedFiles( &fileViewData, 1,
648 DtActionInvoke( file_mgr_rec->shell, TRASH_ACTION,
649 action_args, arg_count, NULL, NULL,
650 trash_dir, True, NULL, NULL );
652 else if( desktopRec != NULL )
654 int selectedCount = desktop_data->workspaceData[desktopRec->workspace_num - 1]->files_selected;
657 _DtBuildActionArgsWithDTSelectedFiles(
658 desktop_data->workspaceData[desktopRec->workspace_num - 1]->selectedDTWindows,
660 &action_args, &arg_count );
664 _DtBuildActionArgsWithSelectedFiles( &fileViewData, 1,
668 DtActionInvoke( desktopRec->shell, TRASH_ACTION,
669 action_args, arg_count, NULL, NULL,
670 trash_dir, True, NULL, NULL );
672 _DtFreeActionArgs( action_args, arg_count );
676 if(file_mgr_data) /* if not, then it is a desktop object */
677 FmPopup( NULL, (XtPointer)fileViewData,
678 (XEvent *)event, file_mgr_data );
682 && file_mgr_data->show_type != MULTIPLE_DIRECTORY )
686 child = XmGetFocusWidget(file_mgr_rec->file_window);
689 FileViewData * focusIcon = NULL;
690 FileViewData **order_list;
693 order_list = ((IconLayoutData *)file_mgr_data->layout_data)->order_list;
694 order_count = ((IconLayoutData *)file_mgr_data->layout_data)->order_count;
696 for (i = 0; i < order_count; ++i)
698 if (order_list[i]->filtered)
701 if( order_list[i]->widget == child
702 && !order_list[i]->need_update )
705 int y = order_list[i]->y;
707 focusIcon = order_list[i];
709 for( j = i+1; j < order_count; ++j )
711 if (order_list[j]->filtered)
714 if( order_list[j]->y == y )
715 focusIcon = order_list[j];
722 XmProcessTraversal( focusIcon->widget, XmTRAVERSE_CURRENT );
726 case osfXK_BeginLine:
728 && file_mgr_data->show_type != MULTIPLE_DIRECTORY )
732 child = XmGetFocusWidget(file_mgr_rec->file_window);
735 FileViewData * focusIcon = NULL;
736 FileViewData **order_list;
739 order_list = ((IconLayoutData *)file_mgr_data->layout_data)->order_list;
740 order_count = ((IconLayoutData *)file_mgr_data->layout_data)->order_count;
742 for (i = 0; i < order_count; ++i)
744 if (order_list[i]->filtered)
747 if( order_list[i]->widget == child
748 && !order_list[i]->need_update )
751 int y = order_list[i]->y;
753 focusIcon = order_list[i];
755 for( j = i-1; j >= 0; --j )
757 if (order_list[j]->filtered)
760 if( order_list[j]->y == y )
761 focusIcon = order_list[j];
768 XmProcessTraversal( focusIcon->widget, XmTRAVERSE_CURRENT );
775 if( VerticalScrollbarIsVisible(
776 file_mgr_rec->vertical_scroll_bar,
777 file_mgr_rec->scroll_window))
780 XtCallActionProc( file_mgr_rec->vertical_scroll_bar,
781 "PageUpOrLeft", new_event,&p, 1 );
788 if( VerticalScrollbarIsVisible(
789 file_mgr_rec->vertical_scroll_bar,
790 file_mgr_rec->scroll_window))
793 XtCallActionProc( file_mgr_rec->vertical_scroll_bar,
794 "PageDownOrRight", new_event, &p, 1 );
800 ProcessDTSelection(desktopRec, (XButtonEvent *)event);
802 ProcessSelection( file_mgr_data, eventIcon,
803 ((event->state & ControlMask) != 0),
804 (XButtonEvent *)event);
811 /* In file window - start region select */
812 /* There are no region selects for desktop icons */
813 ProcessBtnUp = False;
814 B1DragPossible = False;
817 if (desktopRec == NULL)
819 ProcessSelection(file_mgr_data, NULL,
820 ((event->state & ControlMask) != 0),
821 (XButtonEvent *)event);
825 else if(new_event->type == ButtonRelease || (new_event->type == KeyRelease &&
826 keybdFocusPolicy == XmEXPLICIT))
828 if(new_event->type == KeyRelease)
830 if (keysym != osfXK_Select)
833 event = (XButtonPressedEvent *)new_event;
837 event = (XButtonPressedEvent *)new_event;
838 if(event->button != Button1)
842 * When a button 1 up event is received, we will first see if the
843 * select occurred in the icon's title; if so, then we will post
844 * the rename text field. If the icon in which the button down
845 * occurred was not already selected, then all of the selection
846 * work was done at button 1 down time, so there is nothing left
847 * for us to do but return. However, if the icon was already
848 * selected, then we could not do any select processing at button
849 * down time, because the user may have been trying to initate
850 * a drag request; this can't be determined until either the drag
851 * threshold is surpassed, or the button up occurs.
853 if (((initialDragX >= 0) && (initialDragY >= 0)) &&
854 (eventIcon = (Widget) InputForGadget(w, initialDragX,
858 * If processing was postponed until the button up, then do it now.
860 B1DragPossible = False;
865 tmpEvent.xbutton = *event;
866 tmpEvent.xbutton.x = initialDragX;
867 tmpEvent.xbutton.y = initialDragY;
871 ProcessDTSelection(desktopRec, (XButtonEvent *)&tmpEvent);
875 ProcessSelection(file_mgr_data, eventIcon,
876 ((event->state & ControlMask) != 0),
877 (XButtonEvent *)&tmpEvent);
883 * If the select occurred in the title portion of the icon, then
884 * put up a text edit field, which can be used to change the name
885 * of the icon. The last field '0' means its not on the Desktop.
887 if (_DtIconSelectInTitle(eventIcon, (Position)initialDragX,
888 (Position)initialDragY) && ProcessBtnUpCD)
890 /* Map the icon into its fileViewData structure */
891 /* Check for desktop icon first */
894 for (i = 0; i<desktop_data->numIconsUsed; i++)
896 if (desktop_data->desktopWindows[i]->iconGadget == eventIcon)
899 desktop_data->desktopWindows[i]->file_view_data;
906 /* Not a desktop icon */
907 XtSetArg(args[0], XmNuserData, (XtPointer) &directoryData);
908 XtGetValues(eventIcon, args, 1);
909 for (i = 0; i < directoryData->file_count; i++)
911 if (directoryData->file_view_data[i]->widget == eventIcon &&
912 directoryData->file_view_data[i]->displayed)
914 fileViewData = directoryData->file_view_data[i];
922 CreateNameChangeDialog(eventIcon, fileViewData,
923 (XtPointer)desktopRec, DESKTOP);
925 else if( file_mgr_data->view != BY_NAME )
927 /* We don't allow users to rename when they are viewing a
928 directory in 'By Name Only' mode.
929 Because clicking on the label is the only way for them
930 to select a file. Popup a text widget to allow rename
931 would be very confusing
933 if( file_mgr_data->view != BY_ATTRIBUTES
934 || ( file_mgr_data->view == BY_ATTRIBUTES
935 && TurnOnTextName ) )
936 CreateNameChangeDialog(eventIcon, fileViewData,
937 (XtPointer)file_mgr_data, NOT_DESKTOP);
945 B1DragPossible = False;
946 B2DragPossible = False;
947 ProcessBtnUp = False;
949 ProcessBtnUpCD = True;
951 else if(new_event->type == KeyPress)
953 if (keysym == XK_Escape)
955 /* an escape unposts the name change text widget */
959 UnpostTextField(file_mgr_data);
967 * When a select operation terminates, we need to find the real button
968 * up event, so that we can get the correct (x,y) for where the select
978 if ((event->type == ButtonRelease) && (event->xbutton.button == Button1))
985 /************************************************************************
987 * GetSelectionRectangle
989 ************************************************************************/
992 GetSelectionRectangle(
996 FileMgrRec *file_mgr_rec,
997 FileMgrData *file_mgr_data,
998 Boolean toggleSelect)
1001 static GC draw_gc = 0;
1002 XGCValues gc_values;
1004 Region widget_region;
1005 Region intersect_region;
1006 Region redraw_region;
1008 static XRectangle return_rect;
1011 int virt_width, virt_height;
1018 int pixmap_x, pixmap_y, pixmap_x1, pixmap_y1;
1019 int directory_count;
1021 Window root, sub_win;
1025 XmManagerWidget file_window;
1026 Dimension current_file_window_width, sw_width;
1027 Dimension current_file_window_height, sw_height;
1028 Dimension file_window_width, file_window_height;
1029 Dimension max_width, max_height;
1030 Dimension min_width, min_height;
1033 int vb_slide_size = 0;
1035 int vb_pg_inc_ret = 0;
1037 int hb_slide_size = 0;
1039 int hb_pg_inc_ret = 0;
1040 Boolean vsbVisible = False;
1041 Boolean hsbVisible = False;
1042 DirectorySet ** directory_set;
1043 FileViewData *file_view_data;
1046 Dimension highlightThickness, shadowThickness;
1047 Dimension width, height;
1048 Dimension marginWidth, marginHeight;
1049 Dimension pixmapWidth, pixmapHeight;
1050 Dimension stringWidth, stringHeight;
1051 unsigned char pixmapPosition;
1052 unsigned char alignment;
1056 /* Get the horizontal and vertical scrollbars. */
1057 XtSetArg (args[0], XmNhorizontalScrollBar, &hb);
1058 XtSetArg (args[1], XmNverticalScrollBar, &vb);
1059 XtSetArg (args[2], XmNwidth, &sw_width);
1060 XtSetArg (args[3], XmNheight, &sw_height);
1061 XtGetValues (file_mgr_rec->scroll_window, args, 4);
1063 file_window = (XmManagerWidget)file_mgr_rec->file_window;
1064 XtSetArg (args[0], XmNwidth, &file_window_width);
1065 XtSetArg (args[1], XmNheight, &file_window_height);
1066 XtGetValues ((Widget)file_window, args, 2);
1067 file_window_width--;
1068 file_window_height--;
1070 if (VerticalScrollbarIsVisible(vb, file_mgr_rec->scroll_window))
1073 current_file_window_width = sw_width - vb->core.width - 12;
1077 current_file_window_width = sw_width - 9;
1080 if (HorizontalScrollbarIsVisible(hb, file_mgr_rec->scroll_window))
1083 current_file_window_height = sw_height - hb->core.height - 12;
1087 current_file_window_height = sw_height - 9;
1092 XmScrollBarGetValues(vb, &vb_val_ret, &vb_slide_size,
1093 &vb_inc_ret, &vb_pg_inc_ret);
1094 min_height = vb_val_ret;
1095 max_height = current_file_window_height + min_height;
1099 max_height = current_file_window_height;
1105 XmScrollBarGetValues(hb, &hb_val_ret, &hb_slide_size,
1106 &hb_inc_ret, &hb_pg_inc_ret);
1107 min_width = hb_val_ret;
1108 max_width = current_file_window_width + min_width;
1112 max_width = current_file_window_width;
1116 /* Get the gc to be used to draw the bounding rectangle */
1120 unsigned int white_pixel;
1122 screen = XDefaultScreenOfDisplay (display);
1123 gc_values.function = GXxor;
1125 white_pixel = WhitePixelOfScreen (screen);
1128 gc_values.foreground = white_pixel;
1129 gc_values.background = BlackPixelOfScreen (screen);
1133 gc_values.background = white_pixel;
1134 gc_values.foreground = BlackPixelOfScreen (screen);
1138 XCreateGC (display, window,
1139 GCForeground | GCBackground | GCFunction, &gc_values);
1142 widget_region = XCreateRegion();
1143 intersect_region = XCreateRegion();
1144 redraw_region = XCreateRegion();
1146 x1 = x2 = old_x = event->x;
1147 y1 = y2 = old_y = event->y;
1149 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1151 while (1) /* Set up a loop to catch the select up point. */
1153 XQueryPointer (display, window, &root, &sub_win,
1154 &win_x, &win_y, &x2, &y2, &mask);
1156 if ((mask & Button1Mask) == 0)
1158 /* Undraw the last rectangle we drew */
1161 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1164 * The real bound of the rectangle is contained in the button up
1165 * event; you can't use the pointer position, because if the system
1166 * is slow, then by the time we query the mouse, the button may have
1167 * been long ago release, and the pointer subsequently moved.
1169 if (XPeekIfEvent(display, &btnUpEvent,(Bool (*)())CheckForBtnUp, NULL))
1171 x2 = btnUpEvent.xbutton.x;
1172 y2 = btnUpEvent.xbutton.y;
1177 if( x2 < 0 ) x2 = 0;
1178 if( y2 < 0 ) y2 = 0;
1180 if ((x2 > old_x && !hsbVisible && (Dimension)old_x < file_window_width) ||
1181 (x2 > old_x && hsbVisible && (Dimension)(hb_val_ret +
1182 hb_slide_size) < (Dimension)(file_window_width + 1)) ||
1183 (x2 < old_x && !hsbVisible && old_x > 0) ||
1184 (x2 < old_x && hsbVisible && hb_val_ret >= 0) ||
1185 (y2 > old_y && !vsbVisible && (Dimension)old_y < file_window_height) ||
1186 (y2 > old_y && vsbVisible && (Dimension)(vb_val_ret +
1187 vb_slide_size) < (Dimension)(file_window_height + 1)) ||
1188 (y2 < old_y && !vsbVisible && old_y > 0) ||
1189 (y2 < old_y && vsbVisible && vb_val_ret >= 0))
1191 DrawRectangle (display, window, draw_gc, x1, y1, old_x, old_y);
1192 if((Dimension)x2 >= max_width)
1196 hb_val_ret += (x2 - max_width);
1197 if((Dimension)(hb_val_ret + hb_slide_size) <= (Dimension)(file_window_width + 1))
1199 XmScrollBarSetValues(hb, hb_val_ret, hb_slide_size,
1200 hb_inc_ret, hb_pg_inc_ret, True);
1201 min_width = (x2 - max_width) + min_width;
1203 XmUpdateDisplay ((Widget)file_window);
1205 else if((Dimension)(hb_val_ret + hb_slide_size) > (Dimension)(file_window_width + 1) &&
1206 (Dimension)(hb_val_ret - (x2 - max_width)) <
1207 (Dimension)(file_window_width - hb_slide_size))
1209 XmScrollBarSetValues(hb,
1210 file_window_width - hb_slide_size + 1,
1211 hb_slide_size, hb_inc_ret, hb_pg_inc_ret, True);
1212 temp = (file_window_width - hb_slide_size + 1) - hb_val_ret;
1213 hb_val_ret = file_window_width - hb_slide_size + 1;
1214 min_width = temp + min_width;
1215 max_width = temp + max_width;
1216 XmUpdateDisplay ((Widget)file_window);
1217 x2 = file_window_width;
1221 hb_val_ret = file_window_width - hb_slide_size + 1;
1222 x2 = max_width = file_window_width;
1223 min_width = max_width - current_file_window_width;
1230 if((Dimension)x2 > current_file_window_width)
1231 x2 = current_file_window_width;
1235 if((Dimension)x2 > file_window_width)
1236 x2 = file_window_width;
1240 else if((Dimension)x2 < min_width)
1246 hb_val_ret -= (min_width - x2);
1249 XmScrollBarSetValues(hb, hb_val_ret, hb_slide_size,
1250 hb_inc_ret, hb_pg_inc_ret, True);
1251 max_width = max_width - (min_width - x2);
1253 XmUpdateDisplay (file_mgr_rec->file_window);
1255 else if((hb_val_ret < 0) &&
1256 ((int)(hb_val_ret + (min_width - x2)) >= (int)0))
1258 XmScrollBarSetValues(hb, 0, hb_slide_size,
1259 hb_inc_ret, hb_pg_inc_ret, True);
1260 max_width = current_file_window_width;
1261 XmUpdateDisplay ((Widget)file_window);
1262 x2 = hb_val_ret = min_width = 0;
1266 hb_val_ret = min_width = x2 = 0;
1267 max_width = current_file_window_width;
1283 if((Dimension)y2 > max_height)
1287 vb_val_ret += (y2 - max_height);
1288 if((Dimension)(vb_val_ret + vb_slide_size) <= (Dimension)(file_window_height + 1))
1290 XmScrollBarSetValues(vb, vb_val_ret, vb_slide_size,
1291 vb_inc_ret, vb_pg_inc_ret, True);
1292 min_height = (y2 - max_height) + min_height;
1294 XmUpdateDisplay ((Widget)file_window);
1296 else if((Dimension)(vb_val_ret + vb_slide_size) > (Dimension)(file_window_height + 1) &&
1297 (Dimension)(vb_val_ret - (y2 - max_height)) <
1298 (Dimension)(file_window_height + 1 - vb_slide_size))
1300 XmScrollBarSetValues(vb,
1301 file_window_height + 1 - vb_slide_size,
1302 vb_slide_size, vb_inc_ret, vb_pg_inc_ret, True);
1303 temp = (file_window_height + 1 - vb_slide_size) - vb_val_ret;
1304 vb_val_ret = file_window_height + 1 - vb_slide_size;
1305 min_height = temp + min_height;
1306 max_height = temp + max_height;
1307 XmUpdateDisplay ((Widget)file_window);
1308 y2 = file_window_height;
1312 vb_val_ret = file_window_height + 1 - vb_slide_size;
1313 y2 = max_height = file_window_height;
1314 min_height = max_height - current_file_window_height;
1321 if((Dimension)y2 > current_file_window_height)
1322 y2 = current_file_window_height;
1326 if((Dimension)y2 > file_window_height)
1327 y2 = file_window_height;
1331 else if((Dimension)y2 < min_height)
1337 vb_val_ret -= (min_height - y2);
1340 XmScrollBarSetValues(vb, vb_val_ret, vb_slide_size,
1341 vb_inc_ret, vb_pg_inc_ret, True);
1342 max_height = max_height - (min_height - y2);
1344 XmUpdateDisplay (file_mgr_rec->file_window);
1346 else if(vb_val_ret < 0 &&
1347 ((int)(vb_val_ret + (min_height - y2)) >= (int)0))
1349 XmScrollBarSetValues(vb, 0, vb_slide_size,
1350 vb_inc_ret, vb_pg_inc_ret, True);
1351 max_height = current_file_window_height;
1352 XmUpdateDisplay ((Widget)file_window);
1353 y2 = vb_val_ret = min_height = 0;
1357 vb_val_ret = min_height = y2 = 0;
1358 max_height = current_file_window_height;
1395 virt_width = x4 - x3 + 1;
1396 virt_height = y4 - y3 + 1;
1399 return_rect.x = (short)virt_x;
1400 return_rect.y = (short)virt_y;
1401 return_rect.width = (unsigned short)virt_width;
1402 return_rect.height = (unsigned short)virt_height;
1403 region = XCreateRegion();
1404 XUnionRectWithRegion (&return_rect, region, region);
1406 /* Run through the gadget set to cause each icon within the */
1407 /* rectangle to be selected. */
1409 if (file_mgr_data->show_type == SINGLE_DIRECTORY)
1410 directory_count = 1;
1412 directory_count = file_mgr_data->directory_count;
1414 directory_set = file_mgr_data->directory_set;
1417 for (i = 0; i < directory_count; i++)
1419 for (j = 0; j < directory_set[i]->file_count; j++)
1423 file_view_data = directory_set[i]->order_list[j];
1425 if (!file_view_data->displayed || file_view_data->need_update)
1428 g = (DtIconGadget) file_view_data->widget;
1430 highlightThickness = g->gadget.highlight_thickness;
1431 shadowThickness = g->gadget.shadow_thickness;
1436 marginWidth = g->icon.cache->margin_width;
1437 marginHeight = g->icon.cache->margin_height;
1438 pixmapPosition = g->icon.cache->pixmap_position;
1439 alignment = g->icon.cache->alignment;
1441 pixmapWidth = g->icon.pixmap_width;
1442 pixmapHeight = g->icon.pixmap_height;
1443 stringWidth = g->icon.string_width;
1444 stringHeight = g->icon.cache->string_height;
1446 switch ((int) pixmapPosition)
1449 if (alignment == XmALIGNMENT_BEGINNING)
1450 pixmap_x = x + highlightThickness;
1451 else if(alignment == XmALIGNMENT_CENTER)
1453 if(stringWidth >= pixmapWidth)
1454 pixmap_x = x + highlightThickness +
1455 ((Dimension)(stringWidth - pixmapWidth)/(Dimension)2);
1457 pixmap_x = x + highlightThickness;
1461 fprintf(stderr, "GetSelectionRectangle: unsupported alignment %d , defaulting to Beginning\n", alignment);
1462 pixmap_x = x + highlightThickness;
1467 pixmap_x = x + highlightThickness;
1470 pixmap_y = y + pixmapHeight;
1471 pixmap_x = pixmap_x + pixmapWidth;
1473 pixmap_x1 = pixmap_x + pixmapWidth;
1474 pixmap_y1 = pixmap_y + pixmapHeight;
1477 if(XPointInRegion(region, pixmap_x, pixmap_y)
1479 && XPointInRegion(region, pixmap_x1, pixmap_y1)
1483 if (toggleSelect == True &&
1484 FileIsSelected (file_mgr_data, file_view_data))
1485 DeselectFile (file_mgr_data, file_view_data, True);
1488 if(!FileIsSelected (file_mgr_data, file_view_data))
1489 SelectFile (file_mgr_data, file_view_data);
1492 else if (FileIsSelected (file_mgr_data, file_view_data))
1493 DeselectFile (file_mgr_data, file_view_data, True);
1496 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1497 XDestroyRegion (region);
1501 XDestroyRegion (widget_region);
1502 XDestroyRegion (intersect_region);
1503 XDestroyRegion (redraw_region);
1510 /************************************************************************
1513 * DrawRectangle takes two points as input and draws a rectangle with
1514 * a line width and height of 1 around the rectangle generated
1515 * by the two points. The rectangle is drawn XOR so that it
1518 ************************************************************************/
1533 unsigned int height;
1557 XDrawRectangle (display, window, gc, x, y, width, height);
1559 if (width > 2 && height > 2)
1560 XDrawRectangle (display, window, gc, x + 1, y + 1, width - 2, height - 2);
1565 * Given a widget, create a region describing the area occupied by the
1566 * widget; it may be a simple rectangle, or a compound region composed
1567 * of two rectangles (the pixmap and the label).
1571 WidgetRectToRegion (
1572 FileMgrData * file_mgr_data,
1576 XRectangle widget_rect;
1577 XRectangle pRect, lRect;
1578 unsigned char flags;
1579 static Region temp_region = NULL;
1581 /* Empty the region */
1582 if (temp_region == NULL)
1583 temp_region = XCreateRegion();
1584 XSubtractRegion(temp_region, temp_region, region);
1589 /* Tree mode and attribute views do not support compound icons */
1590 if ((file_mgr_data->show_type != SINGLE_DIRECTORY) ||
1591 (file_mgr_data->view == BY_ATTRIBUTES))
1593 widget_rect.x = (short)w->core.x;
1594 widget_rect.y = (short)w->core.y;
1595 widget_rect.width = (unsigned short)w->core.width;
1596 widget_rect.height = (unsigned short)w->core.height;
1598 XUnionRectWithRegion(&widget_rect, region, region);
1602 _DtIconGetIconRects((DtIconGadget)w, &flags, &pRect, &lRect);
1604 if (flags & XmPIXMAP_RECT)
1605 XUnionRectWithRegion(&pRect, region, region);
1607 if (flags & XmLABEL_RECT)
1608 XUnionRectWithRegion(&lRect, region, region);
1615 FileMgrData * file_mgr_data,
1617 Boolean toggleSelect,
1618 XButtonEvent * event)
1620 XRectangle * selection_rect;
1621 XRectangle widget_rect;
1622 DirectorySet ** directory_set;
1623 int directory_count;
1626 Region widget_region;
1627 Region intersect_region;
1628 Region redraw_region;
1629 FileMgrRec * file_mgr_rec;
1630 FileViewData * file_view_data;
1632 file_mgr_rec = (FileMgrRec *)file_mgr_data->file_mgr_rec;
1634 /* User is starting a new selection; clear all old ones */
1637 DeselectAllFiles (file_mgr_data);
1638 file_mgr_data->selected_file_count = 0;
1640 XFlush (XtDisplay (file_mgr_rec->file_window));
1641 XmUpdateDisplay (file_mgr_rec->file_window);
1644 /* Get the rectangle to be used as the selection area */
1645 if (icon == NULL && event->type == ButtonPress)
1647 /* User is starting a region select */
1648 GetSelectionRectangle (XtDisplay(file_mgr_rec->file_window),
1649 (Window) XtWindow(file_mgr_rec->file_window),
1650 event, file_mgr_rec, file_mgr_data,
1655 /* User did a single select either through keyboard or mouse */
1656 if(event->type == KeyPress)
1658 widget_rect.x = (short)icon->core.x;
1659 widget_rect.y = (short)icon->core.y;
1660 widget_rect.width = (short)icon->core.width;
1661 widget_rect.height = (short)icon->core.height;
1665 widget_rect.x = (short)event->x;
1666 widget_rect.y = (short)event->y;
1667 widget_rect.width = 1;
1668 widget_rect.height = 1;
1670 selection_rect = &widget_rect;
1672 region = XCreateRegion();
1673 widget_region = XCreateRegion();
1674 intersect_region = XCreateRegion();
1675 redraw_region = XCreateRegion();
1677 XUnionRectWithRegion (selection_rect, region, region);
1680 /* Run through the gadget set to cause each icon within the */
1681 /* rectangle to be selected. */
1683 if (file_mgr_data->show_type == SINGLE_DIRECTORY)
1686 directory_count = 1;
1690 directory_count = file_mgr_data->directory_count;
1694 directory_set = file_mgr_data->directory_set;
1697 for (; i < directory_count; i++)
1699 if (PositioningEnabledInView(file_mgr_data))
1701 ObjectPtr top = GetTopOfStack(file_mgr_data);
1702 int next_position = 0;
1705 * Stacking order requires us to handle this specially. Objects
1706 * must be searched in top to bottom order when determining if
1707 * they are in the selection rectangle, but they must be drawn
1708 * bottom to top, to guarantee that the visuals are correct.
1711 /* Find set of selected objects */
1714 if(top->file_view_data == NULL)
1720 if (!top->file_view_data->displayed)
1726 WidgetRectToRegion(file_mgr_data, top->file_view_data->widget,
1728 XIntersectRegion(region, widget_region, intersect_region);
1730 if (!XEmptyRegion(intersect_region))
1733 FileIsSelected (file_mgr_data, top->file_view_data))
1735 DeselectFile(file_mgr_data, top->file_view_data, True);
1737 XUnionRegion(widget_region, redraw_region, redraw_region);
1742 * We don't want to change the icon yet, because we
1743 * need to do it in bottom to top order.
1746 RepositionUpInStack(file_mgr_data, top->stacking_order,
1750 /* Higher item 'cover' lower ones */
1751 XSubtractRegion(region, widget_region, region);
1757 /* Now, select any newly selected files */
1758 if (next_position > 0)
1760 /* Find where to start the redraw from */
1761 top = GetTopOfStack(file_mgr_data);
1762 while (next_position - 1 > 0)
1770 if(top->file_view_data != NULL)
1771 SelectFile(file_mgr_data, top->file_view_data);
1776 if (!XEmptyRegion(redraw_region))
1777 RepaintDesktop(file_mgr_data, NULL, redraw_region);
1779 RegisterDesktopHotspots(file_mgr_data, file_mgr_rec);
1784 for (j = 0; j < directory_set[i]->file_count; j++)
1786 file_view_data = directory_set[i]->order_list[j];
1788 if (!file_view_data->displayed)
1791 WidgetRectToRegion(file_mgr_data, file_view_data->widget,
1793 XIntersectRegion (region, widget_region, intersect_region);
1795 if (!XEmptyRegion (intersect_region))
1797 if (toggleSelect == True &&
1798 FileIsSelected (file_mgr_data, file_view_data))
1799 DeselectFile (file_mgr_data, file_view_data, True);
1802 SelectFile (file_mgr_data, file_view_data);
1803 if(file_mgr_data->view == BY_ATTRIBUTES)
1806 * Need to determine whether the click was in the
1809 XRectangle textExtent;
1811 XmFontList fontList;
1812 XmString fileNameString;
1813 DtIconGadget g = (DtIconGadget)file_view_data->widget;
1815 _DtIconGetTextExtent_r(file_view_data->widget,
1818 XtVaGetValues( file_view_data->widget,
1823 fileNameString = XmStringCreateLocalized( file_view_data->file_data->file_name );
1824 textExtent.width = XmStringWidth( fontList, fileNameString );
1825 XmStringFree( fileNameString );
1827 (unsigned short)file_view_data->widget->core.height;
1829 textExtent.x = (short)file_view_data->widget->core.x
1830 + g->icon.pixmap_width
1831 + g->icon.cache->margin_width
1832 + g->icon.cache->spacing;
1834 textExtent.y = (short)file_view_data->widget->core.y;
1836 tmp_region = XCreateRegion();
1837 XUnionRectWithRegion (&textExtent,
1838 tmp_region, tmp_region);
1840 XSubtractRegion (widget_region, tmp_region, tmp_region);
1842 XIntersectRegion (region, tmp_region, intersect_region);
1843 if (XEmptyRegion (intersect_region))
1844 TurnOnTextName = True;
1846 TurnOnTextName = False;
1847 XDestroyRegion (tmp_region);
1855 XDestroyRegion (region);
1856 XDestroyRegion (widget_region);
1857 XDestroyRegion (intersect_region);
1858 XDestroyRegion (redraw_region);
1862 if(file_mgr_data != trashFileMgrData)
1864 if (file_mgr_data->selected_file_count == 0)
1865 ActivateNoSelect (file_mgr_rec);
1866 else if (file_mgr_data->selected_file_count == 1)
1868 ActivateSingleSelect (file_mgr_rec,
1869 file_mgr_data->selection_list[0]->file_data->logical_type);
1872 ActivateMultipleSelect (file_mgr_rec);
1875 SensitizeTrashBtns();
1877 ProcessBtnUp = False;
1884 FileViewData *file_view_data,
1885 FileMgrData *file_mgr_data,
1888 int n, num_rectangles;
1890 Dimension highlightThickness, shadowThickness;
1891 Dimension half_shadowThickness;
1892 Dimension marginWidth, marginHeight;
1893 Dimension pixmapWidth, pixmapHeight;
1894 Dimension stringWidth, stringHeight;
1896 XRectangle rect[10];
1897 unsigned char pixmapPosition;
1898 unsigned char alignment;
1899 Position adj_x, adj_y;
1902 DtIconGadget g = (DtIconGadget)w;
1905 gc = ((XmManagerWidget)(g->object.parent))->manager.highlight_GC;
1910 DrawShadowTh(w, gc, DESKTOP);
1915 /* in in as placed mode need to cycle the icons so the traversal
1916 box doesn't chop up the icons */
1917 if(type == NOT_DESKTOP && file_view_data != NULL)
1919 if (PositioningEnabledInView(file_mgr_data))
1921 top = GetTopOfStack(file_mgr_data);
1922 if(top != NULL && top->file_view_data != file_view_data)
1924 ObjectPtr savetop, next, prev;
1928 while(top != NULL && top->file_view_data != file_view_data)
1940 top->next = savetop;
1941 top->stacking_order = 1;
1942 savetop->prev = top;
1944 for(i = 2; top->prev != NULL; i++)
1946 top->stacking_order = i;
1947 if(top->next == NULL)
1952 RedrawOneGadget(w, NULL, NULL);
1959 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
1960 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
1961 XtSetArg (args[n], XmNx, &x); n++;
1962 XtSetArg (args[n], XmNy, &y); n++;
1963 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
1964 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
1965 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
1966 XtSetArg (args[n], XmNalignment, &alignment); n++;
1967 XtGetValues (w, args, n);
1969 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
1970 pixmapWidth = g->icon.pixmap_width;
1971 pixmapHeight = g->icon.pixmap_height;
1972 stringWidth = g->icon.string_width;
1973 stringHeight = g->icon.cache->string_height;
1975 adj_x = shadowThickness + highlightThickness + marginWidth;
1976 adj_y = shadowThickness + highlightThickness + marginHeight;
1978 if(shadowThickness != 0)
1979 half_shadowThickness = shadowThickness/2;
1981 half_shadowThickness = 0;
1984 switch ((int) pixmapPosition)
1987 if (alignment == XmALIGNMENT_BEGINNING)
1990 rect[num_rectangles].x = x;
1991 rect[num_rectangles].y = y;
1992 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
1993 rect[num_rectangles++].height = highlightThickness;
1995 if(stringWidth > pixmapWidth)
1998 rect[num_rectangles].x = x + pixmapWidth +
1999 (2 * adj_x) - highlightThickness;
2000 rect[num_rectangles].y = y;
2001 rect[num_rectangles].width = highlightThickness;
2002 rect[num_rectangles++].height = pixmapHeight + spacing;
2005 rect[num_rectangles].x = x + pixmapWidth +
2006 (2 * adj_x) - highlightThickness;
2007 rect[num_rectangles].y = y + pixmapHeight + spacing;
2008 rect[num_rectangles].width = stringWidth -
2009 pixmapWidth + highlightThickness;
2010 rect[num_rectangles++].height = highlightThickness;
2013 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2014 - highlightThickness;
2015 rect[num_rectangles].y = y + pixmapHeight + spacing;
2016 rect[num_rectangles].width = highlightThickness;
2017 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2022 rect[num_rectangles].x = x + pixmapWidth +
2023 (2 * adj_x) - highlightThickness;
2024 rect[num_rectangles].y = y;
2025 rect[num_rectangles].width = highlightThickness;
2026 rect[num_rectangles++].height = pixmapHeight + (2 * adj_y) -
2030 rect[num_rectangles].x = x + stringWidth +
2031 (2 * adj_x) - highlightThickness;
2032 rect[num_rectangles].y = y + pixmapHeight + (2 * adj_y) -
2034 rect[num_rectangles].width = pixmapWidth -
2035 stringWidth + highlightThickness;
2036 rect[num_rectangles++].height = highlightThickness;
2040 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2041 - highlightThickness;
2042 rect[num_rectangles].y = y + pixmapHeight + (2 * adj_y) -
2044 rect[num_rectangles].width = highlightThickness;
2045 rect[num_rectangles++].height = spacing + stringHeight +
2050 rect[num_rectangles].x = x;
2051 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2052 spacing + (2 * adj_y) - highlightThickness;
2053 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2054 rect[num_rectangles++].height = highlightThickness;
2057 rect[num_rectangles].x = x;
2058 rect[num_rectangles].y = y;
2059 rect[num_rectangles].width = highlightThickness;
2060 rect[num_rectangles++].height = pixmapHeight +
2061 stringHeight + spacing + (2 * adj_y);
2064 else if (alignment == XmALIGNMENT_CENTER)
2066 if(stringWidth > pixmapWidth)
2069 rect[num_rectangles].x = x
2070 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
2071 rect[num_rectangles].y = y;
2072 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
2073 rect[num_rectangles++].height = highlightThickness;
2076 rect[num_rectangles].x = x
2077 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2080 - highlightThickness;
2081 rect[num_rectangles].y = y;
2082 rect[num_rectangles].width = highlightThickness;
2083 rect[num_rectangles++].height = pixmapHeight + spacing;
2086 rect[num_rectangles].x = x
2087 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2090 - highlightThickness;
2091 rect[num_rectangles].y = y + pixmapHeight + spacing;
2092 rect[num_rectangles].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2093 + (Dimension)(stringWidth - pixmapWidth)%(Dimension)2;
2094 rect[num_rectangles++].height = highlightThickness;
2097 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2098 - highlightThickness;
2099 rect[num_rectangles].y = y + pixmapHeight + spacing;
2100 rect[num_rectangles].width = highlightThickness;
2101 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2104 rect[num_rectangles].x = x;
2105 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2106 spacing + (2 * adj_y) - highlightThickness;
2107 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2108 rect[num_rectangles++].height = highlightThickness;
2111 rect[num_rectangles].x = x;
2112 rect[num_rectangles].y = y + pixmapHeight + spacing;
2113 rect[num_rectangles].width = highlightThickness;
2114 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2117 rect[num_rectangles].x = x;
2118 rect[num_rectangles].y = y + pixmapHeight + spacing;
2119 rect[num_rectangles].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2120 + highlightThickness;
2121 rect[num_rectangles++].height = highlightThickness;
2124 rect[num_rectangles].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
2125 rect[num_rectangles].y = y;
2126 rect[num_rectangles].width = highlightThickness;
2127 rect[num_rectangles++].height = pixmapHeight + spacing;
2132 rect[num_rectangles].x = x;
2133 rect[num_rectangles].y = y;
2134 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
2135 rect[num_rectangles++].height = highlightThickness;
2138 rect[num_rectangles].x = x + pixmapWidth + (2 * adj_x) -
2140 rect[num_rectangles].y = y;
2141 rect[num_rectangles].width = highlightThickness;
2142 rect[num_rectangles++].height = pixmapHeight + spacing +
2143 2 * highlightThickness;
2146 rect[num_rectangles].x = x + pixmapWidth + adj_x -
2147 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness;
2148 rect[num_rectangles].y = y + pixmapHeight + spacing +
2149 highlightThickness + 1;
2150 rect[num_rectangles].width = (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2152 rect[num_rectangles++].height = highlightThickness;
2155 rect[num_rectangles].x = x + stringWidth + adj_x +
2156 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness;
2157 rect[num_rectangles].y = y + pixmapHeight + spacing
2158 + highlightThickness + 1;
2159 rect[num_rectangles].width = highlightThickness;
2160 rect[num_rectangles++].height = stringHeight + (2 * adj_y)
2161 - highlightThickness - 1;
2164 rect[num_rectangles].x = x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2;
2165 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2166 spacing + (2 * adj_y) - highlightThickness;
2167 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2168 rect[num_rectangles++].height = highlightThickness;
2171 rect[num_rectangles].x = x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2;
2172 rect[num_rectangles].y = y + pixmapHeight + spacing +
2173 highlightThickness + 1;
2174 rect[num_rectangles].width = highlightThickness;
2175 rect[num_rectangles++].height = stringHeight + (2 * adj_y)
2176 - highlightThickness - 1;
2179 rect[num_rectangles].x = x;
2180 rect[num_rectangles].y = y + pixmapHeight + spacing +
2181 highlightThickness + 1;
2182 rect[num_rectangles].width = (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2184 rect[num_rectangles++].height = highlightThickness;
2187 rect[num_rectangles].x = x;
2188 rect[num_rectangles].y = y;
2189 rect[num_rectangles].width = highlightThickness;
2190 rect[num_rectangles++].height = pixmapHeight + spacing +
2191 2 * highlightThickness;
2195 FM_XmHighlightBorder ((Widget)w);
2198 if((Dimension)(stringHeight + 4) >= pixmapHeight)
2199 FM_XmHighlightBorder ((Widget)w);
2203 rect[num_rectangles].x = x;
2204 rect[num_rectangles].y = y;
2205 rect[num_rectangles].width = adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2206 rect[num_rectangles++].height = highlightThickness;
2209 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2210 rect[num_rectangles].y = y;
2211 rect[num_rectangles].width = highlightThickness;
2212 rect[num_rectangles++].height = (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2215 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2216 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2217 rect[num_rectangles].width = spacing/2 + stringWidth + adj_x;
2218 rect[num_rectangles++].height = highlightThickness;
2221 rect[num_rectangles].x = x + adj_x + pixmapWidth + spacing +
2222 stringWidth + adj_x - highlightThickness;
2223 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2224 rect[num_rectangles].width = highlightThickness;
2225 rect[num_rectangles++].height = stringHeight + 2*adj_y;
2228 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2229 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2230 stringHeight + 2*adj_y - highlightThickness;
2231 rect[num_rectangles].width = spacing/2 + stringWidth + adj_x;
2232 rect[num_rectangles++].height = highlightThickness;
2235 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2236 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2237 stringHeight + 2*adj_y;
2238 rect[num_rectangles].width = highlightThickness;
2239 rect[num_rectangles++].height = pixmapHeight - stringHeight -
2240 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2243 rect[num_rectangles].x = x;
2244 rect[num_rectangles].y = y + pixmapHeight + 2*adj_y -
2246 rect[num_rectangles].width = adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2247 rect[num_rectangles++].height = highlightThickness;
2250 rect[num_rectangles].x = x;
2251 rect[num_rectangles].y = y;
2252 rect[num_rectangles].width = highlightThickness;
2253 rect[num_rectangles++].height = pixmapHeight + 2*adj_y;
2256 case XmPIXMAP_BOTTOM:
2257 case XmPIXMAP_RIGHT:
2258 FM_XmHighlightBorder ((Widget)w);
2264 XFillRectangles (XtDisplay (w), XtWindow (w), gc, &rect[0], num_rectangles);
2274 Dimension highlightThickness, shadowThickness;
2275 Dimension half_shadowThickness;
2276 Dimension marginWidth, marginHeight;
2277 Dimension pixmapWidth, pixmapHeight;
2278 Dimension stringWidth, stringHeight;
2280 unsigned char pixmapPosition;
2281 unsigned char alignment;
2282 Position adj_x, adj_y;
2284 DtIconGadget g = (DtIconGadget)w;
2290 DrawShadowTh(w, NULL, DESKTOP);
2296 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
2297 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
2298 XtSetArg (args[n], XmNx, &x); n++;
2299 XtSetArg (args[n], XmNy, &y); n++;
2300 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
2301 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
2302 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
2303 XtSetArg (args[n], XmNalignment, &alignment); n++;
2304 XtGetValues (w, args, n);
2306 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
2307 pixmapWidth = g->icon.pixmap_width;
2308 pixmapHeight = g->icon.pixmap_height;
2309 stringWidth = g->icon.string_width;
2310 stringHeight = g->icon.cache->string_height;
2312 adj_x = shadowThickness + highlightThickness + marginWidth;
2313 adj_y = shadowThickness + highlightThickness + marginHeight;
2315 if(shadowThickness != 0)
2316 half_shadowThickness = shadowThickness/2;
2318 half_shadowThickness = 0;
2320 switch ((int) pixmapPosition)
2323 if (alignment == XmALIGNMENT_BEGINNING)
2326 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2327 pixmapWidth + (2 * adj_x), highlightThickness, False);
2329 if(stringWidth > pixmapWidth)
2332 XClearArea (XtDisplay (w), XtWindow (w),
2333 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2334 y, highlightThickness,
2335 pixmapHeight + spacing,
2339 XClearArea (XtDisplay (w), XtWindow (w),
2340 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2341 y + pixmapHeight + spacing,
2342 stringWidth - pixmapWidth + highlightThickness,
2347 XClearArea (XtDisplay (w), XtWindow (w),
2348 x + stringWidth + (2 * adj_x) - highlightThickness,
2349 y + pixmapHeight + spacing,
2351 stringHeight + (2 * adj_y),
2357 XClearArea (XtDisplay (w), XtWindow (w),
2358 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2359 y, highlightThickness,
2360 pixmapHeight + (2 * adj_y) - half_shadowThickness,
2364 XClearArea (XtDisplay (w), XtWindow (w),
2365 x + stringWidth + (2 * adj_x) - highlightThickness,
2366 y + pixmapHeight + (2 * adj_y) - highlightThickness,
2367 pixmapWidth - stringWidth + highlightThickness,
2372 XClearArea (XtDisplay (w), XtWindow (w),
2373 x + stringWidth + (2 * adj_x) - highlightThickness,
2374 y + pixmapHeight + (2 * adj_y) -
2375 half_shadowThickness,
2377 spacing + stringHeight + highlightThickness,
2382 XClearArea (XtDisplay (w), XtWindow (w), x,
2383 y + pixmapHeight + stringHeight +
2384 spacing + (2 * adj_y) - highlightThickness,
2385 stringWidth + (2 * adj_y),
2390 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2392 pixmapHeight + stringHeight + spacing + (2 * adj_y),
2396 else if (alignment == XmALIGNMENT_CENTER)
2398 if(stringWidth > pixmapWidth)
2401 XClearArea (XtDisplay (w), XtWindow (w),
2402 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2, y,
2403 pixmapWidth + (2 * adj_x),
2408 XClearArea (XtDisplay (w), XtWindow (w),
2409 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + pixmapWidth +
2410 (2 * adj_x) - highlightThickness,
2411 y, highlightThickness, pixmapHeight + spacing,
2415 XClearArea (XtDisplay (w), XtWindow (w),
2416 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + pixmapWidth +
2417 (2 * adj_x) - highlightThickness,
2418 y + pixmapHeight + spacing,
2419 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
2420 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2,
2425 XClearArea (XtDisplay (w), XtWindow (w),
2426 x + stringWidth + (2 * adj_x) - highlightThickness,
2427 y + pixmapHeight + spacing, highlightThickness,
2428 stringHeight + (2 * adj_y),
2432 XClearArea (XtDisplay (w), XtWindow (w), x,
2433 y + pixmapHeight + stringHeight +
2434 spacing + (2 * adj_y) - highlightThickness,
2435 stringWidth + (2 * adj_y), highlightThickness,
2439 XClearArea (XtDisplay (w), XtWindow (w), x,
2440 y + pixmapHeight + spacing, highlightThickness,
2441 stringHeight + (2 * adj_y),
2445 XClearArea (XtDisplay (w), XtWindow (w), x,
2446 y + pixmapHeight + spacing,
2447 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + highlightThickness,
2452 XClearArea (XtDisplay (w), XtWindow (w),
2453 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2,
2454 y, highlightThickness, pixmapHeight + spacing,
2460 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2461 pixmapWidth + (2 * adj_x), highlightThickness,
2465 XClearArea (XtDisplay (w), XtWindow (w),
2466 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2467 y, highlightThickness,
2468 pixmapHeight + spacing + 2 * highlightThickness,
2472 XClearArea (XtDisplay (w), XtWindow (w),
2473 x + pixmapWidth + adj_x + highlightThickness -
2474 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2475 y + pixmapHeight + spacing + highlightThickness + 1,
2476 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness,
2481 XClearArea (XtDisplay (w), XtWindow (w),
2482 x + stringWidth + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2483 adj_x + highlightThickness,
2484 y + pixmapHeight + spacing + highlightThickness + 1,
2486 stringHeight + (2 * adj_y) - highlightThickness -1,
2490 XClearArea (XtDisplay (w), XtWindow (w),
2491 x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2492 y + pixmapHeight + stringHeight +
2493 spacing + (2 * adj_y) - highlightThickness,
2494 stringWidth + (2 * adj_y),
2499 XClearArea (XtDisplay (w), XtWindow (w),
2500 x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2501 y + pixmapHeight + spacing + highlightThickness + 1,
2503 stringHeight + (2 * adj_y) - highlightThickness - 1,
2507 XClearArea (XtDisplay (w), XtWindow (w), x,
2508 y + pixmapHeight + spacing + highlightThickness + 1,
2509 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness,
2514 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2516 pixmapHeight + spacing + 2 * highlightThickness,
2522 FM_XmUnhighlightBorder ((Widget)w);
2525 if((Dimension)(stringHeight + 4) >= pixmapHeight)
2526 FM_XmUnhighlightBorder ((Widget)w);
2530 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2531 adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2536 XClearArea (XtDisplay (w), XtWindow (w),
2537 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2540 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2544 XClearArea (XtDisplay (w), XtWindow (w),
2545 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2546 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2547 spacing/2 + stringWidth + adj_x,
2552 XClearArea (XtDisplay (w), XtWindow (w),
2553 x + adj_x + pixmapWidth + spacing +
2554 stringWidth + adj_x - highlightThickness,
2555 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2557 stringHeight + 2*adj_y,
2561 XClearArea (XtDisplay (w), XtWindow (w),
2562 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2563 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2564 stringHeight + 2*adj_y - highlightThickness,
2565 spacing/2 + stringWidth + adj_x,
2570 XClearArea (XtDisplay (w), XtWindow (w),
2571 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2572 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2573 stringHeight + 2*adj_y,
2575 pixmapHeight - stringHeight -
2576 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2580 XClearArea (XtDisplay (w), XtWindow (w), x,
2581 y + pixmapHeight + 2*adj_y - highlightThickness,
2582 adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2587 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2589 pixmapHeight + 2*adj_y,
2593 case XmPIXMAP_BOTTOM:
2594 case XmPIXMAP_RIGHT:
2595 FM_XmUnhighlightBorder ((Widget)w);
2609 Dimension highlightThickness, shadowThickness;
2610 Dimension width, height;
2611 Dimension marginWidth, marginHeight;
2612 Dimension pixmapWidth, pixmapHeight;
2613 Dimension stringWidth, stringHeight;
2615 unsigned char pixmapPosition;
2616 unsigned char alignment;
2617 unsigned char shadowType;
2618 GC top_gc, bottom_gc ;
2620 XRectangle rect[10];
2621 DtIconGadget g = (DtIconGadget)w;
2622 XmManagerWidget mgr = (XmManagerWidget)XtParent(w);
2623 Boolean s_out = False,
2629 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
2630 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
2631 XtSetArg (args[n], XmNx, &x); n++;
2632 XtSetArg (args[n], XmNy, &y); n++;
2633 XtSetArg (args[n], XmNwidth, &width); n++;
2634 XtSetArg (args[n], XmNheight, &height); n++;
2635 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
2636 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
2637 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
2638 XtSetArg (args[n], XmNalignment, &alignment); n++;
2639 XtSetArg (args[n], XmNshadowType, &shadowType); n++;
2640 XtGetValues (w, args, n);
2642 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
2643 pixmapWidth = g->icon.pixmap_width;
2644 pixmapHeight = g->icon.pixmap_height;
2645 stringWidth = g->icon.string_width;
2646 stringHeight = g->icon.cache->string_height;
2648 /* Get shadow attributes.
2650 s_out = (shadowType == XmSHADOW_OUT || shadowType == XmSHADOW_ETCHED_OUT)
2652 s_etched = (shadowType == XmSHADOW_ETCHED_IN ||
2653 shadowType == XmSHADOW_ETCHED_OUT)
2658 if(shadowType == XmSHADOW_ETCHED_OUT)
2661 ? mgr->manager.top_shadow_GC : mgr->manager.bottom_shadow_GC;
2663 ? mgr->manager.bottom_shadow_GC : mgr->manager.top_shadow_GC;
2668 ? mgr->manager.top_shadow_GC : mgr->manager.bottom_shadow_GC;
2670 ? mgr->manager.bottom_shadow_GC : mgr->manager.top_shadow_GC;
2674 top_gc = bottom_gc = gc;
2680 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
2681 x + highlightThickness,
2682 y + highlightThickness,
2683 width - 2*highlightThickness,
2684 height - 2*highlightThickness,
2685 shadowThickness, XmSHADOW_IN);
2689 int half_shadowThickness;
2692 if (shadowThickness <= 0) return;
2693 if (shadowThickness > (Dimension)(width / 2)) shadowThickness = width / 2;
2694 if (shadowThickness > (Dimension)(height / 2)) shadowThickness = height / 2;
2695 if (shadowThickness <= 0) return;
2697 shadowThickness = (shadowThickness % 2) ?
2698 (shadowThickness-1) : (shadowThickness);
2700 half_shadowThickness = shadowThickness / 2;
2701 switch ((int) pixmapPosition)
2704 if (alignment == XmALIGNMENT_BEGINNING)
2706 if(type == NOT_DESKTOP)
2710 rect[num_rects].x = x + highlightThickness;
2711 rect[num_rects].y = y + highlightThickness;
2712 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
2713 (2 * marginWidth) - half_shadowThickness;
2714 rect[num_rects++].height = half_shadowThickness;
2717 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2718 (2 * marginWidth) + shadowThickness;
2719 rect[num_rects].y = y + highlightThickness;
2720 rect[num_rects].width = half_shadowThickness;
2721 rect[num_rects++].height = pixmapHeight + marginHeight +
2722 spacing/2 + shadowThickness +
2723 half_shadowThickness;
2725 if(stringWidth > pixmapWidth)
2728 rect[num_rects].x = x + highlightThickness +
2730 pixmapWidth + (2 * marginWidth);
2731 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2733 rect[num_rects].width = stringWidth - pixmapWidth +
2734 marginWidth - half_shadowThickness;
2735 rect[num_rects++].height = half_shadowThickness;
2738 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
2739 + shadowThickness + highlightThickness;
2740 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2742 rect[num_rects].width = half_shadowThickness;
2743 rect[num_rects++].height = stringHeight +
2744 (2*marginHeight) + half_shadowThickness;
2749 rect[num_rects].x = x + highlightThickness + stringWidth +
2750 (2 * marginWidth) + shadowThickness;
2751 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2752 shadowThickness + half_shadowThickness;
2753 rect[num_rects].width = pixmapWidth - stringWidth +
2754 marginHeight - half_shadowThickness;
2755 rect[num_rects++].height = half_shadowThickness;
2758 rect[num_rects].x = x + highlightThickness + stringWidth +
2759 (2 * marginWidth) + shadowThickness;
2760 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2761 shadowThickness + half_shadowThickness;
2762 rect[num_rects].width = half_shadowThickness;
2763 rect[num_rects++].height = stringHeight +
2768 rect[num_rects].x = x + highlightThickness;
2769 rect[num_rects].y = y + highlightThickness + pixmapHeight +
2770 stringHeight + spacing + (2*marginHeight) + shadowThickness;
2771 if(stringWidth > pixmapWidth)
2772 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2773 shadowThickness + half_shadowThickness;
2775 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2776 shadowThickness + half_shadowThickness;
2777 rect[num_rects++].height = half_shadowThickness;
2780 rect[num_rects].x = x + highlightThickness;
2781 rect[num_rects].y = y + highlightThickness;
2782 rect[num_rects].width = half_shadowThickness;
2783 rect[num_rects++].height = pixmapHeight + stringHeight +
2784 spacing + (2 * marginHeight) + shadowThickness;
2786 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
2787 &rect[0], num_rects);
2791 rect[num_rects].x = x + highlightThickness +
2792 half_shadowThickness;
2793 rect[num_rects].y = y + highlightThickness +
2794 half_shadowThickness;
2795 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
2796 half_shadowThickness;
2797 rect[num_rects++].height = half_shadowThickness;
2799 if(stringWidth > pixmapWidth)
2802 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2803 shadowThickness + (2 * marginWidth) +
2804 half_shadowThickness;
2805 rect[num_rects].y = y + highlightThickness;
2806 rect[num_rects].width = half_shadowThickness;
2807 if(highlightThickness == 0)
2808 rect[num_rects++].height = pixmapHeight + marginHeight+
2809 shadowThickness + (spacing/2)
2810 + half_shadowThickness;
2812 rect[num_rects++].height = pixmapHeight + marginHeight+
2816 rect[num_rects].x = x + highlightThickness +
2818 pixmapWidth + (2 * marginWidth);
2819 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2820 shadowThickness + half_shadowThickness;
2821 rect[num_rects].width = stringWidth - pixmapWidth +
2822 marginWidth - shadowThickness;
2823 rect[num_rects++].height = half_shadowThickness;
2826 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
2827 shadowThickness + half_shadowThickness
2828 + highlightThickness;
2829 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2831 rect[num_rects].width = half_shadowThickness;
2832 if(highlightThickness == 0)
2833 rect[num_rects++].height = stringHeight +
2834 (2*marginHeight) + half_shadowThickness;
2836 rect[num_rects++].height = stringHeight +
2837 (2*marginHeight) + shadowThickness
2838 + half_shadowThickness;
2844 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2845 shadowThickness + (2 * marginWidth) +
2846 half_shadowThickness;
2847 rect[num_rects].y = y + highlightThickness;
2848 rect[num_rects].width = half_shadowThickness;
2849 rect[num_rects++].height = pixmapHeight + marginHeight +
2850 shadowThickness + (spacing/2)
2851 + half_shadowThickness;
2853 rect[num_rects].x = x + highlightThickness + stringWidth +
2854 (2 * marginWidth) + shadowThickness +
2855 half_shadowThickness;
2856 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2858 rect[num_rects].width = pixmapWidth - stringWidth +
2859 marginHeight - half_shadowThickness;
2860 rect[num_rects++].height = half_shadowThickness;
2863 rect[num_rects].x = x + highlightThickness + stringWidth +
2864 (2 * marginWidth) + shadowThickness +
2865 half_shadowThickness;
2866 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2868 rect[num_rects].width = half_shadowThickness;
2869 rect[num_rects++].height = stringHeight +
2870 (2*marginHeight) + half_shadowThickness;
2874 rect[num_rects].x = x + highlightThickness;
2875 rect[num_rects].y = y + highlightThickness + pixmapHeight +
2876 stringHeight + spacing + (2*marginHeight) +
2877 shadowThickness + half_shadowThickness;
2878 if(stringWidth > pixmapWidth)
2879 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2880 half_shadowThickness + shadowThickness;
2882 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2883 (2*shadowThickness);
2884 rect[num_rects++].height = half_shadowThickness;
2887 rect[num_rects].x = x + highlightThickness +
2888 half_shadowThickness;
2889 rect[num_rects].y = y + highlightThickness +
2890 half_shadowThickness;
2891 rect[num_rects].width = half_shadowThickness;
2892 rect[num_rects++].height = pixmapHeight + stringHeight +
2893 spacing + (2 * marginHeight) + half_shadowThickness;
2895 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
2896 &rect[0], num_rects);
2902 rect[num_rects].x = x + highlightThickness;
2903 rect[num_rects].y = y + highlightThickness;
2904 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
2905 (2 * marginWidth) + half_shadowThickness;
2906 rect[num_rects++].height = half_shadowThickness;
2909 rect[num_rects].x = x + highlightThickness +
2910 half_shadowThickness;
2911 rect[num_rects].y = y + highlightThickness +
2912 half_shadowThickness;
2913 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
2915 rect[num_rects++].height = half_shadowThickness;
2917 if(stringWidth > pixmapWidth)
2920 rect[num_rects].x = x + highlightThickness +
2922 pixmapWidth + (2 * marginWidth);
2923 rect[num_rects].y = y + highlightThickness +
2924 pixmapHeight + marginHeight +
2925 half_shadowThickness;
2926 rect[num_rects].width = stringWidth - pixmapWidth +
2927 marginWidth + half_shadowThickness;
2928 rect[num_rects++].height = half_shadowThickness;
2931 rect[num_rects].x = x + highlightThickness +
2933 pixmapWidth + (2 * marginWidth);
2934 rect[num_rects].y = y + highlightThickness +
2935 pixmapHeight + marginHeight
2937 rect[num_rects].width = stringWidth - pixmapWidth +
2939 rect[num_rects++].height = half_shadowThickness;
2943 rect[num_rects].x = x + highlightThickness;
2944 rect[num_rects].y = y + highlightThickness;
2945 rect[num_rects].width = half_shadowThickness;
2946 rect[num_rects++].height = pixmapHeight + stringHeight +
2947 spacing + (2 * marginHeight) + shadowThickness +
2948 half_shadowThickness;
2951 rect[num_rects].x = x + highlightThickness +
2952 half_shadowThickness;
2953 rect[num_rects].y = y + highlightThickness +
2954 half_shadowThickness;
2955 rect[num_rects].width = half_shadowThickness;
2956 rect[num_rects++].height = pixmapHeight + stringHeight +
2957 spacing + (2 * marginHeight) + half_shadowThickness;
2959 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
2960 &rect[0], num_rects);
2964 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2965 (2 * marginWidth) + shadowThickness;
2966 rect[num_rects].y = y + highlightThickness +
2967 half_shadowThickness;
2968 rect[num_rects].width = half_shadowThickness;
2969 if(stringWidth > pixmapWidth)
2971 if(highlightThickness == 0)
2972 rect[num_rects++].height = pixmapHeight + marginHeight
2975 rect[num_rects++].height = pixmapHeight + marginHeight
2980 if(highlightThickness == 0)
2981 rect[num_rects++].height = pixmapHeight + marginHeight
2982 + spacing/2 + half_shadowThickness + shadowThickness;
2984 rect[num_rects++].height = pixmapHeight + marginHeight
2985 + spacing/2 + half_shadowThickness;
2989 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2990 shadowThickness + (2 * marginWidth) + half_shadowThickness;
2991 rect[num_rects].y = y + highlightThickness;
2992 rect[num_rects].width = half_shadowThickness;
2993 if(stringWidth > pixmapWidth)
2995 if(highlightThickness == 0)
2996 rect[num_rects++].height = pixmapHeight + marginHeight +
2999 rect[num_rects++].height = pixmapHeight + marginHeight +
3000 half_shadowThickness;
3004 if(highlightThickness == 0)
3005 rect[num_rects++].height = pixmapHeight + marginHeight +
3006 shadowThickness + (spacing/2)
3007 + half_shadowThickness;
3009 rect[num_rects++].height = pixmapHeight + marginHeight +
3010 shadowThickness + shadowThickness;
3014 if(stringWidth > pixmapWidth)
3016 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
3017 + shadowThickness + highlightThickness;
3021 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3022 (2 * marginWidth) + shadowThickness;
3024 rect[num_rects].y = y + highlightThickness +
3025 pixmapHeight + 2*marginHeight +
3026 half_shadowThickness;
3027 rect[num_rects].width = half_shadowThickness;
3028 rect[num_rects++].height = stringHeight + highlightThickness +
3029 (2*marginHeight) + 2*shadowThickness;
3032 if(stringWidth > pixmapWidth)
3034 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
3035 shadowThickness + half_shadowThickness + highlightThickness;
3039 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3040 shadowThickness + (2 * marginWidth) + half_shadowThickness;
3042 rect[num_rects].y = y + highlightThickness +
3043 pixmapHeight + 2*marginHeight;
3044 rect[num_rects].width = half_shadowThickness;
3045 rect[num_rects++].height = stringHeight +
3046 highlightThickness +
3047 (2*marginHeight) + shadowThickness +
3048 half_shadowThickness;
3051 rect[num_rects].x = x + highlightThickness +
3052 half_shadowThickness;
3053 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3054 stringHeight + spacing + (2*marginHeight) + shadowThickness;
3055 if(stringWidth > pixmapWidth)
3056 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3059 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3061 rect[num_rects++].height = half_shadowThickness;
3063 rect[num_rects].x = x + highlightThickness;
3064 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3065 stringHeight + spacing + (2*marginHeight) +
3066 shadowThickness + half_shadowThickness;
3067 if(stringWidth > pixmapWidth)
3068 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3069 half_shadowThickness + shadowThickness;
3071 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3072 (2*shadowThickness);
3073 rect[num_rects++].height = half_shadowThickness;
3075 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3076 &rect[0], num_rects);
3080 else if (alignment == XmALIGNMENT_CENTER && type == DESKTOP)
3082 if(stringWidth > pixmapWidth)
3087 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3089 rect[num_rects].y = y + highlightThickness;
3090 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3091 (2 * marginWidth) + half_shadowThickness;
3092 rect[num_rects++].height = half_shadowThickness;
3095 rect[num_rects].x = x + highlightThickness +
3096 (Dimension)(stringWidth -pixmapWidth)/(Dimension)2 + half_shadowThickness;
3097 rect[num_rects].y = y + highlightThickness +
3098 half_shadowThickness;
3099 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3101 rect[num_rects++].height = half_shadowThickness;
3104 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3105 highlightThickness + shadowThickness +
3106 pixmapWidth + (2 * marginWidth);
3107 rect[num_rects].y = y + highlightThickness +
3108 pixmapHeight + marginHeight +
3109 half_shadowThickness;
3110 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3111 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2 +
3112 marginWidth + half_shadowThickness;
3113 rect[num_rects++].height = half_shadowThickness;
3116 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3117 highlightThickness + shadowThickness +
3118 pixmapWidth + (2 * marginWidth);
3119 rect[num_rects].y = y + highlightThickness +
3120 pixmapHeight + marginHeight
3122 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3123 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2 +
3125 rect[num_rects++].height = half_shadowThickness;
3128 rect[num_rects].x = x + highlightThickness;
3129 rect[num_rects].y = y + highlightThickness +
3130 pixmapHeight + 2*marginHeight +
3131 half_shadowThickness;
3132 rect[num_rects].width = half_shadowThickness;
3133 rect[num_rects++].height = stringHeight + highlightThickness +
3134 (2*marginHeight) + 2*shadowThickness;
3136 /* 6 */ rect[num_rects].x = x + highlightThickness +
3137 half_shadowThickness;
3138 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3140 rect[num_rects].width = half_shadowThickness;
3141 rect[num_rects++].height = stringHeight +
3142 highlightThickness +
3143 (2*marginHeight) + shadowThickness +
3144 half_shadowThickness;
3147 rect[num_rects].x = x + highlightThickness;
3148 rect[num_rects].y = y + highlightThickness +
3149 pixmapHeight + marginHeight +
3150 half_shadowThickness;
3151 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3152 half_shadowThickness;
3153 rect[num_rects++].height = half_shadowThickness;
3156 rect[num_rects].x = x + highlightThickness;
3157 rect[num_rects].y = y + highlightThickness +
3158 pixmapHeight + marginHeight +
3160 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3163 rect[num_rects++].height = half_shadowThickness;
3166 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3168 rect[num_rects].y = y + highlightThickness;
3169 rect[num_rects].width = half_shadowThickness;
3170 if(highlightThickness == 0)
3171 rect[num_rects++].height = pixmapHeight + marginHeight
3174 rect[num_rects++].height = pixmapHeight + marginHeight
3178 rect[num_rects].x = x + highlightThickness +
3179 (Dimension)(stringWidth -pixmapWidth)/(Dimension)2 + half_shadowThickness;
3180 rect[num_rects].y = y + highlightThickness +
3181 half_shadowThickness;
3182 rect[num_rects].width = half_shadowThickness;
3183 if(highlightThickness == 0)
3184 rect[num_rects++].height = pixmapHeight + marginHeight +
3187 rect[num_rects++].height = pixmapHeight + marginHeight +
3188 half_shadowThickness;
3190 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3191 &rect[0], num_rects);
3195 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3196 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3197 (2 * marginWidth) + shadowThickness;
3198 rect[num_rects].y = y + highlightThickness
3199 + half_shadowThickness;
3200 rect[num_rects].width = half_shadowThickness;
3201 if(highlightThickness == 0)
3202 rect[num_rects++].height = pixmapHeight + marginHeight
3205 rect[num_rects++].height = pixmapHeight + marginHeight
3209 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3210 shadowThickness + (2 * marginWidth) + half_shadowThickness +
3211 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
3212 rect[num_rects].y = y + highlightThickness;
3213 rect[num_rects].width = half_shadowThickness;
3214 if(highlightThickness == 0)
3215 rect[num_rects++].height = pixmapHeight + marginHeight +
3218 rect[num_rects++].height = pixmapHeight + marginHeight +
3219 half_shadowThickness;
3222 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
3223 + shadowThickness + highlightThickness;
3224 rect[num_rects].y = y + highlightThickness +
3225 pixmapHeight + 2*marginHeight +
3226 half_shadowThickness;
3227 rect[num_rects].width = half_shadowThickness;
3228 rect[num_rects++].height = stringHeight + highlightThickness +
3229 (2*marginHeight) + 2*shadowThickness;
3232 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
3233 shadowThickness + half_shadowThickness + highlightThickness;
3234 rect[num_rects].y = y + highlightThickness +
3235 pixmapHeight + 2*marginHeight;
3236 rect[num_rects].width = half_shadowThickness;
3237 rect[num_rects++].height = stringHeight +
3238 highlightThickness +
3239 (2*marginHeight) + shadowThickness +
3240 half_shadowThickness;
3243 rect[num_rects].x = x + highlightThickness +
3244 half_shadowThickness;
3245 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3246 stringHeight + spacing + (2*marginHeight) + shadowThickness;
3247 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3249 rect[num_rects++].height = half_shadowThickness;
3251 rect[num_rects].x = x + highlightThickness;
3252 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3253 stringHeight + spacing + (2*marginHeight) +
3254 shadowThickness + half_shadowThickness;
3255 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3256 half_shadowThickness + shadowThickness;
3257 rect[num_rects++].height = half_shadowThickness;
3259 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3260 &rect[0], num_rects);
3267 rect[num_rects].x = x + highlightThickness;
3268 rect[num_rects].y = y + highlightThickness;
3269 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3270 (2 * marginWidth) + half_shadowThickness;
3271 rect[num_rects++].height = half_shadowThickness;
3274 rect[num_rects].x = x + highlightThickness +
3275 half_shadowThickness;
3276 rect[num_rects].y = y + highlightThickness +
3277 half_shadowThickness;
3278 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3280 rect[num_rects++].height = half_shadowThickness;
3283 rect[num_rects].x = x + highlightThickness;
3284 rect[num_rects].y = y + highlightThickness;
3285 rect[num_rects].width = half_shadowThickness;
3286 rect[num_rects++].height = 2 * highlightThickness +
3287 pixmapHeight + stringHeight + 2 * marginWidth +
3291 rect[num_rects].x = x + highlightThickness +
3292 half_shadowThickness;
3293 rect[num_rects].y = y + highlightThickness +
3294 half_shadowThickness;
3295 rect[num_rects].width = half_shadowThickness;
3296 rect[num_rects++].height = 2 * highlightThickness +
3297 pixmapHeight + stringHeight +
3298 2 * marginWidth + spacing -
3299 half_shadowThickness;
3301 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3302 &rect[0], num_rects);
3306 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3307 (2 * marginWidth) + shadowThickness;
3308 rect[num_rects].y = y + highlightThickness
3309 + half_shadowThickness;
3310 rect[num_rects].width = half_shadowThickness;
3311 rect[num_rects++].height = 2 * highlightThickness +
3312 pixmapHeight + stringHeight + 2 * marginWidth +
3313 spacing - half_shadowThickness;
3316 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3317 shadowThickness + (2 * marginWidth) + half_shadowThickness;
3319 rect[num_rects].y = y + highlightThickness;
3320 rect[num_rects].width = half_shadowThickness;
3321 rect[num_rects++].height = 2 * highlightThickness +
3322 pixmapHeight + stringHeight +
3323 2 * marginWidth + spacing;
3326 rect[num_rects].x = x + highlightThickness +
3327 half_shadowThickness;
3328 rect[num_rects].y = y + 2 * highlightThickness +
3329 pixmapHeight + stringHeight + spacing +
3331 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3332 (2 * marginWidth) + half_shadowThickness;
3333 rect[num_rects++].height = half_shadowThickness;
3336 rect[num_rects].x = x + highlightThickness;
3337 rect[num_rects].y = y + 2 * highlightThickness +
3338 pixmapHeight + stringHeight + spacing +
3339 2 * marginHeight + half_shadowThickness;
3340 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3342 rect[num_rects++].height = half_shadowThickness;
3343 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3344 &rect[0], num_rects);
3348 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
3349 x + highlightThickness,
3350 y + highlightThickness,
3351 width - 2*highlightThickness,
3352 height - 2*highlightThickness,
3353 shadowThickness, XmSHADOW_IN);
3356 if(type == NOT_DESKTOP)
3358 if((Dimension)(stringHeight+5) >= (Dimension)pixmapHeight)
3362 rect[num_rects].x = x + highlightThickness;
3363 rect[num_rects].y = y + highlightThickness;
3364 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3365 shadowThickness + 2*marginWidth;
3366 rect[num_rects++].height = half_shadowThickness;
3369 rect[num_rects].x = x + pixmapWidth + stringWidth + spacing +
3370 shadowThickness + 2*marginWidth +
3372 rect[num_rects].y = y + highlightThickness;
3373 rect[num_rects].width = half_shadowThickness;
3374 rect[num_rects++].height = stringHeight + 2*marginHeight +
3375 shadowThickness + half_shadowThickness;
3378 rect[num_rects].x = x + highlightThickness;
3379 rect[num_rects].y = y + highlightThickness + stringHeight +
3380 2*marginHeight + shadowThickness;
3381 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3382 shadowThickness + 2*marginWidth;
3383 rect[num_rects++].height = half_shadowThickness;
3386 rect[num_rects].x = x + highlightThickness;
3387 rect[num_rects].y = y + highlightThickness;
3388 rect[num_rects].width = half_shadowThickness;
3389 rect[num_rects++].height = stringHeight + 2*marginHeight +
3390 shadowThickness + half_shadowThickness;
3392 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3393 &rect[0], num_rects);
3397 rect[num_rects].x = x + highlightThickness +
3398 half_shadowThickness;
3399 rect[num_rects].y = y + highlightThickness +
3400 half_shadowThickness;
3401 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3402 half_shadowThickness + 2*marginWidth;
3403 rect[num_rects++].height = half_shadowThickness;
3406 rect[num_rects].x = x + highlightThickness +
3407 half_shadowThickness + pixmapWidth +
3408 stringWidth + spacing + shadowThickness +
3410 rect[num_rects].y = y + highlightThickness;
3411 rect[num_rects].width = half_shadowThickness;
3412 rect[num_rects++].height = stringHeight + 2*marginHeight +
3416 rect[num_rects].x = x + highlightThickness;
3418 rect[num_rects].y = y + highlightThickness + stringHeight +
3419 2*marginHeight + shadowThickness +
3420 half_shadowThickness;
3421 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3422 2*shadowThickness + 2*marginWidth;
3423 rect[num_rects++].height = half_shadowThickness;
3426 rect[num_rects].x = x + highlightThickness +
3427 half_shadowThickness;
3428 rect[num_rects].y = y + highlightThickness +
3429 half_shadowThickness;
3430 rect[num_rects].width = half_shadowThickness;
3431 rect[num_rects++].height = stringHeight + 2*marginHeight +
3432 half_shadowThickness;
3434 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3435 &rect[0], num_rects);
3442 rect[num_rects].x = x + highlightThickness;
3443 rect[num_rects].y = y + highlightThickness;
3444 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3445 (2 * marginWidth) - half_shadowThickness;
3446 rect[num_rects++].height = half_shadowThickness;
3449 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3450 2*shadowThickness + 2*marginWidth -
3452 rect[num_rects].y = y + highlightThickness;
3453 rect[num_rects].width = half_shadowThickness;
3454 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3455 marginHeight - half_shadowThickness;
3458 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3459 2*shadowThickness + 2*marginWidth -
3461 rect[num_rects].y = y + highlightThickness +
3462 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3463 marginHeight -shadowThickness;
3464 rect[num_rects].width = stringWidth + marginWidth +
3466 rect[num_rects++].height = half_shadowThickness;
3469 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3470 2*shadowThickness + 3*marginWidth
3471 + stringWidth - half_shadowThickness;
3472 rect[num_rects].y = y + highlightThickness +
3473 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3474 half_shadowThickness;
3475 rect[num_rects].width = half_shadowThickness;
3476 rect[num_rects++].height = stringHeight + 2*marginHeight +
3477 half_shadowThickness;
3480 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3481 2*shadowThickness + 2*marginWidth -
3483 rect[num_rects].y = y + highlightThickness +
3484 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3485 stringHeight + 2*marginHeight +
3487 rect[num_rects].width = stringWidth + marginWidth +
3489 rect[num_rects++].height = half_shadowThickness;
3492 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3493 2*shadowThickness + 2*marginWidth -
3495 rect[num_rects].y = y + highlightThickness +
3496 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3497 stringHeight + 2*marginHeight +
3499 rect[num_rects].width = half_shadowThickness;
3500 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3504 rect[num_rects].x = x + highlightThickness;
3505 rect[num_rects].y = y + highlightThickness +
3506 pixmapHeight + 2*marginHeight + shadowThickness;
3507 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3508 (2 * marginWidth) - half_shadowThickness;
3509 rect[num_rects++].height = half_shadowThickness;
3512 rect[num_rects].x = x + highlightThickness;
3513 rect[num_rects].y = y + highlightThickness;
3514 rect[num_rects].width = half_shadowThickness;
3515 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3518 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3519 &rect[0], num_rects);
3523 rect[num_rects].x = x + highlightThickness +
3524 half_shadowThickness;
3525 rect[num_rects].y = y + highlightThickness +
3526 half_shadowThickness;
3527 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3528 half_shadowThickness;
3529 rect[num_rects++].height = half_shadowThickness;
3532 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3533 2*marginWidth + shadowThickness +
3534 half_shadowThickness;
3535 rect[num_rects].y = y + highlightThickness;
3536 rect[num_rects].width = half_shadowThickness;
3537 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3538 marginHeight - shadowThickness;
3541 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3542 2*marginWidth + shadowThickness;
3543 rect[num_rects].y = y + highlightThickness +
3544 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3545 half_shadowThickness;
3546 rect[num_rects].width = stringWidth + marginWidth +
3547 half_shadowThickness;
3548 rect[num_rects++].height = half_shadowThickness;
3551 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3552 3*marginWidth + 2*shadowThickness +
3554 rect[num_rects].y = y + highlightThickness +
3555 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2);
3557 rect[num_rects].width = half_shadowThickness;
3558 rect[num_rects++].height = stringHeight + 2*marginHeight +
3562 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3563 2*marginWidth + shadowThickness +
3564 half_shadowThickness;
3565 rect[num_rects].y = y + highlightThickness +
3566 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3567 2*marginHeight + shadowThickness +
3568 stringHeight + half_shadowThickness;
3569 rect[num_rects].width = stringWidth + marginWidth +
3571 rect[num_rects++].height = half_shadowThickness;
3574 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3575 2*marginWidth + shadowThickness +
3576 half_shadowThickness;
3577 rect[num_rects].y = y + highlightThickness +
3578 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3579 2*marginHeight + shadowThickness +
3580 stringHeight + half_shadowThickness;
3581 rect[num_rects].width = half_shadowThickness;
3582 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3585 rect[num_rects].x = x + highlightThickness;
3586 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3587 2*marginHeight + shadowThickness +
3588 half_shadowThickness;
3589 rect[num_rects].width = pixmapWidth + 2*marginWidth +
3591 rect[num_rects++].height = half_shadowThickness;
3594 rect[num_rects].x = x + highlightThickness +
3595 half_shadowThickness;
3596 rect[num_rects].y = y + highlightThickness +
3597 half_shadowThickness;
3598 rect[num_rects].width = half_shadowThickness;
3599 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3600 half_shadowThickness;
3602 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3603 &rect[0], num_rects);
3609 if((Dimension)(stringHeight+5) >= pixmapHeight)
3613 rect[num_rects].x = x + highlightThickness;
3614 rect[num_rects].y = y + highlightThickness;
3615 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3616 2*shadowThickness + 2*marginWidth;
3617 rect[num_rects++].height = half_shadowThickness;
3620 rect[num_rects].x = x + highlightThickness +
3621 half_shadowThickness;
3622 rect[num_rects].y = y + highlightThickness +
3623 half_shadowThickness;
3624 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3625 shadowThickness + 2*marginWidth;
3626 rect[num_rects++].height = half_shadowThickness;
3629 rect[num_rects].x = x + highlightThickness;
3630 rect[num_rects].y = y + highlightThickness;
3631 rect[num_rects].width = half_shadowThickness;
3632 if(pixmapHeight > stringHeight)
3633 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3636 rect[num_rects++].height = stringHeight + 2*marginHeight +
3640 rect[num_rects].x = x + highlightThickness +
3641 half_shadowThickness;
3642 rect[num_rects].y = y + highlightThickness +
3643 half_shadowThickness;
3644 rect[num_rects].width = half_shadowThickness;
3645 if(pixmapHeight > stringHeight)
3646 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3647 half_shadowThickness;
3649 rect[num_rects++].height = stringHeight + 2*marginHeight +
3650 half_shadowThickness;
3652 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3653 &rect[0], num_rects);
3657 rect[num_rects].x = x + pixmapWidth + stringWidth + spacing +
3658 shadowThickness + 2*marginWidth +
3660 rect[num_rects].y = y + highlightThickness +
3662 rect[num_rects].width = half_shadowThickness;
3663 if(pixmapHeight > stringHeight)
3664 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3667 rect[num_rects++].height = stringHeight + 2*marginHeight +
3671 rect[num_rects].x = x + highlightThickness +
3672 half_shadowThickness + pixmapWidth +
3673 stringWidth + spacing + shadowThickness +
3675 rect[num_rects].y = y + highlightThickness +
3676 half_shadowThickness;
3677 rect[num_rects].width = half_shadowThickness;
3678 if(pixmapHeight > stringHeight)
3679 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3682 rect[num_rects++].height = stringHeight + 2*marginHeight +
3686 rect[num_rects].x = x + highlightThickness +
3687 half_shadowThickness;
3688 if(pixmapHeight > stringHeight)
3689 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3690 2*marginHeight + shadowThickness;
3692 rect[num_rects].y = y + highlightThickness + stringHeight +
3693 2*marginHeight + shadowThickness;
3694 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3695 shadowThickness + 2*marginWidth -
3696 half_shadowThickness;
3697 rect[num_rects++].height = half_shadowThickness;
3700 rect[num_rects].x = x + highlightThickness;
3702 if(pixmapHeight > stringHeight)
3703 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3704 2*marginHeight + shadowThickness +
3705 half_shadowThickness;
3707 rect[num_rects].y = y + highlightThickness + stringHeight +
3708 2*marginHeight + shadowThickness +
3709 half_shadowThickness;
3710 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3711 2*shadowThickness + 2*marginWidth;
3712 rect[num_rects++].height = half_shadowThickness;
3714 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3715 &rect[0], num_rects);
3721 rect[num_rects].x = x + highlightThickness;
3722 rect[num_rects].y = y + highlightThickness;
3723 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3724 (2 * marginWidth) + half_shadowThickness;
3725 rect[num_rects++].height = half_shadowThickness;
3728 rect[num_rects].x = x + highlightThickness +
3729 half_shadowThickness;
3730 rect[num_rects].y = y + highlightThickness +
3731 half_shadowThickness;
3732 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3734 rect[num_rects++].height = half_shadowThickness;
3737 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3738 2*shadowThickness + 2*marginWidth -
3740 rect[num_rects].y = y + highlightThickness +
3741 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3742 marginHeight -shadowThickness;
3743 rect[num_rects].width = stringWidth + marginWidth +
3745 rect[num_rects++].height = half_shadowThickness;
3748 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3749 2*marginWidth + shadowThickness;
3750 rect[num_rects].y = y + highlightThickness +
3751 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3752 half_shadowThickness;
3753 rect[num_rects].width = stringWidth + marginWidth +
3754 half_shadowThickness;
3755 rect[num_rects++].height = half_shadowThickness;
3758 rect[num_rects].x = x + highlightThickness;
3759 rect[num_rects].y = y + highlightThickness;
3760 rect[num_rects].width = half_shadowThickness;
3761 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3765 rect[num_rects].x = x + highlightThickness +
3766 half_shadowThickness;
3767 rect[num_rects].y = y + highlightThickness +
3768 half_shadowThickness;
3769 rect[num_rects].width = half_shadowThickness;
3770 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3773 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3774 &rect[0], num_rects);
3778 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3779 2*shadowThickness + 2*marginWidth -
3781 rect[num_rects].y = y + highlightThickness + shadowThickness;
3782 rect[num_rects].width = half_shadowThickness;
3783 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3784 marginHeight - half_shadowThickness -
3788 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3789 2*marginWidth + shadowThickness +
3790 half_shadowThickness;
3791 rect[num_rects].y = y + highlightThickness +
3792 half_shadowThickness;
3793 rect[num_rects].width = half_shadowThickness;
3794 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3795 marginHeight - half_shadowThickness -
3799 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3800 2*shadowThickness + 3*marginWidth
3801 + stringWidth - half_shadowThickness;
3802 rect[num_rects].y = y + highlightThickness +
3803 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3804 half_shadowThickness;
3805 rect[num_rects].width = half_shadowThickness;
3806 rect[num_rects++].height = stringHeight + 2*marginHeight +
3807 half_shadowThickness;
3810 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3811 3*marginWidth + 2*shadowThickness +
3813 rect[num_rects].y = y + highlightThickness +
3814 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2);
3816 rect[num_rects].width = half_shadowThickness;
3817 rect[num_rects++].height = stringHeight + 2*marginHeight +
3821 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3822 2*shadowThickness + 2*marginWidth -
3824 rect[num_rects].y = y + highlightThickness +
3825 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3826 stringHeight + 2*marginHeight +
3828 rect[num_rects].width = stringWidth + marginWidth +
3830 rect[num_rects++].height = half_shadowThickness;
3833 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3834 2*marginWidth + shadowThickness +
3835 half_shadowThickness;
3836 rect[num_rects].y = y + highlightThickness +
3837 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3838 2*marginHeight + shadowThickness +
3839 stringHeight + half_shadowThickness;
3840 rect[num_rects].width = stringWidth + marginWidth +
3842 rect[num_rects++].height = half_shadowThickness;
3845 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3846 2*shadowThickness + 2*marginWidth -
3848 rect[num_rects].y = y + highlightThickness +
3849 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3850 stringHeight + 2*marginHeight +
3852 rect[num_rects].width = half_shadowThickness;
3853 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3857 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3858 2*marginWidth + shadowThickness +
3859 half_shadowThickness;
3860 rect[num_rects].y = y + highlightThickness +
3861 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3862 2*marginHeight + shadowThickness +
3863 stringHeight + half_shadowThickness;
3864 rect[num_rects].width = half_shadowThickness;
3865 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3869 rect[num_rects].x = x + highlightThickness + shadowThickness;
3870 rect[num_rects].y = y + highlightThickness +
3871 pixmapHeight + 2*marginHeight + shadowThickness;
3872 rect[num_rects].width = pixmapWidth + shadowThickness +
3873 (2 * marginWidth) - half_shadowThickness;
3874 rect[num_rects++].height = half_shadowThickness;
3877 rect[num_rects].x = x + highlightThickness +
3878 half_shadowThickness;
3879 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3880 2*marginHeight + shadowThickness +
3881 half_shadowThickness;
3882 rect[num_rects].width = pixmapWidth + 2*marginWidth +
3883 shadowThickness + half_shadowThickness;
3884 rect[num_rects++].height = half_shadowThickness;
3886 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3887 &rect[0], num_rects);
3891 case XmPIXMAP_BOTTOM:
3892 case XmPIXMAP_RIGHT:
3893 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
3894 x + highlightThickness,
3895 y + highlightThickness,
3896 width - 2*highlightThickness,
3897 height - 2*highlightThickness,
3898 shadowThickness, XmSHADOW_IN);
3907 FM_XmHighlightBorder(
3910 if( XmIsPrimitive( w) ) {
3911 (*(xmPrimitiveClassRec.primitive_class.border_highlight))( w) ;
3913 if( XmIsGadget( w) ) {
3914 (*(xmGadgetClassRec.gadget_class.border_highlight))( w) ;
3921 FM_XmUnhighlightBorder(
3924 if( XmIsPrimitive( w) )
3926 (*(xmPrimitiveClassRec.primitive_class.border_unhighlight))( w) ;
3929 { if( XmIsGadget( w) )
3931 (*(xmGadgetClassRec.gadget_class.border_unhighlight))( w) ;
3945 widget = XmObjectAtPoint (wid, x, y);
3947 if (!widget || !XtIsSensitive (widget))
3948 return ((XmGadget) NULL);
3950 return ((XmGadget) widget);