home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / XAP / XFILEMAN / XFILEMAN.TAR / xfilemanager / grab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-22  |  3.8 KB  |  123 lines

  1. /*
  2.  * Copyright 1993 by Ove Kalkan, Cremlingen, Germany
  3.  *
  4.  * Permission to use, copy, modify, distribute and sell this software and it's
  5.  * documentation for any purpose is hereby granted without fee, rpovided that
  6.  * the above copyright notice and this permission appear in supporting
  7.  * documentation, and that the name of Ove Kalkan not to be used in
  8.  * advertising or publicity pertaining to distributiopn of the software without
  9.  * specific, written prior permission. Ove Kalkan makes no representations
  10.  * about the suitability of this software for any purpose. It is provided
  11.  * as is without express or implied warranty.
  12.  *
  13.  * OVE KALKAN DISPLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  14.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABLILITY AND FITNESS, IN NO
  15.  * EVENT SHALL OVE KALKAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  16.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  17.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19.  * PERFORMANCE OF THIS SOFTWARE.
  20.  *
  21.  * $Header: filename,v 1.0 yyyy/mm/dd hh:mm:ss loginname Exp $
  22.  */
  23.  
  24. #include "global.h"
  25.  
  26.  
  27. /*
  28.  * Globale Variablen
  29.  */
  30.  
  31.  
  32. /*********************************************************
  33.  * name:    leaveWindow
  34.  * description:    Wird immer dann aufgerufen, wenn ein Fenster
  35.  *        verlassen wurde.Es werden die fuer die Grab
  36.  *        Funktion wichtigen Parameter gesetzt
  37.  * input:    Widget    w    - Fenster das verlassen wurde
  38.  *        XEvent    *e    - der Event
  39.  *        String    *s    - notused
  40.  *        Cardinal *c    - notused
  41.  * output:    none
  42.  * author:    Ove Kalkan
  43.  * date:    16.6.93
  44.  *********************************************************/
  45. XtActionProc        leaveWindow    (Widget w, XLeaveWindowEvent *e, 
  46.                     String *s, Cardinal *c)
  47. {
  48.     /*
  49.      * Wenn es eine Grab-Operation gibt, dann das Highlight loeschen
  50.      */
  51.     if (GRAB) {
  52.         if (last_g) {
  53.             XDrawRectangle(XtDisplay(dir_area),XtWindow(dir_area),
  54.                        back_gc, last_g->x - 4, last_g->y - 2,
  55.                        32 + XTextWidth (defaults.icon_font,
  56.                     last_g->name,strlen(last_g->name)), 20);
  57.             last_y = 16000;
  58.             last_g = NULL;
  59.         }
  60.         else if (folder && last_v < 16000) {
  61.             XDrawRectangle(XtDisplay(folder->window),XtWindow(folder->window),
  62.                        back_gc, 16, last_v*DIR_Y_STEP + 4,
  63.                        folder->max_length + 50 + typelength, 20);
  64.             last_v = 16000;
  65.         }
  66.         else if (last_ws && last_w < 16000) {
  67.             XDrawRectangle(XtDisplay(toplevel),
  68.                     XtWindow(last_ws->window),
  69.                     back_gc,
  70.                     last_ws->wse[last_w]->x - last_ws->wse[last_w]->w/2 - 1,
  71.                     last_ws->wse[last_w]->y - 1,
  72.                     last_ws->wse[last_w]->w + 1, last_ws->wse[last_w]->h + 1);
  73.             last_ws = NULL;
  74.             last_w = 16000;
  75.         }
  76.     }
  77.     folder = NULL;    /* Zeiger auf derzeitiges Window, wird nur innerhalb
  78.                von Fenstern gebraucht */
  79.     /*
  80.      * Muss gemacht werden, da nach einem XGrabButton ein LeaveNotify kommt
  81.      * und bei einem Grab in einem FolderFenster der Folder sonst verloren
  82.      * gehen wuerde und man erst aus dem Fenster hinaus und danach wieder
  83.      * hinein fahren muesste, damit das Fenster reagiert.
  84.      */
  85.     if (REFRESH) {
  86.         last_fo = selc_fo;
  87.         folder = selc_fo;
  88.         last_v = selc_f;
  89.         REFRESH = FALSE;
  90.     }
  91. }
  92.  
  93.  
  94. /*********************************************************
  95.  * name:    enterWindow
  96.  * description:    Wird immer dann aufgerufen, wenn der Mauszeiger
  97.  *        in ein Fenster faehrt.
  98.  * input:    Widget    w    - Fenster das verlassen wurde
  99.  *        XEvent    *e    - der Event
  100.  *        String    *s    - notused
  101.  *        Cardinal *c    - notused
  102.  * output:    none
  103.  * author:    Ove Kalkan
  104.  * date:    16.6.93
  105.  *********************************************************/
  106. XtActionProc        enterWindow    (Widget w, XEnterWindowEvent *e, 
  107.                     String *s, Cardinal *c)
  108. {
  109.     if (w != dir_area) {
  110.         Dimension    i = 0;
  111.  
  112.         while (i < folder_count && i < MAX_FOLDERS && folders[i]->window != w)
  113.             i++;
  114.  
  115.         if (i < folder_count) {
  116.             folder = folders[i];
  117.         }
  118.     }
  119. }
  120.  
  121.  
  122.  
  123.