1 /*----------------------------------------------------------------------------
2 --
3 --  Module:           XmUbMonthDisplay
4 --
5 --  Project:          XmUb - Ulle's Motif widgets
6 --  System:
7 --    Subsystem:      <>
8 --    Function block: <>
9 --
10 --  Description:
11 --    This is the private header file for the widget.
12 --
13 --  Filename:         XmUbMonthDP.h
14 --
15 --  Authors:          Roger Larsson, Ulrika Bornetun
16 --  Creation date:    1993-09-26
17 --
18 --
19 --  (C) Copyright Ulrika Bornetun, Roger Larsson (1995)
20 --      All rights reserved
21 --
22 --  Permission to use, copy, modify, and distribute this software and its
23 --  documentation for any purpose and without fee is hereby granted,
24 --  provided that the above copyright notice appear in all copies. Ulrika
25 --  Bornetun and Roger Larsson make no representations about the usability
26 --  of this software for any purpose. It is provided "as is" without express
27 --  or implied warranty.
28 ----------------------------------------------------------------------------*/
29 
30 /* SCCS module identifier. */
31 /* SCCSID = @(#) Module: XmUbMonthDP.h, Version: 1.1, Date: 95/02/18 15:10:09 */
32 
33 #ifndef _XmUbMonthDP_h
34 #define _XmUbMonthDP_h
35 
36 /*----------------------------------------------------------------------------
37 --  Include files
38 ----------------------------------------------------------------------------*/
39 
40 #include <stdio.h>
41 #include <X11/StringDefs.h>
42 #include <Xm/XmP.h>
43 
44 #if XmVersion > 1001
45 #include "Xm/ManagerP.h"
46 #endif
47 
48 #include "XmUbMonthD.h"
49 
50 /*----------------------------------------------------------------------------
51 --  Macro definitions
52 ----------------------------------------------------------------------------*/
53 
54 /* Indices for widgets in the internal children array. */
55 
56 #define NO_INTERNAL_CHILDREN  ( XmUbMD_LAST_CHILD + 1 )
57 
58 /* With a maximum of bad luck, we can have 6 rows with days. */
59 #define NO_DAY_BUTTONS        42
60 
61 #define NO_DAY_NAME_BUTTONS     7
62 
63 /* The week number row-column is vertically oriented. */
64 #define NO_WEEK_NUMBER_BUTTONS  7
65 
66 /*----------------------------------------------------------------------------
67 --  Type declarations
68 ----------------------------------------------------------------------------*/
69 
70 /* CLASS RECORD */
71 
72 typedef struct {
73 
74   XtPointer  extension;
75 
76 } XmUbMonthDisplayClassPart;
77 
78 
79 /* Full class record declaration. */
80 
81 typedef struct {
82 
83   CoreClassPart              core_class;
84   CompositeClassPart         composite_class;
85   ConstraintClassPart        constraint_class;
86   XmManagerClassPart         manager_class;
87   XmUbMonthDisplayClassPart  monthdisplay_class;
88 
89 } XmUbMonthDisplayClassRec;
90 
91 
92 /* INSTANCE RECORD */
93 
94 typedef struct {
95 
96   /* RESOURCES. */
97   /* Callbacks. */
98   XtCallbackList    date_selected_callback;
99   XtCallbackList    new_month_callback;
100   XtCallbackList    title_callback;
101   XtCallbackList    update_day_callback;
102 
103   /* Current state. */
104   int               current_year;
105   int               current_month;
106 
107   /* Offsets and spacings. */
108   Dimension         margin_height;
109   Dimension         margin_width;
110   Dimension         label_spacing;
111   Dimension         arrow_spacing;
112 
113   /* Size computation. */
114   Boolean           recompute_width;
115   Boolean           recompute_height;
116 
117   /* Internal widget creation. */
118   /* These resources may not be changed in SetValues. */
119   XmString          month_label;
120   XmString          year_label;
121   XmString          week_number_label;
122   Boolean           month_arrows;
123   Boolean           year_arrows;
124   Boolean           enable_separator;
125   Boolean           use_default_title_callback;
126   Boolean           week_numbers;
127 
128   /* Display. */
129   Pixel             weekday_foreground;
130   Pixel             sun_foreground;
131   Pixel             sat_foreground;
132   Pixel             today_foreground;
133   Pixel             other_month_foreground;
134   Pixel             week_number_foreground;
135 
136   int               day_name_characters;
137   Boolean           fill_out_week;
138   Boolean           title_shadows;
139   unsigned char     title_alignment;
140 
141   /* PRIVATE STATE. */
142   /* Internal widgets. Some may be NULL depending on format. */
143   Widget    internal_children[ NO_INTERNAL_CHILDREN ];
144   Widget    day_name_buttons[ NO_DAY_NAME_BUTTONS ];
145   Widget    day_number_buttons[ NO_DAY_BUTTONS ];
146   Widget    week_number_buttons[ NO_WEEK_NUMBER_BUTTONS ];
147 
148   /* Drag and drop icons. */
149   Widget    date_icon;
150   Pixmap    date_icon_bm;
151   Pixmap    date_icon_mask;
152   Widget    inv_date_icon;
153   Pixmap    inv_date_icon_bm;
154   Pixmap    inv_date_icon_mask;
155 
156   /* Shadows for pushbuttons. */
157   Pixel     pushb_default_topshadow;
158   Pixel     pushb_default_bottomshadow;
159 
160   /* Index in day_number_buttons array for first day of current month. */
161   int       first_date_index;
162 
163   Boolean   resize_called;  /* Because unclear widget set philosophy. */
164   Boolean   internal_widgets_created;
165   Boolean   exposed;
166 
167 } XmUbMonthDisplayPart;
168 
169 /* Full instance record declaration. */
170 
171 typedef struct _XmUbMonthDisplayRec {
172 
173   CorePart              core;
174   CompositePart         composite;
175   ConstraintPart        constraint;
176   XmManagerPart         manager;
177   XmUbMonthDisplayPart  md;
178 
179 } XmUbMonthDisplayRec;
180 
181 
182 
183 /* Constraint record for the children of this widget. */
184 typedef struct {
185 
186   XtPointer  extension;
187 
188 } XmUbMonthDisplayConstraintsPart;
189 
190 
191 typedef struct {
192 
193   XmManagerConstraintPart          manager;
194   XmUbMonthDisplayConstraintsPart  md;
195 
196 } XmUbMonthDisplayConstraintsRec, *XmUbMonthDisplayConstraints;
197 
198 /*----------------------------------------------------------------------------
199 --  Global definitions
200 ----------------------------------------------------------------------------*/
201 
202 /* Conventional declaration. */
203 extern XmUbMonthDisplayClassRec xmUbMonthDisplayClassRec;
204 
205 /*----------------------------------------------------------------------------
206 --  Function prototypes
207 ----------------------------------------------------------------------------*/
208 
209 #endif
210