17a84e134Smrg/*
27a84e134Smrg *
37a84e134SmrgCopyright 1989, 1998 The Open Group
47a84e134Smrg
57a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
67a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
77a84e134Smrgthe above copyright notice appear in all copies and that both that
87a84e134Smrgcopyright notice and this permission notice appear in supporting
97a84e134Smrgdocumentation.
107a84e134Smrg
117a84e134SmrgThe above copyright notice and this permission notice shall be included in
127a84e134Smrgall copies or substantial portions of the Software.
137a84e134Smrg
147a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
157a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
177a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
187a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
197a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
207a84e134Smrg
217a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
227a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
237a84e134Smrgin this Software without prior written authorization from The Open Group.
247a84e134Smrg *
257a84e134Smrg * Author:  Jim Fulton, MIT X Consortium
267a84e134Smrg */
277a84e134Smrg
287a84e134Smrg#ifndef _XawPannerP_h
297a84e134Smrg#define _XawPannerP_h
307a84e134Smrg
317a84e134Smrg#include <X11/Xaw/Panner.h>
327a84e134Smrg#include <X11/Xaw/SimpleP.h>
337a84e134Smrg
347a84e134Smrg/* new fields in widget class */
357a84e134Smrgtypedef struct {
367a84e134Smrg    XtPointer extension;
377a84e134Smrg} PannerClassPart;
387a84e134Smrg
397a84e134Smrg/* Panner widget class */
407a84e134Smrgtypedef struct _PannerClassRec {
417a84e134Smrg    CoreClassPart core_class;
427a84e134Smrg    SimpleClassPart simple_class;
437a84e134Smrg    PannerClassPart panner_class;
447a84e134Smrg} PannerClassRec;
457a84e134Smrg
467a84e134Smrg/* new fields in widget */
477a84e134Smrgtypedef struct {
487a84e134Smrg    /* resources */
497a84e134Smrg    XtCallbackList report_callbacks;	/* callback/Callback */
507a84e134Smrg    Boolean allow_off;			/* allowOff/AllowOff */
517a84e134Smrg    Boolean resize_to_pref;		/* resizeToPreferred/Boolean */
527a84e134Smrg    Pixel foreground;			/* foreground/Foreground */
537a84e134Smrg    Pixel shadow_color;			/* shadowColor/ShadowColor */
547a84e134Smrg    Dimension shadow_thickness;		/* shadowThickness/ShadowThickness */
557a84e134Smrg    Dimension default_scale;		/* defaultScale/DefaultScale */
567a84e134Smrg    Dimension line_width;		/* lineWidth/LineWidth */
577a84e134Smrg    Dimension canvas_width;		/* canvasWidth/CanvasWidth */
587a84e134Smrg    Dimension canvas_height;		/* canvasHeight/CanvasHeight */
597a84e134Smrg    Position slider_x;			/* sliderX/SliderX */
607a84e134Smrg    Position slider_y;			/* sliderY/SliderY */
617a84e134Smrg    Dimension slider_width;		/* sliderWidth/SliderWidth */
627a84e134Smrg    Dimension slider_height;		/* sliderHeight/SliderHeight */
637a84e134Smrg    Dimension internal_border;		/* internalBorderWidth/BorderWidth */
647a84e134Smrg    String stipple_name;		/* backgroundStipple/BackgroundStipple
657a84e134Smrg					 */
667a84e134Smrg    /* private */
677a84e134Smrg    GC slider_gc;			/* background of slider */
687a84e134Smrg    GC shadow_gc;			/* edge of slider and shadow */
697a84e134Smrg    GC xor_gc;				/* for doing XOR tmp graphics */
707a84e134Smrg    double haspect, vaspect;		/* aspect ratio of core to canvas */
717a84e134Smrg    Boolean rubber_band;		/* true = rubber band, false = move */
727a84e134Smrg    struct {
737a84e134Smrg	Boolean doing;			/* tmp graphics in progress */
747a84e134Smrg	Boolean showing;		/* true if tmp graphics displayed */
757a84e134Smrg	Position startx, starty;	/* initial position of slider */
767a84e134Smrg	Position dx, dy;		/* offset loc for tmp graphics */
777a84e134Smrg	Position x, y;			/* location for tmp graphics */
787a84e134Smrg    } tmp;
797a84e134Smrg    Position knob_x, knob_y;		/* real upper left of knob in canvas */
807a84e134Smrg    Dimension knob_width, knob_height;	/* real size of knob in canvas */
817a84e134Smrg    Boolean shadow_valid;		/* true if rects are valid */
827a84e134Smrg    XRectangle shadow_rects[2];		/* location of shadows */
837a84e134Smrg    Position last_x, last_y;		/* previous location of knob */
847a84e134Smrg#ifndef OLDXAW
855b16253fSmrg    XtPointer pad[4];	/* for future use and keep binary compatibility */
867a84e134Smrg#endif
877a84e134Smrg} PannerPart;
887a84e134Smrg
897a84e134Smrgtypedef struct _PannerRec {
907a84e134Smrg    CorePart core;
917a84e134Smrg    SimplePart simple;
927a84e134Smrg    PannerPart panner;
937a84e134Smrg} PannerRec;
947a84e134Smrg
957a84e134Smrg#define PANNER_HSCALE(pw,val)	((pw)->panner.haspect * ((double)(val)))
967a84e134Smrg#define PANNER_VSCALE(pw,val)	((pw)->panner.vaspect * ((double)(val)))
977a84e134Smrg
987a84e134Smrg#define PANNER_DSCALE(pw,val) (Dimension)  \
997a84e134Smrg((((unsigned long)(val)) * (unsigned long)pw->panner.default_scale) / 100L)
1007a84e134Smrg
1017a84e134Smrg#define PANNER_DEFAULT_SCALE	8		/* percent */
1027a84e134Smrg#define PANNER_OUTOFRANGE -30000
1037a84e134Smrg
1047a84e134Smrgextern PannerClassRec pannerClassRec;
1057a84e134Smrg
1067a84e134Smrg#endif /* _XawPannerP_h */
107