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 11 12 13 14 #ifndef _IBMApplication_h 15 #define _IBMApplication_h 16 17 18 #include <Xm/Xm.h> 19 #include "Application.h" 20 21 // 22 // Class name definition: 23 // 24 #define ClassIBMApplication "IBMApplication" 25 26 // 27 // XtCallbackProc (*CB), XtEventHandler (*EH) and XtActionProc (*AP) 28 // DialogCallback (*DCB) functions for this and derived classes 29 // 30 31 extern "C" void IBMApplication_IBMButtonHelpAP(Widget, XEvent*, String*, Cardinal*); 32 extern "C" void IBMApplication_ColorProc(XColor*, XColor*, XColor*, XColor*, XColor*); 33 extern "C" Boolean IBMApplication_String2Pixel (Display *d, XrmValue args[], Cardinal nargs, 34 XrmValue *from, XrmValue *to, XtPointer *closure); 35 36 37 class Command; 38 class HelpWin; 39 40 typedef struct 41 { 42 // 43 // options and resources: 44 // 45 String UIRoot; 46 47 Boolean wizard; // True is we're opening wizard windows by default 48 String noWizardNames; // list of windows for which we want no wizard 49 } IBMResource; 50 51 // 52 // IBMApplication class definition: 53 // 54 class IBMApplication : public Application 55 { 56 private: 57 // 58 // Private class data: 59 // 60 friend void IBMApplication_IBMButtonHelpAP(Widget, XEvent*, String*, Cardinal*); 61 void initLogo(); // Creates the Logo pixmap 62 void initIcon(); // Creates the Icon pixmap 63 Pixmap logo_pmap; // Logo pixmap; 64 Pixmap icon_pmap; // Icon pixmap; 65 int num_colors; // The number of allocated colors 66 char *aboutAppString; // The text in the aboutApp dialog. 67 68 friend Boolean IBMApplication_String2Pixel (Display *d, XrmValue args[], Cardinal nargs, 69 XrmValue *from, XrmValue *to, XtPointer *closure); 70 static XmColorProc DefColorProc; 71 friend void IBMApplication_ColorProc(XColor *bg_color, XColor *fg_color, 72 XColor *sel_color, XColor *ts_color, XColor *bs_color); 73 74 protected: 75 static IBMResource resource; // resources and options 76 77 // 78 // Initialize the window system. 79 // 80 virtual boolean initializeWindowSystem(int *argcp, char **argv); 81 82 // 83 // Protected member data: 84 // 85 static const String DefaultResources[]; 86 static XtActionsRec actions[]; 87 88 89 HelpWin *helpWindow; 90 91 boolean initialize(int* argcp, char** argv); 92 93 // 94 // Load application specific action routines 95 // 96 virtual void addActions(); 97 98 99 virtual HelpWin *newHelpWindow(); 100 101 // 102 // Handle Xt Warnings (called by Application_XtWarningHandler) 103 // Handle X Errors (called by XErrorHandler, static, above) 104 // 105 virtual void handleXtWarning(char *message); 106 107 // 108 // Constructor for the subclasses: 109 // 110 IBMApplication(char* className); 111 112 // 113 // Install the default resources for this class and then call the 114 // same super class method to get the default resources from the 115 // super classes. 116 // 117 virtual void installDefaultResources(Widget baseWidget); 118 119 120 // 121 // W I Z A R D S W I Z A R D S W I Z A R D S 122 // W I Z A R D S W I Z A R D S W I Z A R D S 123 // 124 List* noWizards; 125 void parseNoWizardNames(); 126 void printNoWizardNames(); 127 128 // 129 // prevent leakage of the tech-support text 130 // 131 char* techSupportString; 132 133 public: 134 135 ~IBMApplication(); 136 137 Command *helpOnContextCmd; 138 Command *genericHelpCmd; 139 Command *helpTutorialCmd; 140 getUIRoot()141 const char *getUIRoot() 142 { 143 return this->resource.UIRoot; 144 } 145 146 // 147 // Displays any help required. 148 // 149 virtual void helpOn(const char *topic); 150 151 // 152 // Start the tutorial on behalf of the application. 153 // 154 virtual boolean startTutorial(); 155 156 // 157 // Get the command string that will start the tutorial. 158 // 159 virtual const char *getStartTutorialCommandString(); 160 161 // 162 // Get the Logo pixmap 163 // 164 virtual Pixmap getLogoPixmap(boolean create_if_necessary=FALSE); 165 virtual void cleanupLogo(); 166 167 // 168 // Get the Icon pixmap 169 // getIconPixmap()170 virtual Pixmap getIconPixmap(){return this->icon_pmap;}; 171 172 // 173 // Get the version string - among other things, this is used as the 174 // the string that is place in the About dialog that pops up when 175 // 'Help on Version' is requested. 176 // 177 virtual void getVersionNumbers(int *maj, int *min, int *mic); 178 const char *getAboutAppString(); 179 const char *getTechSupportString(); 180 181 // 182 // Get the name of the directoy that contains the help files. 183 // This returns $UIRoot/help 184 // 185 const char *getHelpDirectory(); 186 const char *getHTMLDirectory(); 187 188 // 189 // If there is a copyright notice, we create the Logo and Icon data 190 // structures and then call the super class method, 191 // otherwise, we just return. 192 // 193 virtual void postCopyrightNotice(); 194 195 // 196 // W I Z A R D S W I Z A R D S W I Z A R D S 197 // W I Z A R D S W I Z A R D S W I Z A R D S 198 // inWizardMode() is virtual because GAR wants to default to TRUE instead of 199 // FALSE. The command line arg has the ability only to turn on the value. 200 // inWizardMode()201 virtual boolean inWizardMode() { return this->resource.wizard; } 202 boolean isWizardWindow(const char* wiz_name); 203 void appendNoWizardName(const char* nowiz_name); 204 205 // 206 // print a application default to the resource file. For example: 207 // DX.width: 300x500 into $HOME/DX 208 // 209 void printResource (const char* resource, const char* value); 210 virtual boolean getApplicationDefaultsFileName(char* res_file, boolean create=FALSE); 211 212 // 213 // Returns a pointer to the class name. 214 // getClassName()215 const char* getClassName() 216 { 217 return ClassIBMApplication; 218 } 219 220 // Get Temp. directory 221 const char *getTmpDirectory(boolean bList = FALSE); 222 }; 223 224 extern IBMApplication *theIBMApplication; 225 226 #endif // _IBMApplication_h 227