home *** CD-ROM | disk | FTP | other *** search
/ IRIS Development Option 6.2 / IRIS_Development_Option_6.2_814-0478-001.iso / dist / motif_dev.idb / usr / include / Sgm / GraphP.h.z / GraphP.h
C/C++ Source or Header  |  1996-03-14  |  10KB  |  305 lines

  1. /*******************************************************************************
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. *******************************************************************************/
  17. /* -*-C-*-
  18. *******************************************************************************
  19. *
  20. *  File:         GraphP.h
  21. *  Description:  Private header file for GraphWidget.
  22. *  Author:       Luis Miguel (luis@postgres.berkeley.edu)
  23. *  
  24. *  $Author: blean $
  25. *  $Source: /hosts/bonnie/proj/banyan/isms/motif/src/lib/Sgm/RCS/GraphP.h,v $
  26. *  $Revision: 1.4 $
  27. *  $Date: 1994/11/12 01:47:37 $
  28. *
  29. *******************************************************************************
  30. */
  31.  
  32. #ifndef _SgGraphP_h
  33. #define _SgGraphP_h
  34.  
  35. #include "Graph.h"
  36. #include "ArcP.h"
  37. #include "Arc.h"
  38.  
  39.  
  40. /* useful macros */
  41. #ifndef MAX
  42. #define MAX(a,b)        ((a) > (b) ? (a) : (b))
  43. #endif
  44.  
  45. #ifndef MIN
  46. #define MIN(a,b)        ((a) < (b) ? (a) : (b))
  47. #endif
  48.  
  49. /* some constants */
  50.  
  51. #define  LARGE_NUM           987654321
  52.  
  53. typedef enum  {NORMAL, 
  54.            NODE_INDICATED, 
  55.            NODE_INDICATED_PENDING_CANCEL, 
  56.            NODES_INDICATED, 
  57.            NODES_INDICATED_PENDING_CANCEL, 
  58.            ARC_INDICATED, 
  59.            ARC_INDICATED_PENDING_CANCEL, 
  60.            ARCS_INDICATED, 
  61.            ARCS_INDICATED_PENDING_CANCEL, 
  62.            NODE_SELECTED_FOR_MOTION, 
  63.            ARC_SELECTED_FOR_MOTION,
  64.            MULTIPLE_NODES_SELECTED_FOR_MOTION, 
  65.            NODE_SELECTED,
  66.            NODES_SELECTED, 
  67.            ARC_SELECTED, 
  68.            ARCS_SELECTED,
  69.            POSSIBLE_DOUBLE_CLICK,
  70.            SUBGRAPH_INDICATED,
  71.            SUBGRAPH_INDICATED_PENDING_CANCEL,
  72.            MOVING_ARC, 
  73.            MOVING_ARCS, 
  74.            MOVING_NODE, 
  75.            MOVING_NODES, 
  76.            ADDING_NODE, 
  77.            ADDING_ARC,
  78.            ADDING_ARC_IN_PARENT,
  79.            REGION_INDICATED} ActionMode;
  80.  
  81. /* The node structure "surrounding" widgets */
  82.  
  83. typedef struct _node *NodePtr;
  84. typedef NodePtr *NList;
  85.  
  86. typedef struct nodelist {
  87.     NList      nodes;
  88.     int        n_nodes;
  89.     int        n_slots;
  90. } NodeList;
  91.  
  92.  
  93. typedef struct _node {
  94.     /* all node and arc widgets */
  95.     Widget      widget;
  96.     ArcList     from_arcs;
  97.     ArcList     to_arcs;
  98.     
  99.     /* the structure of the graph */
  100.     NodeList    parents;
  101.     NodeList    kids;
  102.     int         visited;  /* the visited flag can contain a Boolean or count */
  103.     
  104.     /* tree processing needs these */
  105.     int         level;
  106.     NodePtr     tree_parent;
  107.     NodeList    tree_kids;
  108.     
  109.     
  110. } Node;
  111.  
  112. /* New fields for the GraphWidget widget class record */
  113.  
  114. typedef struct _SgGraphClassPart {
  115.     caddr_t extension;
  116. #ifdef __sgi /* Allow future extensions without breaking shared library compatibility */
  117.     caddr_t _SG_vendorExtension;
  118. #endif /* __sgi */
  119. } SgGraphClassPart;
  120.  
  121. /* Full Class record declaration */
  122.  
  123. typedef struct _SgGraphClassRec {
  124.     CoreClassPart    core_class;
  125.     CompositeClassPart  composite_class;
  126.     ConstraintClassPart    constraint_class;
  127.     XmManagerClassPart  manager_class;
  128.     SgGraphClassPart    graph_class;
  129. } SgGraphClassRec;
  130.  
  131. externalref SgGraphClassRec sgGraphClassRec;
  132.  
  133. /* New Fields for the GraphWidget  widget record */
  134.  
  135.  
  136. typedef struct {
  137.  
  138.     Window         bufferWindow;
  139.     Pixmap         bufferPixmap;
  140.     int            bufferWindowCount;
  141.     ActionMode     current_action;
  142.     Time           last_button_time;
  143.     int            double_click_interval;
  144.     int            scroll_increment;
  145.     Cursor         indicate_child_cursor;
  146.     Cursor         indicate_parent_cursor;
  147.     Cursor         ptr_cursor;
  148.     Cursor         motion_cursor;
  149.     Cursor         indicate_cursor;
  150.     Cursor         high_right_cursor;
  151.     Cursor         high_left_cursor;
  152.     Cursor         low_right_cursor;
  153.     Cursor         low_left_cursor;
  154.     Pixel          foreground;
  155.     int            start_x, start_y, end_x, end_y;
  156.     int            delta_x, delta_y;
  157.     int            pick_delta;
  158.     int            child_spacing;
  159.     int            sibling_spacing;
  160.     int            original_child_spacing;
  161.     int            original_sibling_spacing;
  162.     GC             gc;
  163.     GC             xorgc;
  164.     GC             highlightgc;
  165.     GC             overview_top_gc;
  166.     GC             overview_bottom_gc;
  167.     GC             overview_markgc;
  168.     GC             overview_arc_gc;
  169.     GC             overview_node_gc;
  170.     Boolean        show_overview_arcs;
  171.     Boolean        edit_mode;
  172.     Boolean        add_mode;
  173.     Boolean        nodes_movable;
  174.     Boolean        arcs_selectable;
  175.     Boolean        arcs_editable;
  176.     autoLayoutType auto_layout_mode;
  177.     Atom           layoutKey;
  178.     Boolean        siblings_visible;
  179.     Boolean        re_layout;
  180.     Boolean       re_orient;
  181.     Boolean       layed_out;
  182.     Boolean        batch_drawing_mode;
  183.     unsigned char  layoutStyle;
  184.     unsigned char  direction;
  185.     unsigned char  arc_draw_mode;
  186.     WidgetList     arcs;
  187.     ArcList        selected_arcs;
  188.     NodeList       selected_nodes;
  189.     NodeList       user_roots;
  190.     int            n_arcs;
  191.     int            n_arc_slots;
  192.     NodePtr        root;
  193.     NodePtr        current_node;
  194.     NodePtr        current_subgraph;
  195.     Widget         current_arc;
  196.     Widget         highlighted_arc;
  197.     Widget         indicated_widget;
  198.     Widget         overview_widget;
  199.     Boolean        overview_in_motion;
  200.     Pixel          arc_highlight_color;
  201.     Pixel          overview_arc_color;
  202.     Pixel          overview_node_color;
  203.     Pixel          overview_viewport_top_color;
  204.     Pixel          overview_viewport_bottom_color;
  205.     XRectangle     overview_rect;
  206.     float          x_scale_factor;
  207.     float          y_scale_factor;
  208.     Boolean        skew_overview;
  209.     Boolean        allow_grandchild_input;
  210. #ifdef NEVER /* this needs to be a widget class pointer, not an int */
  211.     int            default_widget_class;
  212. #else
  213.     WidgetClass    default_widget_class;
  214. #endif /* NEVER */
  215.     Boolean allow_multiple_selections;
  216.     void  (*layout_proc)();
  217.     unsigned char  arc_style;
  218.  
  219.     Widget butterfly_widget;
  220.     XtCallbackList graph_too_big_callback;      
  221.     XtCallbackList user_button_callback;      
  222.     XtCallbackList graph_changed;      
  223.     XtCallbackList new_arc;  
  224.     XtCallbackList new_node;  
  225.     XtCallbackList node_moved;
  226.     XtCallbackList arc_moved;
  227.     XtCallbackList double_click;  
  228.     XtCallbackList select_node;  
  229.     XtCallbackList deselect;  
  230.     XtCallbackList select_arc;  
  231.     XtCallbackList select_subgraph;  
  232. /*    XtCallbackList constraint_free;  
  233.     XtCallbackList constraint_init;  
  234.     XtCallbackList arm_arc_callback;
  235.     XtCallbackList activate_arc_callback;
  236.     XtCallbackList disarm_arc_callback;
  237. */
  238.     
  239.     Boolean         is_scrolled;
  240.     Boolean         show_crossing_arcs;
  241.     Dimension       clip_width;
  242.     Dimension       clip_height;
  243.     Dimension       scrollbar_width;
  244.     int         adjust_size;
  245.  
  246. #ifdef __sgi /* Allow future extensions without breaking shared library compatibility */
  247.     caddr_t _SG_vendorExtension;
  248. #endif /* __sgi */
  249. } SgGraphPart;
  250.  
  251.  
  252. /**************************************************************************
  253.  *
  254.  * Full instance record declaration
  255.  *
  256.  **************************************************************************/
  257.  
  258. typedef struct _SgGraphRec {
  259.     CorePart        core;
  260.     CompositePart   composite;
  261.     ConstraintPart  constraint;
  262.     XmManagerPart   manager;
  263.     SgGraphPart     graph;
  264. }  SgGraphRec;
  265.  
  266. /* Graph constraint record */
  267.  
  268. typedef struct _SgGraphConstraintsRec {
  269.     XmManagerConstraintPart manager;
  270.     EventMask     old_mask;
  271.     NodePtr       node;    
  272.     int           delta_x;
  273.     int           delta_y;
  274.     int           old_x;
  275.     int           old_y;
  276.     Pixel         overview_highlight_color;
  277.     caddr_t       extension;
  278. } SgGraphConstraintsRec, *SgGraphConstraintPtr;
  279.  
  280.  
  281.  
  282. #define NODEPTR(widget) ( (widget) ?                                       \
  283.              ( XtIsWidget(widget)  ?              \
  284.               ((SgGraphConstraintsRec *) ((Widget)(widget))->core.constraints)->node   :     \
  285.               ((SgGraphConstraintsRec *) ((Object)(widget))->object.constraints)->node)  :  \
  286.              NULL)
  287.  
  288.  
  289. #define CONSTRAINTREC(widget) ( (widget) ?                                       \
  290.                    ( XtIsWidget(widget)  ?              \
  291.                 ((SgGraphConstraintsRec *) ((Widget)(widget))->core.constraints)   :     \
  292.                 ((SgGraphConstraintsRec *) ((Object)(widget))->object.constraints))  :  \
  293.                    NULL)
  294.  
  295.  
  296. /* Internal routines needed elsewhere in the library */
  297. extern Boolean _SgGraphArcInRect (Widget arc, XRectangle *rect);
  298. extern void    _SgGraphSetupArcInternal (Widget graph, Widget arc);
  299.  
  300.  
  301. #endif /* _SgGraphP_h  */
  302. /* DON"T ADD ANYTHING AFTER THIS endif */
  303.  
  304.  
  305.