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 <defines.h>
11
12
13
14
15 #include <Xm/Xm.h>
16 #include <Xm/CascadeB.h>
17 #include <Xm/Separator.h>
18 #include <Xm/RowColumn.h>
19
20 #include "DXStrings.h"
21 #include "IBMMainWindow.h"
22 #include "IBMApplication.h"
23 #include "CommandScope.h"
24 #include "HelpOnContextCommand.h"
25 #include "UIComponentHelpCommand.h"
26 #include "ButtonInterface.h"
27 #include "WarningDialogManager.h"
28 #include "HelpMenuCommand.h"
29 #include "icon50.h"
30 #include "WizardDialog.h"
31
32
33 boolean IBMMainWindow::ClassInitialized = FALSE;
34
35 String IBMMainWindow::DefaultResources[] =
36 {
37 "*helpMenu.labelString: Help",
38 "*helpMenu.mnemonic: H",
39 "*onContextOption.labelString: Context-Sensitive Help",
40 "*onContextOption.mnemonic: C",
41 "*onWindowOption.labelString: Overview (of Window)...",
42 "*onWindowOption.mnemonic: O",
43 "*onManualOption.labelString: Table of Contents...",
44 "*onManualOption.mnemonic: T",
45 "*onHelpOption.labelString: Using Help...",
46 "*onHelpOption.mnemonic: H",
47 "*aboutAppOption.labelString: Product Information...",
48 "*aboutAppOption.mnemonic: n",
49 "*techSupportOption.labelString: Technical Support...",
50 "*techSupportOption.mnemonic: S",
51
52 NULL
53 };
54 #if 0
55 //
56 // This method should only be called if this window does not have a
57 // menu bar (i.e. this->hasMenuBar == FALSE);
58 //
59 void IBMMainWindow::createMenus(Widget parent)
60 {
61 this->MainWindow::createMenus(parent);
62 }
63 #endif
64
createBaseHelpMenu(Widget parent,boolean add_standard_help,boolean addAboutApp)65 void IBMMainWindow::createBaseHelpMenu(Widget parent,
66 boolean add_standard_help,
67 boolean addAboutApp)
68 {
69 ASSERT(parent);
70 Widget pulldown;
71
72 ASSERT(this->menuBar);
73 //
74 // Create "Help" menu and options.
75 //
76 pulldown =
77 this->helpMenuPulldown =
78 XmCreatePulldownMenu(parent, "helpMenuPulldown", NUL(ArgList), 0);
79
80 this->helpMenu =
81 XtVaCreateManagedWidget
82 ("helpMenu",
83 xmCascadeButtonWidgetClass,
84 parent,
85 XmNsubMenuId, pulldown,
86 NULL);
87
88 if (add_standard_help) {
89 this->onContextOption =
90 new ButtonInterface (pulldown, "onContextOption",
91 this->helpOnContextCmd);
92
93 this->onWindowOption =
94 new ButtonInterface(pulldown, "onWindowOption",
95 this->helpOnWindowCmd);
96
97 this->onManualOption =
98 new ButtonInterface(pulldown, "onManualOption",
99 theIBMApplication->genericHelpCmd);
100
101 this->onHelpOption =
102 new ButtonInterface(pulldown, "onHelpOption",
103 theIBMApplication->genericHelpCmd);
104
105
106 }
107
108 if (addAboutApp) {
109 XtVaCreateManagedWidget("separator", xmSeparatorWidgetClass, pulldown,
110 NULL);
111
112 this->helpAboutAppCmd =
113 new HelpMenuCommand
114 ("helpAboutApp", NULL, TRUE, HelpMenuCommand::AboutApp);
115 this->aboutAppOption =
116 new ButtonInterface(pulldown, "aboutAppOption",
117 this->helpAboutAppCmd);
118
119 this->helpTechSupportCmd =
120 new HelpMenuCommand
121 ("helpTechSupport", NULL, TRUE, HelpMenuCommand::TechSupport);
122 this->techSupportOption =
123 new ButtonInterface(pulldown, "techSupportOption",
124 this->helpTechSupportCmd);
125 }
126
127 XtVaSetValues(parent, XmNmenuHelpWidget, this->helpMenu, NULL);
128 }
129
130
IBMMainWindow(const char * name,boolean usesMenuBar)131 IBMMainWindow::IBMMainWindow(const char* name, boolean usesMenuBar):
132 MainWindow(name, usesMenuBar)
133 {
134 this->helpMenuPulldown = NULL;
135 this->helpMenu = NULL;
136
137 this->onContextOption = NULL;
138 this->onHelpOption = NULL;
139 this->onManualOption = NULL;
140 this->onWindowOption = NULL;
141 this->aboutAppOption = NULL;
142 this->helpAboutAppCmd = NULL;
143 this->techSupportOption = NULL;
144 this->helpTechSupportCmd = NULL;
145
146 if (usesMenuBar) {
147 this->helpOnContextCmd =
148 new HelpOnContextCommand
149 ("helpOnContext", NULL, TRUE, this);
150 this->helpOnWindowCmd =
151 new UIComponentHelpCommand
152 ("helpOnWindow", NULL, TRUE, this);
153 } else {
154 this->helpOnContextCmd = NULL;
155 this->helpOnWindowCmd = NULL;
156 }
157
158 this->wizardDialog = NUL(WizardDialog*);
159 }
160
161
~IBMMainWindow()162 IBMMainWindow::~IBMMainWindow()
163 {
164 if (this->onContextOption) delete this->onContextOption;
165 if (this->onHelpOption) delete this->onHelpOption;
166 if (this->onManualOption) delete this->onManualOption;
167 if (this->onWindowOption) delete this->onWindowOption;
168
169 if (this->helpOnContextCmd) delete this->helpOnContextCmd;
170 if (this->helpOnWindowCmd) delete this->helpOnWindowCmd;
171
172 if (this->aboutAppOption) delete this->aboutAppOption;
173 if (this->helpAboutAppCmd) delete this->helpAboutAppCmd;
174
175 if (this->techSupportOption) delete this->techSupportOption;
176 if (this->helpTechSupportCmd) delete this->helpTechSupportCmd;
177
178 if (this->wizardDialog) delete this->wizardDialog;
179 }
180
181
182 //
183 // Install the default resources for this class.
184 //
installDefaultResources(Widget baseWidget)185 void IBMMainWindow::installDefaultResources(Widget baseWidget)
186 {
187 this->setDefaultResources(baseWidget, IBMMainWindow::DefaultResources);
188 this->MainWindow::installDefaultResources(baseWidget);
189 }
190
initialize()191 void IBMMainWindow::initialize()
192 {
193
194 this->MainWindow::initialize();
195 if (this->main)
196 this->installComponentHelpCallback(this->main);
197
198 if(theApplication->getIconPixmap() != XtUnspecifiedPixmap)
199 XtVaSetValues(this->getRootWidget(),
200 XmNiconPixmap, theApplication->getIconPixmap(),
201 NULL);
202 }
203
postWizard()204 void IBMMainWindow::postWizard()
205 {
206 if (theIBMApplication->inWizardMode() == FALSE) return;
207 if ((this->wizardDialog) && (this->wizardDialog->isManaged())) return ;
208
209 if (theIBMApplication->isWizardWindow(this->UIComponent::name)) {
210 if (this->wizardDialog == NUL(WizardDialog*))
211 this->wizardDialog =
212 new WizardDialog (this->getRootWidget(), this->UIComponent::name);
213 if (this->wizardDialog->getText())
214 this->wizardDialog->post();
215 }
216 }
217
manage()218 void IBMMainWindow::manage()
219 {
220 this->MainWindow::manage();
221
222 //
223 // Post the wizard window.
224 //
225 if (theIBMApplication->inWizardMode())
226 this->postWizard();
227 }
228