Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtprintinfo / libUI / MotifUI / DtDND.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: DtDND.h /main/3 1995/11/06 09:40:32 rswiston $ */
24 /*                                                                      *
25  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
26  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
27  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
28  * (c) Copyright 1993, 1994 Novell, Inc.                                *
29  */
30
31 #ifndef DTDND_H
32 #define DTDND_H
33
34 #include "MotifUI.h"
35
36 typedef enum
37 {
38    FILENAME_TRANSFER,
39    TEXT_TRANSFER,
40    DROP_ON_ROOT,
41    BUFFER_TRANSFER,
42    CONVERT_DATA,
43    CONVERT_DELETE,
44    ANIMATE
45 } DNDProtocol;
46
47 typedef void (*DNDCallback) (BaseUI *, char **value, int *len, DNDProtocol);
48
49 class DtDND {
50
51    friend void TransferCB(Widget, XtPointer, XtPointer);
52    friend void ConvertCB(Widget, XtPointer, XtPointer);
53    friend void DragFinishCB(Widget, XtPointer, XtPointer);
54    friend void DropOnRootCB(Widget, XtPointer, XtPointer);
55    friend void AnimateCB(Widget, XtPointer, XtPointer);
56    friend void DragMotionHandler(Widget, XtPointer, XEvent *, Boolean *);
57
58    static void TransferCB(Widget, XtPointer, XtPointer);
59    static void ConvertCB(Widget, XtPointer, XtPointer);
60    static void DragFinishCB(Widget, XtPointer, XtPointer);
61    static void DropOnRootCB(Widget, XtPointer, XtPointer);
62    static void AnimateCB(Widget, XtPointer, XtPointer);
63    static void DragMotionHandler(Widget, XtPointer, XEvent *, Boolean *);
64
65  private:
66
67    static boolean FirstTime;
68    static boolean DoingDrag;
69    static XtCallbackRec transferCBRec[];
70    static XtCallbackRec convertCBRec[];
71    static XtCallbackRec dragFinishCBRec[];
72    static XtCallbackRec dropOnRootCBRec[];
73    static XtCallbackRec animateCBRec[];
74    static GC gc;
75    static GC gc_mask;
76
77    MotifUI *obj;
78    Widget dragIcon;
79    Widget sourceIcon;
80    DNDCallback dndCB;
81    XRectangle rects[2];
82    Pixmap pixmap;
83    Pixmap mask;
84    char *name;
85    char *iconFile;
86    Position s_x, s_y;
87    Pixel bg, fg;
88    unsigned char stringDirection;
89    Pixel textSelectColor;
90    XmString string;
91    Pixel selectColor;
92    unsigned char alignment;
93    Boolean showSelectedPixmap;
94    XmFontList fontList;
95    int string_border_width;
96    int p_x, p_y;
97    int p_w, p_h, s_w, s_h;
98    boolean selected;
99    boolean can_drop_on_root;
100    IconStyle icon_size;
101
102    void GetRects();
103    void GetDragPixmaps();
104    void DrawString();
105    void StartDrag(XEvent *);
106
107  public:
108
109    DtDND(MotifUI *obj, DNDCallback dndCB, boolean can_drop_on_root = false);
110    ~DtDND();
111    void UpdateActivity(boolean);
112    void UpdateRects();
113
114 };
115
116 #endif // DTDND_H