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