1/*
2* $Xorg: ClockP.h,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $
3*/
4
5
6/***********************************************************
7
8Copyright 1987, 1988, 1998  The Open Group
9
10Permission to use, copy, modify, distribute, and sell this software and its
11documentation for any purpose is hereby granted without fee, provided that
12the above copyright notice appear in all copies and that both that
13copyright notice and this permission notice appear in supporting
14documentation.
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
22OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26Except as contained in this notice, the name of The Open Group shall not be
27used in advertising or otherwise to promote the sale, use or other dealings
28in this Software without prior written authorization from The Open Group.
29
30
31Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
32
33                        All Rights Reserved
34
35Permission to use, copy, modify, and distribute this software and its
36documentation for any purpose and without fee is hereby granted,
37provided that the above copyright notice appear in all copies and that
38both that copyright notice and this permission notice appear in
39supporting documentation, and that the name of Digital not be
40used in advertising or publicity pertaining to distribution of the
41software without specific, written prior permission.
42
43DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
44ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
45DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
46ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
47WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
48ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
49SOFTWARE.
50
51******************************************************************/
52/* $XFree86: xc/programs/xclock/ClockP.h,v 1.11 2002/10/17 01:00:01 dawes Exp $ */
53
54#ifndef _XawClockP_h
55#define _XawClockP_h
56
57#include <X11/Xos.h>		/* Needed for struct tm. */
58#include "Clock.h"
59#include <X11/Xaw/SimpleP.h>
60#ifdef XRENDER
61#include <X11/Xft/Xft.h>
62#include <X11/extensions/Xrender.h>
63#endif
64
65#define SEG_BUFF_SIZE		128
66#ifdef NO_I18N
67#define ASCII_TIME_BUFLEN	32	/* big enough for 26 plus slop */
68#define STRFTIME_BUFF_SIZE      100     /* buffer for "strftime" option */
69#else
70#define STRFTIME_BUFF_SIZE	256	/* should handle any locale */
71#endif
72
73
74
75/* New fields for the clock widget instance record */
76typedef struct {
77#ifndef RENDER
78	 Pixel	fgpixel;	/* color index for text */
79#endif
80	 Pixel	Hipixel;	/* color index for Highlighting */
81	 Pixel	Hdpixel;	/* color index for hands */
82	 XFontStruct	*font;	/* font for text */
83	 GC	myGC;		/* pointer to GraphicsContext */
84	 GC	EraseGC;	/* eraser GC */
85	 GC	HandGC;		/* Hand GC */
86	 GC	HighGC;		/* Highlighting GC */
87/* start of graph stuff */
88	 float	update;		/* update period in second */
89	 Dimension radius;		/* radius factor */
90	 int	backing_store;	/* backing store type */
91	 Boolean chime;
92	 Boolean beeped;
93	 Boolean analog;
94	 Boolean brief;
95	 Boolean twentyfour;
96	 Boolean utime;
97         String strftime;
98	 Boolean show_second_hand;
99	 Dimension second_hand_length;
100	 Dimension minute_hand_length;
101	 Dimension hour_hand_length;
102	 Dimension hand_width;
103	 Dimension second_hand_width;
104	 Position centerX;
105	 Position centerY;
106	 int	numseg;
107	 int	padding;
108	 XPoint	segbuff[SEG_BUFF_SIZE];
109	 XPoint	*segbuffptr;
110	 XPoint	*hour, *sec;
111	 struct tm  otm ;
112	 struct timeval otv ;
113	 XtIntervalId interval_id;
114	 char prev_time_string[STRFTIME_BUFF_SIZE];
115#ifndef NO_I18N
116    	 XFontSet fontSet;     /* font set for localized text */
117	 Boolean	utf8;
118#endif
119#ifdef XRENDER
120	 XftColor	fg_color;
121	 XftColor	hour_color;
122	 XftColor	min_color;
123	 XftColor	sec_color;
124	 XftColor	major_color;
125	 XftColor	minor_color;
126	 XftFont	*face;
127	 XRenderPictFormat  *mask_format;
128
129	 Boolean    render;
130	 Boolean    sharp;
131	 Boolean    can_polygon;
132	 Boolean    buffer;
133	 XftDraw    *draw;
134	 Picture    picture;
135	 Picture    fill_picture;
136	 Pixmap	    pixmap;
137	 XRectangle damage;
138	 XDouble    x_scale;
139	 XDouble    x_off;
140	 XDouble    y_scale;
141	 XDouble    y_off;
142#endif
143   } ClockPart;
144
145#ifdef XRENDER
146#define ClockFgPixel(c)	((c)->clock.fg_color.pixel)
147#else
148#define ClockFgPixel(c)	((c)->clock.fgpixel)
149#endif
150
151/* Full instance record declaration */
152typedef struct _ClockRec {
153   CorePart core;
154   SimplePart simple;
155   ClockPart clock;
156   } ClockRec;
157
158/* New fields for the Clock widget class record */
159typedef struct {int dummy;} ClockClassPart;
160
161/* Full class record declaration. */
162typedef struct _ClockClassRec {
163   CoreClassPart core_class;
164   SimpleClassPart simple_class;
165   ClockClassPart clock_class;
166   } ClockClassRec;
167
168/* Class pointer. */
169extern ClockClassRec clockClassRec;
170
171#endif /* _XawClockP_h */
172