Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:23

0001 /* $XConsortium: ContainerP.h /main/8 1996/06/13 16:45:53 pascale $ */
0002 /*
0003  * Motif
0004  *
0005  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
0006  *
0007  * These libraries and programs are free software; you can
0008  * redistribute them and/or modify them under the terms of the GNU
0009  * Lesser General Public License as published by the Free Software
0010  * Foundation; either version 2 of the License, or (at your option)
0011  * any later version.
0012  *
0013  * These libraries and programs are distributed in the hope that
0014  * they will be useful, but WITHOUT ANY WARRANTY; without even the
0015  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
0016  * PURPOSE. See the GNU Lesser General Public License for more
0017  * details.
0018  *
0019  * You should have received a copy of the GNU Lesser General Public
0020  * License along with these librararies and programs; if not, write
0021  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
0022  * Floor, Boston, MA 02110-1301 USA
0023  */
0024 /*
0025  * HISTORY
0026  */
0027 #ifndef _XmContainerP_h
0028 #define _XmContainerP_h
0029  
0030 #include <Xm/XmP.h>
0031 #include <Xm/ManagerP.h>
0032 #include <Xm/DragCP.h>
0033 #include <Xm/Container.h>
0034 
0035 #ifdef __cplusplus
0036 extern "C" {
0037 #endif
0038 
0039 /*
0040  * One _XmCwidNodeRec structure is allocated by Container for each of 
0041  * it's children (except for OutlineButtons).  Information about the 
0042  * relationship of the child to other Container children (parentage and
0043  * order) is maintained here by Container.
0044  *
0045  * _XmCwidNodeRec structures are XtCalloc'd by Container in the 
0046  * ConstraintInitialize method and XtFree'd in the ConstraintDestroy method.
0047  * They are linked/unlinked to other _XmCwidNodeRec structures in the
0048  * ChangeManaged method.
0049  */
0050 typedef struct _XmCwidNodeRec
0051         {
0052     struct  _XmCwidNodeRec *    next_ptr;
0053     struct  _XmCwidNodeRec *    prev_ptr;
0054     struct  _XmCwidNodeRec *    child_ptr;
0055     struct  _XmCwidNodeRec *    parent_ptr;
0056     Widget          widget_ptr;
0057     }   XmCwidNodeRec, *CwidNode;
0058 
0059 /*
0060  * Container allocates a _XmContainerXfrActionRec structure to store
0061  * the data from a ContainerStartTransfer action until it can determine
0062  * whether the action should start a primary transfer or begin a drag.
0063  */
0064 typedef struct  _XmContainerXfrActionRec
0065     {
0066     Widget      wid;
0067     XEvent      *event;
0068     String      *params;
0069     Cardinal    *num_params;
0070     Atom        operation;
0071     }   XmContainerXfrActionRec, *ContainerXfrAction;
0072 
0073 /*
0074  * Container allocates an array of _XmContainerCwidCellInfoRec structures
0075  * to use in calculating an ideal size in the GetSpatialSize procedure when
0076  * XmNspatialStyle is XmCELLS.  The array is created and destroyed in the 
0077  * GetSpatialSize procedure.
0078  */
0079 typedef struct  _XmContainerCwidCellInfoRec
0080     {
0081     int cwid_width_in_cells;
0082     int cwid_height_in_cells;
0083     }   XmContainerCwidCellInfoRec, *ContainerCwidCellInfo;
0084 
0085 /* Container constraint class part record */
0086 typedef struct  _XmContainerConstraintPart
0087     {
0088     Widget      entry_parent;       /* XmNentryParent */
0089     Widget      related_cwid;
0090     CwidNode    node_ptr;
0091     int     position_index;     /* XmNpositionIndex */
0092     int     depth;
0093     int     cell_idx;
0094     Boolean     visible_in_outline;
0095     Position    user_x;
0096     Position    user_y;
0097     unsigned char   outline_state;      /* XmNoutlineState */
0098     unsigned char   selection_visual;
0099     unsigned char   selection_state;
0100     unsigned char   cwid_type;
0101     }   XmContainerConstraintPart, * XmContainerConstraint;
0102 
0103 typedef struct  _XmContainerConstraintRec
0104     {
0105     XmManagerConstraintPart     manager;
0106     XmContainerConstraintPart   container;
0107     }   XmContainerConstraintRec, * XmContainerConstraintPtr;
0108 
0109 /* move the other typedef here */
0110 typedef void (*XmSpatialGetSize)(Widget, Dimension *, Dimension *);
0111 
0112 /* Container widget class record  */
0113 typedef struct  _XmContainerClassPart
0114     {
0115     XmSpatialTestFitProc        test_fit_item;
0116     XmSpatialPlacementProc      place_item;
0117     XmSpatialRemoveProc     remove_item;
0118     XmSpatialGetSize        get_spatial_size;
0119     XtPointer           extension;
0120     }   XmContainerClassPart;
0121 
0122 /* Full class record declaration */
0123 typedef struct  _XmContainerClassRec
0124     {
0125     CoreClassPart       core_class;
0126     CompositeClassPart      composite_class;
0127     ConstraintClassPart constraint_class;
0128     XmManagerClassPart  manager_class;
0129     XmContainerClassPart        container_class;
0130     }   XmContainerClassRec, *XmContainerClass;
0131 
0132 externalref XmContainerClassRec xmContainerClassRec;
0133 
0134 /* Container instance record */
0135 typedef struct  _XmContainerPart
0136     {
0137     WidgetList      selected_items;         /* XmNselectedItems */
0138     Widget      icon_header;
0139     Widget      anchor_cwid;
0140     Widget      druggee;
0141     Widget      size_ob;
0142     Widget      drag_context;
0143     CwidNode        first_node;
0144         CwidNode        last_node;
0145     Cardinal *      detail_order;           /* XmNdetailOrder */
0146     XmString *  detail_heading;         /* XmNdetailColumnHeading */
0147     XSegment *      outline_segs;
0148     XtCallbackList  convert_cb;             /* XmNconvertCallback */
0149         XtCallbackList  default_action_cb;      /* XmNdefaultActionCallback */
0150         XtCallbackList  destination_cb;         /* XmNdestinationCallback */
0151     XtCallbackList  outline_cb;             /* XmNoutlineChangedCallback */
0152     XtCallbackList  selection_cb;           /* XmNselectionCallback */
0153     XmTabList       detail_tablist;         /* XmNdetailTabList */
0154     XmFontList      render_table;           /* XmNfontList */
0155     Pixel       select_color;       /* XmNselectColor */
0156     Pixmap      collapsed_state_pixmap; /* XmNcollapsedStatePixmap */
0157     Pixmap      expanded_state_pixmap;  /* XmNexpandedStatePixmap */
0158     GC      normalGC;
0159     GC              marqueeGC;
0160         Time            last_click_time;
0161     Region      cells_region;
0162     ContainerXfrAction transfer_action;
0163     XtIntervalId    transfer_timer_id;
0164     XPoint      anchor_point;
0165     XPoint      marquee_start;
0166     XPoint      marquee_end;
0167     XPoint      marquee_smallest;
0168     XPoint      marquee_largest;
0169     XPoint      dropspot;
0170     unsigned long   dynamic_resource;
0171     int     max_depth;
0172     int     outline_seg_count;
0173     int     *cells;
0174     int     cell_count;
0175     int     next_free_cell;
0176     int     current_width_in_cells;
0177     int     current_height_in_cells;
0178     int     drag_offset_x;
0179     int     drag_offset_y;
0180     unsigned int    selected_item_count;    /* XmNselectedItemCount */
0181     Cardinal        detail_heading_count; /* XmNdetailColumnHeadingCount */
0182         Cardinal        saved_detail_heading_count; 
0183         Cardinal        detail_order_count;     /* XmNdetailOrderCount */
0184     Dimension       first_col_width;        /* XmNoutlineColumnWidth */
0185     Dimension       real_first_col_width;    
0186     Dimension       large_cell_height;      /* XmNlargeCellHeight */
0187         Dimension       large_cell_width;       /* XmNlargeCellWidth */
0188     Dimension   small_cell_height;  /* XmNsmallCellHeight */
0189     Dimension   small_cell_width;   /* XmNsmallCellWidth */
0190     Dimension   real_large_cellh;
0191     Dimension   real_large_cellw;
0192     Dimension   real_small_cellh;
0193     Dimension   real_small_cellw;
0194         Dimension       margin_h;               /* XmNmarginHeight */
0195         Dimension       margin_w;               /* XmNmarginWidth */
0196         Dimension       outline_indent;         /* XmNoutlineIndentation */
0197     Dimension       ob_width;
0198     Dimension       ob_height;
0199     Dimension       prev_width;
0200         Dimension       ideal_width;
0201         Dimension       ideal_height;
0202     /* Note: first_change_managed is also used to resolve between
0203      * XmRenderTable & XmFontList when setting up the resource table
0204      */
0205     Boolean     first_change_managed;
0206     Boolean         extending_mode;
0207         Boolean         marquee_mode;
0208         Boolean         self;
0209         Boolean         toggle_pressed;
0210         Boolean         extend_pressed;
0211     Boolean     ob_pressed;
0212         Boolean         cancel_pressed;
0213         Boolean         kaddmode;
0214         Boolean         no_auto_sel_changes;
0215         Boolean         started_in_anchor;
0216     Boolean         marquee_drawn;
0217     Boolean         have_primary;
0218     Boolean         selecting;
0219     Boolean     large_cell_dim_fixed;
0220     Boolean     small_cell_dim_fixed;
0221     unsigned char   automatic;              /* XmNautomaticSelection */
0222     unsigned char   entry_viewtype;         /* XmNentryViewType */
0223     unsigned char   include_model;          /* XmNspatialIncludeModel */
0224         unsigned char   layout_type;            /* XmNlayoutType */
0225     unsigned char   ob_policy;          /* XmNoutlineButtonPolicy */
0226     unsigned char   outline_sep_style;      /* XmNoutlineLineStyle */
0227         unsigned char   spatial_style;          /* XmNspatialStyle */
0228         unsigned char   primary_ownership;      /* XmNprimaryOwnership */
0229         unsigned char   resize_model;           /* XmNspatialResizeModel */
0230     unsigned char   selection_policy;       /* XmNselectionPolicy */
0231         unsigned char   selection_technique;    /* XmNselectionTechnique */
0232     unsigned char   snap_model;             /* XmNspatialSnapModel */
0233     unsigned char   create_cwid_type;
0234         unsigned char   selection_state;
0235     unsigned char   LeaveDir;               /* leave direction */
0236     XtIntervalId    scroll_proc_id;         /* scroll TimeOutProc */
0237     int             last_xmotion_x;
0238     int             last_xmotion_y;
0239     XmString *  cache_detail_heading;  /* XmNdetailColumnHeading 
0240                           getValues */
0241     }   XmContainerPart;
0242 
0243 /* Full instance record declaration */
0244 typedef struct  _XmContainerRec
0245     {
0246     CorePart    core;
0247     CompositePart   composite;
0248     ConstraintPart  constraint;
0249     XmManagerPart   manager;
0250     XmContainerPart container;
0251     }   XmContainerRec;
0252 
0253 /* enums to keep up with cwid types */
0254 enum {  CONTAINER_ICON,
0255     CONTAINER_OUTLINE_BUTTON,
0256     CONTAINER_HEADER};
0257 
0258 #define TABLIST (1L<<0)
0259 #define FIRSTCW (1L<<1)
0260 #define CtrIsDynamic(w,mask) \
0261     (((XmContainerWidget)(w))->container.dynamic_resource & mask)
0262 
0263 #define CtrDynamicSmallCellHeight(w) \
0264     (((XmContainerWidget)(w))->container.small_cell_height == 0)
0265 #define CtrDynamicSmallCellWidth(w) \
0266     (((XmContainerWidget)(w))->container.small_cell_width == 0)
0267 #define CtrDynamicLargeCellHeight(w) \
0268         (((XmContainerWidget)(w))->container.large_cell_height == 0)
0269 #define CtrDynamicLargeCellWidth(w) \
0270         (((XmContainerWidget)(w))->container.large_cell_width == 0)
0271 
0272 #define CtrIsAUTO_SELECT(w) \
0273         ((((XmContainerWidget)(w))->container.automatic == XmAUTO_SELECT) && \
0274          (((XmContainerWidget)(w))->container.selection_policy \
0275                                                         != XmSINGLE_SELECT))
0276 #define CtrViewIsLARGE_ICON(w) \
0277     (((XmContainerWidget)(w))->container.entry_viewtype == XmLARGE_ICON)
0278 #define CtrViewIsSMALL_ICON(w) \
0279     (((XmContainerWidget)(w))->container.entry_viewtype == XmSMALL_ICON)
0280 #define CtrViewIsANY_ICON(w) \
0281     (((XmContainerWidget)(w))->container.entry_viewtype == XmANY_ICON)
0282 #define CtrIsHORIZONTAL(w) \
0283     (XmDirectionMatchPartial \
0284     (((XmContainerWidget)(w))->manager.string_direction,\
0285                 XmDEFAULT_DIRECTION,XmPRECEDENCE_HORIZ_MASK))
0286 #define CtrIsVERTICAL(w) \
0287     (XmDirectionMatchPartial \
0288     (((XmContainerWidget)(w))->manager.string_direction,\
0289                 XmDEFAULT_DIRECTION,XmPRECEDENCE_VERT_MASK))
0290 #define CtrLayoutIsDETAIL(w) \
0291     (((XmContainerWidget)(w))->container.layout_type == XmDETAIL)
0292 #define CtrLayoutIsOUTLINE_DETAIL(w) \
0293     ((((XmContainerWidget)(w))->container.layout_type == XmDETAIL) || \
0294     (((XmContainerWidget)(w))->container.layout_type == XmOUTLINE))
0295 
0296 #define CtrDrawLinesOUTLINE(w) \
0297     (CtrLayoutIsOUTLINE_DETAIL(w) && \
0298      (((XmContainerWidget)(w))->container.outline_sep_style \
0299                     == XmSINGLE))
0300 #define CtrLayoutIsSPATIAL(w) \
0301     (((XmContainerWidget)(w))->container.layout_type == XmSPATIAL)
0302 #define CtrSpatialStyleIsNONE(w) \
0303     (((XmContainerWidget)(w))->container.spatial_style == XmNONE)
0304 #define CtrSpatialStyleIsGRID(w) \
0305     (((XmContainerWidget)(w))->container.spatial_style == XmGRID)
0306 #define CtrSpatialStyleIsCELLS(w) \
0307     (((XmContainerWidget)(w))->container.spatial_style == XmCELLS)
0308 #define CtrIncludeIsAPPEND(w) \
0309     (((XmContainerWidget)(w))->container.include_model == XmAPPEND)
0310 #define CtrIncludeIsCLOSEST(w) \
0311     (((XmContainerWidget)(w))->container.include_model == XmCLOSEST)
0312 #define CtrIncludeIsFIRST_FIT(w) \
0313     (((XmContainerWidget)(w))->container.include_model == XmFIRST_FIT)
0314 #define CtrSnapModelIsNONE(w) \
0315     (((XmContainerWidget)(w))->container.snap_model == XmNONE)
0316 #define CtrSnapModelIsSNAP(w) \
0317     (((XmContainerWidget)(w))->container.snap_model == XmSNAP_TO_GRID)
0318 #define CtrSnapModelIsCENTER(w) \
0319     (((XmContainerWidget)(w))->container.snap_model == XmCENTER)
0320 #define CtrResizeModelIsGROW_MINOR(w) \
0321     (((XmContainerWidget)(w))->container.resize_model == XmGROW_MINOR)
0322 #define CtrResizeModelIsGROW_MAJOR(w) \
0323     (((XmContainerWidget)(w))->container.resize_model == XmGROW_MAJOR)
0324 #define CtrResizeModelIsGROW_BALANCED(w) \
0325     (((XmContainerWidget)(w))->container.resize_model == XmGROW_BALANCED)
0326 #define CtrPolicyIsSINGLE(w) \
0327     (((XmContainerWidget)(w))->container.selection_policy \
0328                     == XmSINGLE_SELECT)
0329 #define CtrPolicyIsBROWSE(w) \
0330     (((XmContainerWidget)(w))->container.selection_policy \
0331                     == XmBROWSE_SELECT)
0332 #define CtrPolicyIsMULTIPLE(w) \
0333     (((XmContainerWidget)(w))->container.selection_policy \
0334                     == XmMULTIPLE_SELECT)
0335 #define CtrPolicyIsEXTENDED(w) \
0336     (((XmContainerWidget)(w))->container.selection_policy \
0337                     == XmEXTENDED_SELECT)
0338 #define CtrTechIsTOUCH_OVER(w) \
0339     (((XmContainerWidget)(w))->container.selection_technique \
0340                     == XmTOUCH_OVER)
0341 #define CtrTechIsTOUCH_ONLY(w) \
0342     (((XmContainerWidget)(w))->container.selection_technique \
0343                     == XmTOUCH_ONLY)
0344 #define CtrTechIsMARQUEE(w) \
0345     (((XmContainerWidget)(w))->container.selection_technique \
0346                     == XmMARQUEE)
0347 #define CtrTechIsMARQUEE_ES(w) \
0348     (((XmContainerWidget)(w))->container.selection_technique \
0349                     == XmMARQUEE_EXTEND_START)
0350 #define CtrTechIsMARQUEE_EB(w) \
0351     (((XmContainerWidget)(w))->container.selection_technique \
0352                     == XmMARQUEE_EXTEND_BOTH)
0353 #define CtrOB_PRESENT(w) \
0354     (((XmContainerWidget)(w))->container.ob_policy \
0355                     == XmOUTLINE_BUTTON_PRESENT)
0356 #define CtrOB_ABSENT(w) \
0357     (((XmContainerWidget)(w))->container.ob_policy \
0358                     == XmOUTLINE_BUTTON_ABSENT)
0359 #define GetContainerConstraint(w) \
0360     (&((XmContainerConstraintPtr) (w)->core.constraints)->container)
0361 #define CtrItemIsPlaced(w) \
0362     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cell_idx \
0363                     != NO_CELL)
0364 #define CtrICON(w) \
0365     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cwid_type\
0366                     == CONTAINER_ICON)
0367 #define CtrOUTLINE_BUTTON(w) \
0368     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cwid_type\
0369                     == CONTAINER_OUTLINE_BUTTON)
0370 #define CtrHEADER(w) \
0371     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cwid_type\
0372                     == CONTAINER_HEADER)
0373 
0374 #define XmInheritSpatialTestFitProc ((XmSpatialTestFitProc) _XtInherit)
0375 #define XmInheritSpatialPlacementProc   ((XmSpatialPlacementProc) _XtInherit)
0376 #define XmInheritSpatialRemoveProc  ((XmSpatialRemoveProc) _XtInherit)
0377 #define XmInheritSpatialGetSize     ((XmSpatialGetSize) _XtInherit)
0378 
0379 /* possible directions when leaving the container */
0380 #define TOPLEAVE    (1<<0)
0381 #define BOTTOMLEAVE (1<<1)
0382 #define LEFTLEAVE   (1<<2)
0383 #define RIGHTLEAVE  (1<<3)
0384 
0385 #ifdef __cplusplus
0386 }  /* Close scope of 'extern "C"' declaration which encloses file. */
0387 #endif
0388 
0389 #endif /* _XmContainerP_h */
0390 /* DON'T ADD ANYTHING AFTER THIS #endif */
0391 
0392