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 _XmRowColumnP_h 24 #define _XmRowColumnP_h 25 26 #include <Xm/RowColumn.h> 27 #include <Xm/ManagerP.h> 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 /* Button Event Status Record for popup verification at manage time */ 34 typedef struct _XmButtonEventStatusRec 35 { 36 Time time; 37 Boolean verified; 38 Boolean waiting_to_be_managed; 39 XButtonEvent event; 40 } XmButtonEventStatusRec; 41 42 /* replay info rec - last menu that was posted before event replay */ 43 typedef struct _XmReplayInfoRec 44 { 45 Time time; 46 Widget toplevel_menu; 47 } XmReplayInfoRec; 48 49 typedef struct _XmMenuFocusRec 50 { 51 Widget oldWidget; 52 Window oldFocus; 53 int oldRevert; 54 Time oldTime; 55 } XmMenuFocusRec; 56 57 /* Menu State is per screen */ 58 typedef struct _XmMenuStateRec 59 { 60 Widget RC_LastSelectToplevel; 61 XmButtonEventStatusRec RC_ButtonEventStatus; 62 XmReplayInfoRec RC_ReplayInfo; 63 /* 64 * needed for funky menubar mode so that the traversal can be restored 65 * to the correct highlighted item when we are done. 66 */ 67 Widget RC_activeItem; 68 XmMenuFocusRec RC_menuFocus; 69 /* 70 * A workaround is provided to allow applications to get insensitive 71 * menu items. This is useful for context "sensitive-shared-tear off- 72 * accelerated" menu items. Accessed via internal (for now) function, 73 * _XmAllowAcceleratedInsensitiveUmanagedMenuItems(). 74 */ 75 Boolean RC_allowAcceleratedInsensitiveUnmanagedMenuItems; 76 Time MS_LastManagedMenuTime; 77 Boolean MU_InDragMode; 78 Widget MU_CurrentMenuChild; 79 Boolean MU_InPMMode; 80 } XmMenuStateRec, *XmMenuState; 81 82 83 typedef struct _XmRCKidGeometryRec 84 { 85 Widget kid; 86 XtWidgetGeometry box; 87 Dimension margin_top; 88 Dimension margin_bottom; 89 Dimension baseline; 90 } XmRCKidGeometryRec, *XmRCKidGeometry; 91 92 /* The RowColumn instance record */ 93 94 typedef struct _XmRowColumnPart 95 { 96 Dimension margin_height; /* margin around inside of widget */ 97 Dimension margin_width; 98 99 100 Dimension spacing; /* pixels between entries */ 101 Dimension entry_border; /* size of entry borders */ 102 103 /* next only used w/ menubars */ 104 105 Widget help_pushbutton; /* ptr to help pushbutton widget */ 106 107 Widget cascadeBtn; /* if this menu is pulled down by a */ 108 /* pulldown widget this will point */ 109 /* at the pulldown. needed to go */ 110 /* up the cascade */ 111 112 /* next two only used w/ option menus */ 113 /* they are really only temporary */ 114 /* since the data is passed off to */ 115 /* the pulldown widget which is */ 116 /* automatically built */ 117 118 XmString option_label; /* label for option menu pulldown */ 119 120 Widget option_submenu; /* which submenu to pulldown */ 121 122 123 XmRCKidGeometry boxes; /* when doing menu layouts is an */ 124 /* array of geo req's to make it easy */ 125 126 WidgetClass entry_class; /* if homogeneous, what class */ 127 128 XtCallbackList entry_callback; /* a child fired off */ 129 XtCallbackList map_callback; /* about to be mapped call back */ 130 XtCallbackList unmap_callback; /* about to be unmapped call back */ 131 132 Widget memory_subwidget; /* id of last subwidget that */ 133 /* fired off. Recorded by the */ 134 /* entry_fired proc, can be set too */ 135 /* this causes mouse/muscle memory */ 136 /* to also be reset */ 137 138 short num_columns; /* if columnar packing this is how */ 139 /* many columns to use */ 140 141 String menuPost; /* a translation for posting popups */ 142 unsigned int postButton; /* active mouse button */ 143 int postEventType; /* active mouse event type */ 144 unsigned int postModifiers; /* active mouse modifier */ 145 146 String menu_accelerator; 147 KeySym mnemonic; 148 XmStringCharSet mnemonicCharSet; 149 150 unsigned char entry_alignment; /* type of label alignment */ 151 /* our children should have */ 152 153 /* next two are layout, Tight is the */ 154 /* standard menubar packing. Columns */ 155 /* is radio box style, orientation */ 156 /* determines if it is column or row */ 157 /* major, Vert = column major */ 158 159 unsigned char packing; /* entry packing (layout) style */ 160 161 unsigned char type; /* temporary: diff between menu/bar */ 162 163 unsigned char orientation; /* horizontal or vertical */ 164 165 /* next two indicate how the widget */ 166 /* responds to size changes if there */ 167 /* is no geo mgr. If true then the */ 168 /* dimension is never changed. Set */ 169 /* to true if dimension is spec'd */ 170 /* at create time */ 171 172 Boolean armed; /* controls whether pulldowns work */ 173 /* or not, button down in any part of */ 174 /* the menubar arms it, this is a bit field */ 175 /* used for other internal flags, see macros */ 176 177 /* next is only valid for popup menus */ 178 179 Boolean adjust_margin; /* T/F, indicating if we should force */ 180 /* all subwidgets to have similar */ 181 /* margins */ 182 183 Boolean adjust_last; /* Indicates whether or not the last row */ 184 /* row or column should be stretched to */ 185 /* the edge of the row_column widget. */ 186 187 Boolean do_alignment; /* T/F, do we force alignment on all */ 188 /* our children */ 189 190 Boolean radio; /* T/F, do we do the toggle button */ 191 /* 'only-one-down' enforcement */ 192 193 Boolean radio_one; /* T/F, must have one radio button */ 194 /* set to on */ 195 196 197 Boolean homogeneous; /* T/F, do we only allow a single */ 198 /* class of children */ 199 200 Boolean resize_width; 201 Boolean resize_height; 202 203 XtEnum popup_enabled; 204 205 Dimension old_width; /* save the old width, etc to use */ 206 Dimension old_height; /* at resize time since it now has */ 207 Dimension old_shadow_thickness; /* NW gravity */ 208 209 Widget * postFromList; /* list for sharing menupanes */ 210 int postFromCount; /* count of the list */ 211 int postFromListSize; /* size of the malloc'ed list */ 212 213 Widget lastSelectToplevel; /* returned in XmGetPostedFromWidget*/ 214 Widget popupPosted; /* popup submenu currently posted */ 215 216 unsigned char oldFocusPolicy; /* save when menus begin traversal */ 217 218 /***************** 1.2 ***************/ 219 unsigned char TearOffModel; /* enable/disable flag */ 220 Widget ParentShell; /* Save the parent shell when torn */ 221 Widget tear_off_control; 222 Boolean to_state; /* tear off state */ 223 /* tear off activate/deactivate callbacks */ 224 XtCallbackList tear_off_activated_callback; 225 XtCallbackList tear_off_deactivated_callback; 226 Widget tear_off_lastSelectToplevel; 227 Widget tear_off_focus_item; /* when tear off is inactive */ 228 229 unsigned char entry_vertical_alignment; 230 unsigned char popup_menu_click; 231 XtWorkProcId popup_workproc; 232 XmString tear_off_title; 233 } XmRowColumnPart; 234 235 236 /* Full instance record declaration */ 237 238 typedef struct _XmRowColumnRec 239 { 240 CorePart core; 241 CompositePart composite; 242 ConstraintPart constraint; 243 XmManagerPart manager; 244 XmRowColumnPart row_column; 245 } XmRowColumnRec; 246 247 typedef struct _XmRowColumnWidgetRec /* OBSOLETE (for compatibility only).*/ 248 { 249 CorePart core; 250 CompositePart composite; 251 ConstraintPart constraint; 252 XmManagerPart manager; 253 XmRowColumnPart row_column; 254 } XmRowColumnWidgetRec; 255 256 257 258 /* RowColumn class structure */ 259 260 typedef struct _XmRowColumnClassPart 261 { 262 XmMenuProc menuProcedures; /* proc to interface with menu widgets */ 263 XtActionProc armAndActivate; /* proc triggered by acclerator */ 264 XmMenuTraversalProc traversalHandler;/* proc to handle menu traversal */ 265 XtPointer extension; /* Pointer to extension record */ 266 } XmRowColumnClassPart; 267 268 269 270 typedef struct _XmRowColumnClassRec 271 { 272 CoreClassPart core_class; 273 CompositeClassPart composite_class; 274 ConstraintClassPart constraint_class; 275 XmManagerClassPart manager_class; 276 XmRowColumnClassPart row_column_class; 277 } XmRowColumnClassRec, *XmRowColumnClass; 278 279 externalref XmRowColumnClassRec xmRowColumnClassRec; 280 281 282 283 /* Constraint Definition */ 284 285 /* No constraint resources */ 286 287 typedef struct _XmRowColumnConstraintPart 288 { 289 Boolean was_managed; 290 Dimension margin_top; 291 Dimension margin_bottom; 292 Dimension baseline; 293 short position_index; 294 } XmRowColumnConstraintPart; 295 296 typedef struct _XmRowColumnConstraintRec 297 { 298 XmManagerConstraintPart manager; 299 XmRowColumnConstraintPart row_column; 300 } XmRowColumnConstraintRec; 301 302 303 /* Access macros */ 304 305 #define XmRC_ARMED_BIT (1 << 0) 306 #define XmRC_BEING_ARMED_BIT (1 << 1) /* bits in menu's armed byte */ 307 #define XmRC_EXPOSE_BIT (1 << 2) /* used in both menu and */ 308 #define XmRC_WINDOW_MOVED_BIT (1 << 3) /* popup menu, careful */ 309 #define XmRC_WIDGET_MOVED_BIT (1 << 4) 310 #define XmRC_POPPING_DOWN_BIT (1 << 5) 311 #define XmRC_FROM_RESIZE_BIT (1 << 6) 312 313 #define RC_IsArmed(m) (((XmRowColumnWidget)(m))->row_column.armed & XmRC_ARMED_BIT) 314 #define RC_BeingArmed(m) (((XmRowColumnWidget)(m))->row_column.armed & XmRC_BEING_ARMED_BIT) 315 #define RC_DoExpose(m) (((XmRowColumnWidget)(m))->row_column.armed & XmRC_EXPOSE_BIT) 316 #define RC_WidgetHasMoved(m) (((XmRowColumnWidget)(m))->row_column.armed & XmRC_WIDGET_MOVED_BIT) 317 #define RC_WindowHasMoved(m) (((XmRowColumnWidget)(m))->row_column.armed & XmRC_WINDOW_MOVED_BIT) 318 #define RC_PoppingDown(m) (((XmRowColumnWidget)(m))->row_column.armed & XmRC_POPPING_DOWN_BIT) 319 #define RC_FromResize(m) (((XmRowColumnWidget)(m))->row_column.armed & XmRC_FROM_RESIZE_BIT) 320 321 322 #define RC_SetBit(byte,bit,v) byte = (byte & (~bit)) | (v ? bit : 0) 323 324 #define RC_SetArmed(m,v) RC_SetBit (((XmRowColumnWidget)(m))->row_column.armed, XmRC_ARMED_BIT, v) 325 #define RC_SetBeingArmed(m,v) RC_SetBit (((XmRowColumnWidget)(m))->row_column.armed, XmRC_BEING_ARMED_BIT, v) 326 #define RC_SetExpose(m,v) RC_SetBit (((XmRowColumnWidget)(m))->row_column.armed, XmRC_EXPOSE_BIT, v) 327 #define RC_SetWidgetMoved(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.armed, XmRC_WIDGET_MOVED_BIT,v) 328 #define RC_SetWindowMoved(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.armed, XmRC_WINDOW_MOVED_BIT,v) 329 #define RC_SetPoppingDown(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.armed, XmRC_POPPING_DOWN_BIT,v) 330 #define RC_SetFromResize(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.armed, XmRC_FROM_RESIZE_BIT,v) 331 332 #define RC_MarginW(m) (((XmRowColumnWidget)(m))->row_column.margin_width) 333 #define RC_MarginH(m) (((XmRowColumnWidget)(m))->row_column.margin_height) 334 335 #define RC_Entry_cb(m) (((XmRowColumnWidget)(m))->row_column.entry_callback) 336 #define RC_Map_cb(m) (((XmRowColumnWidget)(m))->row_column.map_callback) 337 #define RC_Unmap_cb(m) (((XmRowColumnWidget)(m))->row_column.unmap_callback) 338 339 #define RC_Orientation(m) (((XmRowColumnWidget)(m))->row_column.orientation) 340 #define RC_Spacing(m) (((XmRowColumnWidget)(m))->row_column.spacing) 341 #define RC_EntryBorder(m) (((XmRowColumnWidget)(m))->row_column.entry_border) 342 #define RC_HelpPb(m) (((XmRowColumnWidget)(m))->row_column.help_pushbutton) 343 #define RC_DoMarginAdjust(m) (((XmRowColumnWidget)(m))->row_column.adjust_margin) 344 #define RC_EntryAlignment(m) (((XmRowColumnWidget)(m))->row_column.entry_alignment) 345 #define RC_EntryVerticalAlignment(m) (((XmRowColumnWidget)(m))->row_column.entry_vertical_alignment) 346 #define RC_Packing(m) (((XmRowColumnWidget)(m))->row_column.packing) 347 #define RC_NCol(m) (((XmRowColumnWidget)(m))->row_column.num_columns) 348 #define RC_AdjLast(m) (((XmRowColumnWidget)(m))->row_column.adjust_last) 349 #define RC_AdjMargin(m) (((XmRowColumnWidget)(m))->row_column.adjust_margin) 350 #define RC_MemWidget(m) (((XmRowColumnWidget)(m))->row_column.memory_subwidget) 351 #define RC_CascadeBtn(m) (((XmRowColumnWidget)(m))->row_column.cascadeBtn) 352 #define RC_OptionLabel(m) (((XmRowColumnWidget)(m))->row_column.option_label) 353 #define RC_OptionSubMenu(m) (((XmRowColumnWidget)(m))->row_column.option_submenu) 354 #define RC_RadioBehavior(m) (((XmRowColumnWidget)(m))->row_column.radio) 355 #define RC_RadioAlwaysOne(m) (((XmRowColumnWidget)(m))->row_column.radio_one) 356 #define RC_PopupPosted(m) (((XmRowColumnWidget)(m))->row_column.popupPosted) 357 #define RC_ResizeHeight(m) (((XmRowColumnWidget)(m))->row_column.resize_height) 358 #define RC_ResizeWidth(m) (((XmRowColumnWidget)(m))->row_column.resize_width) 359 #define RC_Type(m) (((XmRowColumnWidget)(m))->row_column.type) 360 #define RC_EntryClass(m) (((XmRowColumnWidget)(m))->row_column.entry_class) 361 #define RC_IsHomogeneous(m) (((XmRowColumnWidget)(m))->row_column.homogeneous) 362 #define RC_Boxes(m) (((XmRowColumnWidget)(m))->row_column.boxes) 363 #define RC_PopupEnabled(m) (((XmRowColumnWidget)(m))->row_column.popup_enabled) 364 #define RC_MenuAccelerator(m) (((XmRowColumnWidget)(m))->row_column.menu_accelerator) 365 #define RC_Mnemonic(m) (((XmRowColumnWidget)(m))->row_column.mnemonic) 366 #define RC_MnemonicCharSet(m) (((XmRowColumnWidget)(m))->row_column.mnemonicCharSet) 367 #define RC_MenuPost(m) (((XmRowColumnWidget) m)->row_column.menuPost) 368 #define RC_PostButton(m) (((XmRowColumnWidget) m)->row_column.postButton) 369 #define RC_PostModifiers(m) (((XmRowColumnWidget) m)->row_column.postModifiers) 370 #define RC_PostEventType(m) (((XmRowColumnWidget) m)->row_column.postEventType) 371 372 #define RC_OldFocusPolicy(m) (((XmRowColumnWidget) m)->row_column.oldFocusPolicy) 373 #define RC_ParentShell(m) (((XmRowColumnWidget) m)->row_column.ParentShell) 374 #define RC_TearOffControl(m) (((XmRowColumnWidget) m)->row_column.tear_off_control) 375 #define RC_TearOffModel(m) (((XmRowColumnWidget) m)->row_column.TearOffModel) 376 377 #define RC_popupMenuClick(m) (((XmRowColumnWidget)(m))->row_column.popup_menu_click) 378 379 #define RC_TearOffTitle(m) (((XmRowColumnWidget)(m))->row_column.tear_off_title) 380 381 /* Tear Off State */ 382 383 #define XmTO_TORN_OFF_BIT (1 << 0) 384 #define XmTO_FROM_INIT_BIT (1 << 1) 385 #define XmTO_VISUAL_DIRTY_BIT (1 << 2) 386 #define XmTO_ACTIVE_BIT (1 << 3) 387 388 #define RC_SetTornOff(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.to_state, XmTO_TORN_OFF_BIT,v) 389 390 #define RC_TornOff(m) (((XmRowColumnWidget)(m))->row_column.to_state & XmTO_TORN_OFF_BIT) 391 392 #define RC_SetFromInit(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.to_state, XmTO_FROM_INIT_BIT,v) 393 394 #define RC_FromInit(m) (((XmRowColumnWidget)(m))->row_column.to_state & XmTO_FROM_INIT_BIT) 395 396 #define RC_SetTearOffDirty(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.to_state, XmTO_VISUAL_DIRTY_BIT,v) 397 398 #define RC_TearOffDirty(m) (((XmRowColumnWidget)(m))->row_column.to_state & XmTO_VISUAL_DIRTY_BIT) 399 400 #define RC_TearOffActive(m) (((XmRowColumnWidget)(m))->row_column.to_state & XmTO_ACTIVE_BIT) 401 402 #define RC_SetTearOffActive(m,v) RC_SetBit(((XmRowColumnWidget)(m))->row_column.to_state, XmTO_ACTIVE_BIT,v) 403 404 #define initial_value 0 405 406 /* Defines used when calling _XmProcessMenuTree() */ 407 408 #define XmADD 0 409 #define XmDELETE 1 410 #define XmREPLACE 2 411 412 413 /* Defines used when calling _XmMenuIsAccessible() */ 414 415 #define XmWEAK_CHECK 1 416 #define XmMEDIUM_CHECK 2 417 #define XmSTRONG_CHECK 3 418 419 #define XmMENU_BEGIN 0 420 #define XmMENU_MIDDLE 1 421 #define XmMENU_END 2 422 423 /* Defines used when calling find_first_managed_child() */ 424 #define ANY_CHILD 0 425 #define FIRST_BUTTON 1 426 427 428 #define XmInheritMenuProceduresProc ((XmMenuProc) _XtInherit) 429 #define XmInheritArmAndActivateProc ((XtActionProc) _XtInherit) 430 #define XmInheritMenuTraversalProc ((XmMenuTraversalProc) _XtInherit) 431 432 #ifdef __cplusplus 433 } /* Close scope of 'extern "C"' declaration which encloses file. */ 434 #endif 435 436 #endif /* _XmRowColumnP_h */ 437 /* DON'T ADD STUFF AFTER THIS #endif */ 438