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 
14 // DXWindow.h -								    //
15 //                                                                          //
16 // Definition for the DXWindow class.					    //
17 //                                                                          //
18 // DXWindow class is a subclass of IBMMainWindow, which implements an
19 // optional menu bar with an optional anchor pixmap on the left side of the
20 // menu bar if the window is an "anchor" window and a Help menu pulldown.
21 // The subclasses are expected to create the menus via createMenus() call.
22 //                                                                          //
23 
24 #ifndef _DXWindow_h
25 #define _DXWindow_h
26 
27 
28 #include "List.h"
29 #include "IBMMainWindow.h"
30 
31 #define ClassDXWindow "DXWindow"
32 
33 extern "C" void DXWindow_ConnectionMenuMapCB(Widget    widget,
34                               XtPointer clientData,
35                               XtPointer callData);
36 extern "C" void DXWindow_FileHistoryMenuMapCB(Widget, XtPointer , XtPointer );
37 
38 class Command;
39 class CommandInterface;
40 class ToggleButtonInterface;
41 class ControlPanelAccessDialog;
42 class PanelAccessManager;
43 class CascadeMenu;
44 
45 //
46 // DXWindow class definition:
47 //
48 class DXWindow : public IBMMainWindow
49 {
50   private:
51     friend void DXWindow_ConnectionMenuMapCB(Widget    widget,
52                               XtPointer clientData,
53                               XtPointer callData);
54     friend void DXWindow_FileHistoryMenuMapCB(Widget, XtPointer , XtPointer );
55 
56   protected:
57     //
58     // Protected member data:
59     //
60 
61     //
62     // These resources are expected to be loaded by the derived classes.
63     //
64     static String DefaultResources[];
65 
66     Widget  anchorButton;	// optional first menu item
67 
68     boolean startup;		// Is this supposed to be opened at startup.
69     boolean anchor;		// is this an anchor window?
70     Pixmap  anchorPixmap;	// anchor pixmap
71 
72     //
73     //  Execute option pulldown support
74     //
75     Widget              executeMenu;
76     Widget              executeMenuPulldown;
77     CommandInterface*   executeOnceOption;
78     CommandInterface*   executeOnChangeOption;
79     CommandInterface*   endExecutionOption;
80     CommandInterface*   sequencerOption;
81 
82     //
83     //  Connect option pulldown support
84     //
85     Widget              connectionMenu;
86     Widget              connectionMenuPulldown;
87     CommandInterface*   startServerOption;
88     CommandInterface*   disconnectFromServerOption;
89     CommandInterface*   resetServerOption;
90     CommandInterface*	processGroupAssignmentOption;
91 
92     //
93     // Options menu
94     //
95     Command		*toggleWindowStartupCmd;
96     ToggleButtonInterface *toggleWindowStartupOption;
97 
98     //
99     //  Adds help option pulldown support
100     //
101     CommandInterface	*helpTutorialOption;
102 
103     //
104     // Override IBMMainWindow to put anchor up
105     //
106     virtual void createMenuBar(Widget parent);
107 
108     //
109     // These two routines provide the basic methods for build the execute
110     // and Help menu pulldowns, but can be overridden by the derived classes.
111     //
112     virtual void createHelpMenu(Widget parent);
113     virtual void createExecuteMenu(Widget parent);
114     virtual void createConnectionMenu(Widget parent);
115 
116     //
117     // Children should implement these virtual functions to hightlight their
118     // "Execute" menu pull down if the have one.
119     //
120     virtual void beginExecution();
121     virtual void standBy();
122     virtual void endExecution();
123     virtual void serverDisconnected();
124 
125     //
126     // Virtual function called at the beginning/end of Command::execute
127     //
128     virtual void beginCommandExecuting();
129     virtual void endCommandExecuting();
130 
131     //
132     // Remember the last message notified so that a new window can get
133     // notified at the creation time.
134     //
135     static Symbol lastMsg;
136     static const void *lastMsgData;
137 
138     //
139     // Not every window uses this, but enough do that we put it here.
140     //
141     ControlPanelAccessDialog	*panelAccessDialog;
142 
143     //
144     // Add a toggle button interface that toggles the startup up state of this
145     // window to the given parent widget.
146     //
147     Widget addStartupToggleOption(Widget parent);
148 
149     //
150     // Change whether or not this window is an anchor window.
151     // Update any visual state or anything else that is required.  At this
152     // level we handle the anchor pixmap if initialized.
153     //
154     virtual void setAnchor(boolean isAnchor);
155     //
156     // Create the anchor button widget and add the pixmap if desired and not
157     // already present
158     //
159     void createAnchor(boolean addPixmap);
160 
161     //
162     // Constructor for the subclasses:
163     //
164     DXWindow(const char*   name,
165 	     boolean isAnchor,
166 	     boolean usesMenuBar = TRUE);
167 
168     //
169     // Install the default resources for this class and then call the
170     // same super class method to get the default resources from the
171     // super classes.
172     //
173     virtual void installDefaultResources(Widget baseWidget);
174 
175     //
176     // Allow subclasses to supply a string for the XmNgeometry resource
177     // (i.e. -geam 90x60-0-0) which we'll use instead of createX,createY,
178     // createWidth, createHeight when making the new window.  If the string
179     // is available then initialize() won't call setGeometry.
180     //
181     virtual void getGeometryNameHierarchy(String*, int*, int);
182     virtual void getGeometryAlternateNames(String*, int*, int);
183 
184     //
185     // build a file history button and menu
186     //
187     virtual void createFileHistoryMenu (Widget parent);
188     virtual void buildFileHistoryMenu();
189     CascadeMenu* file_history_cascade;
190     List file_history_buttons;
191     List file_history_commands;
192 
193   public:
194 
195     //
196     // Destructor:
197     //
198     ~DXWindow();
199 
200     //
201     // Implementation of notify() function for this class:
202     //
203     virtual void notify
204 	(const Symbol message, const void *msgdata=NULL, const char *msg=NULL);
205 
isAnchor()206     boolean isAnchor() { return this->anchor; }
207 
208     //
209     // Post the panel access dialog with this window PanelAccessManager info.
210     // If pam is not NULL, use it when creating the dialog otherwise use
211     // this->panelAccessManager.
212     // Not every window uses this, but enough do that we put it here.
213     //
214     void postPanelAccessDialog(PanelAccessManager *pam);
215 
216     //
217     // Overrides the MainWindow class manage() function.
218     //  Calls the superclass manage() first then finishes building the
219     //  anchor symbol.
220     //
221     virtual void manage();
222 
223     virtual boolean printComment(FILE *f);
224     virtual boolean parseComment(const char *line, const char *file,
225                                 int lineno);
226     //
227     // Reset the window to use the default settings for the state that is
228     // printed by the printComment() method.
229     //
230     virtual void useDefaultCommentState();
231 
232     //
233     // Determine if this window is a startup window.
234     //
isStartup()235     boolean isStartup() { return this->startup; }
236     //
237     // Virtual because SequencerWindow must set a startup flag in his node
238     // at the same time.
239     //
240     virtual void setStartup(boolean set = TRUE);
241 
242     //
243     // Called by the MainWindow CloseCallback
244     //
245     virtual void closeWindow();
246 
247     //
248     // Changes whether or not this window is supposed to open up automatically
249     // on startup.
250     //
251     virtual void toggleWindowStartup();
252 
getClassName()253     const char * getClassName() { return ClassDXWindow; }
254 };
255 
256 
257 #endif // _DXWindow_h
258