Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtwm / ClockP.h
1 /* $XConsortium: ClockP.h /main/4 1996/10/16 16:57:08 drk $ */
2 /**---------------------------------------------------------------------
3 ***     
4 ***     file:           ClockP.h
5 ***
6 ***     project:        MotifPlus Widgets
7 ***
8 ***     description:    Private include file for DtClock class.
9 ***                     Portions adapted from the Xaw Clock widget.
10 ***     
11 ***     
12 ***                     (c) Copyright 1990 by Hewlett-Packard Company.
13 ***
14 ***
15 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
16 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
17
18                         All Rights Reserved
19
20 Permission to use, copy, modify, and distribute this software and its 
21 documentation for any purpose and without fee is hereby granted, 
22 provided that the above copyright notice appear in all copies and that
23 both that copyright notice and this permission notice appear in 
24 supporting documentation, and that the names of Digital or MIT not be
25 used in advertising or publicity pertaining to distribution of the
26 software without specific, written prior permission.  
27
28 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
29 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
30 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
31 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
32 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
33 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
34 SOFTWARE.
35 ***
36 ***
37 ***-------------------------------------------------------------------*/
38
39
40 #ifndef _DtClockP_h
41 #define _DtClockP_h
42
43 #include <Xm/XmP.h>
44 #include <Dt/ControlP.h>
45 #include "Clock.h"
46
47 #define SEG_BUFF_SIZE           128
48 #define ASCII_TIME_BUFLEN       32      /* big enough for 26 plus slop */
49
50
51 \f
52 /*-------------------------------------------------------------
53 **      Class Structure
54 */
55
56 /*      Class Part
57 */
58 typedef struct _DtClockClassPart
59 {
60         XmCacheClassPartPtr     cache_part;
61         caddr_t                 extension;
62 } DtClockClassPart;
63
64 /*      Full Class Record
65 */
66 typedef struct _DtClockClassRec
67 {
68         RectObjClassPart        rect_class;
69         XmGadgetClassPart       gadget_class;
70         DtIconClassPart icon_class;
71         DtControlClassPart      control_class;
72         DtClockClassPart        clock_class;
73 } DtClockClassRec;
74
75 /*      Actual Class
76 */
77 extern DtClockClassRec dtClockClassRec;
78
79
80 \f
81 /*-------------------------------------------------------------
82 **      Instance Structure
83 */
84
85 /*      Instance Part
86 */
87 typedef struct _DtClockPart
88 {
89         int             update;         /* update frequence */
90         Dimension       radius;         /* radius factor */
91         int             backing_store;  /* backing store type */
92         Boolean         reverse_video;
93         Boolean         chime;
94         Boolean         beeped;
95         Dimension       tick_spacing;
96         Dimension       minute_hand_length;
97         Dimension       hour_hand_length;
98         Dimension       hand_width;
99         Position        centerX;
100         Position        centerY;
101         int             numseg;
102         XPoint          segbuff[SEG_BUFF_SIZE];
103         XPoint          *segbuffptr;
104         XPoint          *hour, *sec;
105         struct          tm  otm ;
106
107         XtIntervalId    interval_id;
108         char            prev_time_string[ASCII_TIME_BUFLEN];
109         int             clock_interval;
110
111         GC              clock_hand_gc;
112         GC              clock_background_gc;
113
114         Dimension       left_inset;
115         Dimension       right_inset;
116         Dimension       top_inset;
117         Dimension       bottom_inset;
118         Dimension       clock_width;
119         Dimension       clock_height;
120 } DtClockPart;
121
122 /*      Full Instance Record
123 */
124 typedef struct _DtClockRec
125 {
126         ObjectPart      object;
127         RectObjPart     rectangle;
128         XmGadgetPart    gadget;
129         DtIconPart      icon;
130         DtControlPart   control;
131         DtClockPart     clock;
132 } DtClockRec;
133
134
135 \f
136 /*-------------------------------------------------------------
137 **      Class and Instance Macros
138 */
139
140 /*      DtClock Class Macros
141 */
142
143 /*      DtClock Instance Macros
144 */
145 #define G_ClockInterval(g)      (g -> clock.clock_interval)
146 #define G_ClockHandGC(g)        (g -> clock.clock_hand_gc)
147 #define G_ClockBackgroundGC(g)  (g -> clock.clock_background_gc)
148 #define G_ClockHandPixel(g)     (g -> icon.pixmap_foreground)
149 #define G_ClockBackground(g)    (g -> icon.pixmap_background)
150 #define G_ClockWidth(g)         (g -> clock.clock_width)
151 #define G_ClockHeight(g)        (g -> clock.clock_height)
152 #define G_LeftInset(g)          (g -> clock.left_inset)
153 #define G_RightInset(g)         (g -> clock.right_inset)
154 #define G_TopInset(g)           (g -> clock.top_inset)
155 #define G_BottomInset(g)        (g -> clock.bottom_inset)
156
157
158 #endif /* _DtClockP_h */
159
160
161 /* DON'T ADD ANYTHING AFTER THIS #endif */