ClockP.h revision c2b339b4
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 int 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 XtIntervalId interval_id; 113 char prev_time_string[STRFTIME_BUFF_SIZE]; 114#ifndef NO_I18N 115 XFontSet fontSet; /* font set for localized text */ 116 Boolean utf8; 117#endif 118#ifdef XRENDER 119 XftColor fg_color; 120 XftColor hour_color; 121 XftColor min_color; 122 XftColor sec_color; 123 XftColor major_color; 124 XftColor minor_color; 125 XftFont *face; 126 XRenderPictFormat *mask_format; 127 128 Boolean render; 129 Boolean sharp; 130 Boolean can_polygon; 131 Boolean buffer; 132 XftDraw *draw; 133 Picture picture; 134 Picture fill_picture; 135 Pixmap pixmap; 136 XRectangle damage; 137 XDouble x_scale; 138 XDouble x_off; 139 XDouble y_scale; 140 XDouble y_off; 141#endif 142 } ClockPart; 143 144#ifdef XRENDER 145#define ClockFgPixel(c) ((c)->clock.fg_color.pixel) 146#else 147#define ClockFgPixel(c) ((c)->clock.fgpixel) 148#endif 149 150/* Full instance record declaration */ 151typedef struct _ClockRec { 152 CorePart core; 153 SimplePart simple; 154 ClockPart clock; 155 } ClockRec; 156 157/* New fields for the Clock widget class record */ 158typedef struct {int dummy;} ClockClassPart; 159 160/* Full class record declaration. */ 161typedef struct _ClockClassRec { 162 CoreClassPart core_class; 163 SimpleClassPart simple_class; 164 ClockClassPart clock_class; 165 } ClockClassRec; 166 167/* Class pointer. */ 168extern ClockClassRec clockClassRec; 169 170#endif /* _XawClockP_h */ 171