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  */
24 
25 #ifndef _XmIconBoxP_h
26 #define _XmIconBoxP_h
27 
28 #if defined(VMS) || defined(__VMS)
29 #include <X11/apienvset.h>
30 #endif
31 
32 /************************************************************
33 *	INCLUDE FILES
34 *************************************************************/
35 #include <Xm/ManagerP.h>
36 #include <Xm/IconBox.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /************************************************************
43 *	TYPEDEFS AND DEFINES
44 *************************************************************/
45 
46 
47 /*
48  * Hack to get around naming conventions.  The XmConstraintPartOffset macro
49  * requires our contraint part structure to have this name
50  */
51 #define XmIconBoxConstraintPart IconInfo
52 
53 /*
54  * Access macros for widget instance fields
55  */
56 #define XmIconBox_min_v_cells(w)	(((XmIconBoxWidget)(w))->box.min_v_cells)
57 #define XmIconBox_min_h_cells(w)	(((XmIconBoxWidget)(w))->box.min_h_cells)
58 #define XmIconBox_v_margin(w)	(((XmIconBoxWidget)(w))->box.v_margin)
59 #define XmIconBox_h_margin(w)	(((XmIconBoxWidget)(w))->box.h_margin)
60 #define XmIconBox_min_cell_width(w)  (((XmIconBoxWidget)(w))->box.min_cell_width)
61 #define XmIconBox_min_cell_height(w) (((XmIconBoxWidget)(w))->box.min_cell_height)
62 #define XmIconBox_cell_width(w)	(((XmIconBoxWidget)(w))->box.cell_width)
63 #define XmIconBox_cell_height(w)	(((XmIconBoxWidget)(w))->box.cell_height)
64 
65 #define XmIconBoxC_cell_x(w)      (((XmIconBoxConstraintsRec*)((w)->core.constraints))->icon.cell_x)
66 #define XmIconBoxC_cell_y(w)      (((XmIconBoxConstraintsRec*)((w)->core.constraints))->icon.cell_y)
67 #define XmIconBoxC_pref_width(w)  (((XmIconBoxConstraintsRec*)((w)->core.constraints))->icon.pref_width)
68 #define XmIconBoxC_pref_height(w) (((XmIconBoxConstraintsRec*)((w)->core.constraints))->icon.pref_height)
69 
70 /************************************************************
71 *	MACROS
72 *************************************************************/
73 
74 /************************************************************
75 *	GLOBAL DECLARATIONS
76 *************************************************************/
77 
78 typedef struct {
79     XtPointer extension;	/* Just in case we need it later. */
80 } XmIconBoxClassPart;
81 
82 typedef struct _XmIconBoxClassRec {
83     CoreClassPart		core_class;
84     CompositeClassPart		composite_class;
85     ConstraintClassPart		constraint_class;
86     XmManagerClassPart		manager_class;
87     XmIconBoxClassPart	        box_class;
88 } XmIconBoxClassRec;
89 
90 typedef struct {
91     /* resources */
92 
93     Dimension min_v_cells;	/* Default number of cells in the vert dir. */
94     Dimension min_h_cells;	/* Default number of cells in the horiz dir. */
95     Dimension v_margin;		/* Amount of space to leave between cells */
96     Dimension h_margin;		/* and window edges. */
97     Dimension min_cell_width;	/* Minimum width of the cells. */
98     Dimension min_cell_height;	/* Minimum height of the cells. */
99 
100     /* private state */
101 
102     Dimension cell_width;	/* Width and height of all cells. */
103     Dimension cell_height;
104 
105 } XmIconBoxPart;
106 
107 
108 typedef struct _XmIconBoxRec {
109     CorePart		core;
110     CompositePart	composite;
111     ConstraintPart	constraint;
112     XmManagerPart	manager;
113     XmIconBoxPart	box;
114 } XmIconBoxRec;
115 
116 typedef struct _IconInfo {
117 
118     /*
119      * Resources.
120      */
121 
122     short cell_x;		/* X location of this icon in cell space. */
123     short cell_y;		/* Y location of this icon in cell space. */
124 
125     /*
126      * Private state.
127      */
128 
129     Dimension pref_width, pref_height; /* The preferred size of this widget. */
130 } IconInfo;
131 
132 typedef struct _XmIconBoxConstraintsRec {
133     XmManagerConstraintPart	manager;
134     IconInfo			icon;
135 } XmIconBoxConstraintsRec, *XmIconBoxConstraints;
136 
137 /************************************************************
138 *	EXTERNAL DECLARATIONS
139 *************************************************************/
140 
141 extern XmIconBoxClassRec xmIconBoxClassRec;
142 
143 /************************************************************
144 *	STATIC DECLARATIONS
145 *************************************************************/
146 
147 #ifdef __cplusplus
148 }	/* Closes scope of 'extern "C"' declaration */
149 #endif
150 
151 #if defined(VMS) || defined(__VMS)
152 #include <X11/apienvrst.h>
153 #endif
154 
155 #endif /* _XmIconBoxP_h */
156