00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Authored by: 00007 * Chris Thompson 00008 * Side Effects Software Inc. 00009 * 00010 * NAME: Console handler for utility library (C++) 00011 * 00012 * COMMENTS: 00013 * 00014 */ 00015 00016 #ifndef __UT_Console_h__ 00017 #define __UT_Console_h__ 00018 00019 #include "UT_API.h" 00020 #include "UT_Defines.h" 00021 00022 class UT_ConsoleHandler; 00023 00024 class UT_API UT_Console 00025 { 00026 public: 00027 // Any class in Houdini can call initConsole(). 00028 // Be sure to call this before using stdin/stdout/stderr. 00029 // You can call this as many times as you'd like. 00030 static void initConsole(); 00031 00032 // This function returns either zero or CREATE_NO_WINDOW, which is the 00033 // process creation flag that prevents the process from communicating 00034 // with a console. For graphical applications, we want CREATE_NO_WINDOW 00035 // so that the application doesn't pop up a console window. For non- 00036 // graphical applications, we want zero so that the spawned application 00037 // can access the existing application's console. 00038 static unsigned childProcessCreateWindowFlag(); 00039 00040 // This should only be called once (when Houdini terminates). 00041 static void terminateConsole(); 00042 00043 static bool hasTextConsole(); 00044 00045 // This method allows you to control whether or not the 00046 // application will be allowed to terminate while the console 00047 // is displaying some text. 00048 // If UT_TRUE, the user must explicitly close the console 00049 // (this is useful for apps that display 'usage' messages 00050 // then terminate immediately). 00051 // If UT_FALSE, the console dies when the user closes the 00052 // application. 00053 // 00054 // The default is UT_TRUE. 00055 // 00056 // In Houdini, the policy is this: setWaitForUserToClose() 00057 // is UT_TRUE *until* the main window is opened, then 00058 // it is switched off. 00059 // 00060 // Of course, if the console does not exist on a platform 00061 // (eg. SGI), this has no effect. 00062 static void setWaitForUserToClose( UT_Bool val ); 00063 00064 private: 00065 static UT_Bool theConsoleInitialized; 00066 static UT_ConsoleHandler *theConsoleHandler; 00067 static UT_Bool theConsoleWaitForUser; 00068 static bool theHasTextConsole; 00069 }; 00070 00071 #endif // __UT_Console_h__
1.5.9