1 /*
2  * (from) $XConsortium: SimpleMenP.h,v 1.12 89/12/11 15:01:39 kit Exp $
3  *
4  * Copyright (c) 1995-2009, Paul Mattes.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in the
14  *       documentation and/or other materials provided with the distribution.
15  *     * Neither the name of Paul Mattes nor his contributors may be used
16  *       to endorse or promote products derived from this software without
17  *       specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY PAUL MATTES "AS IS" AND ANY EXPRESS
20  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT,
23  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  * Copyright 1989 Massachusetts Institute of Technology
32  *
33  * Permission to use, copy, modify, distribute, and sell this software and its
34  * documentation for any purpose is hereby granted without fee, provided that
35  * the above copyright notice appear in all copies and that both that
36  * copyright notice and this permission notice appear in supporting
37  * documentation, and that the name of M.I.T. not be used in advertising or
38  * publicity pertaining to distribution of the software without specific,
39  * written prior permission.  M.I.T. makes no representations about the
40  * suitability of this software for any purpose.  It is provided "as is"
41  * without express or implied warranty.
42  *
43  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
44  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
45  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
46  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
47  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
48  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
49  */
50 
51 /*
52  * ComplexMenuP.h - Private Header file for ComplexMenu widget.
53  * (from) SimpleMenuP.h - Private Header file for SimpleMenu widget.
54  *
55  * Date:    April 3, 1989
56  *
57  * By:      Chris D. Peterson
58  *          MIT X Consortium
59  *          kit@expo.lcs.mit.edu
60  */
61 
62 #ifndef _ComplexMenuP_h
63 #define _ComplexMenuP_h
64 
65 #include "CmplxMenu.h"
66 #include "CmeP.h"
67 #include <X11/ShellP.h>
68 
69 #define ForAllChildren(smw, childP) \
70   for ( (childP) = (CmeObject *) (smw)->composite.children ; \
71         (childP) < (CmeObject *) ( (smw)->composite.children + \
72 				 (smw)->composite.num_children ) ; \
73         (childP)++ )
74 
75 typedef struct {
76     XtPointer extension;		/* For future needs. */
77 } ComplexMenuClassPart;
78 
79 typedef struct _ComplexMenuClassRec {
80   CoreClassPart	          core_class;
81   CompositeClassPart      composite_class;
82   ShellClassPart          shell_class;
83   OverrideShellClassPart  override_shell_class;
84   ComplexMenuClassPart	  complexMenu_class;
85 } ComplexMenuClassRec;
86 
87 extern ComplexMenuClassRec complexMenuClassRec;
88 
89 typedef struct _ComplexMenuPart {
90 
91   /* resources */
92 
93   String       label_string;	/* The string for the label or NULL. */
94   CmeObject   label;		/* If label_string is non-NULL then this is
95 				   the label widget. */
96   WidgetClass  label_class;	/* Widget Class of the menu label object. */
97 
98   Dimension    top_margin;	/* Top and bottom margins. */
99   Dimension    bottom_margin;
100   Dimension    row_height;	/* height of each row (menu entry) */
101 
102   Cursor       cursor;		/* The menu's cursor. */
103   CmeObject popup_entry;	/* The entry to position the cursor on for
104 				   when using XawPositionComplexMenu. */
105   Boolean      menu_on_screen;	/* Force the menus to be fully on the screen.*/
106   int          backing_store;	/* What type of backing store to use. */
107 
108   /* private state */
109 
110   Boolean recursive_set_values;	/* contain a possible infinite loop. */
111 
112   Boolean menu_width;		/* If true then force width to remain
113 				   core.width */
114   Boolean menu_height;		/* Just like menu_width, but for height. */
115 
116   CmeObject entry_set;		/* The entry that is currently set or
117 				   highlighted. */
118   CmeObject prev_entry;		/* The entry that was previously set or
119 				   highlighted. */
120   Widget parent;		/* If non-NULL, the widget that popped
121 				   this menu up as a pullright. */
122   Widget deferred_notify;	/* If non-NULL, the widget (from a subordinate
123 				   pullright menu) to notify on exit. */
124 } ComplexMenuPart;
125 
126 typedef struct _ComplexMenuRec {
127   CorePart		core;
128   CompositePart 	composite;
129   ShellPart 	        shell;
130   OverrideShellPart     override;
131   ComplexMenuPart	complex_menu;
132 } ComplexMenuRec;
133 
134 #endif /* _ComplexMenuP_h */
135