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 _XmHierarchyP_h 26 #define _XmHierarchyP_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/ExtP.h> 37 #include <Xm/Hierarchy.h> 38 39 /************************************************************ 40 * TYPEDEFS AND DEFINES 41 *************************************************************/ 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 #define IS_MAPPED (1L << 1) 48 #define IS_COMPRESSED (1L << 2) 49 #define PARENT_GONE (1L << 3) 50 #define IS_SELECTED (1L << 4) 51 52 /************************************************************ 53 * MACROS 54 *************************************************************/ 55 56 /************************************************************ 57 * GLOBAL DECLARATIONS 58 *************************************************************/ 59 60 typedef struct _HierNodeInfo { 61 /* 62 * Public (Resource) data. 63 */ 64 65 XmHierarchyNodeState state; /* State of the node. */ 66 Widget parent; /* parent of this child. */ 67 Widget insert_before; /* Sibling to insert this node before; 68 NULL will place it at the end. */ 69 Pixmap open_folder, close_folder; /* Images for open/close buttons. */ 70 71 /* 72 * Private data. 73 */ 74 75 Widget widget; /* Back pointer to this node's widget. */ 76 Widget open_close_button; /* The open or close button. */ 77 78 struct _HierarchyConstraintRec ** children; /* norm children. */ 79 Cardinal num_children; /* number of each type of children. */ 80 Cardinal alloc_attrs, alloc; /* amount of allocated space for each */ 81 82 unsigned char status; /* 8 status bits. */ 83 } HierNodeInfo; 84 85 typedef struct _HierarchyConstraintRec { 86 XmManagerConstraintPart manager; 87 HierNodeInfo hierarchy; 88 } HierarchyConstraintRec, XmHierarchyConstraintRec, *HierarchyConstraints; 89 90 typedef void (*XmHierarchyNodeProc)(HierarchyConstraints); 91 typedef void (*XmHierarchyExtraNodeProc)(Widget, HierarchyConstraints); 92 typedef void (*XmHierarchyBuildTableProc)(Widget, 93 HierarchyConstraints, Cardinal *); 94 typedef void (*XmHierarchyResetButtonProc)(Widget, HierarchyConstraints); 95 96 typedef struct { 97 /* Class function for changing node state. */ 98 XmHierarchyNodeProc change_node_state; 99 /* map or unmap a given node. */ 100 XmHierarchyNodeProc map_node; 101 XmHierarchyNodeProc unmap_node; 102 /* Unmaps all the extra nodes. */ 103 XmHierarchyExtraNodeProc unmap_all_extra_nodes; 104 /* Builds the node table. */ 105 XmHierarchyBuildTableProc build_node_table; 106 /* Correctly sets the state of the open/close button. */ 107 XmHierarchyResetButtonProc reset_open_close_button; 108 /* Toggles state of a node. */ 109 XtCallbackProc toggle_node_state; 110 /* Just in case we need it later. */ 111 XtPointer extension; 112 } HierarchyClassPart; 113 114 typedef struct _XmHierarchyClassRec { 115 CoreClassPart core_class; 116 CompositeClassPart composite_class; 117 ConstraintClassPart constraint_class; 118 XmManagerClassPart manager_class; 119 HierarchyClassPart hierarchy_class; 120 } XmHierarchyClassRec; 121 122 externalref XmHierarchyClassRec xmHierarchyClassRec; 123 124 typedef struct _HierarchyPart { 125 /* resources */ 126 127 Boolean auto_close; /* Auto-close children when parent is closed?*/ 128 Boolean refigure_mode; /* Do refigures? */ 129 130 Dimension h_margin; /* The horizontal margin. */ 131 Dimension v_margin; /* The vertical margin. */ 132 Pixmap open_folder, close_folder; /* Images for open/close buttons. */ 133 134 XtCallbackList node_state_callback; /* Called when the node button is 135 clicked */ 136 XtCallbackList node_state_changed_callback; /* Called when the node state 137 changes */ 138 XtCallbackList node_state_beg_end_callback; /* Called when beginning 139 or ending a set of node 140 state changes */ 141 142 /* private state */ 143 144 HierarchyConstraintRec ** node_table; 145 HierarchyConstraints top_node; 146 Cardinal num_nodes, alloc_nodes; 147 Pixmap def_open_folder, def_close_folder; /* Default folder button Images*/ 148 149 XtWorkProcId work_proc_id; /* work proc id for the move nodes wp */ 150 } HierarchyPart; 151 152 typedef struct _XmHierarchyRec { 153 CorePart core; 154 CompositePart composite; 155 ConstraintPart constraint; 156 XmManagerPart manager; 157 HierarchyPart hierarchy; 158 } XmHierarchyRec; 159 160 /* 161 * These are necessary because the XmResolvePartOffset macros assume a 162 * certain naming convention 163 */ 164 typedef HierarchyPart XmHierarchyPart; 165 typedef HierNodeInfo XmHierarchyConstraintPart; 166 167 #define XmHierarchy_auto_close(w) (((XmHierarchyWidget)(w))->hierarchy.auto_close) 168 #define XmHierarchy_refigure_mode(w) (((XmHierarchyWidget)(w))->hierarchy.refigure_mode) 169 #define XmHierarchy_h_margin(w) (((XmHierarchyWidget)(w))->hierarchy.h_margin) 170 #define XmHierarchy_v_margin(w) (((XmHierarchyWidget)(w))->hierarchy.v_margin) 171 #define XmHierarchy_open_folder(w) (((XmHierarchyWidget)(w))->hierarchy.open_folder) 172 #define XmHierarchy_close_folder(w) (((XmHierarchyWidget)(w))->hierarchy.close_folder) 173 #define XmHierarchy_node_state_callback(w) (((XmHierarchyWidget)(w))->hierarchy.node_state_callback) 174 #define XmHierarchy_node_state_changed_callback(w) (((XmHierarchyWidget)(w))->hierarchy.node_state_changed_callback) 175 #define XmHierarchy_node_state_beg_end_callback(w) (((XmHierarchyWidget)(w))->hierarchy.node_state_beg_end_callback) 176 #define XmHierarchy_node_table(w) (((XmHierarchyWidget)(w))->hierarchy.node_table) 177 #define XmHierarchy_top_node(w) (((XmHierarchyWidget)(w))->hierarchy.top_node) 178 #define XmHierarchy_num_nodes(w) (((XmHierarchyWidget)(w))->hierarchy.num_nodes) 179 #define XmHierarchy_alloc_nodes(w) (((XmHierarchyWidget)(w))->hierarchy.alloc_nodes) 180 #define XmHierarchy_def_open_folder(w) (((XmHierarchyWidget)(w))->hierarchy.def_open_folder) 181 #define XmHierarchy_def_close_folder(w) (((XmHierarchyWidget)(w))->hierarchy.def_close_folder) 182 #define XmHierarchy_work_proc_id(w) (((XmHierarchyWidget)(w))->hierarchy.work_proc_id) 183 184 #define XmHierarchyC_state(constraints) ((constraints)->hierarchy.state) 185 #define XmHierarchyC_parent(constraints) ((constraints)->hierarchy.parent) 186 #define XmHierarchyC_insert_before(constraints) ((constraints)->hierarchy.insert_before) 187 #define XmHierarchyC_open_folder(constraints) ((constraints)->hierarchy.open_folder) 188 #define XmHierarchyC_close_folder(constraints) ((constraints)->hierarchy.close_folder) 189 #define XmHierarchyC_widget(constraints) ((constraints)->hierarchy.widget) 190 #define XmHierarchyC_open_close_button(constraints) ((constraints)->hierarchy.open_close_button) 191 #define XmHierarchyC_children(constraints) ((constraints)->hierarchy.children) 192 #define XmHierarchyC_num_children(constraints) ((constraints)->hierarchy.num_children) 193 #define XmHierarchyC_alloc_attrs(constraints) ((constraints)->hierarchy.alloc_attrs) 194 #define XmHierarchyC_alloc(constraints) ((constraints)->hierarchy.alloc) 195 #define XmHierarchyC_status(constraints) ((constraints)->hierarchy.status) 196 197 #define XtInheritChangeNodeState ((XmHierarchyNodeProc)_XtInherit) 198 #define XtInheritUnmapAllExtraNodes ((XmHierarchyExtraNodeProc)_XtInherit) 199 #define XtInheritUnmapNode ((XmHierarchyNodeProc)_XtInherit) 200 #define XtInheritMapNode ((XmHierarchyNodeProc)_XtInherit) 201 #define XtInheritBuildNodeTable ((XmHierarchyBuildTableProc)_XtInherit) 202 #define XtInheritResetOpenCloseButton ((XmHierarchyResetButtonProc)_XtInherit) 203 #define XtInheritToggleNodeState ((XtCallbackProc)_XtInherit) 204 205 /************************************************************ 206 * EXTERNAL DECLARATIONS 207 *************************************************************/ 208 209 210 /************************************************************ 211 * STATIC DECLARATIONS 212 *************************************************************/ 213 214 #ifdef __cplusplus 215 } /* Closes scope of 'extern "C"' declaration */ 216 #endif 217 218 #if defined(VMS) || defined(__VMS) 219 #include <X11/apienvrst.h> 220 #endif 221 222 #endif /* _HierarchyP_h */ 223