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