Blame demos/programs/drag_and_drop/DNDDemo.h

Packit b099d7
/*
Packit b099d7
 * Motif
Packit b099d7
 *
Packit b099d7
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
Packit b099d7
 *
Packit b099d7
 * These libraries and programs are free software; you can
Packit b099d7
 * redistribute them and/or modify them under the terms of the GNU
Packit b099d7
 * Lesser General Public License as published by the Free Software
Packit b099d7
 * Foundation; either version 2 of the License, or (at your option)
Packit b099d7
 * any later version.
Packit b099d7
 *
Packit b099d7
 * These libraries and programs are distributed in the hope that
Packit b099d7
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
Packit b099d7
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
Packit b099d7
 * PURPOSE. See the GNU Lesser General Public License for more
Packit b099d7
 * details.
Packit b099d7
 *
Packit b099d7
 * You should have received a copy of the GNU Lesser General Public
Packit b099d7
 * License along with these librararies and programs; if not, write
Packit b099d7
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
Packit b099d7
 * Floor, Boston, MA 02110-1301 USA
Packit b099d7
 * 
Packit b099d7
 */
Packit b099d7
/* 
Packit b099d7
 * HISTORY
Packit b099d7
*/ 
Packit b099d7
/*   $TOG: DNDDemo.h /main/7 1997/03/31 13:33:51 dbl $ */
Packit b099d7
/*
Packit b099d7
*  (c) C o pyright 1987, 1988, 1989 HEWLETT-PACKARD COMPANY */
Packit b099d7
/*
Packit b099d7
 *    file: DNDDemo.h
Packit b099d7
 *
Packit b099d7
 *	Header file for the program DNDDemo.
Packit b099d7
 */
Packit b099d7
Packit b099d7
#include <stdio.h>
Packit b099d7
#include <X11/Xatom.h>
Packit b099d7
#include <X11/Intrinsic.h>
Packit b099d7
#include <X11/Xproto.h>
Packit b099d7
#include <Xm/Xm.h>
Packit b099d7
#include <Xm/AtomMgr.h>
Packit b099d7
#include <Xm/MainW.h>
Packit b099d7
#include <Xm/DrawingA.h>
Packit b099d7
#include <Xm/SeparatoG.h>
Packit b099d7
#include <Xm/Form.h>
Packit b099d7
#include <Xm/RowColumn.h>
Packit b099d7
#include <Xm/PushB.h>
Packit b099d7
#include <Xm/MessageB.h>
Packit b099d7
#include <Xm/DragDrop.h>
Packit b099d7
#include <Xm/Screen.h>
Packit b099d7
#include <Xm/TransferP.h>
Packit b099d7
Packit b099d7
Packit b099d7
/* The following is used to layout the color labels */
Packit b099d7
#define BOX_WIDTH       85
Packit b099d7
#define BOX_HEIGHT      25
Packit b099d7
#define BOX_X_OFFSET    95
Packit b099d7
#define BOX_Y_OFFSET    35
Packit b099d7
#define BOX_X_MARGIN    10
Packit b099d7
#define BOX_Y_MARGIN    10
Packit b099d7
Packit b099d7
/* The following are used in setting up the drag icons */
Packit b099d7
#define ICON_WIDTH          32
Packit b099d7
#define ICON_HEIGHT         32
Packit b099d7
#define SMALL_ICON_WIDTH    16
Packit b099d7
#define SMALL_ICON_HEIGHT   16
Packit b099d7
#define ICON_X_HOT          0
Packit b099d7
#define ICON_Y_HOT          0
Packit b099d7
Packit b099d7
/* Some scales or text entry field could be added to change this value */
Packit b099d7
#define RECT_WIDTH  20
Packit b099d7
#define RECT_HEIGHT 50
Packit b099d7
Packit b099d7
/* The following defines could be setup as application resources */
Packit b099d7
#define RECT_START_COLOR    "black"
Packit b099d7
#define HIGHLIGHT_THICKNESS 3
Packit b099d7
#define HIGHLIGHT_COLOR     "Black"   /* this is equivalent to gray60
Packit b099d7
                                         in the R5 rgb.txt */
