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 libraries 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 occurring
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 occurring 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 = NULL;
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 if (action_args && arg_count)
673 _DtFreeActionArgs( action_args, arg_count );
677 if(file_mgr_data) /* if not, then it is a desktop object */
678 FmPopup( NULL, (XtPointer)fileViewData,
679 (XEvent *)event, file_mgr_data );
683 && file_mgr_data->show_type != MULTIPLE_DIRECTORY )
687 child = XmGetFocusWidget(file_mgr_rec->file_window);
690 FileViewData * focusIcon = NULL;
691 FileViewData **order_list;
694 order_list = ((IconLayoutData *)file_mgr_data->layout_data)->order_list;
695 order_count = ((IconLayoutData *)file_mgr_data->layout_data)->order_count;
697 for (i = 0; i < order_count; ++i)
699 if (order_list[i]->filtered)
702 if( order_list[i]->widget == child
703 && !order_list[i]->need_update )
706 int y = order_list[i]->y;
708 focusIcon = order_list[i];
710 for( j = i+1; j < order_count; ++j )
712 if (order_list[j]->filtered)
715 if( order_list[j]->y == y )
716 focusIcon = order_list[j];
723 XmProcessTraversal( focusIcon->widget, XmTRAVERSE_CURRENT );
727 case osfXK_BeginLine:
729 && file_mgr_data->show_type != MULTIPLE_DIRECTORY )
733 child = XmGetFocusWidget(file_mgr_rec->file_window);
736 FileViewData * focusIcon = NULL;
737 FileViewData **order_list;
740 order_list = ((IconLayoutData *)file_mgr_data->layout_data)->order_list;
741 order_count = ((IconLayoutData *)file_mgr_data->layout_data)->order_count;
743 for (i = 0; i < order_count; ++i)
745 if (order_list[i]->filtered)
748 if( order_list[i]->widget == child
749 && !order_list[i]->need_update )
752 int y = order_list[i]->y;
754 focusIcon = order_list[i];
756 for( j = i-1; j >= 0; --j )
758 if (order_list[j]->filtered)
761 if( order_list[j]->y == y )
762 focusIcon = order_list[j];
769 XmProcessTraversal( focusIcon->widget, XmTRAVERSE_CURRENT );
776 if( VerticalScrollbarIsVisible(
777 file_mgr_rec->vertical_scroll_bar,
778 file_mgr_rec->scroll_window))
781 XtCallActionProc( file_mgr_rec->vertical_scroll_bar,
782 "PageUpOrLeft", new_event,&p, 1 );
789 if( VerticalScrollbarIsVisible(
790 file_mgr_rec->vertical_scroll_bar,
791 file_mgr_rec->scroll_window))
794 XtCallActionProc( file_mgr_rec->vertical_scroll_bar,
795 "PageDownOrRight", new_event, &p, 1 );
801 ProcessDTSelection(desktopRec, (XButtonEvent *)event);
803 ProcessSelection( file_mgr_data, eventIcon,
804 ((event->state & ControlMask) != 0),
805 (XButtonEvent *)event);
812 /* In file window - start region select */
813 /* There are no region selects for desktop icons */
814 ProcessBtnUp = False;
815 B1DragPossible = False;
818 if (desktopRec == NULL)
820 ProcessSelection(file_mgr_data, NULL,
821 ((event->state & ControlMask) != 0),
822 (XButtonEvent *)event);
826 else if(new_event->type == ButtonRelease || (new_event->type == KeyRelease &&
827 keybdFocusPolicy == XmEXPLICIT))
829 if(new_event->type == KeyRelease)
831 if (keysym != osfXK_Select)
834 event = (XButtonPressedEvent *)new_event;
838 event = (XButtonPressedEvent *)new_event;
839 if(event->button != Button1)
843 * When a button 1 up event is received, we will first see if the
844 * select occurred in the icon's title; if so, then we will post
845 * the rename text field. If the icon in which the button down
846 * occurred was not already selected, then all of the selection
847 * work was done at button 1 down time, so there is nothing left
848 * for us to do but return. However, if the icon was already
849 * selected, then we could not do any select processing at button
850 * down time, because the user may have been trying to initate
851 * a drag request; this can't be determined until either the drag
852 * threshold is surpassed, or the button up occurs.
854 if (((initialDragX >= 0) && (initialDragY >= 0)) &&
855 (eventIcon = (Widget) InputForGadget(w, initialDragX,
859 * If processing was postponed until the button up, then do it now.
861 B1DragPossible = False;
866 tmpEvent.xbutton = *event;
867 tmpEvent.xbutton.x = initialDragX;
868 tmpEvent.xbutton.y = initialDragY;
872 ProcessDTSelection(desktopRec, (XButtonEvent *)&tmpEvent);
876 ProcessSelection(file_mgr_data, eventIcon,
877 ((event->state & ControlMask) != 0),
878 (XButtonEvent *)&tmpEvent);
884 * If the select occurred in the title portion of the icon, then
885 * put up a text edit field, which can be used to change the name
886 * of the icon. The last field '0' means its not on the Desktop.
888 if (_DtIconSelectInTitle(eventIcon, (Position)initialDragX,
889 (Position)initialDragY) && ProcessBtnUpCD)
891 /* Map the icon into its fileViewData structure */
892 /* Check for desktop icon first */
895 for (i = 0; i<desktop_data->numIconsUsed; i++)
897 if (desktop_data->desktopWindows[i]->iconGadget == eventIcon)
900 desktop_data->desktopWindows[i]->file_view_data;
907 /* Not a desktop icon */
908 XtSetArg(args[0], XmNuserData, (XtPointer) &directoryData);
909 XtGetValues(eventIcon, args, 1);
910 for (i = 0; i < directoryData->file_count; i++)
912 if (directoryData->file_view_data[i]->widget == eventIcon &&
913 directoryData->file_view_data[i]->displayed)
915 fileViewData = directoryData->file_view_data[i];
923 CreateNameChangeDialog(eventIcon, fileViewData,
924 (XtPointer)desktopRec, DESKTOP);
926 else if( file_mgr_data->view != BY_NAME )
928 /* We don't allow users to rename when they are viewing a
929 directory in 'By Name Only' mode.
930 Because clicking on the label is the only way for them
931 to select a file. Popup a text widget to allow rename
932 would be very confusing
934 if( file_mgr_data->view != BY_ATTRIBUTES
935 || ( file_mgr_data->view == BY_ATTRIBUTES
936 && TurnOnTextName ) )
937 CreateNameChangeDialog(eventIcon, fileViewData,
938 (XtPointer)file_mgr_data, NOT_DESKTOP);
946 B1DragPossible = False;
947 B2DragPossible = False;
948 ProcessBtnUp = False;
950 ProcessBtnUpCD = True;
952 else if(new_event->type == KeyPress)
954 if (keysym == XK_Escape)
956 /* an escape unposts the name change text widget */
960 UnpostTextField(file_mgr_data);
968 * When a select operation terminates, we need to find the real button
969 * up event, so that we can get the correct (x,y) for where the select
979 if ((event->type == ButtonRelease) && (event->xbutton.button == Button1))
986 /************************************************************************
988 * GetSelectionRectangle
990 ************************************************************************/
993 GetSelectionRectangle(
997 FileMgrRec *file_mgr_rec,
998 FileMgrData *file_mgr_data,
999 Boolean toggleSelect)
1002 static GC draw_gc = 0;
1003 XGCValues gc_values;
1005 Region widget_region;
1006 Region intersect_region;
1007 Region redraw_region;
1009 static XRectangle return_rect;
1012 int virt_width, virt_height;
1019 int pixmap_x, pixmap_y, pixmap_x1, pixmap_y1;
1020 int directory_count;
1022 Window root, sub_win;
1026 XmManagerWidget file_window;
1027 Dimension current_file_window_width, sw_width;
1028 Dimension current_file_window_height, sw_height;
1029 Dimension file_window_width, file_window_height;
1030 Dimension max_width, max_height;
1031 Dimension min_width, min_height;
1034 int vb_slide_size = 0;
1036 int vb_pg_inc_ret = 0;
1038 int hb_slide_size = 0;
1040 int hb_pg_inc_ret = 0;
1041 Boolean vsbVisible = False;
1042 Boolean hsbVisible = False;
1043 DirectorySet ** directory_set;
1044 FileViewData *file_view_data;
1047 Dimension highlightThickness, shadowThickness;
1048 Dimension width, height;
1049 Dimension marginWidth, marginHeight;
1050 Dimension pixmapWidth, pixmapHeight;
1051 Dimension stringWidth, stringHeight;
1052 unsigned char pixmapPosition;
1053 unsigned char alignment;
1057 /* Get the horizontal and vertical scrollbars. */
1058 XtSetArg (args[0], XmNhorizontalScrollBar, &hb);
1059 XtSetArg (args[1], XmNverticalScrollBar, &vb);
1060 XtSetArg (args[2], XmNwidth, &sw_width);
1061 XtSetArg (args[3], XmNheight, &sw_height);
1062 XtGetValues (file_mgr_rec->scroll_window, args, 4);
1064 file_window = (XmManagerWidget)file_mgr_rec->file_window;
1065 XtSetArg (args[0], XmNwidth, &file_window_width);
1066 XtSetArg (args[1], XmNheight, &file_window_height);
1067 XtGetValues ((Widget)file_window, args, 2);
1068 file_window_width--;
1069 file_window_height--;
1071 if (VerticalScrollbarIsVisible(vb, file_mgr_rec->scroll_window))
1074 current_file_window_width = sw_width - vb->core.width - 12;
1078 current_file_window_width = sw_width - 9;
1081 if (HorizontalScrollbarIsVisible(hb, file_mgr_rec->scroll_window))
1084 current_file_window_height = sw_height - hb->core.height - 12;
1088 current_file_window_height = sw_height - 9;
1093 XmScrollBarGetValues(vb, &vb_val_ret, &vb_slide_size,
1094 &vb_inc_ret, &vb_pg_inc_ret);
1095 min_height = vb_val_ret;
1096 max_height = current_file_window_height + min_height;
1100 max_height = current_file_window_height;
1106 XmScrollBarGetValues(hb, &hb_val_ret, &hb_slide_size,
1107 &hb_inc_ret, &hb_pg_inc_ret);
1108 min_width = hb_val_ret;
1109 max_width = current_file_window_width + min_width;
1113 max_width = current_file_window_width;
1117 /* Get the gc to be used to draw the bounding rectangle */
1121 unsigned int white_pixel;
1123 screen = XDefaultScreenOfDisplay (display);
1124 gc_values.function = GXxor;
1126 white_pixel = WhitePixelOfScreen (screen);
1129 gc_values.foreground = white_pixel;
1130 gc_values.background = BlackPixelOfScreen (screen);
1134 gc_values.background = white_pixel;
1135 gc_values.foreground = BlackPixelOfScreen (screen);
1139 XCreateGC (display, window,
1140 GCForeground | GCBackground | GCFunction, &gc_values);
1143 widget_region = XCreateRegion();
1144 intersect_region = XCreateRegion();
1145 redraw_region = XCreateRegion();
1147 x1 = x2 = old_x = event->x;
1148 y1 = y2 = old_y = event->y;
1150 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1152 while (1) /* Set up a loop to catch the select up point. */
1154 XQueryPointer (display, window, &root, &sub_win,
1155 &win_x, &win_y, &x2, &y2, &mask);
1157 if ((mask & Button1Mask) == 0)
1159 /* Undraw the last rectangle we drew */
1162 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1165 * The real bound of the rectangle is contained in the button up
1166 * event; you can't use the pointer position, because if the system
1167 * is slow, then by the time we query the mouse, the button may have
1168 * been long ago release, and the pointer subsequently moved.
1170 if (XPeekIfEvent(display, &btnUpEvent,(Bool (*)())CheckForBtnUp, NULL))
1172 x2 = btnUpEvent.xbutton.x;
1173 y2 = btnUpEvent.xbutton.y;
1178 if( x2 < 0 ) x2 = 0;
1179 if( y2 < 0 ) y2 = 0;
1181 if ((x2 > old_x && !hsbVisible && (Dimension)old_x < file_window_width) ||
1182 (x2 > old_x && hsbVisible && (Dimension)(hb_val_ret +
1183 hb_slide_size) < (Dimension)(file_window_width + 1)) ||
1184 (x2 < old_x && !hsbVisible && old_x > 0) ||
1185 (x2 < old_x && hsbVisible && hb_val_ret >= 0) ||
1186 (y2 > old_y && !vsbVisible && (Dimension)old_y < file_window_height) ||
1187 (y2 > old_y && vsbVisible && (Dimension)(vb_val_ret +
1188 vb_slide_size) < (Dimension)(file_window_height + 1)) ||
1189 (y2 < old_y && !vsbVisible && old_y > 0) ||
1190 (y2 < old_y && vsbVisible && vb_val_ret >= 0))
1192 DrawRectangle (display, window, draw_gc, x1, y1, old_x, old_y);
1193 if((Dimension)x2 >= max_width)
1197 hb_val_ret += (x2 - max_width);
1198 if((Dimension)(hb_val_ret + hb_slide_size) <= (Dimension)(file_window_width + 1))
1200 XmScrollBarSetValues(hb, hb_val_ret, hb_slide_size,
1201 hb_inc_ret, hb_pg_inc_ret, True);
1202 min_width = (x2 - max_width) + min_width;
1204 XmUpdateDisplay ((Widget)file_window);
1206 else if((Dimension)(hb_val_ret + hb_slide_size) > (Dimension)(file_window_width + 1) &&
1207 (Dimension)(hb_val_ret - (x2 - max_width)) <
1208 (Dimension)(file_window_width - hb_slide_size))
1210 XmScrollBarSetValues(hb,
1211 file_window_width - hb_slide_size + 1,
1212 hb_slide_size, hb_inc_ret, hb_pg_inc_ret, True);
1213 temp = (file_window_width - hb_slide_size + 1) - hb_val_ret;
1214 hb_val_ret = file_window_width - hb_slide_size + 1;
1215 min_width = temp + min_width;
1216 max_width = temp + max_width;
1217 XmUpdateDisplay ((Widget)file_window);
1218 x2 = file_window_width;
1222 hb_val_ret = file_window_width - hb_slide_size + 1;
1223 x2 = max_width = file_window_width;
1224 min_width = max_width - current_file_window_width;
1231 if((Dimension)x2 > current_file_window_width)
1232 x2 = current_file_window_width;
1236 if((Dimension)x2 > file_window_width)
1237 x2 = file_window_width;
1241 else if((Dimension)x2 < min_width)
1247 hb_val_ret -= (min_width - x2);
1250 XmScrollBarSetValues(hb, hb_val_ret, hb_slide_size,
1251 hb_inc_ret, hb_pg_inc_ret, True);
1252 max_width = max_width - (min_width - x2);
1254 XmUpdateDisplay (file_mgr_rec->file_window);
1256 else if((hb_val_ret < 0) &&
1257 ((int)(hb_val_ret + (min_width - x2)) >= (int)0))
1259 XmScrollBarSetValues(hb, 0, hb_slide_size,
1260 hb_inc_ret, hb_pg_inc_ret, True);
1261 max_width = current_file_window_width;
1262 XmUpdateDisplay ((Widget)file_window);
1263 x2 = hb_val_ret = min_width = 0;
1267 hb_val_ret = min_width = x2 = 0;
1268 max_width = current_file_window_width;
1284 if((Dimension)y2 > max_height)
1288 vb_val_ret += (y2 - max_height);
1289 if((Dimension)(vb_val_ret + vb_slide_size) <= (Dimension)(file_window_height + 1))
1291 XmScrollBarSetValues(vb, vb_val_ret, vb_slide_size,
1292 vb_inc_ret, vb_pg_inc_ret, True);
1293 min_height = (y2 - max_height) + min_height;
1295 XmUpdateDisplay ((Widget)file_window);
1297 else if((Dimension)(vb_val_ret + vb_slide_size) > (Dimension)(file_window_height + 1) &&
1298 (Dimension)(vb_val_ret - (y2 - max_height)) <
1299 (Dimension)(file_window_height + 1 - vb_slide_size))
1301 XmScrollBarSetValues(vb,
1302 file_window_height + 1 - vb_slide_size,
1303 vb_slide_size, vb_inc_ret, vb_pg_inc_ret, True);
1304 temp = (file_window_height + 1 - vb_slide_size) - vb_val_ret;
1305 vb_val_ret = file_window_height + 1 - vb_slide_size;
1306 min_height = temp + min_height;
1307 max_height = temp + max_height;
1308 XmUpdateDisplay ((Widget)file_window);
1309 y2 = file_window_height;
1313 vb_val_ret = file_window_height + 1 - vb_slide_size;
1314 y2 = max_height = file_window_height;
1315 min_height = max_height - current_file_window_height;
1322 if((Dimension)y2 > current_file_window_height)
1323 y2 = current_file_window_height;
1327 if((Dimension)y2 > file_window_height)
1328 y2 = file_window_height;
1332 else if((Dimension)y2 < min_height)
1338 vb_val_ret -= (min_height - y2);
1341 XmScrollBarSetValues(vb, vb_val_ret, vb_slide_size,
1342 vb_inc_ret, vb_pg_inc_ret, True);
1343 max_height = max_height - (min_height - y2);
1345 XmUpdateDisplay (file_mgr_rec->file_window);
1347 else if(vb_val_ret < 0 &&
1348 ((int)(vb_val_ret + (min_height - y2)) >= (int)0))
1350 XmScrollBarSetValues(vb, 0, vb_slide_size,
1351 vb_inc_ret, vb_pg_inc_ret, True);
1352 max_height = current_file_window_height;
1353 XmUpdateDisplay ((Widget)file_window);
1354 y2 = vb_val_ret = min_height = 0;
1358 vb_val_ret = min_height = y2 = 0;
1359 max_height = current_file_window_height;
1396 virt_width = x4 - x3 + 1;
1397 virt_height = y4 - y3 + 1;
1400 return_rect.x = (short)virt_x;
1401 return_rect.y = (short)virt_y;
1402 return_rect.width = (unsigned short)virt_width;
1403 return_rect.height = (unsigned short)virt_height;
1404 region = XCreateRegion();
1405 XUnionRectWithRegion (&return_rect, region, region);
1407 /* Run through the gadget set to cause each icon within the */
1408 /* rectangle to be selected. */
1410 if (file_mgr_data->show_type == SINGLE_DIRECTORY)
1411 directory_count = 1;
1413 directory_count = file_mgr_data->directory_count;
1415 directory_set = file_mgr_data->directory_set;
1418 for (i = 0; i < directory_count; i++)
1420 for (j = 0; j < directory_set[i]->file_count; j++)
1424 file_view_data = directory_set[i]->order_list[j];
1426 if (!file_view_data->displayed || file_view_data->need_update)
1429 g = (DtIconGadget) file_view_data->widget;
1431 highlightThickness = g->gadget.highlight_thickness;
1432 shadowThickness = g->gadget.shadow_thickness;
1437 marginWidth = g->icon.cache->margin_width;
1438 marginHeight = g->icon.cache->margin_height;
1439 pixmapPosition = g->icon.cache->pixmap_position;
1440 alignment = g->icon.cache->alignment;
1442 pixmapWidth = g->icon.pixmap_width;
1443 pixmapHeight = g->icon.pixmap_height;
1444 stringWidth = g->icon.string_width;
1445 stringHeight = g->icon.cache->string_height;
1447 switch ((int) pixmapPosition)
1450 if (alignment == XmALIGNMENT_BEGINNING)
1451 pixmap_x = x + highlightThickness;
1452 else if(alignment == XmALIGNMENT_CENTER)
1454 if(stringWidth >= pixmapWidth)
1455 pixmap_x = x + highlightThickness +
1456 ((Dimension)(stringWidth - pixmapWidth)/(Dimension)2);
1458 pixmap_x = x + highlightThickness;
1462 fprintf(stderr, "GetSelectionRectangle: unsupported alignment %d , defaulting to Beginning\n", alignment);
1463 pixmap_x = x + highlightThickness;
1468 pixmap_x = x + highlightThickness;
1471 pixmap_y = y + pixmapHeight;
1472 pixmap_x = pixmap_x + pixmapWidth;
1474 pixmap_x1 = pixmap_x + pixmapWidth;
1475 pixmap_y1 = pixmap_y + pixmapHeight;
1478 if(XPointInRegion(region, pixmap_x, pixmap_y)
1480 && XPointInRegion(region, pixmap_x1, pixmap_y1)
1484 if (toggleSelect == True &&
1485 FileIsSelected (file_mgr_data, file_view_data))
1486 DeselectFile (file_mgr_data, file_view_data, True);
1489 if(!FileIsSelected (file_mgr_data, file_view_data))
1490 SelectFile (file_mgr_data, file_view_data);
1493 else if (FileIsSelected (file_mgr_data, file_view_data))
1494 DeselectFile (file_mgr_data, file_view_data, True);
1497 DrawRectangle (display, window, draw_gc, x1, y1, x2, y2);
1498 XDestroyRegion (region);
1502 XDestroyRegion (widget_region);
1503 XDestroyRegion (intersect_region);
1504 XDestroyRegion (redraw_region);
1511 /************************************************************************
1514 * DrawRectangle takes two points as input and draws a rectangle with
1515 * a line width and height of 1 around the rectangle generated
1516 * by the two points. The rectangle is drawn XOR so that it
1519 ************************************************************************/
1534 unsigned int height;
1558 XDrawRectangle (display, window, gc, x, y, width, height);
1560 if (width > 2 && height > 2)
1561 XDrawRectangle (display, window, gc, x + 1, y + 1, width - 2, height - 2);
1566 * Given a widget, create a region describing the area occupied by the
1567 * widget; it may be a simple rectangle, or a compound region composed
1568 * of two rectangles (the pixmap and the label).
1572 WidgetRectToRegion (
1573 FileMgrData * file_mgr_data,
1577 XRectangle widget_rect;
1578 XRectangle pRect, lRect;
1579 unsigned char flags;
1580 static Region temp_region = NULL;
1582 /* Empty the region */
1583 if (temp_region == NULL)
1584 temp_region = XCreateRegion();
1585 XSubtractRegion(temp_region, temp_region, region);
1590 /* Tree mode and attribute views do not support compound icons */
1591 if ((file_mgr_data->show_type != SINGLE_DIRECTORY) ||
1592 (file_mgr_data->view == BY_ATTRIBUTES))
1594 widget_rect.x = (short)w->core.x;
1595 widget_rect.y = (short)w->core.y;
1596 widget_rect.width = (unsigned short)w->core.width;
1597 widget_rect.height = (unsigned short)w->core.height;
1599 XUnionRectWithRegion(&widget_rect, region, region);
1603 _DtIconGetIconRects((DtIconGadget)w, &flags, &pRect, &lRect);
1605 if (flags & XmPIXMAP_RECT)
1606 XUnionRectWithRegion(&pRect, region, region);
1608 if (flags & XmLABEL_RECT)
1609 XUnionRectWithRegion(&lRect, region, region);
1616 FileMgrData * file_mgr_data,
1618 Boolean toggleSelect,
1619 XButtonEvent * event)
1621 XRectangle * selection_rect;
1622 XRectangle widget_rect;
1623 DirectorySet ** directory_set;
1624 int directory_count;
1627 Region widget_region;
1628 Region intersect_region;
1629 Region redraw_region;
1630 FileMgrRec * file_mgr_rec;
1631 FileViewData * file_view_data;
1633 file_mgr_rec = (FileMgrRec *)file_mgr_data->file_mgr_rec;
1635 /* User is starting a new selection; clear all old ones */
1638 DeselectAllFiles (file_mgr_data);
1639 file_mgr_data->selected_file_count = 0;
1641 XFlush (XtDisplay (file_mgr_rec->file_window));
1642 XmUpdateDisplay (file_mgr_rec->file_window);
1645 /* Get the rectangle to be used as the selection area */
1646 if (icon == NULL && event->type == ButtonPress)
1648 /* User is starting a region select */
1649 GetSelectionRectangle (XtDisplay(file_mgr_rec->file_window),
1650 (Window) XtWindow(file_mgr_rec->file_window),
1651 event, file_mgr_rec, file_mgr_data,
1656 /* User did a single select either through keyboard or mouse */
1657 if(event->type == KeyPress)
1659 widget_rect.x = (short)icon->core.x;
1660 widget_rect.y = (short)icon->core.y;
1661 widget_rect.width = (short)icon->core.width;
1662 widget_rect.height = (short)icon->core.height;
1666 widget_rect.x = (short)event->x;
1667 widget_rect.y = (short)event->y;
1668 widget_rect.width = 1;
1669 widget_rect.height = 1;
1671 selection_rect = &widget_rect;
1673 region = XCreateRegion();
1674 widget_region = XCreateRegion();
1675 intersect_region = XCreateRegion();
1676 redraw_region = XCreateRegion();
1678 XUnionRectWithRegion (selection_rect, region, region);
1681 /* Run through the gadget set to cause each icon within the */
1682 /* rectangle to be selected. */
1684 if (file_mgr_data->show_type == SINGLE_DIRECTORY)
1687 directory_count = 1;
1691 directory_count = file_mgr_data->directory_count;
1695 directory_set = file_mgr_data->directory_set;
1698 for (; i < directory_count; i++)
1700 if (PositioningEnabledInView(file_mgr_data))
1702 ObjectPtr top = GetTopOfStack(file_mgr_data);
1703 int next_position = 0;
1706 * Stacking order requires us to handle this specially. Objects
1707 * must be searched in top to bottom order when determining if
1708 * they are in the selection rectangle, but they must be drawn
1709 * bottom to top, to guarantee that the visuals are correct.
1712 /* Find set of selected objects */
1715 if(top->file_view_data == NULL)
1721 if (!top->file_view_data->displayed)
1727 WidgetRectToRegion(file_mgr_data, top->file_view_data->widget,
1729 XIntersectRegion(region, widget_region, intersect_region);
1731 if (!XEmptyRegion(intersect_region))
1734 FileIsSelected (file_mgr_data, top->file_view_data))
1736 DeselectFile(file_mgr_data, top->file_view_data, True);
1738 XUnionRegion(widget_region, redraw_region, redraw_region);
1743 * We don't want to change the icon yet, because we
1744 * need to do it in bottom to top order.
1747 RepositionUpInStack(file_mgr_data, top->stacking_order,
1751 /* Higher item 'cover' lower ones */
1752 XSubtractRegion(region, widget_region, region);
1758 /* Now, select any newly selected files */
1759 if (next_position > 0)
1761 /* Find where to start the redraw from */
1762 top = GetTopOfStack(file_mgr_data);
1763 while (next_position - 1 > 0)
1771 if(top->file_view_data != NULL)
1772 SelectFile(file_mgr_data, top->file_view_data);
1777 if (!XEmptyRegion(redraw_region))
1778 RepaintDesktop(file_mgr_data, NULL, redraw_region);
1780 RegisterDesktopHotspots(file_mgr_data, file_mgr_rec);
1785 for (j = 0; j < directory_set[i]->file_count; j++)
1787 file_view_data = directory_set[i]->order_list[j];
1789 if (!file_view_data->displayed)
1792 WidgetRectToRegion(file_mgr_data, file_view_data->widget,
1794 XIntersectRegion (region, widget_region, intersect_region);
1796 if (!XEmptyRegion (intersect_region))
1798 if (toggleSelect == True &&
1799 FileIsSelected (file_mgr_data, file_view_data))
1800 DeselectFile (file_mgr_data, file_view_data, True);
1803 SelectFile (file_mgr_data, file_view_data);
1804 if(file_mgr_data->view == BY_ATTRIBUTES)
1807 * Need to determine whether the click was in the
1810 XRectangle textExtent;
1812 XmFontList fontList;
1813 XmString fileNameString;
1814 DtIconGadget g = (DtIconGadget)file_view_data->widget;
1816 _DtIconGetTextExtent_r(file_view_data->widget,
1819 XtVaGetValues( file_view_data->widget,
1824 fileNameString = XmStringCreateLocalized( file_view_data->file_data->file_name );
1825 textExtent.width = XmStringWidth( fontList, fileNameString );
1826 XmStringFree( fileNameString );
1828 (unsigned short)file_view_data->widget->core.height;
1830 textExtent.x = (short)file_view_data->widget->core.x
1831 + g->icon.pixmap_width
1832 + g->icon.cache->margin_width
1833 + g->icon.cache->spacing;
1835 textExtent.y = (short)file_view_data->widget->core.y;
1837 tmp_region = XCreateRegion();
1838 XUnionRectWithRegion (&textExtent,
1839 tmp_region, tmp_region);
1841 XSubtractRegion (widget_region, tmp_region, tmp_region);
1843 XIntersectRegion (region, tmp_region, intersect_region);
1844 if (XEmptyRegion (intersect_region))
1845 TurnOnTextName = True;
1847 TurnOnTextName = False;
1848 XDestroyRegion (tmp_region);
1856 XDestroyRegion (region);
1857 XDestroyRegion (widget_region);
1858 XDestroyRegion (intersect_region);
1859 XDestroyRegion (redraw_region);
1863 if(file_mgr_data != trashFileMgrData)
1865 if (file_mgr_data->selected_file_count == 0)
1866 ActivateNoSelect (file_mgr_rec);
1867 else if (file_mgr_data->selected_file_count == 1)
1869 ActivateSingleSelect (file_mgr_rec,
1870 file_mgr_data->selection_list[0]->file_data->logical_type);
1873 ActivateMultipleSelect (file_mgr_rec);
1876 SensitizeTrashBtns();
1878 ProcessBtnUp = False;
1885 FileViewData *file_view_data,
1886 FileMgrData *file_mgr_data,
1889 int n, num_rectangles;
1891 Dimension highlightThickness, shadowThickness;
1892 Dimension half_shadowThickness;
1893 Dimension marginWidth, marginHeight;
1894 Dimension pixmapWidth, pixmapHeight;
1895 Dimension stringWidth, stringHeight;
1897 XRectangle rect[10];
1898 unsigned char pixmapPosition;
1899 unsigned char alignment;
1900 Position adj_x, adj_y;
1903 DtIconGadget g = (DtIconGadget)w;
1906 gc = ((XmManagerWidget)(g->object.parent))->manager.highlight_GC;
1911 DrawShadowTh(w, gc, DESKTOP);
1916 /* in in as placed mode need to cycle the icons so the traversal
1917 box doesn't chop up the icons */
1918 if(type == NOT_DESKTOP && file_view_data != NULL)
1920 if (PositioningEnabledInView(file_mgr_data))
1922 top = GetTopOfStack(file_mgr_data);
1923 if(top != NULL && top->file_view_data != file_view_data)
1925 ObjectPtr savetop, next, prev;
1929 while(top != NULL && top->file_view_data != file_view_data)
1941 top->next = savetop;
1942 top->stacking_order = 1;
1943 savetop->prev = top;
1945 for(i = 2; top->prev != NULL; i++)
1947 top->stacking_order = i;
1948 if(top->next == NULL)
1953 RedrawOneGadget(w, NULL, NULL);
1960 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
1961 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
1962 XtSetArg (args[n], XmNx, &x); n++;
1963 XtSetArg (args[n], XmNy, &y); n++;
1964 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
1965 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
1966 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
1967 XtSetArg (args[n], XmNalignment, &alignment); n++;
1968 XtGetValues (w, args, n);
1970 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
1971 pixmapWidth = g->icon.pixmap_width;
1972 pixmapHeight = g->icon.pixmap_height;
1973 stringWidth = g->icon.string_width;
1974 stringHeight = g->icon.cache->string_height;
1976 adj_x = shadowThickness + highlightThickness + marginWidth;
1977 adj_y = shadowThickness + highlightThickness + marginHeight;
1979 if(shadowThickness != 0)
1980 half_shadowThickness = shadowThickness/2;
1982 half_shadowThickness = 0;
1985 switch ((int) pixmapPosition)
1988 if (alignment == XmALIGNMENT_BEGINNING)
1991 rect[num_rectangles].x = x;
1992 rect[num_rectangles].y = y;
1993 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
1994 rect[num_rectangles++].height = highlightThickness;
1996 if(stringWidth > pixmapWidth)
1999 rect[num_rectangles].x = x + pixmapWidth +
2000 (2 * adj_x) - highlightThickness;
2001 rect[num_rectangles].y = y;
2002 rect[num_rectangles].width = highlightThickness;
2003 rect[num_rectangles++].height = pixmapHeight + spacing;
2006 rect[num_rectangles].x = x + pixmapWidth +
2007 (2 * adj_x) - highlightThickness;
2008 rect[num_rectangles].y = y + pixmapHeight + spacing;
2009 rect[num_rectangles].width = stringWidth -
2010 pixmapWidth + highlightThickness;
2011 rect[num_rectangles++].height = highlightThickness;
2014 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2015 - highlightThickness;
2016 rect[num_rectangles].y = y + pixmapHeight + spacing;
2017 rect[num_rectangles].width = highlightThickness;
2018 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2023 rect[num_rectangles].x = x + pixmapWidth +
2024 (2 * adj_x) - highlightThickness;
2025 rect[num_rectangles].y = y;
2026 rect[num_rectangles].width = highlightThickness;
2027 rect[num_rectangles++].height = pixmapHeight + (2 * adj_y) -
2031 rect[num_rectangles].x = x + stringWidth +
2032 (2 * adj_x) - highlightThickness;
2033 rect[num_rectangles].y = y + pixmapHeight + (2 * adj_y) -
2035 rect[num_rectangles].width = pixmapWidth -
2036 stringWidth + highlightThickness;
2037 rect[num_rectangles++].height = highlightThickness;
2041 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2042 - highlightThickness;
2043 rect[num_rectangles].y = y + pixmapHeight + (2 * adj_y) -
2045 rect[num_rectangles].width = highlightThickness;
2046 rect[num_rectangles++].height = spacing + stringHeight +
2051 rect[num_rectangles].x = x;
2052 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2053 spacing + (2 * adj_y) - highlightThickness;
2054 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2055 rect[num_rectangles++].height = highlightThickness;
2058 rect[num_rectangles].x = x;
2059 rect[num_rectangles].y = y;
2060 rect[num_rectangles].width = highlightThickness;
2061 rect[num_rectangles++].height = pixmapHeight +
2062 stringHeight + spacing + (2 * adj_y);
2065 else if (alignment == XmALIGNMENT_CENTER)
2067 if(stringWidth > pixmapWidth)
2070 rect[num_rectangles].x = x
2071 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
2072 rect[num_rectangles].y = y;
2073 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
2074 rect[num_rectangles++].height = highlightThickness;
2077 rect[num_rectangles].x = x
2078 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2081 - highlightThickness;
2082 rect[num_rectangles].y = y;
2083 rect[num_rectangles].width = highlightThickness;
2084 rect[num_rectangles++].height = pixmapHeight + spacing;
2087 rect[num_rectangles].x = x
2088 + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2091 - highlightThickness;
2092 rect[num_rectangles].y = y + pixmapHeight + spacing;
2093 rect[num_rectangles].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2094 + (Dimension)(stringWidth - pixmapWidth)%(Dimension)2;
2095 rect[num_rectangles++].height = highlightThickness;
2098 rect[num_rectangles].x = x + stringWidth + (2 * adj_x)
2099 - highlightThickness;
2100 rect[num_rectangles].y = y + pixmapHeight + spacing;
2101 rect[num_rectangles].width = highlightThickness;
2102 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2105 rect[num_rectangles].x = x;
2106 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2107 spacing + (2 * adj_y) - highlightThickness;
2108 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2109 rect[num_rectangles++].height = highlightThickness;
2112 rect[num_rectangles].x = x;
2113 rect[num_rectangles].y = y + pixmapHeight + spacing;
2114 rect[num_rectangles].width = highlightThickness;
2115 rect[num_rectangles++].height = stringHeight + (2 * adj_y);
2118 rect[num_rectangles].x = x;
2119 rect[num_rectangles].y = y + pixmapHeight + spacing;
2120 rect[num_rectangles].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2
2121 + highlightThickness;
2122 rect[num_rectangles++].height = highlightThickness;
2125 rect[num_rectangles].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
2126 rect[num_rectangles].y = y;
2127 rect[num_rectangles].width = highlightThickness;
2128 rect[num_rectangles++].height = pixmapHeight + spacing;
2133 rect[num_rectangles].x = x;
2134 rect[num_rectangles].y = y;
2135 rect[num_rectangles].width = pixmapWidth + (2 * adj_x);
2136 rect[num_rectangles++].height = highlightThickness;
2139 rect[num_rectangles].x = x + pixmapWidth + (2 * adj_x) -
2141 rect[num_rectangles].y = y;
2142 rect[num_rectangles].width = highlightThickness;
2143 rect[num_rectangles++].height = pixmapHeight + spacing +
2144 2 * highlightThickness;
2147 rect[num_rectangles].x = x + pixmapWidth + adj_x -
2148 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness;
2149 rect[num_rectangles].y = y + pixmapHeight + spacing +
2150 highlightThickness + 1;
2151 rect[num_rectangles].width = (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2153 rect[num_rectangles++].height = highlightThickness;
2156 rect[num_rectangles].x = x + stringWidth + adj_x +
2157 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness;
2158 rect[num_rectangles].y = y + pixmapHeight + spacing
2159 + highlightThickness + 1;
2160 rect[num_rectangles].width = highlightThickness;
2161 rect[num_rectangles++].height = stringHeight + (2 * adj_y)
2162 - highlightThickness - 1;
2165 rect[num_rectangles].x = x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2;
2166 rect[num_rectangles].y = y + pixmapHeight + stringHeight +
2167 spacing + (2 * adj_y) - highlightThickness;
2168 rect[num_rectangles].width = stringWidth + (2 * adj_y);
2169 rect[num_rectangles++].height = highlightThickness;
2172 rect[num_rectangles].x = x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2;
2173 rect[num_rectangles].y = y + pixmapHeight + spacing +
2174 highlightThickness + 1;
2175 rect[num_rectangles].width = highlightThickness;
2176 rect[num_rectangles++].height = stringHeight + (2 * adj_y)
2177 - highlightThickness - 1;
2180 rect[num_rectangles].x = x;
2181 rect[num_rectangles].y = y + pixmapHeight + spacing +
2182 highlightThickness + 1;
2183 rect[num_rectangles].width = (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2185 rect[num_rectangles++].height = highlightThickness;
2188 rect[num_rectangles].x = x;
2189 rect[num_rectangles].y = y;
2190 rect[num_rectangles].width = highlightThickness;
2191 rect[num_rectangles++].height = pixmapHeight + spacing +
2192 2 * highlightThickness;
2196 FM_XmHighlightBorder ((Widget)w);
2199 if((Dimension)(stringHeight + 4) >= pixmapHeight)
2200 FM_XmHighlightBorder ((Widget)w);
2204 rect[num_rectangles].x = x;
2205 rect[num_rectangles].y = y;
2206 rect[num_rectangles].width = adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2207 rect[num_rectangles++].height = highlightThickness;
2210 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2211 rect[num_rectangles].y = y;
2212 rect[num_rectangles].width = highlightThickness;
2213 rect[num_rectangles++].height = (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2216 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2217 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2218 rect[num_rectangles].width = spacing/2 + stringWidth + adj_x;
2219 rect[num_rectangles++].height = highlightThickness;
2222 rect[num_rectangles].x = x + adj_x + pixmapWidth + spacing +
2223 stringWidth + adj_x - highlightThickness;
2224 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2225 rect[num_rectangles].width = highlightThickness;
2226 rect[num_rectangles++].height = stringHeight + 2*adj_y;
2229 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2230 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2231 stringHeight + 2*adj_y - highlightThickness;
2232 rect[num_rectangles].width = spacing/2 + stringWidth + adj_x;
2233 rect[num_rectangles++].height = highlightThickness;
2236 rect[num_rectangles].x = x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2237 rect[num_rectangles].y = y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2238 stringHeight + 2*adj_y;
2239 rect[num_rectangles].width = highlightThickness;
2240 rect[num_rectangles++].height = pixmapHeight - stringHeight -
2241 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2;
2244 rect[num_rectangles].x = x;
2245 rect[num_rectangles].y = y + pixmapHeight + 2*adj_y -
2247 rect[num_rectangles].width = adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2;
2248 rect[num_rectangles++].height = highlightThickness;
2251 rect[num_rectangles].x = x;
2252 rect[num_rectangles].y = y;
2253 rect[num_rectangles].width = highlightThickness;
2254 rect[num_rectangles++].height = pixmapHeight + 2*adj_y;
2257 case XmPIXMAP_BOTTOM:
2258 case XmPIXMAP_RIGHT:
2259 FM_XmHighlightBorder ((Widget)w);
2265 XFillRectangles (XtDisplay (w), XtWindow (w), gc, &rect[0], num_rectangles);
2275 Dimension highlightThickness, shadowThickness;
2276 Dimension half_shadowThickness;
2277 Dimension marginWidth, marginHeight;
2278 Dimension pixmapWidth, pixmapHeight;
2279 Dimension stringWidth, stringHeight;
2281 unsigned char pixmapPosition;
2282 unsigned char alignment;
2283 Position adj_x, adj_y;
2285 DtIconGadget g = (DtIconGadget)w;
2291 DrawShadowTh(w, NULL, DESKTOP);
2297 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
2298 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
2299 XtSetArg (args[n], XmNx, &x); n++;
2300 XtSetArg (args[n], XmNy, &y); n++;
2301 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
2302 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
2303 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
2304 XtSetArg (args[n], XmNalignment, &alignment); n++;
2305 XtGetValues (w, args, n);
2307 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
2308 pixmapWidth = g->icon.pixmap_width;
2309 pixmapHeight = g->icon.pixmap_height;
2310 stringWidth = g->icon.string_width;
2311 stringHeight = g->icon.cache->string_height;
2313 adj_x = shadowThickness + highlightThickness + marginWidth;
2314 adj_y = shadowThickness + highlightThickness + marginHeight;
2316 if(shadowThickness != 0)
2317 half_shadowThickness = shadowThickness/2;
2319 half_shadowThickness = 0;
2321 switch ((int) pixmapPosition)
2324 if (alignment == XmALIGNMENT_BEGINNING)
2327 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2328 pixmapWidth + (2 * adj_x), highlightThickness, False);
2330 if(stringWidth > pixmapWidth)
2333 XClearArea (XtDisplay (w), XtWindow (w),
2334 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2335 y, highlightThickness,
2336 pixmapHeight + spacing,
2340 XClearArea (XtDisplay (w), XtWindow (w),
2341 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2342 y + pixmapHeight + spacing,
2343 stringWidth - pixmapWidth + highlightThickness,
2348 XClearArea (XtDisplay (w), XtWindow (w),
2349 x + stringWidth + (2 * adj_x) - highlightThickness,
2350 y + pixmapHeight + spacing,
2352 stringHeight + (2 * adj_y),
2358 XClearArea (XtDisplay (w), XtWindow (w),
2359 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2360 y, highlightThickness,
2361 pixmapHeight + (2 * adj_y) - half_shadowThickness,
2365 XClearArea (XtDisplay (w), XtWindow (w),
2366 x + stringWidth + (2 * adj_x) - highlightThickness,
2367 y + pixmapHeight + (2 * adj_y) - highlightThickness,
2368 pixmapWidth - stringWidth + highlightThickness,
2373 XClearArea (XtDisplay (w), XtWindow (w),
2374 x + stringWidth + (2 * adj_x) - highlightThickness,
2375 y + pixmapHeight + (2 * adj_y) -
2376 half_shadowThickness,
2378 spacing + stringHeight + highlightThickness,
2383 XClearArea (XtDisplay (w), XtWindow (w), x,
2384 y + pixmapHeight + stringHeight +
2385 spacing + (2 * adj_y) - highlightThickness,
2386 stringWidth + (2 * adj_y),
2391 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2393 pixmapHeight + stringHeight + spacing + (2 * adj_y),
2397 else if (alignment == XmALIGNMENT_CENTER)
2399 if(stringWidth > pixmapWidth)
2402 XClearArea (XtDisplay (w), XtWindow (w),
2403 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2, y,
2404 pixmapWidth + (2 * adj_x),
2409 XClearArea (XtDisplay (w), XtWindow (w),
2410 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + pixmapWidth +
2411 (2 * adj_x) - highlightThickness,
2412 y, highlightThickness, pixmapHeight + spacing,
2416 XClearArea (XtDisplay (w), XtWindow (w),
2417 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + pixmapWidth +
2418 (2 * adj_x) - highlightThickness,
2419 y + pixmapHeight + spacing,
2420 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
2421 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2,
2426 XClearArea (XtDisplay (w), XtWindow (w),
2427 x + stringWidth + (2 * adj_x) - highlightThickness,
2428 y + pixmapHeight + spacing, highlightThickness,
2429 stringHeight + (2 * adj_y),
2433 XClearArea (XtDisplay (w), XtWindow (w), x,
2434 y + pixmapHeight + stringHeight +
2435 spacing + (2 * adj_y) - highlightThickness,
2436 stringWidth + (2 * adj_y), highlightThickness,
2440 XClearArea (XtDisplay (w), XtWindow (w), x,
2441 y + pixmapHeight + spacing, highlightThickness,
2442 stringHeight + (2 * adj_y),
2446 XClearArea (XtDisplay (w), XtWindow (w), x,
2447 y + pixmapHeight + spacing,
2448 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 + highlightThickness,
2453 XClearArea (XtDisplay (w), XtWindow (w),
2454 x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2,
2455 y, highlightThickness, pixmapHeight + spacing,
2461 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2462 pixmapWidth + (2 * adj_x), highlightThickness,
2466 XClearArea (XtDisplay (w), XtWindow (w),
2467 x + pixmapWidth + (2 * adj_x) - highlightThickness,
2468 y, highlightThickness,
2469 pixmapHeight + spacing + 2 * highlightThickness,
2473 XClearArea (XtDisplay (w), XtWindow (w),
2474 x + pixmapWidth + adj_x + highlightThickness -
2475 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2476 y + pixmapHeight + spacing + highlightThickness + 1,
2477 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness,
2482 XClearArea (XtDisplay (w), XtWindow (w),
2483 x + stringWidth + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 +
2484 adj_x + highlightThickness,
2485 y + pixmapHeight + spacing + highlightThickness + 1,
2487 stringHeight + (2 * adj_y) - highlightThickness -1,
2491 XClearArea (XtDisplay (w), XtWindow (w),
2492 x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2493 y + pixmapHeight + stringHeight +
2494 spacing + (2 * adj_y) - highlightThickness,
2495 stringWidth + (2 * adj_y),
2500 XClearArea (XtDisplay (w), XtWindow (w),
2501 x + (Dimension)(pixmapWidth - stringWidth)/(Dimension)2,
2502 y + pixmapHeight + spacing + highlightThickness + 1,
2504 stringHeight + (2 * adj_y) - highlightThickness - 1,
2508 XClearArea (XtDisplay (w), XtWindow (w), x,
2509 y + pixmapHeight + spacing + highlightThickness + 1,
2510 (Dimension)(pixmapWidth - stringWidth)/(Dimension)2 + highlightThickness,
2515 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2517 pixmapHeight + spacing + 2 * highlightThickness,
2523 FM_XmUnhighlightBorder ((Widget)w);
2526 if((Dimension)(stringHeight + 4) >= pixmapHeight)
2527 FM_XmUnhighlightBorder ((Widget)w);
2531 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2532 adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2537 XClearArea (XtDisplay (w), XtWindow (w),
2538 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2541 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2545 XClearArea (XtDisplay (w), XtWindow (w),
2546 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2547 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2548 spacing/2 + stringWidth + adj_x,
2553 XClearArea (XtDisplay (w), XtWindow (w),
2554 x + adj_x + pixmapWidth + spacing +
2555 stringWidth + adj_x - highlightThickness,
2556 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2558 stringHeight + 2*adj_y,
2562 XClearArea (XtDisplay (w), XtWindow (w),
2563 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2564 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2565 stringHeight + 2*adj_y - highlightThickness,
2566 spacing/2 + stringWidth + adj_x,
2571 XClearArea (XtDisplay (w), XtWindow (w),
2572 x + adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2573 y + (Dimension)(pixmapHeight - stringHeight)/(Dimension)2 +
2574 stringHeight + 2*adj_y,
2576 pixmapHeight - stringHeight -
2577 (Dimension)(pixmapHeight - stringHeight)/(Dimension)2,
2581 XClearArea (XtDisplay (w), XtWindow (w), x,
2582 y + pixmapHeight + 2*adj_y - highlightThickness,
2583 adj_x + pixmapWidth + (Dimension)(spacing+1)/(Dimension)2,
2588 XClearArea (XtDisplay (w), XtWindow (w), x, y,
2590 pixmapHeight + 2*adj_y,
2594 case XmPIXMAP_BOTTOM:
2595 case XmPIXMAP_RIGHT:
2596 FM_XmUnhighlightBorder ((Widget)w);
2610 Dimension highlightThickness, shadowThickness;
2611 Dimension width, height;
2612 Dimension marginWidth, marginHeight;
2613 Dimension pixmapWidth, pixmapHeight;
2614 Dimension stringWidth, stringHeight;
2616 unsigned char pixmapPosition;
2617 unsigned char alignment;
2618 unsigned char shadowType;
2619 GC top_gc, bottom_gc ;
2621 XRectangle rect[10];
2622 DtIconGadget g = (DtIconGadget)w;
2623 XmManagerWidget mgr = (XmManagerWidget)XtParent(w);
2624 Boolean s_out = False,
2630 XtSetArg (args[n], XmNhighlightThickness, &highlightThickness); n++;
2631 XtSetArg (args[n], XmNshadowThickness, &shadowThickness); n++;
2632 XtSetArg (args[n], XmNx, &x); n++;
2633 XtSetArg (args[n], XmNy, &y); n++;
2634 XtSetArg (args[n], XmNwidth, &width); n++;
2635 XtSetArg (args[n], XmNheight, &height); n++;
2636 XtSetArg (args[n], XmNmarginWidth, &marginWidth); n++;
2637 XtSetArg (args[n], XmNmarginHeight, &marginHeight); n++;
2638 XtSetArg (args[n], XmNpixmapPosition, &pixmapPosition); n++;
2639 XtSetArg (args[n], XmNalignment, &alignment); n++;
2640 XtSetArg (args[n], XmNshadowType, &shadowType); n++;
2641 XtGetValues (w, args, n);
2643 spacing = (((DtIconGadget)(g)) -> icon.cache -> spacing);
2644 pixmapWidth = g->icon.pixmap_width;
2645 pixmapHeight = g->icon.pixmap_height;
2646 stringWidth = g->icon.string_width;
2647 stringHeight = g->icon.cache->string_height;
2649 /* Get shadow attributes.
2651 s_out = (shadowType == XmSHADOW_OUT || shadowType == XmSHADOW_ETCHED_OUT)
2653 s_etched = (shadowType == XmSHADOW_ETCHED_IN ||
2654 shadowType == XmSHADOW_ETCHED_OUT)
2659 if(shadowType == XmSHADOW_ETCHED_OUT)
2662 ? mgr->manager.top_shadow_GC : mgr->manager.bottom_shadow_GC;
2664 ? mgr->manager.bottom_shadow_GC : mgr->manager.top_shadow_GC;
2669 ? mgr->manager.top_shadow_GC : mgr->manager.bottom_shadow_GC;
2671 ? mgr->manager.bottom_shadow_GC : mgr->manager.top_shadow_GC;
2675 top_gc = bottom_gc = gc;
2681 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
2682 x + highlightThickness,
2683 y + highlightThickness,
2684 width - 2*highlightThickness,
2685 height - 2*highlightThickness,
2686 shadowThickness, XmSHADOW_IN);
2690 int half_shadowThickness;
2693 if (shadowThickness <= 0) return;
2694 if (shadowThickness > (Dimension)(width / 2)) shadowThickness = width / 2;
2695 if (shadowThickness > (Dimension)(height / 2)) shadowThickness = height / 2;
2696 if (shadowThickness <= 0) return;
2698 shadowThickness = (shadowThickness % 2) ?
2699 (shadowThickness-1) : (shadowThickness);
2701 half_shadowThickness = shadowThickness / 2;
2702 switch ((int) pixmapPosition)
2705 if (alignment == XmALIGNMENT_BEGINNING)
2707 if(type == NOT_DESKTOP)
2711 rect[num_rects].x = x + highlightThickness;
2712 rect[num_rects].y = y + highlightThickness;
2713 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
2714 (2 * marginWidth) - half_shadowThickness;
2715 rect[num_rects++].height = half_shadowThickness;
2718 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2719 (2 * marginWidth) + shadowThickness;
2720 rect[num_rects].y = y + highlightThickness;
2721 rect[num_rects].width = half_shadowThickness;
2722 rect[num_rects++].height = pixmapHeight + marginHeight +
2723 spacing/2 + shadowThickness +
2724 half_shadowThickness;
2726 if(stringWidth > pixmapWidth)
2729 rect[num_rects].x = x + highlightThickness +
2731 pixmapWidth + (2 * marginWidth);
2732 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2734 rect[num_rects].width = stringWidth - pixmapWidth +
2735 marginWidth - half_shadowThickness;
2736 rect[num_rects++].height = half_shadowThickness;
2739 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
2740 + shadowThickness + highlightThickness;
2741 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2743 rect[num_rects].width = half_shadowThickness;
2744 rect[num_rects++].height = stringHeight +
2745 (2*marginHeight) + half_shadowThickness;
2750 rect[num_rects].x = x + highlightThickness + stringWidth +
2751 (2 * marginWidth) + shadowThickness;
2752 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2753 shadowThickness + half_shadowThickness;
2754 rect[num_rects].width = pixmapWidth - stringWidth +
2755 marginHeight - half_shadowThickness;
2756 rect[num_rects++].height = half_shadowThickness;
2759 rect[num_rects].x = x + highlightThickness + stringWidth +
2760 (2 * marginWidth) + shadowThickness;
2761 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2762 shadowThickness + half_shadowThickness;
2763 rect[num_rects].width = half_shadowThickness;
2764 rect[num_rects++].height = stringHeight +
2769 rect[num_rects].x = x + highlightThickness;
2770 rect[num_rects].y = y + highlightThickness + pixmapHeight +
2771 stringHeight + spacing + (2*marginHeight) + shadowThickness;
2772 if(stringWidth > pixmapWidth)
2773 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2774 shadowThickness + half_shadowThickness;
2776 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2777 shadowThickness + half_shadowThickness;
2778 rect[num_rects++].height = half_shadowThickness;
2781 rect[num_rects].x = x + highlightThickness;
2782 rect[num_rects].y = y + highlightThickness;
2783 rect[num_rects].width = half_shadowThickness;
2784 rect[num_rects++].height = pixmapHeight + stringHeight +
2785 spacing + (2 * marginHeight) + shadowThickness;
2787 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
2788 &rect[0], num_rects);
2792 rect[num_rects].x = x + highlightThickness +
2793 half_shadowThickness;
2794 rect[num_rects].y = y + highlightThickness +
2795 half_shadowThickness;
2796 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
2797 half_shadowThickness;
2798 rect[num_rects++].height = half_shadowThickness;
2800 if(stringWidth > pixmapWidth)
2803 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2804 shadowThickness + (2 * marginWidth) +
2805 half_shadowThickness;
2806 rect[num_rects].y = y + highlightThickness;
2807 rect[num_rects].width = half_shadowThickness;
2808 if(highlightThickness == 0)
2809 rect[num_rects++].height = pixmapHeight + marginHeight+
2810 shadowThickness + (spacing/2)
2811 + half_shadowThickness;
2813 rect[num_rects++].height = pixmapHeight + marginHeight+
2817 rect[num_rects].x = x + highlightThickness +
2819 pixmapWidth + (2 * marginWidth);
2820 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2821 shadowThickness + half_shadowThickness;
2822 rect[num_rects].width = stringWidth - pixmapWidth +
2823 marginWidth - shadowThickness;
2824 rect[num_rects++].height = half_shadowThickness;
2827 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
2828 shadowThickness + half_shadowThickness
2829 + highlightThickness;
2830 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2832 rect[num_rects].width = half_shadowThickness;
2833 if(highlightThickness == 0)
2834 rect[num_rects++].height = stringHeight +
2835 (2*marginHeight) + half_shadowThickness;
2837 rect[num_rects++].height = stringHeight +
2838 (2*marginHeight) + shadowThickness
2839 + half_shadowThickness;
2845 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2846 shadowThickness + (2 * marginWidth) +
2847 half_shadowThickness;
2848 rect[num_rects].y = y + highlightThickness;
2849 rect[num_rects].width = half_shadowThickness;
2850 rect[num_rects++].height = pixmapHeight + marginHeight +
2851 shadowThickness + (spacing/2)
2852 + half_shadowThickness;
2854 rect[num_rects].x = x + highlightThickness + stringWidth +
2855 (2 * marginWidth) + shadowThickness +
2856 half_shadowThickness;
2857 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2859 rect[num_rects].width = pixmapWidth - stringWidth +
2860 marginHeight - half_shadowThickness;
2861 rect[num_rects++].height = half_shadowThickness;
2864 rect[num_rects].x = x + highlightThickness + stringWidth +
2865 (2 * marginWidth) + shadowThickness +
2866 half_shadowThickness;
2867 rect[num_rects].y = y + pixmapHeight + 2*marginHeight +
2869 rect[num_rects].width = half_shadowThickness;
2870 rect[num_rects++].height = stringHeight +
2871 (2*marginHeight) + half_shadowThickness;
2875 rect[num_rects].x = x + highlightThickness;
2876 rect[num_rects].y = y + highlightThickness + pixmapHeight +
2877 stringHeight + spacing + (2*marginHeight) +
2878 shadowThickness + half_shadowThickness;
2879 if(stringWidth > pixmapWidth)
2880 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2881 half_shadowThickness + shadowThickness;
2883 rect[num_rects].width = stringWidth + (2 * marginWidth) +
2884 (2*shadowThickness);
2885 rect[num_rects++].height = half_shadowThickness;
2888 rect[num_rects].x = x + highlightThickness +
2889 half_shadowThickness;
2890 rect[num_rects].y = y + highlightThickness +
2891 half_shadowThickness;
2892 rect[num_rects].width = half_shadowThickness;
2893 rect[num_rects++].height = pixmapHeight + stringHeight +
2894 spacing + (2 * marginHeight) + half_shadowThickness;
2896 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
2897 &rect[0], num_rects);
2903 rect[num_rects].x = x + highlightThickness;
2904 rect[num_rects].y = y + highlightThickness;
2905 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
2906 (2 * marginWidth) + half_shadowThickness;
2907 rect[num_rects++].height = half_shadowThickness;
2910 rect[num_rects].x = x + highlightThickness +
2911 half_shadowThickness;
2912 rect[num_rects].y = y + highlightThickness +
2913 half_shadowThickness;
2914 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
2916 rect[num_rects++].height = half_shadowThickness;
2918 if(stringWidth > pixmapWidth)
2921 rect[num_rects].x = x + highlightThickness +
2923 pixmapWidth + (2 * marginWidth);
2924 rect[num_rects].y = y + highlightThickness +
2925 pixmapHeight + marginHeight +
2926 half_shadowThickness;
2927 rect[num_rects].width = stringWidth - pixmapWidth +
2928 marginWidth + half_shadowThickness;
2929 rect[num_rects++].height = half_shadowThickness;
2932 rect[num_rects].x = x + highlightThickness +
2934 pixmapWidth + (2 * marginWidth);
2935 rect[num_rects].y = y + highlightThickness +
2936 pixmapHeight + marginHeight
2938 rect[num_rects].width = stringWidth - pixmapWidth +
2940 rect[num_rects++].height = half_shadowThickness;
2944 rect[num_rects].x = x + highlightThickness;
2945 rect[num_rects].y = y + highlightThickness;
2946 rect[num_rects].width = half_shadowThickness;
2947 rect[num_rects++].height = pixmapHeight + stringHeight +
2948 spacing + (2 * marginHeight) + shadowThickness +
2949 half_shadowThickness;
2952 rect[num_rects].x = x + highlightThickness +
2953 half_shadowThickness;
2954 rect[num_rects].y = y + highlightThickness +
2955 half_shadowThickness;
2956 rect[num_rects].width = half_shadowThickness;
2957 rect[num_rects++].height = pixmapHeight + stringHeight +
2958 spacing + (2 * marginHeight) + half_shadowThickness;
2960 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
2961 &rect[0], num_rects);
2965 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2966 (2 * marginWidth) + shadowThickness;
2967 rect[num_rects].y = y + highlightThickness +
2968 half_shadowThickness;
2969 rect[num_rects].width = half_shadowThickness;
2970 if(stringWidth > pixmapWidth)
2972 if(highlightThickness == 0)
2973 rect[num_rects++].height = pixmapHeight + marginHeight
2976 rect[num_rects++].height = pixmapHeight + marginHeight
2981 if(highlightThickness == 0)
2982 rect[num_rects++].height = pixmapHeight + marginHeight
2983 + spacing/2 + half_shadowThickness + shadowThickness;
2985 rect[num_rects++].height = pixmapHeight + marginHeight
2986 + spacing/2 + half_shadowThickness;
2990 rect[num_rects].x = x + highlightThickness + pixmapWidth +
2991 shadowThickness + (2 * marginWidth) + half_shadowThickness;
2992 rect[num_rects].y = y + highlightThickness;
2993 rect[num_rects].width = half_shadowThickness;
2994 if(stringWidth > pixmapWidth)
2996 if(highlightThickness == 0)
2997 rect[num_rects++].height = pixmapHeight + marginHeight +
3000 rect[num_rects++].height = pixmapHeight + marginHeight +
3001 half_shadowThickness;
3005 if(highlightThickness == 0)
3006 rect[num_rects++].height = pixmapHeight + marginHeight +
3007 shadowThickness + (spacing/2)
3008 + half_shadowThickness;
3010 rect[num_rects++].height = pixmapHeight + marginHeight +
3011 shadowThickness + shadowThickness;
3015 if(stringWidth > pixmapWidth)
3017 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
3018 + shadowThickness + highlightThickness;
3022 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3023 (2 * marginWidth) + shadowThickness;
3025 rect[num_rects].y = y + highlightThickness +
3026 pixmapHeight + 2*marginHeight +
3027 half_shadowThickness;
3028 rect[num_rects].width = half_shadowThickness;
3029 rect[num_rects++].height = stringHeight + highlightThickness +
3030 (2*marginHeight) + 2*shadowThickness;
3033 if(stringWidth > pixmapWidth)
3035 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
3036 shadowThickness + half_shadowThickness + highlightThickness;
3040 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3041 shadowThickness + (2 * marginWidth) + half_shadowThickness;
3043 rect[num_rects].y = y + highlightThickness +
3044 pixmapHeight + 2*marginHeight;
3045 rect[num_rects].width = half_shadowThickness;
3046 rect[num_rects++].height = stringHeight +
3047 highlightThickness +
3048 (2*marginHeight) + shadowThickness +
3049 half_shadowThickness;
3052 rect[num_rects].x = x + highlightThickness +
3053 half_shadowThickness;
3054 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3055 stringHeight + spacing + (2*marginHeight) + shadowThickness;
3056 if(stringWidth > pixmapWidth)
3057 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3060 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3062 rect[num_rects++].height = half_shadowThickness;
3064 rect[num_rects].x = x + highlightThickness;
3065 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3066 stringHeight + spacing + (2*marginHeight) +
3067 shadowThickness + half_shadowThickness;
3068 if(stringWidth > pixmapWidth)
3069 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3070 half_shadowThickness + shadowThickness;
3072 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3073 (2*shadowThickness);
3074 rect[num_rects++].height = half_shadowThickness;
3076 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3077 &rect[0], num_rects);
3081 else if (alignment == XmALIGNMENT_CENTER && type == DESKTOP)
3083 if(stringWidth > pixmapWidth)
3088 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3090 rect[num_rects].y = y + highlightThickness;
3091 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3092 (2 * marginWidth) + half_shadowThickness;
3093 rect[num_rects++].height = half_shadowThickness;
3096 rect[num_rects].x = x + highlightThickness +
3097 (Dimension)(stringWidth -pixmapWidth)/(Dimension)2 + half_shadowThickness;
3098 rect[num_rects].y = y + highlightThickness +
3099 half_shadowThickness;
3100 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3102 rect[num_rects++].height = half_shadowThickness;
3105 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3106 highlightThickness + shadowThickness +
3107 pixmapWidth + (2 * marginWidth);
3108 rect[num_rects].y = y + highlightThickness +
3109 pixmapHeight + marginHeight +
3110 half_shadowThickness;
3111 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3112 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2 +
3113 marginWidth + half_shadowThickness;
3114 rect[num_rects++].height = half_shadowThickness;
3117 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3118 highlightThickness + shadowThickness +
3119 pixmapWidth + (2 * marginWidth);
3120 rect[num_rects].y = y + highlightThickness +
3121 pixmapHeight + marginHeight
3123 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3124 (Dimension)(stringWidth - pixmapWidth)%(Dimension)2 +
3126 rect[num_rects++].height = half_shadowThickness;
3129 rect[num_rects].x = x + highlightThickness;
3130 rect[num_rects].y = y + highlightThickness +
3131 pixmapHeight + 2*marginHeight +
3132 half_shadowThickness;
3133 rect[num_rects].width = half_shadowThickness;
3134 rect[num_rects++].height = stringHeight + highlightThickness +
3135 (2*marginHeight) + 2*shadowThickness;
3137 /* 6 */ rect[num_rects].x = x + highlightThickness +
3138 half_shadowThickness;
3139 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3141 rect[num_rects].width = half_shadowThickness;
3142 rect[num_rects++].height = stringHeight +
3143 highlightThickness +
3144 (2*marginHeight) + shadowThickness +
3145 half_shadowThickness;
3148 rect[num_rects].x = x + highlightThickness;
3149 rect[num_rects].y = y + highlightThickness +
3150 pixmapHeight + marginHeight +
3151 half_shadowThickness;
3152 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3153 half_shadowThickness;
3154 rect[num_rects++].height = half_shadowThickness;
3157 rect[num_rects].x = x + highlightThickness;
3158 rect[num_rects].y = y + highlightThickness +
3159 pixmapHeight + marginHeight +
3161 rect[num_rects].width = (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3164 rect[num_rects++].height = half_shadowThickness;
3167 rect[num_rects].x = x + (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3169 rect[num_rects].y = y + highlightThickness;
3170 rect[num_rects].width = half_shadowThickness;
3171 if(highlightThickness == 0)
3172 rect[num_rects++].height = pixmapHeight + marginHeight
3175 rect[num_rects++].height = pixmapHeight + marginHeight
3179 rect[num_rects].x = x + highlightThickness +
3180 (Dimension)(stringWidth -pixmapWidth)/(Dimension)2 + half_shadowThickness;
3181 rect[num_rects].y = y + highlightThickness +
3182 half_shadowThickness;
3183 rect[num_rects].width = half_shadowThickness;
3184 if(highlightThickness == 0)
3185 rect[num_rects++].height = pixmapHeight + marginHeight +
3188 rect[num_rects++].height = pixmapHeight + marginHeight +
3189 half_shadowThickness;
3191 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3192 &rect[0], num_rects);
3196 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3197 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2 +
3198 (2 * marginWidth) + shadowThickness;
3199 rect[num_rects].y = y + highlightThickness
3200 + half_shadowThickness;
3201 rect[num_rects].width = half_shadowThickness;
3202 if(highlightThickness == 0)
3203 rect[num_rects++].height = pixmapHeight + marginHeight
3206 rect[num_rects++].height = pixmapHeight + marginHeight
3210 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3211 shadowThickness + (2 * marginWidth) + half_shadowThickness +
3212 (Dimension)(stringWidth - pixmapWidth)/(Dimension)2;
3213 rect[num_rects].y = y + highlightThickness;
3214 rect[num_rects].width = half_shadowThickness;
3215 if(highlightThickness == 0)
3216 rect[num_rects++].height = pixmapHeight + marginHeight +
3219 rect[num_rects++].height = pixmapHeight + marginHeight +
3220 half_shadowThickness;
3223 rect[num_rects].x = x + stringWidth + (2 * marginWidth)
3224 + shadowThickness + highlightThickness;
3225 rect[num_rects].y = y + highlightThickness +
3226 pixmapHeight + 2*marginHeight +
3227 half_shadowThickness;
3228 rect[num_rects].width = half_shadowThickness;
3229 rect[num_rects++].height = stringHeight + highlightThickness +
3230 (2*marginHeight) + 2*shadowThickness;
3233 rect[num_rects].x = x + stringWidth + (2 * marginWidth) +
3234 shadowThickness + half_shadowThickness + highlightThickness;
3235 rect[num_rects].y = y + highlightThickness +
3236 pixmapHeight + 2*marginHeight;
3237 rect[num_rects].width = half_shadowThickness;
3238 rect[num_rects++].height = stringHeight +
3239 highlightThickness +
3240 (2*marginHeight) + shadowThickness +
3241 half_shadowThickness;
3244 rect[num_rects].x = x + highlightThickness +
3245 half_shadowThickness;
3246 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3247 stringHeight + spacing + (2*marginHeight) + shadowThickness;
3248 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3250 rect[num_rects++].height = half_shadowThickness;
3252 rect[num_rects].x = x + highlightThickness;
3253 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3254 stringHeight + spacing + (2*marginHeight) +
3255 shadowThickness + half_shadowThickness;
3256 rect[num_rects].width = stringWidth + (2 * marginWidth) +
3257 half_shadowThickness + shadowThickness;
3258 rect[num_rects++].height = half_shadowThickness;
3260 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3261 &rect[0], num_rects);
3268 rect[num_rects].x = x + highlightThickness;
3269 rect[num_rects].y = y + highlightThickness;
3270 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3271 (2 * marginWidth) + half_shadowThickness;
3272 rect[num_rects++].height = half_shadowThickness;
3275 rect[num_rects].x = x + highlightThickness +
3276 half_shadowThickness;
3277 rect[num_rects].y = y + highlightThickness +
3278 half_shadowThickness;
3279 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3281 rect[num_rects++].height = half_shadowThickness;
3284 rect[num_rects].x = x + highlightThickness;
3285 rect[num_rects].y = y + highlightThickness;
3286 rect[num_rects].width = half_shadowThickness;
3287 rect[num_rects++].height = 2 * highlightThickness +
3288 pixmapHeight + stringHeight + 2 * marginWidth +
3292 rect[num_rects].x = x + highlightThickness +
3293 half_shadowThickness;
3294 rect[num_rects].y = y + highlightThickness +
3295 half_shadowThickness;
3296 rect[num_rects].width = half_shadowThickness;
3297 rect[num_rects++].height = 2 * highlightThickness +
3298 pixmapHeight + stringHeight +
3299 2 * marginWidth + spacing -
3300 half_shadowThickness;
3302 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3303 &rect[0], num_rects);
3307 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3308 (2 * marginWidth) + shadowThickness;
3309 rect[num_rects].y = y + highlightThickness
3310 + half_shadowThickness;
3311 rect[num_rects].width = half_shadowThickness;
3312 rect[num_rects++].height = 2 * highlightThickness +
3313 pixmapHeight + stringHeight + 2 * marginWidth +
3314 spacing - half_shadowThickness;
3317 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3318 shadowThickness + (2 * marginWidth) + half_shadowThickness;
3320 rect[num_rects].y = y + highlightThickness;
3321 rect[num_rects].width = half_shadowThickness;
3322 rect[num_rects++].height = 2 * highlightThickness +
3323 pixmapHeight + stringHeight +
3324 2 * marginWidth + spacing;
3327 rect[num_rects].x = x + highlightThickness +
3328 half_shadowThickness;
3329 rect[num_rects].y = y + 2 * highlightThickness +
3330 pixmapHeight + stringHeight + spacing +
3332 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3333 (2 * marginWidth) + half_shadowThickness;
3334 rect[num_rects++].height = half_shadowThickness;
3337 rect[num_rects].x = x + highlightThickness;
3338 rect[num_rects].y = y + 2 * highlightThickness +
3339 pixmapHeight + stringHeight + spacing +
3340 2 * marginHeight + half_shadowThickness;
3341 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3343 rect[num_rects++].height = half_shadowThickness;
3344 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3345 &rect[0], num_rects);
3349 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
3350 x + highlightThickness,
3351 y + highlightThickness,
3352 width - 2*highlightThickness,
3353 height - 2*highlightThickness,
3354 shadowThickness, XmSHADOW_IN);
3357 if(type == NOT_DESKTOP)
3359 if((Dimension)(stringHeight+5) >= (Dimension)pixmapHeight)
3363 rect[num_rects].x = x + highlightThickness;
3364 rect[num_rects].y = y + highlightThickness;
3365 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3366 shadowThickness + 2*marginWidth;
3367 rect[num_rects++].height = half_shadowThickness;
3370 rect[num_rects].x = x + pixmapWidth + stringWidth + spacing +
3371 shadowThickness + 2*marginWidth +
3373 rect[num_rects].y = y + highlightThickness;
3374 rect[num_rects].width = half_shadowThickness;
3375 rect[num_rects++].height = stringHeight + 2*marginHeight +
3376 shadowThickness + half_shadowThickness;
3379 rect[num_rects].x = x + highlightThickness;
3380 rect[num_rects].y = y + highlightThickness + stringHeight +
3381 2*marginHeight + shadowThickness;
3382 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3383 shadowThickness + 2*marginWidth;
3384 rect[num_rects++].height = half_shadowThickness;
3387 rect[num_rects].x = x + highlightThickness;
3388 rect[num_rects].y = y + highlightThickness;
3389 rect[num_rects].width = half_shadowThickness;
3390 rect[num_rects++].height = stringHeight + 2*marginHeight +
3391 shadowThickness + half_shadowThickness;
3393 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3394 &rect[0], num_rects);
3398 rect[num_rects].x = x + highlightThickness +
3399 half_shadowThickness;
3400 rect[num_rects].y = y + highlightThickness +
3401 half_shadowThickness;
3402 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3403 half_shadowThickness + 2*marginWidth;
3404 rect[num_rects++].height = half_shadowThickness;
3407 rect[num_rects].x = x + highlightThickness +
3408 half_shadowThickness + pixmapWidth +
3409 stringWidth + spacing + shadowThickness +
3411 rect[num_rects].y = y + highlightThickness;
3412 rect[num_rects].width = half_shadowThickness;
3413 rect[num_rects++].height = stringHeight + 2*marginHeight +
3417 rect[num_rects].x = x + highlightThickness;
3419 rect[num_rects].y = y + highlightThickness + stringHeight +
3420 2*marginHeight + shadowThickness +
3421 half_shadowThickness;
3422 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3423 2*shadowThickness + 2*marginWidth;
3424 rect[num_rects++].height = half_shadowThickness;
3427 rect[num_rects].x = x + highlightThickness +
3428 half_shadowThickness;
3429 rect[num_rects].y = y + highlightThickness +
3430 half_shadowThickness;
3431 rect[num_rects].width = half_shadowThickness;
3432 rect[num_rects++].height = stringHeight + 2*marginHeight +
3433 half_shadowThickness;
3435 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3436 &rect[0], num_rects);
3443 rect[num_rects].x = x + highlightThickness;
3444 rect[num_rects].y = y + highlightThickness;
3445 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3446 (2 * marginWidth) - half_shadowThickness;
3447 rect[num_rects++].height = half_shadowThickness;
3450 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3451 2*shadowThickness + 2*marginWidth -
3453 rect[num_rects].y = y + highlightThickness;
3454 rect[num_rects].width = half_shadowThickness;
3455 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3456 marginHeight - half_shadowThickness;
3459 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3460 2*shadowThickness + 2*marginWidth -
3462 rect[num_rects].y = y + highlightThickness +
3463 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3464 marginHeight -shadowThickness;
3465 rect[num_rects].width = stringWidth + marginWidth +
3467 rect[num_rects++].height = half_shadowThickness;
3470 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3471 2*shadowThickness + 3*marginWidth
3472 + stringWidth - half_shadowThickness;
3473 rect[num_rects].y = y + highlightThickness +
3474 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3475 half_shadowThickness;
3476 rect[num_rects].width = half_shadowThickness;
3477 rect[num_rects++].height = stringHeight + 2*marginHeight +
3478 half_shadowThickness;
3481 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3482 2*shadowThickness + 2*marginWidth -
3484 rect[num_rects].y = y + highlightThickness +
3485 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3486 stringHeight + 2*marginHeight +
3488 rect[num_rects].width = stringWidth + marginWidth +
3490 rect[num_rects++].height = half_shadowThickness;
3493 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3494 2*shadowThickness + 2*marginWidth -
3496 rect[num_rects].y = y + highlightThickness +
3497 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3498 stringHeight + 2*marginHeight +
3500 rect[num_rects].width = half_shadowThickness;
3501 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3505 rect[num_rects].x = x + highlightThickness;
3506 rect[num_rects].y = y + highlightThickness +
3507 pixmapHeight + 2*marginHeight + shadowThickness;
3508 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3509 (2 * marginWidth) - half_shadowThickness;
3510 rect[num_rects++].height = half_shadowThickness;
3513 rect[num_rects].x = x + highlightThickness;
3514 rect[num_rects].y = y + highlightThickness;
3515 rect[num_rects].width = half_shadowThickness;
3516 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3519 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3520 &rect[0], num_rects);
3524 rect[num_rects].x = x + highlightThickness +
3525 half_shadowThickness;
3526 rect[num_rects].y = y + highlightThickness +
3527 half_shadowThickness;
3528 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3529 half_shadowThickness;
3530 rect[num_rects++].height = half_shadowThickness;
3533 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3534 2*marginWidth + shadowThickness +
3535 half_shadowThickness;
3536 rect[num_rects].y = y + highlightThickness;
3537 rect[num_rects].width = half_shadowThickness;
3538 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3539 marginHeight - shadowThickness;
3542 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3543 2*marginWidth + shadowThickness;
3544 rect[num_rects].y = y + highlightThickness +
3545 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3546 half_shadowThickness;
3547 rect[num_rects].width = stringWidth + marginWidth +
3548 half_shadowThickness;
3549 rect[num_rects++].height = half_shadowThickness;
3552 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3553 3*marginWidth + 2*shadowThickness +
3555 rect[num_rects].y = y + highlightThickness +
3556 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2);
3558 rect[num_rects].width = half_shadowThickness;
3559 rect[num_rects++].height = stringHeight + 2*marginHeight +
3563 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3564 2*marginWidth + shadowThickness +
3565 half_shadowThickness;
3566 rect[num_rects].y = y + highlightThickness +
3567 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3568 2*marginHeight + shadowThickness +
3569 stringHeight + half_shadowThickness;
3570 rect[num_rects].width = stringWidth + marginWidth +
3572 rect[num_rects++].height = half_shadowThickness;
3575 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3576 2*marginWidth + shadowThickness +
3577 half_shadowThickness;
3578 rect[num_rects].y = y + highlightThickness +
3579 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3580 2*marginHeight + shadowThickness +
3581 stringHeight + half_shadowThickness;
3582 rect[num_rects].width = half_shadowThickness;
3583 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3586 rect[num_rects].x = x + highlightThickness;
3587 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3588 2*marginHeight + shadowThickness +
3589 half_shadowThickness;
3590 rect[num_rects].width = pixmapWidth + 2*marginWidth +
3592 rect[num_rects++].height = half_shadowThickness;
3595 rect[num_rects].x = x + highlightThickness +
3596 half_shadowThickness;
3597 rect[num_rects].y = y + highlightThickness +
3598 half_shadowThickness;
3599 rect[num_rects].width = half_shadowThickness;
3600 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3601 half_shadowThickness;
3603 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3604 &rect[0], num_rects);
3610 if((Dimension)(stringHeight+5) >= pixmapHeight)
3614 rect[num_rects].x = x + highlightThickness;
3615 rect[num_rects].y = y + highlightThickness;
3616 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3617 2*shadowThickness + 2*marginWidth;
3618 rect[num_rects++].height = half_shadowThickness;
3621 rect[num_rects].x = x + highlightThickness +
3622 half_shadowThickness;
3623 rect[num_rects].y = y + highlightThickness +
3624 half_shadowThickness;
3625 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3626 shadowThickness + 2*marginWidth;
3627 rect[num_rects++].height = half_shadowThickness;
3630 rect[num_rects].x = x + highlightThickness;
3631 rect[num_rects].y = y + highlightThickness;
3632 rect[num_rects].width = half_shadowThickness;
3633 if(pixmapHeight > stringHeight)
3634 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3637 rect[num_rects++].height = stringHeight + 2*marginHeight +
3641 rect[num_rects].x = x + highlightThickness +
3642 half_shadowThickness;
3643 rect[num_rects].y = y + highlightThickness +
3644 half_shadowThickness;
3645 rect[num_rects].width = half_shadowThickness;
3646 if(pixmapHeight > stringHeight)
3647 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3648 half_shadowThickness;
3650 rect[num_rects++].height = stringHeight + 2*marginHeight +
3651 half_shadowThickness;
3653 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3654 &rect[0], num_rects);
3658 rect[num_rects].x = x + pixmapWidth + stringWidth + spacing +
3659 shadowThickness + 2*marginWidth +
3661 rect[num_rects].y = y + highlightThickness +
3663 rect[num_rects].width = half_shadowThickness;
3664 if(pixmapHeight > stringHeight)
3665 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3668 rect[num_rects++].height = stringHeight + 2*marginHeight +
3672 rect[num_rects].x = x + highlightThickness +
3673 half_shadowThickness + pixmapWidth +
3674 stringWidth + spacing + shadowThickness +
3676 rect[num_rects].y = y + highlightThickness +
3677 half_shadowThickness;
3678 rect[num_rects].width = half_shadowThickness;
3679 if(pixmapHeight > stringHeight)
3680 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3683 rect[num_rects++].height = stringHeight + 2*marginHeight +
3687 rect[num_rects].x = x + highlightThickness +
3688 half_shadowThickness;
3689 if(pixmapHeight > stringHeight)
3690 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3691 2*marginHeight + shadowThickness;
3693 rect[num_rects].y = y + highlightThickness + stringHeight +
3694 2*marginHeight + shadowThickness;
3695 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3696 shadowThickness + 2*marginWidth -
3697 half_shadowThickness;
3698 rect[num_rects++].height = half_shadowThickness;
3701 rect[num_rects].x = x + highlightThickness;
3703 if(pixmapHeight > stringHeight)
3704 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3705 2*marginHeight + shadowThickness +
3706 half_shadowThickness;
3708 rect[num_rects].y = y + highlightThickness + stringHeight +
3709 2*marginHeight + shadowThickness +
3710 half_shadowThickness;
3711 rect[num_rects].width = pixmapWidth + stringWidth + spacing +
3712 2*shadowThickness + 2*marginWidth;
3713 rect[num_rects++].height = half_shadowThickness;
3715 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3716 &rect[0], num_rects);
3722 rect[num_rects].x = x + highlightThickness;
3723 rect[num_rects].y = y + highlightThickness;
3724 rect[num_rects].width = pixmapWidth + (2 * shadowThickness) +
3725 (2 * marginWidth) + half_shadowThickness;
3726 rect[num_rects++].height = half_shadowThickness;
3729 rect[num_rects].x = x + highlightThickness +
3730 half_shadowThickness;
3731 rect[num_rects].y = y + highlightThickness +
3732 half_shadowThickness;
3733 rect[num_rects].width = pixmapWidth + (2 * marginWidth) +
3735 rect[num_rects++].height = half_shadowThickness;
3738 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3739 2*shadowThickness + 2*marginWidth -
3741 rect[num_rects].y = y + highlightThickness +
3742 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3743 marginHeight -shadowThickness;
3744 rect[num_rects].width = stringWidth + marginWidth +
3746 rect[num_rects++].height = half_shadowThickness;
3749 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3750 2*marginWidth + shadowThickness;
3751 rect[num_rects].y = y + highlightThickness +
3752 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3753 half_shadowThickness;
3754 rect[num_rects].width = stringWidth + marginWidth +
3755 half_shadowThickness;
3756 rect[num_rects++].height = half_shadowThickness;
3759 rect[num_rects].x = x + highlightThickness;
3760 rect[num_rects].y = y + highlightThickness;
3761 rect[num_rects].width = half_shadowThickness;
3762 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3766 rect[num_rects].x = x + highlightThickness +
3767 half_shadowThickness;
3768 rect[num_rects].y = y + highlightThickness +
3769 half_shadowThickness;
3770 rect[num_rects].width = half_shadowThickness;
3771 rect[num_rects++].height = pixmapHeight + 2*marginHeight +
3774 XFillRectangles (XtDisplay (w), XtWindow (w), top_gc,
3775 &rect[0], num_rects);
3779 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3780 2*shadowThickness + 2*marginWidth -
3782 rect[num_rects].y = y + highlightThickness + shadowThickness;
3783 rect[num_rects].width = half_shadowThickness;
3784 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3785 marginHeight - half_shadowThickness -
3789 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3790 2*marginWidth + shadowThickness +
3791 half_shadowThickness;
3792 rect[num_rects].y = y + highlightThickness +
3793 half_shadowThickness;
3794 rect[num_rects].width = half_shadowThickness;
3795 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3796 marginHeight - half_shadowThickness -
3800 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3801 2*shadowThickness + 3*marginWidth
3802 + stringWidth - half_shadowThickness;
3803 rect[num_rects].y = y + highlightThickness +
3804 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3805 half_shadowThickness;
3806 rect[num_rects].width = half_shadowThickness;
3807 rect[num_rects++].height = stringHeight + 2*marginHeight +
3808 half_shadowThickness;
3811 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3812 3*marginWidth + 2*shadowThickness +
3814 rect[num_rects].y = y + highlightThickness +
3815 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2);
3817 rect[num_rects].width = half_shadowThickness;
3818 rect[num_rects++].height = stringHeight + 2*marginHeight +
3822 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3823 2*shadowThickness + 2*marginWidth -
3825 rect[num_rects].y = y + highlightThickness +
3826 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3827 stringHeight + 2*marginHeight +
3829 rect[num_rects].width = stringWidth + marginWidth +
3831 rect[num_rects++].height = half_shadowThickness;
3834 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3835 2*marginWidth + shadowThickness +
3836 half_shadowThickness;
3837 rect[num_rects].y = y + highlightThickness +
3838 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3839 2*marginHeight + shadowThickness +
3840 stringHeight + half_shadowThickness;
3841 rect[num_rects].width = stringWidth + marginWidth +
3843 rect[num_rects++].height = half_shadowThickness;
3846 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3847 2*shadowThickness + 2*marginWidth -
3849 rect[num_rects].y = y + highlightThickness +
3850 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3851 stringHeight + 2*marginHeight +
3853 rect[num_rects].width = half_shadowThickness;
3854 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3858 rect[num_rects].x = x + highlightThickness + pixmapWidth +
3859 2*marginWidth + shadowThickness +
3860 half_shadowThickness;
3861 rect[num_rects].y = y + highlightThickness +
3862 ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3863 2*marginHeight + shadowThickness +
3864 stringHeight + half_shadowThickness;
3865 rect[num_rects].width = half_shadowThickness;
3866 rect[num_rects++].height = ((Dimension)(pixmapHeight - stringHeight)/(Dimension)2) +
3870 rect[num_rects].x = x + highlightThickness + shadowThickness;
3871 rect[num_rects].y = y + highlightThickness +
3872 pixmapHeight + 2*marginHeight + shadowThickness;
3873 rect[num_rects].width = pixmapWidth + shadowThickness +
3874 (2 * marginWidth) - half_shadowThickness;
3875 rect[num_rects++].height = half_shadowThickness;
3878 rect[num_rects].x = x + highlightThickness +
3879 half_shadowThickness;
3880 rect[num_rects].y = y + highlightThickness + pixmapHeight +
3881 2*marginHeight + shadowThickness +
3882 half_shadowThickness;
3883 rect[num_rects].width = pixmapWidth + 2*marginWidth +
3884 shadowThickness + half_shadowThickness;
3885 rect[num_rects++].height = half_shadowThickness;
3887 XFillRectangles (XtDisplay (w), XtWindow (w), bottom_gc,
3888 &rect[0], num_rects);
3892 case XmPIXMAP_BOTTOM:
3893 case XmPIXMAP_RIGHT:
3894 XmeDrawShadows (XtDisplay(w), XtWindow(w), top_gc, bottom_gc,
3895 x + highlightThickness,
3896 y + highlightThickness,
3897 width - 2*highlightThickness,
3898 height - 2*highlightThickness,
3899 shadowThickness, XmSHADOW_IN);
3908 FM_XmHighlightBorder(
3911 if( XmIsPrimitive( w) ) {
3912 (*(xmPrimitiveClassRec.primitive_class.border_highlight))( w) ;
3914 if( XmIsGadget( w) ) {
3915 (*(xmGadgetClassRec.gadget_class.border_highlight))( w) ;
3922 FM_XmUnhighlightBorder(
3925 if( XmIsPrimitive( w) )
3927 (*(xmPrimitiveClassRec.primitive_class.border_unhighlight))( w) ;
3930 { if( XmIsGadget( w) )
3932 (*(xmGadgetClassRec.gadget_class.border_unhighlight))( w) ;
3946 widget = XmObjectAtPoint (wid, x, y);
3948 if (!widget || !XtIsSensitive (widget))
3949 return ((XmGadget) NULL);
3951 return ((XmGadget) widget);