1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 
9 #include <dxconfig.h>
10 #include "../base/defines.h"
11 
12 
13 #ifndef _DisplayNode_h
14 #define _DisplayNode_h
15 
16 
17 
18 #include "DrivenNode.h"
19 
20 
21 #define WHERE                   3
22 
23 //
24 // Class name definition:
25 //
26 #define ClassDisplayNode	"DisplayNode"
27 
28 //
29 // Referenced Classes
30 class ImageWindow;
31 class Network;
32 class PanelAccessManager;
33 
34 //
35 // DisplayNode class definition:
36 //
37 class DisplayNode : public DrivenNode
38 {
39   private:
40     //
41     // Private member data:
42     //
43     static void HandleImageMessage(void *clientData, int id, void *line);
44     PanelAccessManager *panelAccessManager;
45 
46     boolean      printCommonComments(FILE *f, const char *indent = NULL);
47 
48     boolean      parseCommonComments(const char *comment, const char *file,
49 			 int lineno);
50     //
51     // read/written to the .cfg file and passed to the editor window
52     // when it is created.
53     //
54     int xpos,ypos, width, height;
55 
56   protected:
57     //
58     // Protected member data:
59     //
60     boolean	userSpecifiedWhere;
61     ImageWindow *image;
62     char	*title;
63     int		depth;
64     int		windowId;
65     boolean     lastImage;
66 
67     virtual void handleImageMessage(int id, const char *line);
68 
69     void         prepareToSendValue(int index, Parameter *p);
70     void         prepareToSendNode();
71 
72     virtual boolean netPrintAuxComment(FILE *f);
73     virtual boolean netParseAuxComment(const char *comment,
74 			 const char *file,
75 			 int lineno);
76 
77     virtual char        *inputValueString(int i, const char *prefix);
78     virtual boolean      printIOComment(FILE *f, boolean input, int index,
79 				const char *indent = NULL,
80 				boolean valueOnly = FALSE);
81 
82     //
83     // Search through the networks list of image windows trying to find one
84     // that is not associated with a (display) node.  If canBeAnchor is TRUE
85     // then any ImageWindow will do and if available we return an anchor
86     // window, otherwise the returned ImageWindow must not by an anchor window.
87     // If one is not found in the current list, then create one if requested.
88     //
89     ImageWindow *getUnassociatedImageWindow(
90 			boolean alloc_one = TRUE, boolean canBeAnchor = TRUE);
91 
92     virtual void switchNetwork(Network *from, Network *to, boolean silently=FALSE);
93 
94     //
95     // Update any UI visuals that may be based on the state of this
96     // node.   Among other times, this is called after receiving a message
97     // from the executive.
98     //
99     virtual void reflectStateChange(boolean unmanage);
100 
101     //
102     // Parse the node specific info from an executive message.
103     // Returns the number of attributes parsed.
104     //
105     virtual int  handleNodeMsgInfo(const char *line);
106 
107 
108     //
109     // This node does not have a message id param, so it
110     // returns 0.
111     //
112     virtual int getMessageIdParamNumber();
113 
114     //
115     // Monitor the status of the WHERE param.  If the tab is connected, then
116     // treat it as if the user had supplied a value.
117     //
118     virtual void ioParameterStatusChanged(boolean input, int index,
119 			NodeParameterStatusChange status);
120 
121   public:
122     //
123     // Constructor:
124     //
125     DisplayNode(NodeDefinition *nd, Network *net, int instnc);
126 
127     //
128     // Destructor:
129     //
130     ~DisplayNode();
131 
132     virtual boolean cfgParseComment(const char* comment,
133                                 const char* filename, int lineno);
134     virtual boolean cfgPrintNode(FILE *f, PrintType);
135 
136     virtual boolean initialize();
137 
138     virtual void setTitle(const char *title, boolean fromServer = FALSE);
139     virtual const char *getTitle();
140 
141     void setDepth(int depth);
getDepth()142     int getDepth() { return this->depth;}
143 
144     virtual Type setInputValue(int index,
145 		       const char *value,
146 		       Type t = DXType::UndefinedType,
147 		       boolean send = TRUE);
148     virtual boolean associateImage(ImageWindow *w);
149     void    notifyWhereChange(boolean send);
150     virtual void    openImageWindow(boolean manage = TRUE);
151 
152 #if WORKSPACE_PAGES
153     virtual void setGroupName(GroupRecord *grec, Symbol);
154 #else
155     virtual void setGroupName(const char *name);
156 #endif
157     virtual void setDefaultCfgState();
158 
159 
160     void    setLastImage(boolean last);
161     boolean isLastImage();
162 
163 
getPanelManager()164     PanelAccessManager* getPanelManager()
165     {
166 	return this->panelAccessManager;
167     }
168 
useSoftwareRendering()169     virtual boolean useSoftwareRendering(){return TRUE;};
170 
getDXWindow()171     virtual DXWindow *getDXWindow() {return (DXWindow *)(this->image);}
172 
173     //
174     // Determine if this node is a node of the given class
175     //
176     virtual boolean isA(Symbol classname);
177 
178     //
179     // Return TRUE if this node has state that will be saved in a .cfg file.
180     //
181     virtual boolean hasCfgState();
182 
needsFastSort()183     virtual boolean needsFastSort() { return TRUE; }
184 
185     //
186     // Returns a pointer to the class name.
187     //
getClassName()188     virtual const char* getClassName()
189     {
190 	return ClassDisplayNode;
191     }
192 };
193 
194 
195 #endif // _DisplayNode_h
196