Packit b099d7
#define DRAW_AREA_BG_COLOR "white"
Packit b099d7
#define DRAW_AREA_FG_COLOR "black"     /* 5127 fix */
Packit b099d7
#define LABEL1_COLOR       "#ff5026"     /* a slight softer shade of red,
Packit b099d7
                                            red was too dark */
Packit b099d7
#define LABEL2_COLOR    "orange"
Packit b099d7
#define LABEL3_COLOR    "yellow"
Packit b099d7
#define LABEL4_COLOR    "violet"
Packit b099d7
#define LABEL5_COLOR    "#00C3ff"           /* a blue green color,
Packit b099d7
                                               blue was too dark */
Packit b099d7
#define LABEL6_COLOR    "green"
Packit b099d7
Packit b099d7
#define VALID_CURSOR_FG_COLOR   "black"
Packit b099d7
#define INVALID_CURSOR_FG_COLOR "maroon"
Packit b099d7
#define NONE_CURSOR_FG_COLOR    "maroon"
Packit b099d7
Packit b099d7
Packit b099d7
/*
Packit b099d7
 * This struct is used to contain information about each rectangle 
Packit b099d7
 * to use in the dislay routines
Packit b099d7
 */
Packit b099d7
typedef struct _RectStruct {
Packit b099d7
  CARD32 x;
Packit b099d7
  CARD32 y;
Packit b099d7
  CARD32 width;
Packit b099d7
  CARD32 height;
Packit b099d7
  CARD32 color;
Packit b099d7
  CARD32 pixmap;   /* currently not in use */
Packit b099d7
} RectStruct, *RectPtr;
Packit b099d7
Packit b099d7
/* This struct is used to hold global application information */
Packit b099d7
typedef struct _AppInfoRec {
Packit b099d7
    GC rectGC;              /* graphic context used to draw the rectangles */
Packit b099d7
    Pixel currentColor;     /* color that is currently in the GC */
Packit b099d7
    RectPtr *rectDpyTable;  /* the rectangle display table */
Packit b099d7
    int rectsAllocd;        /* keeps track of how much the above
Packit b099d7
                               table has been alloc'd */
Packit b099d7
    int numRects;           /* the number of rects that are visible */
Packit b099d7
    RectPtr highlightRect;  /* the current highlighted rectangle */
Packit b099d7
    RectPtr clearRect;      /* the rectangle that is being moved */
Packit b099d7
    Boolean doMove;         /* indicates that a move is being performed */
Packit b099d7
    Boolean creatingRect;   /* indicates that a rect create is being 
Packit b099d7
                               performed */
Packit b099d7
    unsigned char operation;/* indicates the drop help operation */
Packit b099d7
    unsigned int maxCursorWidth;  /* the maximum allowable cursor width */
Packit b099d7
    unsigned int maxCursorHeight; /* the maximum allowable cursor height */
Packit b099d7
    Position rectX;
Packit b099d7
    Position rectY;
Packit b099d7
    Position rectX2;
Packit b099d7
    Position rectY2;
Packit b099d7
} AppInfoRec, *AppInfo;
Packit b099d7
Packit b099d7
/*
Packit b099d7
 * This struct is used to pass information
Packit b099d7
 * from the dropProc to the transferProc
Packit b099d7
 */
Packit b099d7
typedef struct _DropTransferRec {
Packit b099d7
    Widget widget;
Packit b099d7
    Position x;
Packit b099d7
    Position y;
Packit b099d7
} DropTransferRec, *DropTransfer;
Packit b099d7
Packit b099d7
/*
Packit b099d7
 * This struct is used to pass information
Packit b099d7
 * from the rectangle dragStart proc to it's associated
Packit b099d7
 * callback procs.
Packit b099d7
 */
Packit b099d7
typedef struct _DragConvertRec {
Packit b099d7
    Widget widget;
Packit b099d7
    RectPtr rect;
Packit b099d7
} DragConvertRec, *DragConvertPtr;
Packit b099d7
Packit b099d7
Packit b099d7
Packit b099d7
extern void     InitializeAppInfo(void );
Packit b099d7
extern void     StartRect(Widget , XEvent *, String *, Cardinal *);
Packit b099d7
extern void     ExtendRect(Widget , XEvent *, String *, Cardinal *);
Packit b099d7
extern void     EndRect(Widget , XEvent *, String *, Cardinal *);
Packit b099d7
extern RectPtr  RectCreate(Position , Position , Dimension ,
Packit b099d7
                          Dimension , Pixel , Pixmap );
