1 /*----------------------------------------------------------------------------
2 --
3 --  Module:           XmUbArrowLabel
4 --
5 --  Project:          XmUb - Ulle's Motif widgets
6 --  System:
7 --    Subsystem:      <>
8 --    Function block: <>
9 --
10 --  Description:
11 --    This is the public header file for the widget.
12 --
13 --    The arrow label widget displays one label and two arrow buttons.
14 --    It may be used for stepping, like in <-Month->.
15 --
16 --  Filename:         XmUbArrLab.h
17 --
18 --  Authors:          Roger Larsson, Ulrika Bornetun
19 --  Creation date:    1993-09-28
20 --
21 --
22 --  (C) Copyright Ulrika Bornetun, Roger Larsson (1995)
23 --      All rights reserved
24 --
25 --  Permission to use, copy, modify, and distribute this software and its
26 --  documentation for any purpose and without fee is hereby granted,
27 --  provided that the above copyright notice appear in all copies. Ulrika
28 --  Bornetun and Roger Larsson make no representations about the usability
29 --  of this software for any purpose. It is provided "as is" without express
30 --  or implied warranty.
31 ----------------------------------------------------------------------------*/
32 
33 /* SCCS module identifier. */
34 /* SCCSID = @(#) Module: XmUbArrLab.h, Version: 1.1, Date: 95/02/18 15:10:06 */
35 
36 #ifndef _XmUbArrLab_h
37 #define _XmUbArrLab_h
38 
39 /*----------------------------------------------------------------------------
40 --  Include files
41 ----------------------------------------------------------------------------*/
42 
43 #include <stdio.h>
44 #include <time.h>
45 #include <X11/StringDefs.h>
46 #include <Xm/Xm.h>
47 
48 /*----------------------------------------------------------------------------
49 --  Resources for the arrow label widget.
50 --  All XmManager resources apply.
51 --  The following list describes resources added in this widget.
52 --
53 --  XmNactivateCallback        CSG
54 --      XmCCallback
55 --    Callback(s) that is called when an arrow button was activated.
56 --    Callback reason: XmUbCR_BACK_ARROW_ACTIVATED or
57 --                     XmUbCR_FORWARD_ARROW_ACTIVATED.
58 --    Type:    XtCallbackList
59 --    Default: NULL
60 --
61 --  XmUbNalArrowOrientation    CG
62 --      XmCOrientation
63 --    The orientation of the arrows. Valid values are XmHORIZONTAL and
64 --    XmVERTICAL.
65 --    When the orientation is horizontal, the back arrow will be a left arrow
66 --    and the forward arrow will point to the right.
67 --    When the orientation is vertical, the back arrow points up and the
68 --    forward arrow points down.
69 --    Type:    unsigned char
70 --    Default: XmHORIZONTAL
71 --
72 --  XmUbNalArrowPlacement      CG
73 --      XmUbCAlArrowPlacement
74 --    The placement of the arrows. Valid values are
75 --      XmUbARROWS_LEFT        Arrows together on the left, label on the right.
76 --      XmUbARROWS_RIGHT       Arrows together on the right, label on the left.
77 --      XmUbARROWS_SPREAD_OUT  Label in the middle, arrows on both sides.
78 --
79 --    The back arrow is always placed left of the forward arrow.
80 --    Type:    unsigned char
81 --    Default: XmUbARROWS_SPREAD_OUT
82 --
83 --  XmNlabelString             CSG
84 --      XmCXmString
85 --    The string to be shown in the label. If none is given, it will be the
86 --    name of the label widget. The string is copied internally. A copy will
87 --    be returned by XtGetValues.
88 --    Type:    XmString
89 --    Default: NULL
90 --
91 --  XmNmarginHeight            CSG
92 --      XmCMarginHeight
93 --    The margin used at the top and the bottom of the widget.
94 --    Type:    Dimension
95 --    Default: 0
96 --
97 --  XmNmarginWidth             CSG
98 --      XmCMarginWidth
99 --    The margin used at the left and right ends of the widget.
100 --    Type:    Dimension
101 --    Default: 0
102 --
103 --  XmNspacing                 CSG
104 --      XmCSpacing
105 --    The space between the different components.
106 --    Type:    Dimension
107 --    Default: 2
108 --
109 ----------------------------------------------------------------------------*/
110 
111 /*----------------------------------------------------------------------------
112 --  Macro definitions
113 ----------------------------------------------------------------------------*/
114 
115 #define XmUbNalArrowOrientation   "alArrowOrientation"
116 #define XmUbNalArrowPlacement     "alArrowPlacement"
117 #define XmUbNalRecomputeHeight    "alRecomputeHeight"
118 #define XmUbNalRecomputeWidth     "alRecomputeWidth"
119 
120 #define XmUbCAlArrowPlacement     "AlArrowPlacement"
121 #define XmUbCAlRecomputeHeight    "AlRecomputeHeight"
122 #define XmUbCAlRecomputeWidth     "AlRecomputeWidth"
123 
124 /* Arrow placement. */
125 #define XmUbARROWS_LEFT        0
126 #define XmUbARROWS_RIGHT       1
127 #define XmUbARROWS_SPREAD_OUT  2
128 
129 
130 /* Id's for children retrieval. */
131 #define XmUbAL_CHILD_LABEL          0
132 #define XmUbAL_CHILD_BACK_ARROW     1
133 #define XmUbAL_CHILD_FORWARD_ARROW  2
134 
135 #define XmUbAL_FIRST_CHILD  XmUbAL_CHILD_LABEL
136 #define XmUbAL_LAST_CHILD   XmUbAL_CHILD_FORWARD_ARROW
137 
138 /* Callback reasons. */
139 #define XmUbCR_BACK_ARROW_ACTIVATED      0
140 #define XmUbCR_FORWARD_ARROW_ACTIVATED   1
141 
142 /*----------------------------------------------------------------------------
143 --  Type declarations
144 ----------------------------------------------------------------------------*/
145 
146 /* Callback structure. */
147 
148 typedef struct {
149 
150   int      reason;
151   XEvent   *event;
152   Widget   child;
153 
154 } XmUbArrowLabelCallbackStruct;
155 
156 
157 /*
158 -- CALLBACKS
159 --
160 -- XmNactivateCallback
161 --   Called when an arrow button is pressed.
162 --
163 --   reason              XmUbCR_BACK_ARROW_ACTIVATED or
164 --                       XmUbCR_FORWARD_ARROW_ACTIVATED.
165 --   event               The button press callback event.
166 --   child               The widget id for the button that was pressed.
167 --
168 */
169 
170 
171 
172 /*----------------------------------------------------------------------------
173 --  Global definitions
174 ----------------------------------------------------------------------------*/
175 
176 /* Class record constants. */
177 extern WidgetClass xmUbArrowLabelWidgetClass;
178 
179 
180 typedef struct _XmUbArrowLabelClassRec *XmUbArrowLabelWidgetClass;
181 typedef struct _XmUbArrowLabelRec      *XmUbArrowLabelWidget;
182 
183 
184 /*----------------------------------------------------------------------------
185 --  Function prototypes
186 ----------------------------------------------------------------------------*/
187 
188 Widget
189   XmUbCreateArrowLabel( Widget    parent,
190                         String    name,
191                         ArgList   arglist,
192                         Cardinal  argcount );
193 
194 Widget
195   XmUbArrowLabelGetChild( Widget  widget,
196                           int     child );
197 
198 
199 #endif
200 
201 
202