File: LayoutP.h

package info (click to toggle)
gridengine 6.2-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 51,532 kB
  • ctags: 51,172
  • sloc: ansic: 418,155; java: 37,080; sh: 22,593; jsp: 7,699; makefile: 5,292; csh: 4,244; xml: 2,901; cpp: 2,086; perl: 1,895; tcl: 1,188; lisp: 669; ruby: 642; yacc: 393; lex: 266
file content (214 lines) | stat: -rw-r--r-- 6,011 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/* 
 * Motif Tools Library, Version 3.1
 * $Id$
 * 
 * Written by David Flanagan.
 * Copyright (c) 1992-2001 by David Flanagan.
 * All Rights Reserved.  See the file COPYRIGHT for details.
 * This is open source software.  See the file LICENSE for details.
 * There is no warranty for this software.  See NO_WARRANTY for details.
 *
 * $Log$
 * Revision 1.1.1.1  2001/07/18 11:06:02  root
 * Initial checkin.
 *
 * Revision 1.2  2001/06/12 16:25:28  andre
 * *** empty log message ***
 *
 *
 */

#ifndef _XmtLayoutP_h
#define _XmtLayoutP_h
    
#include <Xm/BulletinBP.h>
#include <Xmt/Layout.h>
#include <Xmt/Lexer.h>

typedef enum {
    XmtLayoutRow,  
    XmtLayoutCol,  
    XmtLayoutChild,
    XmtLayoutSpace,
    XmtLayoutString,
    XmtLayoutPixmap,
    XmtLayoutVSep,
    XmtLayoutHSep
} XmtLayoutType;

typedef void (*XmtLayoutParserProc)(
#if NeedFunctionPrototypes
    XmtLayoutWidget, String
#endif
);

typedef XtPointer (*XmtLayoutLookupTypeProc)(
#if NeedFunctionPrototypes
    StringConst
#endif	
);

typedef Widget (*XmtLayoutCreateProc)(
#if NeedFunctionPrototypes				      
    StringConst, XtPointer, Widget, ArgList, Cardinal
#endif
);

/*
 * The Layout class part structure contains three procedure pointers.
 * These are optional methods; the fields should be statically
 * initialzed to NULL, and can be dynamically set with special
 * registration procedures.  The reason that they are not statically
 * initialzed is to avoid linking in code that is not always used.
 */
typedef struct {
    XmtLayoutParserProc parser; 
    XmtLayoutLookupTypeProc lookup_type_proc;
    XmtLayoutCreateProc create_proc;
    XtPointer extension;
} XmtLayoutClassPart;

typedef struct _XmtLayoutClassRec {
    CoreClassPart core_class;
    CompositeClassPart composite_class;
    ConstraintClassPart	constraint_class;
    XmManagerClassPart	manager_class;
    XmBulletinBoardClassPart bulletin_class;
    XmtLayoutClassPart layout_class;
} XmtLayoutClassRec;

externalref XmtLayoutClassRec xmtLayoutClassRec;

typedef struct {
    /* resources */
    String layout;
    XFontStruct *font;
    XmFontList font_list;
#if XmVersion >= 2000
    XmRenderTable render_table;
#endif
    Dimension default_spacing;
    unsigned char orientation;
    Boolean debug_layout;
    /* private state */
    GC gc, grey_gc;
    double pixpermm;  /* pixels per mm; for resolution independence */
    double pixperem;  /* pixels per em; for font size independence */
    Boolean needs_layout;
    short layout_disabled;
    Widget toplevel;
    struct _XmtLayoutInfo *widget_info;
    XmtLexer lexer;
    Boolean in_parser;
    Boolean geometry_okay;
} XmtLayoutPart;

typedef struct _XmtLayoutRec {
    CorePart core;
    CompositePart composite;
    ConstraintPart constraint;
    XmManagerPart manager;
    XmBulletinBoardPart	bulletin_board;
    XmtLayoutPart layout;
} XmtLayoutRec;

typedef struct {
    /* resources */
    Dimension width;
    Dimension height;
    Dimension stretchability;
    Dimension shrinkability;
    Boolean allow_resize;
    Boolean sensitive;
    unsigned char justification;
    unsigned char margin_width;
    unsigned char margin_height;
    unsigned char frame_type;
    unsigned char frame_line_type;
    unsigned char frame_position;
    unsigned char frame_margin;
    unsigned char frame_thickness;
    unsigned char caption_position;
    unsigned char caption_justification;
    unsigned char caption_alignment;
    unsigned char caption_margin;
    XmString caption;
    Widget in;         /* the row or column we're in */
    Position position; /* and the position we're at */
    Widget after;      /* or the object we're after  in the layout*/
    Widget before;     /* or the object we're before in the layout */
    /* private */
    Widget first_child;       /* the first item in a row or col */
    Dimension pref_w, pref_h;
    Dimension caption_width, caption_height;
    unsigned char type;
    Boolean dont_copy_caption;
} XmtLayoutConstraintsPart;

typedef struct {
    XmManagerConstraintPart  manager;
    XmtLayoutConstraintsPart layout;
} XmtLayoutConstraintsRec, *XmtLayoutConstraints;

/*
 * This structure is used to store information about children widgets
 * that is parsed from the layout string before those widgets are
 * created.  The flags field indicates which fields in the constraints
 * record are valid.
 */
typedef struct _XmtLayoutInfo {
    XrmQuark name;
    XmtLayoutConstraintsPart constraints;
    XmtLayoutConstraintsPart dummy_constraints;
    struct _XmtLayoutInfo *next;
} XmtLayoutInfo;

#define Constraint(obj, field) \
    (((XmtLayoutConstraints)(((Object)obj)->object.constraints))->layout.field)

#define LayoutConstraintsRec(obj) \
    ((XmtLayoutConstraintsPart *)\
    &(((XmtLayoutConstraints)(((Object)obj)->object.constraints))->layout))

#define LayoutConstraints(obj) \
    (((XmtLayoutConstraints)(((Object)obj)->object.constraints))->layout)

#define ForEachChild(w, child)\
    for(i=0;\
	(i < w->composite.num_children) && (child=lw->composite.children[i]);\
	i++)

#define ForEachItem(b,i)\
    for(i = LayoutConstraints(b).first_child;\
	i;\
	i = LayoutConstraints(i).before)

/* a very big number */
/* but not so big that we're likely to overflow an unsigned short */
#define INFINITY 5000

#define XmtLAYOUT_DEFAULT_STRETCHABILITY 10
#define XmtLAYOUT_DEFAULT_SHRINKABILITY 10

/* a very gross hack */
#define XmtIsLayoutGadget(w)\
    XtIsSubclass((w), xmtLayoutGadgetClass)
#define XmtUnsetRectObj(w)\
    ((w)->core.widget_class->core_class.class_inited &= ~0x2)
#define XmtSetRectObj(w)\
    ((w)->core.widget_class->core_class.class_inited |= 0x2)

#undef XtIsManaged  /* XmP.h defines this to check for RectObj */
#define XtIsManaged(w)\
    ((XtIsRectObj(w) || XmtIsLayoutGadget(w)) && (w)->core.managed)


_XFUNCPROTOBEGIN
#if NeedFunctionPrototypes
extern void _XmtLayoutChildren(XmtLayoutWidget, XmtWideBoolean);
#else
extern void _XmtLayoutChildren();
#endif
_XFUNCPROTOEND

#endif /* _XmtLayoutP_h */