apptbase.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/apptbase.h
  3. // Purpose: declaration of wxAppTraits for MSW
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 22.06.2003
  7. // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSW_APPTBASE_H_
  11. #define _WX_MSW_APPTBASE_H_
  12. // ----------------------------------------------------------------------------
  13. // wxAppTraits: the MSW version adds extra hooks needed by MSW-only code
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase
  16. {
  17. public:
  18. // wxExecute() support methods
  19. // ---------------------------
  20. // called before starting to wait for the child termination, may return
  21. // some opaque data which will be passed later to AfterChildWaitLoop()
  22. virtual void *BeforeChildWaitLoop() = 0;
  23. // called after starting to wait for the child termination, the parameter
  24. // is the return value of BeforeChildWaitLoop()
  25. virtual void AfterChildWaitLoop(void *data) = 0;
  26. #if wxUSE_THREADS
  27. // wxThread helpers
  28. // ----------------
  29. // process a message while waiting for a(nother) thread, should return
  30. // false if and only if we have to exit the application
  31. virtual bool DoMessageFromThreadWait() = 0;
  32. // wait for the handle to be signaled, return WAIT_OBJECT_0 if it is or, in
  33. // the GUI code, WAIT_OBJECT_0 + 1 if a Windows message arrived
  34. virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) = 0;
  35. #endif // wxUSE_THREADS
  36. #ifndef __WXWINCE__
  37. // console helpers
  38. // ---------------
  39. // this method can be overridden by a derived class to always return true
  40. // or false to force [not] using the console for output to stderr
  41. //
  42. // by default console applications always return true from here while the
  43. // GUI ones only return true if they're being run from console and there is
  44. // no other activity happening in this console
  45. virtual bool CanUseStderr() = 0;
  46. // write text to the console, return true if ok or false on error
  47. virtual bool WriteToStderr(const wxString& text) = 0;
  48. #endif // !__WXWINCE__
  49. protected:
  50. #if wxUSE_THREADS
  51. // implementation of WaitForThread() for the console applications which is
  52. // also used by the GUI code if it doesn't [yet|already] dispatch events
  53. WXDWORD DoSimpleWaitForThread(WXHANDLE hThread);
  54. #endif // wxUSE_THREADS
  55. };
  56. #endif // _WX_MSW_APPTBASE_H_