ClockP.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. All Rights Reserved
  39. Permission to use, copy, modify, and distribute this software and its
  40. documentation for any purpose and without fee is hereby granted,
  41. provided that the above copyright notice appear in all copies and that
  42. both that copyright notice and this permission notice appear in
  43. supporting documentation, and that the names of Digital or MIT not be
  44. used in advertising or publicity pertaining to distribution of the
  45. software without specific, written prior permission.
  46. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  47. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  48. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  49. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  50. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  51. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  52. SOFTWARE.
  53. ***
  54. ***
  55. ***-------------------------------------------------------------------*/
  56. #ifndef _DtClockP_h
  57. #define _DtClockP_h
  58. #include <Xm/XmP.h>
  59. #include <Dt/ControlP.h>
  60. #include "Clock.h"
  61. #define SEG_BUFF_SIZE 128
  62. #define ASCII_TIME_BUFLEN 32 /* big enough for 26 plus slop */
  63. /*-------------------------------------------------------------
  64. ** Class Structure
  65. */
  66. /* Class Part
  67. */
  68. typedef struct _DtClockClassPart
  69. {
  70. XmCacheClassPartPtr cache_part;
  71. caddr_t extension;
  72. } DtClockClassPart;
  73. /* Full Class Record
  74. */
  75. typedef struct _DtClockClassRec
  76. {
  77. RectObjClassPart rect_class;
  78. XmGadgetClassPart gadget_class;
  79. DtIconClassPart icon_class;
  80. DtControlClassPart control_class;
  81. DtClockClassPart clock_class;
  82. } DtClockClassRec;
  83. /* Actual Class
  84. */
  85. extern DtClockClassRec dtClockClassRec;
  86. /*-------------------------------------------------------------
  87. ** Instance Structure
  88. */
  89. /* Instance Part
  90. */
  91. typedef struct _DtClockPart
  92. {
  93. int update; /* update frequence */
  94. Dimension radius; /* radius factor */
  95. int backing_store; /* backing store type */
  96. Boolean reverse_video;
  97. Boolean chime;
  98. Boolean beeped;
  99. Dimension tick_spacing;
  100. Dimension minute_hand_length;
  101. Dimension hour_hand_length;
  102. Dimension hand_width;
  103. Position centerX;
  104. Position centerY;
  105. int numseg;
  106. XPoint segbuff[SEG_BUFF_SIZE];
  107. XPoint *segbuffptr;
  108. XPoint *hour, *sec;
  109. struct tm otm ;
  110. XtIntervalId interval_id;
  111. char prev_time_string[ASCII_TIME_BUFLEN];
  112. int clock_interval;
  113. GC clock_hand_gc;
  114. GC clock_background_gc;
  115. Dimension left_inset;
  116. Dimension right_inset;
  117. Dimension top_inset;
  118. Dimension bottom_inset;
  119. Dimension clock_width;
  120. Dimension clock_height;
  121. } DtClockPart;
  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. ** Class and Instance Macros
  135. */
  136. /* DtClock Class Macros
  137. */
  138. /* DtClock Instance Macros
  139. */
  140. #define G_ClockInterval(g) (g -> clock.clock_interval)
  141. #define G_ClockHandGC(g) (g -> clock.clock_hand_gc)
  142. #define G_ClockBackgroundGC(g) (g -> clock.clock_background_gc)
  143. #define G_ClockHandPixel(g) (g -> icon.pixmap_foreground)
  144. #define G_ClockBackground(g) (g -> icon.pixmap_background)
  145. #define G_ClockWidth(g) (g -> clock.clock_width)
  146. #define G_ClockHeight(g) (g -> clock.clock_height)
  147. #define G_LeftInset(g) (g -> clock.left_inset)
  148. #define G_RightInset(g) (g -> clock.right_inset)
  149. #define G_TopInset(g) (g -> clock.top_inset)
  150. #define G_BottomInset(g) (g -> clock.bottom_inset)
  151. #endif /* _DtClockP_h */
  152. /* DON'T ADD ANYTHING AFTER THIS #endif */