PannerP.h revision 7a84e134
1/*
2 * $Xorg: PannerP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $
3 *
4Copyright 1989, 1998 The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25 *
26 * Author:  Jim Fulton, MIT X Consortium
27 */
28/* $XFree86: xc/lib/Xaw/PannerP.h,v 1.7 2001/01/17 19:42:29 dawes Exp $ */
29
30#ifndef _XawPannerP_h
31#define _XawPannerP_h
32
33#include <X11/Xaw/Panner.h>
34#include <X11/Xaw/SimpleP.h>
35
36/* new fields in widget class */
37typedef struct {
38    XtPointer extension;
39} PannerClassPart;
40
41/* Panner widget class */
42typedef struct _PannerClassRec {
43    CoreClassPart core_class;
44    SimpleClassPart simple_class;
45    PannerClassPart panner_class;
46} PannerClassRec;
47
48/* new fields in widget */
49typedef struct {
50    /* resources */
51    XtCallbackList report_callbacks;	/* callback/Callback */
52    Boolean allow_off;			/* allowOff/AllowOff */
53    Boolean resize_to_pref;		/* resizeToPreferred/Boolean */
54    Pixel foreground;			/* foreground/Foreground */
55    Pixel shadow_color;			/* shadowColor/ShadowColor */
56    Dimension shadow_thickness;		/* shadowThickness/ShadowThickness */
57    Dimension default_scale;		/* defaultScale/DefaultScale */
58    Dimension line_width;		/* lineWidth/LineWidth */
59    Dimension canvas_width;		/* canvasWidth/CanvasWidth */
60    Dimension canvas_height;		/* canvasHeight/CanvasHeight */
61    Position slider_x;			/* sliderX/SliderX */
62    Position slider_y;			/* sliderY/SliderY */
63    Dimension slider_width;		/* sliderWidth/SliderWidth */
64    Dimension slider_height;		/* sliderHeight/SliderHeight */
65    Dimension internal_border;		/* internalBorderWidth/BorderWidth */
66    String stipple_name;		/* backgroundStipple/BackgroundStipple
67					 */
68    /* private */
69    GC slider_gc;			/* background of slider */
70    GC shadow_gc;			/* edge of slider and shadow */
71    GC xor_gc;				/* for doing XOR tmp graphics */
72    double haspect, vaspect;		/* aspect ratio of core to canvas */
73    Boolean rubber_band;		/* true = rubber band, false = move */
74    struct {
75	Boolean doing;			/* tmp graphics in progress */
76	Boolean showing;		/* true if tmp graphics displayed */
77	Position startx, starty;	/* initial position of slider */
78	Position dx, dy;		/* offset loc for tmp graphics */
79	Position x, y;			/* location for tmp graphics */
80    } tmp;
81    Position knob_x, knob_y;		/* real upper left of knob in canvas */
82    Dimension knob_width, knob_height;	/* real size of knob in canvas */
83    Boolean shadow_valid;		/* true if rects are valid */
84    XRectangle shadow_rects[2];		/* location of shadows */
85    Position last_x, last_y;		/* previous location of knob */
86#ifndef OLDXAW
87    XtPointer pad[4];	/* for future use and keep binary compatability */
88#endif
89} PannerPart;
90
91typedef struct _PannerRec {
92    CorePart core;
93    SimplePart simple;
94    PannerPart panner;
95} PannerRec;
96
97#define PANNER_HSCALE(pw,val)	((pw)->panner.haspect * ((double)(val)))
98#define PANNER_VSCALE(pw,val)	((pw)->panner.vaspect * ((double)(val)))
99
100#define PANNER_DSCALE(pw,val) (Dimension)  \
101((((unsigned long)(val)) * (unsigned long)pw->panner.default_scale) / 100L)
102
103#define PANNER_DEFAULT_SCALE	8		/* percent */
104#define PANNER_OUTOFRANGE -30000
105
106extern PannerClassRec pannerClassRec;
107
108#endif /* _XawPannerP_h */
109