OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / Basic / NodeViewInfo.hh
1 /*      copyright (c) 1996 FUJITSU LIMITED      */
2 /*      All Rights Reserved                     */
3
4 /*
5  * $XConsortium: NodeViewInfo.hh /main/9 1996/10/18 19:47:58 cde-hal $
6  *
7  * Copyright (c) 1993 HAL Computer Systems International, Ltd.
8  * All rights reserved.  Unpublished -- rights reserved under
9  * the Copyright Laws of the United States.  USE OF A COPYRIGHT
10  * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
11  * OR DISCLOSURE.
12  * 
13  * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
14  * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.  USE,
15  * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
16  * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
17  * INTERNATIONAL, LTD.
18  * 
19  *                         RESTRICTED RIGHTS LEGEND
20  * Use, duplication, or disclosure by the Government is subject
21  * to the restrictions as set forth in subparagraph (c)(l)(ii)
22  * of the Rights in Technical Data and Computer Software clause
23  * at DFARS 252.227-7013.
24  *
25  *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
26  *                  1315 Dell Avenue
27  *                  Campbell, CA  95008
28  * 
29  */
30 #include "UAS.hh"
31
32 #include <X11/Xlib.h>
33 #include <X11/Intrinsic.h>
34
35 #include <Dt/CanvasP.h>
36 #include <Dt/CanvasSegP.h>
37
38 #include "dti_cc/CC_Dlist.h"
39
40 #include "UAS/DtSR/Util_Classes/Dict.hh"
41
42 class Graphic;
43
44 // wrap the canvas segment for search hit usage
45 class sr_DtCvSegment
46 {
47 public:
48   _DtCvSegment* hitseg;
49   sr_DtCvSegment( _DtCvSegment* pseg) { hitseg = pseg ; };
50   ~sr_DtCvSegment() {};
51   int operator==(const sr_DtCvSegment& psg) const
52      { return psg.hitseg == hitseg; }
53   int operator!=(const sr_DtCvSegment& psg) const
54      { return psg.hitseg != hitseg; }
55 };
56
57 class NodeViewInfo
58 {
59 public:
60   NodeViewInfo (UAS_Pointer<UAS_Common> &node_ptr, _DtCvTopicInfo *topic = 0);
61   ~NodeViewInfo();
62
63   UAS_Pointer<UAS_Common> &node_ptr()
64     { return (f_node_ptr); }
65
66   _DtCvTopicInfo *topic()       { return f_topic; }
67
68   _DtCvTopicInfo *topic(_DtCvTopicInfo *topic)
69     { f_topic = topic ; return topic; }
70
71 #ifdef NotDefined
72   HashTbl &locator_table()
73     { return (f_locator_table); }
74 #endif
75   
76   void add_graphic(UAS_Pointer<Graphic> &);
77
78   xList<UAS_Pointer<Graphic> > &graphics()
79     { return f_pixmap_list ; } 
80
81   void clear_search_hits();
82   void set_search_hits(UAS_Pointer<UAS_List<UAS_TextRun> > &);
83
84   enum trav_dir_t { PREV, NEXT };
85   enum trav_status_t { SUCCESS, NOT_MOVED, REACH_LIMIT };
86   trav_status_t  adjust_current_search_hit(trav_dir_t);
87
88   int hit_entries() const;
89   int search_hit_idx();
90
91   void comp_pixel_values(Display* dpy, Colormap& cmap);
92
93   // retrieve the segment which matches to vcc
94   _DtCvSegment* get_segment(unsigned int vcc);
95
96   static unsigned int segment_to_vcc(_DtCvSegment* seg);
97
98 private:
99
100   UAS_Pointer<UAS_Common>  f_node_ptr;        /* pointer to the associated node       */
101   _DtCvTopicInfo *f_topic;          /* pointer to the TML model of it       */
102
103 #ifdef NotDefined
104   HashTbl        f_locator_table;   /* quick lookup table for node locators */
105 #endif
106   xList<UAS_Pointer<Graphic> > f_pixmap_list; /* graphics processing */
107
108   CC_TPtrDlist<sr_DtCvSegment> f_hits;
109   sr_DtCvSegment* f_current_hit;
110
111   _DtCvSegment* top_container();
112
113   UAS_String    f_def_key;
114   unsigned long f_def_val;
115   Dict<UAS_String, unsigned long> f_color_dict;
116   void comp_pixel_values_traverse(_DtCvSegment*, Display*, Colormap&);
117 };