Packit b099d7
extern RectPtr  RectFind(Position , Position );
Packit b099d7
extern void     RectSetColor(RectPtr , Display *, Window , Pixel );
Packit b099d7
extern Pixel    RectGetColor(RectPtr );
Packit b099d7
extern Pixmap   GetBitmapFromRect(Widget , RectPtr , Pixel , Pixel ,
Packit b099d7
                                  Dimension *, Dimension *);
Packit b099d7
extern void     RectHide(Display *, Window , RectPtr );
Packit b099d7
extern void     RectFree(RectPtr );
Packit b099d7
extern void     RedrawRectangles(Widget );
Packit b099d7
extern void     RectDrawStippled(Display *, Window , RectPtr );
Packit b099d7
extern void     RectHighlight(Widget , RectPtr );
Packit b099d7
extern void     RectUnhighlight(Widget );
Packit b099d7
extern void     RectSetPixmap(RectPtr , Display *, Window , Pixmap );
Packit b099d7
extern void     RectRegister(RectPtr , Position , Position );
Packit b099d7
extern void     InitializeRectDpyTable(void );
Packit b099d7
extern void     CreateLayout(void );
Packit b099d7
extern void     CreateRectGC(void );
Packit b099d7
extern Pixel    GetColor(char *);
Packit b099d7
extern void     ColorRect(Widget , XEvent *, String *, Cardinal *);
Packit b099d7
extern void     RectConvert(Widget, XtPointer, XmConvertCallbackStruct*);
Packit b099d7
extern void	ColorConvert(Widget, XtPointer, XmConvertCallbackStruct*);
Packit b099d7
extern void	handleDestination(Widget, XtPointer, XtPointer);
Packit b099d7
Packit b099d7
Packit b099d7
/* The following character arrays hold the bits for
Packit b099d7
 * the source and state icons for both 32x32 and 16x16 drag icons.
Packit b099d7
 * The source is a color palatte icon and the state is a paint brush icon.
Packit b099d7
 */
Packit b099d7
extern unsigned char SOURCE_ICON_BITS[];
Packit b099d7
extern unsigned char SOURCE_ICON_MASK[];
Packit b099d7
extern unsigned char STATE_ICON_BITS[];
Packit b099d7
extern unsigned char STATE_ICON_MASK[];
Packit b099d7
extern unsigned char INVALID_ICON_BITS[];
Packit b099d7
extern unsigned char SMALL_SOURCE_ICON_BITS[];
Packit b099d7
extern unsigned char SMALL_SOURCE_ICON_MASK[];
Packit b099d7
extern unsigned char SMALL_STATE_ICON_BITS[];
Packit b099d7
extern unsigned char SMALL_STATE_ICON_MASK[];
Packit b099d7
extern unsigned char SMALL_INVALID_ICON_BITS[];
Packit b099d7
Packit b099d7
/* The folowing character arrays are for use with the drop help
Packit b099d7
 * dialogs.  For internationalization, message catalogs should
Packit b099d7
 * replace these static declarations.
Packit b099d7
 */
Packit b099d7
extern char HELP_MSG1[];
Packit b099d7
extern char HELP_MSG2[];
Packit b099d7
extern char HELP_MSG3[];
Packit b099d7
extern char HELP_MSG4[];
Packit b099d7
extern char HELP_MSG5[];
Packit b099d7
Packit b099d7
Packit b099d7
/* Globals variables */
Packit b099d7
extern AppInfo      appInfo;
Packit b099d7
extern Widget       topLevel;
Packit b099d7
extern Widget       drawingArea;
Packit b099d7
extern Widget       helpDialog;
Packit b099d7
extern Widget       helpLabel, helpMenu;
Packit b099d7
extern XtAppContext appContext;
Packit b099d7