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