apptrait.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/apptrait.h
  3. // Purpose: class implementing wxAppTraits for MSW
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 21.06.2003
  7. // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSW_APPTRAIT_H_
  11. #define _WX_MSW_APPTRAIT_H_
  12. // ----------------------------------------------------------------------------
  13. // wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase
  16. {
  17. public:
  18. virtual wxEventLoopBase *CreateEventLoop();
  19. virtual void *BeforeChildWaitLoop();
  20. virtual void AfterChildWaitLoop(void *data);
  21. #if wxUSE_TIMER
  22. virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
  23. #endif // wxUSE_TIMER
  24. #if wxUSE_THREADS
  25. virtual bool DoMessageFromThreadWait();
  26. virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags);
  27. #endif // wxUSE_THREADS
  28. #ifndef __WXWINCE__
  29. virtual bool CanUseStderr() { return true; }
  30. virtual bool WriteToStderr(const wxString& text);
  31. #endif // !__WXWINCE__
  32. };
  33. #if wxUSE_GUI
  34. #if defined(__WXMSW__)
  35. class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
  36. {
  37. public:
  38. virtual wxEventLoopBase *CreateEventLoop();
  39. virtual void *BeforeChildWaitLoop();
  40. virtual void AfterChildWaitLoop(void *data);
  41. #if wxUSE_TIMER
  42. virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
  43. #endif // wxUSE_TIMER
  44. #if wxUSE_THREADS
  45. virtual bool DoMessageFromThreadWait();
  46. virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags);
  47. #endif // wxUSE_THREADS
  48. virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const;
  49. #ifndef __WXWINCE__
  50. virtual bool CanUseStderr();
  51. virtual bool WriteToStderr(const wxString& text);
  52. #endif // !__WXWINCE__
  53. };
  54. #elif defined(__WXGTK__)
  55. class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
  56. {
  57. public:
  58. virtual wxEventLoopBase *CreateEventLoop();
  59. virtual void *BeforeChildWaitLoop() { return NULL; }
  60. virtual void AfterChildWaitLoop(void *WXUNUSED(data)) { }
  61. #if wxUSE_TIMER
  62. virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
  63. #endif
  64. #if wxUSE_THREADS && defined(__WXGTK20__)
  65. virtual void MutexGuiEnter();
  66. virtual void MutexGuiLeave();
  67. #endif
  68. #if wxUSE_THREADS
  69. virtual bool DoMessageFromThreadWait() { return true; }
  70. virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags))
  71. { return DoSimpleWaitForThread(hThread); }
  72. #endif // wxUSE_THREADS
  73. virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const;
  74. #ifndef __WXWINCE__
  75. virtual bool CanUseStderr() { return false; }
  76. virtual bool WriteToStderr(const wxString& WXUNUSED(text)) { return false; }
  77. #endif // !__WXWINCE__
  78. };
  79. #endif
  80. #endif // wxUSE_GUI
  81. #endif // _WX_MSW_APPTRAIT_H_