1 /*
2  * Motif
3  *
4  * Copyright (c) 1987-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 librararies 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 #ifndef _XmTraversalI_h
24 #define _XmTraversalI_h
25 
26 #include <Xm/XmP.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 
33 #define NavigTypeIsTabGroup(navigation_type) \
34   ((navigation_type == XmTAB_GROUP) || \
35    (navigation_type == XmSTICKY_TAB_GROUP) || \
36    (navigation_type == XmEXCLUSIVE_TAB_GROUP))
37 
38 
39 typedef enum {
40     XmUnrelated,
41     XmMyAncestor,
42     XmMyDescendant,
43     XmMyCousin,
44     XmMySelf
45 } XmGeneology;
46 
47 typedef struct _XmTravGraphRec
48 {
49     union _XmTraversalNodeRec *head ;
50     Widget top ;
51     union _XmTraversalNodeRec *current ;
52     unsigned short num_entries ;
53     unsigned short num_alloc ;
54     unsigned short next_alloc ;
55     unsigned short exclusive ;
56     unsigned short tab_list_alloc ;
57     unsigned short num_tab_list ;
58     Widget *excl_tab_list ;
59 } XmTravGraphRec, * XmTravGraph ;
60 
61 
62 typedef struct _XmFocusDataRec {
63     Widget	active_tab_group;
64     Widget	focus_item;
65     Widget	old_focus_item;
66     Widget	pointer_item;
67     Widget	old_pointer_item;
68     Boolean	needToFlush;
69     XCrossingEvent lastCrossingEvent;
70     XmGeneology focalPoint;
71     unsigned char focus_policy ; /* Mirrors focus_policy resource when focus */
72     XmTravGraphRec trav_graph ;  /*   data retrieved using _XmGetFocusData().*/
73     Widget      first_focus ;
74 } XmFocusDataRec ;
75 
76 typedef enum
77 {
78   XmTAB_GRAPH_NODE, XmTAB_NODE, XmCONTROL_GRAPH_NODE, XmCONTROL_NODE
79 } XmTravGraphNodeType ;
80 
81 typedef union _XmDeferredGraphLink
82 {
83   int offset ;
84   struct _XmGraphNodeRec *link ;
85 } XmDeferredGraphLink ;
86 
87 typedef struct _XmAnyNodeRec               /* Common */
88 {
89   unsigned char type ;
90   XmNavigationType nav_type ;
91   XmDeferredGraphLink tab_parent ;
92   Widget widget ;
93   XRectangle rect ;
94   union _XmTraversalNodeRec *next ;
95   union _XmTraversalNodeRec *prev ;
96 } XmAnyNodeRec, *XmAnyNode ;
97 
98 typedef struct _XmControlNodeRec
99 {
100   XmAnyNodeRec any ;
101   union _XmTraversalNodeRec *up ;
102   union _XmTraversalNodeRec *down ;
103 } XmControlNodeRec, *XmControlNode ;
104 
105 typedef struct _XmTabNodeRec
106 {
107   XmAnyNodeRec any ;
108 } XmTabNodeRec, *XmTabNode ;
109 
110 typedef struct _XmGraphNodeRec
111 {
112   XmAnyNodeRec any ;
113   union _XmTraversalNodeRec *sub_head ;
114   union _XmTraversalNodeRec *sub_tail ;
115 } XmGraphNodeRec, *XmGraphNode ;
116 
117 typedef union _XmTraversalNodeRec
118 {
119   XmAnyNodeRec any ;
120   XmControlNodeRec control ;
121   XmTabNodeRec tab ;
122   XmGraphNodeRec graph ;
123 } XmTraversalNodeRec, *XmTraversalNode ;
124 
125 typedef struct
126 {
127   XmTraversalNode *items;
128   XmTraversalNode lead_item;
129   Cardinal num_items;
130   Cardinal max_items;
131   Position min_hint;
132   Position max_hint;
133 } XmTraversalRow;
134 
135 
136 /********    Private Function Declarations for Traversal.c    ********/
137 
138 extern XmFocusData _XmCreateFocusData( void ) ;
139 extern void _XmDestroyFocusData(
140                         XmFocusData focusData) ;
141 extern void _XmSetActiveTabGroup(
142                         XmFocusData focusData,
143                         Widget tabGroup) ;
144 extern Widget _XmGetActiveItem(
145                         Widget w) ;
146 extern void _XmNavigInitialize(
147                         Widget request,
148                         Widget new_wid,
149                         ArgList args,
150                         Cardinal *num_args) ;
151 extern Boolean _XmNavigSetValues(
152                         Widget current,
153                         Widget request,
154                         Widget new_wid,
155                         ArgList args,
156                         Cardinal *num_args) ;
157 extern void _XmNavigResize(
158                         Widget wid) ;
159 extern void _XmValidateFocus(
160                         Widget wid) ;
161 extern void _XmNavigDestroy(
162                         Widget wid) ;
163 extern Boolean _XmCallFocusMoved(
164                         Widget old,
165                         Widget new_wid,
166                         XEvent *event) ;
167 extern Boolean _XmMgrTraversal(
168                         Widget wid,
169                         XmTraversalDirection direction) ;
170 extern void _XmClearFocusPath(
171                         Widget wid) ;
172 extern Boolean _XmFocusIsHere(
173                         Widget w) ;
174 extern unsigned char _XmGetFocusPolicy(
175                         Widget w) ;
176 extern Widget _XmFindTopMostShell(
177                         Widget w) ;
178 extern void _XmFocusModelChanged(
179                         Widget wid,
180                         XtPointer client_data,
181                         XtPointer call_data) ;
182 extern XmFocusData _XmGetFocusData(
183                         Widget wid) ;
184 extern Boolean _XmComputeVisibilityRect(
185                         Widget w,
186                         XRectangle *rectPtr,
187 			Boolean include_initial_border,
188 			Boolean allow_scrolling) ;
189 extern Boolean _XmGetPointVisibility(Widget w,
190 				     int root_x,
191 				     int root_y);
192 extern void _XmSetRect(
193                         register XRectangle *rect,
194                         Widget w) ;
195 extern int _XmIntersectRect(
196                         register XRectangle *srcRectA,
197                         register Widget widget,
198                         register XRectangle *dstRect) ;
199 extern int _XmEmptyRect(
200                         register XRectangle *r) ;
201 extern void _XmClearRect(
202                         register XRectangle *r) ;
203 extern Boolean _XmIsNavigable(
204                         Widget wid) ;
205 extern void _XmWidgetFocusChange(
206                         Widget wid,
207                         XmFocusChange change) ;
208 extern Widget _XmNavigate(
209                         Widget wid,
210                         XmTraversalDirection direction) ;
211 extern void _XmSetInitialOfTabGroup(
212                         Widget tab_group,
213                         Widget init_focus) ;
214 extern void _XmResetTravGraph(
215                         Widget wid) ;
216 extern Boolean _XmShellIsExclusive(
217                         Widget wid) ;
218 extern Widget _XmGetFirstFocus(
219                         Widget wid) ;
220 
221 /********    End Private Function Declarations    ********/
222 
223 /********    Private Function Declarations for TraversalI.c    ********/
224 
225 extern XmNavigability _XmGetNavigability(
226                         Widget wid) ;
227 extern Boolean _XmIsViewable(
228                         Widget wid) ;
229 extern Widget _XmIsScrollableClipWidget(
230                         Widget work_window,
231 			Boolean scrollable,
232                         XRectangle *visRect) ;
233 extern Boolean _XmGetEffectiveView(
234                         Widget wid,
235                         XRectangle *visRect) ;
236 extern Boolean _XmIntersectionOf(
237                         register XRectangle *srcRectA,
238                         register XRectangle *srcRectB,
239                         register XRectangle *destRect) ;
240 extern XmNavigationType _XmGetNavigationType(
241                         Widget widget) ;
242 extern Widget _XmGetActiveTabGroup(
243                         Widget wid) ;
244 extern Widget _XmTraverseAway(
245                         XmTravGraph list,
246                         Widget wid,
247 #if NeedWidePrototypes
248                         int wid_is_control) ;
249 #else
250                         Boolean wid_is_control) ;
251 #endif /* NeedWidePrototypes */
252 extern Widget _XmTraverse(
253                         XmTravGraph list,
254                         XmTraversalDirection action,
255                         XmTraversalDirection *local_dir,
256                         Widget reference_wid) ;
257 extern void _XmFreeTravGraph(
258                         XmTravGraph trav_list) ;
259 extern void _XmTravGraphRemove(
260                         XmTravGraph tgraph,
261                         Widget wid) ;
262 extern void _XmTravGraphAdd(
263                         XmTravGraph tgraph,
264                         Widget wid) ;
265 extern void _XmTravGraphUpdate(
266                         XmTravGraph tgraph,
267                         Widget wid) ;
268 extern Boolean _XmNewTravGraph(
269                         XmTravGraph trav_list,
270                         Widget top_wid,
271                         Widget init_current) ;
272 extern Boolean _XmSetInitialOfTabGraph(
273                         XmTravGraph trav_graph,
274                         Widget tab_group,
275                         Widget init_focus) ;
276 extern void _XmTabListAdd(
277                         XmTravGraph graph,
278                         Widget wid) ;
279 extern void _XmTabListDelete(
280                         XmTravGraph graph,
281                         Widget wid) ;
282 
283 /********    End Private Function Declarations    ********/
284 
285 
286 #ifdef __cplusplus
287 }  /* Close scope of 'extern "C"' declaration which encloses file. */
288 #endif
289 
290 #endif /* _XmTraversalI_h */
291