1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#ifndef XmPgplot_h
#define XmPgplot_h
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define resource-name constants.
*/
#define XmpNminColors "minColors"
#define XmpCMinColors "MinColors"
#define XmpNmaxColors "maxColors"
#define XmpCMaxColors "MaxColors"
#define XmpNpadX "padX"
#define XmpCPadX "PadX"
#define XmpNpadY "padY"
#define XmpCPadY "PadY"
#define XmpNshare "share"
#define XmpCShare "Share"
#define XMP_NORM_CURSOR 0 /* Un-augmented X cursor */
#define XMP_LINE_CURSOR 1 /* Line cursor between ref and pointer */
#define XMP_RECT_CURSOR 2 /* Rectangular cursor between ref and pointer */
#define XMP_YRNG_CURSOR 3 /* Two horizontal lines, at ref.x and pointer.x */
#define XMP_XRNG_CURSOR 4 /* Two vertical lines, at ref.y and pointer.y */
#define XMP_HLINE_CURSOR 6 /* Horizontal line cursor at y=ref.y */
#define XMP_VLINE_CURSOR 5 /* Vertical line cursor at x=ref.x */
#define XMP_CROSS_CURSOR 7 /* Cross-hair cursor centered on the pointer */
/*
* When a cursor-input callback [previously registered using xmp_arm_cursor()]
* is called by the widget, the position of the cursor and the key
* that the user pressed are recorded in a struct of the following
* form. A pointer to this struct is then cast to (XtPointer) and
* passed as the 'call_data' argument of the callback function. The
* callback function should cast this argument back to
* (XmpCursorCallbackStruct *) in order to access its fields.
*/
typedef struct {
float x,y; /* The world-coordinate position of the cursor */
char key; /* The key pressed by the user (Mouse buttons='A','D','X') */
} XmpCursorCallbackStruct;
int xmp_arm_cursor(Widget widget, int mode, float xref, float yref,
XtCallbackProc callback, void *client_data);
int xmp_disarm_cursor(Widget widget);
/*
* Record the official PGPLOT device name of the widget driver.
*/
#define XMP_DEVICE "XMOTIF"
/*
* The following function returns an unambiguous PGPLOT device-specification
* that can be used as the FILE argument of cpgbeg() to open a given PGPLOT
* widget. It simply returns a string composed of the widget name, followed
* by a "/" followed by XMP_DEVICE. Note that the returned string is owned
* by the widget and must not be free()d or overwritten.
*/
char *xmp_device_name(Widget widget);
/*
* After a widget has been opened to PGPLOT (via pgopen or pgbeg), the
* following function can be used to return the PGPLOT id of the device.
* When multiple PGPLOT devices are open this id can then be used with
* the PGPLOT cpgslct() function to select the widget as the currently
* selected PGPLOT graphics device.
*
* If the specified widget has not been opened to pgplot, or has been
* closed and not re-opened, then 0 will be returned.
*/
int xmp_device_id(Widget widget);
/*
* The following global is a pointer to the shared class context
* descriptor and is what is passed to XtCreateManagedWidget()
* to tell it what type of widget to create.
*/
externalref WidgetClass xmPgplotWidgetClass;
/*
* Declare opaque aliases to the widget class and instance structures.
*/
typedef struct XmPgplotClassRec *XmPgplotWidgetClass;
typedef struct XmPgplotRec *XmPgplotWidget;
/*
* Convenience widget creation functions.
*/
Widget XmCreatePgplot(Widget parent, char *name, ArgList arglist,
Cardinal argcount);
Widget XmCreateScrolledPgplot(Widget parent, char *name, ArgList arglist,
Cardinal argcount);
/*
* The following functions allow conversions between PGPLOT world coordinates
* and X-window pixel coordinates.
*/
int xmp_pixel_to_world(Widget widget, int px, int py, float *wx, float *wy);
int xmp_world_to_pixel(Widget widget, float wx, float wy, int *px, int *py);
#ifdef __cplusplus
}
#endif
#endif
|