00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWApplication.h,v $ 00004 00005 Copyright (c) Kitware, Inc. 00006 All rights reserved. 00007 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 // .NAME vtkKWApplication - an application class 00015 // .SECTION Description 00016 // vtkKWApplication is the overall class that represents the entire 00017 // application. It is also responsible for managing the vtkKWWindowBase(s) 00018 // associated to the application. 00019 00020 #ifndef __vtkKWApplication_h 00021 #define __vtkKWApplication_h 00022 00023 #include "vtkKWObject.h" 00024 00025 #include "vtkTcl.h" // Needed for Tcl_Interp 00026 #include "vtkTk.h" // Needed for Tk_Window 00027 00028 class vtkKWApplicationInternals; 00029 class vtkKWBalloonHelpManager; 00030 class vtkKWColorPickerDialog; 00031 class vtkKWLabel; 00032 class vtkKWLogDialog; 00033 class vtkKWMessageDialog; 00034 class vtkKWOptionDataBase; 00035 class vtkKWRegistryHelper; 00036 class vtkKWSplashScreen; 00037 class vtkKWTclInteractor; 00038 class vtkKWTextWithScrollbars; 00039 class vtkKWTheme; 00040 class vtkKWTopLevel; 00041 class vtkKWWidget; 00042 class vtkKWWindowBase; 00043 00044 class KWWidgets_EXPORT vtkKWApplication : public vtkKWObject 00045 { 00046 public: 00047 static vtkKWApplication* New(); 00048 vtkTypeRevisionMacro(vtkKWApplication,vtkKWObject); 00049 void PrintSelf(ostream& os, vtkIndent indent); 00050 00051 // Description: 00052 // Override vtkKWObject's method. A vtkKWObject is associated to a 00053 // vtkKWApplication. Even if vtkKWApplication is a subclass of 00054 // vtkKWObject, an application's application is actually 'itself', 00055 // and it can not be reset. 00056 virtual vtkKWApplication *GetApplication() { return this; } 00057 virtual void SetApplication (vtkKWApplication*); 00058 00059 // Description: 00060 // Start running the application, with or without arguments, and enter the 00061 // event loop. The application will exit the event loop once every 00062 // windows has been closed. 00063 // As a convenience, if one (or more) window has been added to the 00064 // application (using AddWindow()), and none of them has been mapped 00065 // on the screen yet, the application will automatically display the first 00066 // window by calling its Display() method. 00067 virtual void Start(); 00068 virtual void Start(int argc, char *argv[]); 00069 00070 // Description: 00071 // This method is invoked when the user exits the app 00072 // Return 1 if the app exited successfully, 0 otherwise (for example, 00073 // if some dialogs are still up, or the user did not confirm, etc). 00074 virtual int Exit(); 00075 00076 // Description: 00077 // Set/Get if a confirmation dialog should be displayed before the 00078 // application exits. 00079 vtkSetMacro(PromptBeforeExit, int); 00080 vtkGetMacro(PromptBeforeExit, int); 00081 vtkBooleanMacro(PromptBeforeExit, int); 00082 00083 // Description: 00084 // Set/Get the value returned by the application at exit. 00085 // This can be used from scripts to set an error status 00086 vtkSetMacro(ExitStatus, int); 00087 vtkGetMacro(ExitStatus, int); 00088 00089 // Description: 00090 // Get when application is exiting (set to 1 as soon as Exit() is called). 00091 vtkGetMacro(InExit, int); 00092 00093 // Description: 00094 // Set/Get if the error log should be sent.emailed before application exits. 00095 vtkSetMacro(SendErrorLogBeforeExit, int); 00096 vtkGetMacro(SendErrorLogBeforeExit, int); 00097 vtkBooleanMacro(SendErrorLogBeforeExit, int); 00098 00099 // Description: 00100 // Add, remove (i.e. close), or retrieve a window to/from this application. 00101 // Note that AddWindow() will increase the reference count of the window 00102 // that is added, RemoveWindow() will decrease it. Once the last window is 00103 // closed, Exit() is called. 00104 // Return 1 if successful, 0 otherwise 00105 virtual int AddWindow(vtkKWWindowBase *w); 00106 virtual int RemoveWindow(vtkKWWindowBase *); 00107 virtual vtkKWWindowBase* GetNthWindow(int rank); 00108 00109 // Description: 00110 // Get the number of windows, the number of windows mapped on screen. 00111 virtual int GetNumberOfWindows(); 00112 virtual int GetNumberOfWindowsMapped(); 00113 00114 // Description: 00115 // Set/Get the application name. 00116 // Also check the LimitedEditionModeName variable if you plan on running 00117 // the application in limited edition mode. 00118 vtkSetStringMacro(Name); 00119 vtkGetStringMacro(Name); 00120 00121 // Description: 00122 // Get the major and minor application version. 00123 vtkSetMacro(MajorVersion, int); 00124 vtkGetMacro(MajorVersion, int); 00125 vtkSetMacro(MinorVersion, int); 00126 vtkGetMacro(MinorVersion, int); 00127 00128 // Description: 00129 // Set/Get the application version name - this usually is the application 00130 // name postfixed with the version number (major/minor). 00131 // If it has not been set, it will use the value of Name and append 00132 // the major/minor version. 00133 vtkSetStringMacro(VersionName); 00134 virtual const char* GetVersionName(); 00135 00136 // Description: 00137 // Set/Get the application release name - this is the release of the 00138 // application version (if any), typically: beta1, beta2, final, patch1, etc. 00139 vtkSetStringMacro(ReleaseName); 00140 vtkGetStringMacro(ReleaseName); 00141 00142 // Description: 00143 // Get the "pretty" name of the application. 00144 // This is typically used for windows or dialogs title, About boxes, etc. 00145 // It combines the application name, its version, and other relevant 00146 // informations (like its limited edition mode). 00147 virtual const char* GetPrettyName(); 00148 00149 // Descrition: 00150 // Set/Get if the application is running in limited edition mode. 00151 // This can be used throughout the whole UI to enable or disable 00152 // features on the fly. Make sure it is *not* wrapped ! 00153 //BTX 00154 virtual void SetLimitedEditionMode(int arg); 00155 vtkBooleanMacro(LimitedEditionMode, int); 00156 vtkGetMacro(LimitedEditionMode, int); 00157 //ETX 00158 00159 // Descrition: 00160 // Return the limited edition mode and optionally warn the user ; 00161 // if the limited edition mode is true, display a popup warning stating 00162 // that 'feature' is not available in this mode. 00163 virtual int GetLimitedEditionModeAndWarn(const char *feature); 00164 00165 // Descrition: 00166 // Set/Get the name of the application when it runs in limited edition mode. 00167 // This is used by GetPrettyName() for example, instead of the Name variable. 00168 // If it has not been set, it will use the value of Name and append 00169 // the "Limited Edition" to it. 00170 vtkSetStringMacro(LimitedEditionModeName); 00171 virtual const char *GetLimitedEditionModeName(); 00172 00173 // Descrition: 00174 // Set/Get if the application is running in release/production mode. 00175 // This should be set as soon as possible, before creating any UI. 00176 // The release mode (as opposed to debug/development mode) can be used 00177 // to prevent the output window from showing up, to disable the support of 00178 // specific file formats that should only be used during development, to 00179 // remove the Tcl Command Prompt, etc. 00180 //BTX 00181 virtual void SetReleaseMode(int); 00182 vtkBooleanMacro(ReleaseMode, int); 00183 vtkGetMacro(ReleaseMode, int); 00184 //ETX 00185 00186 // Description: 00187 // Set/Get the directory in which the application is supposed 00188 // to be installed. 00189 virtual const char *GetInstallationDirectory(); 00190 vtkSetStringMacro(InstallationDirectory); 00191 00192 // Description: 00193 // Set/Get the directory in which the application can store 00194 // user data. 00195 // On Windows, this is usually: 00196 // C:\Documents and Settings<username>\My Documents\NameOfTheApplication 00197 // On Unix/MacOSX, this is usually: 00198 // $HOME/.NameOfTheApplication (ex: /users/barre/.VolView) 00199 virtual const char* GetUserDataDirectory(); 00200 vtkSetStringMacro(UserDataDirectory); 00201 00202 // Description: 00203 // Load and evaluate a Tcl script from a file. 00204 // Return 1 if successful, 0 otherwise 00205 virtual int LoadScript(const char* filename); 00206 00207 // Description: 00208 // Run an AppleScript provided as a string (don't forget to escape the 00209 // quotes). Only on Apple platforms. 00210 // Return 1 if successful, 0 otherwise 00211 #ifdef __APPLE__ 00212 //BTX 00213 static int RunAppleScript(const char *text); 00214 //ETX 00215 #endif 00216 00217 // Description: 00218 // Set/Get the "exit after load script" flag. If this flag is set, then 00219 // the application will automatically Exit() after a call to LoadScript(). 00220 // This is mainly used for testing purposes. Even though a Tcl script 00221 // can end with an explicit call to Exit on the application Tcl object, 00222 // this call may never be reached it the script contains an error. Setting 00223 // this variable will make sure the application will exit anyway. 00224 vtkSetClampMacro(ExitAfterLoadScript, int, 0, 1); 00225 vtkBooleanMacro(ExitAfterLoadScript, int); 00226 vtkGetMacro(ExitAfterLoadScript, int); 00227 00228 // Description: 00229 // Set/Get the print quality. 00230 vtkGetMacro(PrintTargetDPI, double); 00231 vtkSetMacro(PrintTargetDPI, double); 00232 00233 // Description: 00234 // Get the Registry object. 00235 //BTX 00236 vtkKWRegistryHelper *GetRegistryHelper(); 00237 //ETX 00238 00239 // Description: 00240 // Set/Get the registry application version name - this usually is the 00241 // application name postfixed with the *major* version number. The minor 00242 // version is not used so that application settings are maintained 00243 // between minor version changes. 00244 // It is typically used as the master key to store registry settings 00245 // (ex: VolView 3, ParaView1, etc.) 00246 vtkSetStringMacro(RegistryVersionName); 00247 virtual const char* GetRegistryVersionName(); 00248 00249 // Description: 00250 // Set/Get the current registry level. 00251 // When setting/retrieving a value in/from the registry a 'level' has 00252 // to be provided as part of the parameters. If this level is greater 00253 // than the current registry level, the operation will be ignored. 00254 // Set the registry level to -1 means to ignore all the registry operations. 00255 vtkSetClampMacro(RegistryLevel, int, -1, 10); 00256 vtkGetMacro(RegistryLevel, int); 00257 00258 // Description: 00259 // Set/Get/Delete/Query a registry value for the application. 00260 // When storing multiple arguments, separate them with spaces. 00261 // Note that if the 'level' is greater than the current registry level, 00262 // the operation will be ignored. 00263 //BTX 00264 virtual int SetRegistryValue( 00265 int level, const char* subkey, const char* key, 00266 const char* format, ...); 00267 //ETX 00268 virtual int GetRegistryValue( 00269 int level, const char* subkey, const char* key, char* value); 00270 virtual int DeleteRegistryValue( 00271 int level, const char* subkey, const char* key); 00272 virtual int HasRegistryValue( 00273 int level, const char* subkey, const char* key); 00274 00275 // Description: 00276 // Retrieve a value from the registry and convert it to a type 00277 // (boolean, float, int). 00278 // Return 0 if the value was not found. 00279 // For GetBooleanRegistryValue(), perform a boolean check of the value in 00280 // the registry. If the value at the key is equal to 'trueval', then return 00281 // true, otherwise return false. 00282 virtual float GetFloatRegistryValue( 00283 int level, const char* subkey, const char* key); 00284 virtual int GetIntRegistryValue( 00285 int level, const char* subkey, const char* key); 00286 virtual int GetBooleanRegistryValue( 00287 int level, const char* subkey, const char* key, const char* trueval); 00288 00289 // Description: 00290 // Save/retrieve color to/from the registry. 00291 // If the color does not exist, it will retrieve -1, -1 ,-1 and return 0 00292 // (1 if success). 00293 // Note that the subkey used here is "Colors". 00294 virtual void SaveColorRegistryValue( 00295 int level, const char *key, double rgb[3]); 00296 virtual int RetrieveColorRegistryValue( 00297 int level, const char *key, double rgb[3]); 00298 00299 // Descrition: 00300 // Save/Retrieve the application settings to/from registry. 00301 // Do not call that method before the application name is known and the 00302 // proper registry level set (if any). 00303 virtual void RestoreApplicationSettingsFromRegistry(); 00304 virtual void SaveApplicationSettingsToRegistry(); 00305 00306 // Description: 00307 // Get the database option object. 00308 //BTX 00309 vtkKWOptionDataBase *GetOptionDataBase(); 00310 //ETX 00311 00312 // Description: 00313 // Set/Get if this application supports a splash screen 00314 vtkSetMacro(SupportSplashScreen, int); 00315 vtkGetMacro(SupportSplashScreen, int); 00316 vtkBooleanMacro(SupportSplashScreen, int); 00317 00318 // Description: 00319 // Set/Get if this application should show the splash screen at startup 00320 vtkGetMacro(SplashScreenVisibility, int); 00321 vtkSetMacro(SplashScreenVisibility, int); 00322 vtkBooleanMacro(SplashScreenVisibility, int); 00323 00324 // Description: 00325 // Retrieve the splash screen object 00326 // This will also create the splash screen widget itself. 00327 virtual vtkKWSplashScreen* GetSplashScreen(); 00328 00329 // Description: 00330 // Set/Get if the user interface geometry should be saved (to the registry, 00331 // for example). 00332 // This is more like a hint that many widgets can query to check if 00333 // they should save their own geometry (and restore it on startup). 00334 vtkGetMacro(SaveUserInterfaceGeometry, int); 00335 vtkSetMacro(SaveUserInterfaceGeometry, int); 00336 vtkBooleanMacro(SaveUserInterfaceGeometry, int); 00337 00338 // Description: 00339 // Get/Set the internal character encoding of the application. 00340 virtual void SetCharacterEncoding(int val); 00341 vtkGetMacro(CharacterEncoding, int); 00342 00343 // Description: 00344 // Get if we have some logic to check for application update online and 00345 // perform that check. 00346 virtual int HasCheckForUpdates(); 00347 virtual void CheckForUpdates(); 00348 00349 // Description: 00350 // Get/Set the current theme. This will install the theme automatically. 00351 virtual void SetTheme(vtkKWTheme *theme); 00352 vtkGetObjectMacro(Theme, vtkKWTheme); 00353 00354 // Description: 00355 // Get if we have some logic to report feedback by email and 00356 // email that feedback. 00357 // Set/Get the email address to send that feedback to. 00358 virtual int CanEmailFeedback(); 00359 virtual void EmailFeedback(); 00360 vtkSetStringMacro(EmailFeedbackAddress); 00361 vtkGetStringMacro(EmailFeedbackAddress); 00362 00363 // Description: 00364 // Send email (win32 only for the moment, use MAPI). 00365 virtual int SendEmail( 00366 const char *to, 00367 const char *subject, 00368 const char *message, 00369 const char *attachment_filename, 00370 const char *extra_error_msg = NULL); 00371 00372 // Description: 00373 // Add email feedback body and subject to output stream. 00374 // Override this function in subclasses (and/or call the superclass) to 00375 // add more information. 00376 virtual void AddEmailFeedbackBody(ostream &); 00377 virtual void AddEmailFeedbackSubject(ostream &); 00378 00379 // Description: 00380 // Display the on-line help for this application. 00381 // Optionally provide a master window this dialog should be the slave of. 00382 virtual void DisplayHelpDialog(vtkKWTopLevel *master); 00383 00384 // Description: 00385 // Set/Get the help starting page. 00386 // If set to a CHM/HTML page, it will be opened automatically on Windows. 00387 vtkGetStringMacro(HelpDialogStartingPage); 00388 vtkSetStringMacro(HelpDialogStartingPage); 00389 00390 // Description: 00391 // Display the about dialog for this application. 00392 // Optionally provide a master window this dialog should be the slave of. 00393 virtual void DisplayAboutDialog(vtkKWTopLevel *master); 00394 00395 // Description: 00396 // Return the Balloon Help helper object. 00397 virtual vtkKWBalloonHelpManager *GetBalloonHelpManager(); 00398 00399 // Description: 00400 // Return the appplication-wide color picker dialog. Redefine this method 00401 // in your application sub-class to provide a customized color picker. 00402 virtual vtkKWColorPickerDialog *GetColorPickerDialog(); 00403 00404 // Description: 00405 // Evaluate Tcl script/code and perform argument substitutions. 00406 //BTX 00407 virtual const char* Script(const char* format, ...); 00408 int EvaluateBooleanExpression(const char* format, ...); 00409 //ETX 00410 00411 // Description: 00412 // Get the interpreter being used by this application 00413 static Tcl_Interp *GetMainInterp(); 00414 00415 // Description: 00416 // Initialize Tcl/Tk 00417 // Return NULL on error (eventually provides an ostream where detailed 00418 // error messages will be stored). 00419 // One method takes argc/argv and will create an internal Tcl interpreter 00420 // on the fly, the other takes a Tcl interpreter and uses it afterward 00421 // (this is mainly intended for initialization as a Tcl package) 00422 //BTX 00423 static Tcl_Interp *InitializeTcl(int argc, char *argv[], ostream *err = 0); 00424 static Tcl_Interp *InitializeTcl(Tcl_Interp *interp, ostream *err = 0); 00425 //ETX 00426 00427 // Description: 00428 // Call RegisterDialogUp to notify the application that a modal dialog is up, 00429 // and UnRegisterDialogUp when it is not anymore. IsDialogUp will return 00430 // if any dialog is up. 00431 // The parameter to pass is a pointer to the dialog/toplevel/widget that is 00432 // being registered/unregistered. If there is no such widget (say, if you 00433 // are calling a builtin Tk function that creates and pops-up a dialog), pass 00434 // the adress of the class that is invoking that call. 00435 // This is used to help preventing a window or an 00436 // application to exit while a dialog is still up. This is usually not 00437 // a problem on Win32, since a modal dialog will prevent the user from 00438 // interacting with the window and exit it, but this is not the case for 00439 // other operating system where the window manager is independent from the 00440 // window contents itself. In any case, inheriting from a vtkKWTopLevel 00441 // or vtkKWDialog should take care of calling this function for you. 00442 virtual void RegisterDialogUp(vtkKWWidget *ptr); 00443 virtual void UnRegisterDialogUp(vtkKWWidget *ptr); 00444 virtual int IsDialogUp(); 00445 00446 // Description: 00447 // Open a link (media). 00448 // On Win32, use ShellExecute to trigger the default viewers. 00449 int OpenLink(const char *link); 00450 00451 // Description: 00452 // Explore link. 00453 // On Win32, this will launch the Explorer, open it in the directory 00454 // of the link, and eventually select that link itself in the directory. 00455 int ExploreLink(const char *link); 00456 00457 // Description: 00458 // Process/update pending events. This method brings the 00459 // application "up to date" by entering the event loop repeatedly until 00460 // all pending events (including idle callbacks) have been processed. 00461 virtual void ProcessPendingEvents(); 00462 00463 // Description: 00464 // Process/update idle tasks. This causes operations that are normally 00465 // deferred, such as display updates and window layout calculations, to be 00466 // performed immediately. 00467 virtual void ProcessIdleTasks(); 00468 00469 // Description: 00470 // Install the Tcl background error callback. Individual applications 00471 // can define a background error command if they wish to handle background 00472 // errors. A background error is one that occurs in an event handler or 00473 // some other command that didn't originate with the application. For 00474 // example, if an error occurs while executing a command specified with 00475 // asynchronously. The default implementation is to feed the Tcl error 00476 // message to a vtkErrorMacro. 00477 virtual void InstallTclBgErrorCallback(); 00478 00479 // Description: 00480 // Popup a warning/error/information/debug message. 00481 virtual void WarningMessage(const char* message); 00482 virtual void ErrorMessage(const char* message); 00483 virtual void DebugMessage(const char* message); 00484 virtual void InformationMessage(const char* message); 00485 00486 // Description: 00487 // Display the warning/error/information/debug message log dialog. 00488 // Optionally provide a master window this dialog should be the slave of. 00489 virtual void DisplayLogDialog(vtkKWTopLevel *master); 00490 virtual vtkKWLogDialog* GetLogDialog(); 00491 00492 // Description: 00493 // Get/display the tcl interactor. 00494 // Optionally provide a master window this dialog should be the slave of. 00495 virtual void DisplayTclInteractor(vtkKWTopLevel *master); 00496 virtual vtkKWTclInteractor* GetTclInteractor(); 00497 00498 // Description: 00499 // Add system information to a stream. 00500 // Will be used to report system info in the About dialog, or the Feedback 00501 // email... 00502 virtual void AddSystemInformation(ostream &); 00503 00504 // Description: 00505 // Some constants 00506 //BTX 00507 static const char *ExitDialogName; 00508 static const char *SendErrorLogDialogName; 00509 static const char *BalloonHelpVisibilityRegKey; 00510 static const char *SaveUserInterfaceGeometryRegKey; 00511 static const char *SplashScreenVisibilityRegKey; 00512 static const char *PrintTargetDPIRegKey; 00513 //ETX 00514 00515 // Description: 00516 // Callbacks. Internal, do not use. 00517 virtual void TclBgErrorCallback(const char* message); 00518 00519 // Description: 00520 // Put a string into the environment of the form var=value 00521 static int PutEnv(const char* value); 00522 00523 protected: 00524 vtkKWApplication(); 00525 ~vtkKWApplication(); 00526 00527 // Description: 00528 // Do one tcl event and enter the event loop, allowing the application 00529 // interface to actually run. 00530 virtual void DoOneTclEvent(); 00531 00532 // Description: 00533 // User data directory 00534 char *UserDataDirectory; 00535 00536 char *EmailFeedbackAddress; 00537 00538 // Description: 00539 // Create email message dialog (in case of error). 00540 virtual void CreateEmailMessageDialog( 00541 vtkKWMessageDialog *dlg, 00542 const char *to, 00543 const char *subject, 00544 const char *message, 00545 const char *attachment_filename); 00546 00547 // Description: 00548 // On-line help starting page 00549 char *HelpDialogStartingPage; 00550 00551 // Description: 00552 // Display the exit dialog. 00553 // Optionally provide a master window this dialog should be the slave of. 00554 // Return 1 if the user wants to exit, 0 otherwise 00555 virtual int DisplayExitDialog(vtkKWTopLevel *master); 00556 00557 // Description: 00558 // Value that is set after exit (status), flag stating that 00559 // Exit was called, flag stating if application should exit after load script 00560 int ExitStatus; 00561 int InExit; 00562 int ExitAfterLoadScript; 00563 int PromptBeforeExit; 00564 int SendErrorLogBeforeExit; 00565 00566 // Description: 00567 // Send the error log (prompt first). 00568 virtual int SendErrorLog(); 00569 00570 // Description: 00571 // Number of dialog that are up. See Un/RegisterDialogUp(). 00572 int DialogUp; 00573 00574 // Description: 00575 // Registry level. If a call to Set/GetRegistryValue uses a level above 00576 // this ivar, the operation is ignored. 00577 int RegistryLevel; 00578 00579 // Description: 00580 // Flag stating if application supports splash screen, and shows it 00581 int SupportSplashScreen; 00582 int SplashScreenVisibility; 00583 virtual void CreateSplashScreen() {}; 00584 00585 // Description: 00586 // Flag stating if the UI geometry should be saved before exiting 00587 int SaveUserInterfaceGeometry; 00588 00589 // Description: 00590 // About dialog, add text and copyrights to the about dialog. 00591 // Override this function in subclasses (and/or call the superclass) to 00592 // add more information. 00593 virtual void ConfigureAboutDialog(); 00594 virtual void AddAboutText(ostream &); 00595 virtual void AddAboutCopyrights(ostream &); 00596 vtkKWMessageDialog *AboutDialog; 00597 vtkKWLabel *AboutDialogImage; 00598 vtkKWTextWithScrollbars *AboutRuntimeInfo; 00599 00600 // Description: 00601 // Character encoding (is passed to Tcl) 00602 int CharacterEncoding; 00603 00604 // Description: 00605 // Print DPI 00606 double PrintTargetDPI; 00607 00608 // Description: 00609 // Current theme 00610 vtkKWTheme *Theme; 00611 00612 // Description: 00613 // Give a change to the application to parse the command-line arguments 00614 // and set some variables accordingly. Subclasses that do not intend 00615 // to call their super's Start(argc, argv) should make sure they 00616 // call their super's ParseCommandLineArguments. 00617 virtual void ParseCommandLineArguments(int argc, char *argv[]); 00618 00619 // Description: 00620 // Check for an argument (example: --foo, /C, -bar, etc). 00621 // Return VTK_OK if found and set 'index' to the position of the 00622 // argument in argv[]. 00623 // Return VTK_ERROR if not found. 00624 static int CheckForArgument( 00625 int argc, char* argv[], const char *arg, int &index); 00626 00627 // Description: 00628 // Check for a valued argument (example: --foo=bar, /C=bar, -bar=foo, etc). 00629 // Return VTK_OK if found and set 'index' to the position of the 00630 // argument in argv[], 'value_pos' to the position right after the '=' 00631 // in that argument. 00632 // Return VTK_ERROR if not found. 00633 static int CheckForValuedArgument( 00634 int argc, char* argv[], const char *arg, int &index, int &value_pos); 00635 00636 // Description: 00637 // Try to find the path to the online updater (for example, WiseUpdt.exe) 00638 // and output that path to the ostream passed as parameter. 00639 virtual int GetCheckForUpdatesPath(ostream &path); 00640 00641 // Description: 00642 // Deallocate/delete/reparent some internal objects in order to solve 00643 // reference loops that would prevent this instance from being deleted. 00644 virtual void PrepareForDelete(); 00645 00646 // PIMPL Encapsulation for STL containers 00647 00648 vtkKWApplicationInternals *Internals; 00649 00650 // Description: 00651 // Initialize VTK's Tcl packages 00652 // Return NULL on error (eventually provides an ostream where detailed 00653 // error messages will be stored). 00654 //BTX 00655 static Tcl_Interp *InitializeVTK(Tcl_Interp *interp, ostream *err = 0); 00656 //ETX 00657 00658 // Description: 00659 // Log dialog 00660 vtkKWLogDialog *LogDialog; 00661 virtual int CreateLogDialog(); 00662 00663 // Description: 00664 // Install/restore output window 00665 virtual void InstallOutputWindow(); 00666 virtual void RestoreOutputWindow(); 00667 00668 // Description: 00669 // Tcl interactor. 00670 vtkKWTclInteractor *TclInteractor; 00671 00672 // Description: 00673 // Color picker dialog 00674 vtkKWColorPickerDialog *ColorPickerDialog; 00675 00676 private: 00677 00678 vtkKWRegistryHelper *RegistryHelper; 00679 vtkKWOptionDataBase *OptionDataBase; 00680 vtkKWSplashScreen *SplashScreen; 00681 vtkKWBalloonHelpManager *BalloonHelpManager; 00682 00683 // Description: 00684 // Application name and version 00685 char *Name; 00686 char *VersionName; 00687 char *ReleaseName; 00688 int MajorVersion; 00689 int MinorVersion; 00690 char *PrettyName; 00691 vtkSetStringMacro(PrettyName); 00692 char *RegistryVersionName; 00693 00694 // Description: 00695 // Limited edition mode, name of the application when in limited edition mode 00696 int LimitedEditionMode; 00697 char *LimitedEditionModeName; 00698 00699 // Description: 00700 // Release mode 00701 int ReleaseMode; 00702 00703 // Description: 00704 // Application installation directory 00705 char *InstallationDirectory; 00706 virtual void FindInstallationDirectory(); 00707 00708 vtkKWApplication(const vtkKWApplication&); // Not implemented. 00709 void operator=(const vtkKWApplication&); // Not implemented. 00710 }; 00711 00712 #endif