app.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/app.h
  3. // Purpose: wxApp class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/13/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_APP_H_
  11. #define _WX_APP_H_
  12. #ifdef __WATCOMC__
  13. #include <types.h>
  14. #include <sys/ioctl.h>
  15. #include <sys/select.h>
  16. #else
  17. #include <sys/time.h>
  18. #include <sys/types.h>
  19. #ifdef __EMX__
  20. #include <unistd.h>
  21. #else
  22. #include <utils.h>
  23. #undef BYTE_ORDER
  24. #include <types.h>
  25. #define INCL_ORDERS
  26. #endif
  27. #endif
  28. #include "wx/event.h"
  29. #include "wx/icon.h"
  30. class WXDLLIMPEXP_FWD_CORE wxFrame;
  31. class WXDLLIMPEXP_FWD_CORE wxWindow;
  32. class WXDLLIMPEXP_FWD_CORE wxApp;
  33. class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
  34. class WXDLLIMPEXP_FWD_BASE wxLog;
  35. WXDLLIMPEXP_DATA_CORE(extern wxApp*) wxTheApp;
  36. WXDLLIMPEXP_DATA_CORE(extern HAB) vHabmain;
  37. // Force an exit from main loop
  38. void WXDLLIMPEXP_CORE wxExit(void);
  39. // Yield to other apps/messages
  40. bool WXDLLIMPEXP_CORE wxYield(void);
  41. extern MRESULT EXPENTRY wxWndProc( HWND
  42. ,ULONG
  43. ,MPARAM
  44. ,MPARAM
  45. );
  46. // Represents the application. Derive OnInit and declare
  47. // a new App object to start application
  48. class WXDLLIMPEXP_CORE wxApp : public wxAppBase
  49. {
  50. DECLARE_DYNAMIC_CLASS(wxApp)
  51. public:
  52. wxApp();
  53. virtual ~wxApp();
  54. // override base class (pure) virtuals
  55. virtual bool Initialize(int& argc, wxChar **argv);
  56. virtual void CleanUp(void);
  57. virtual bool OnInitGui(void);
  58. virtual void WakeUpIdle(void);
  59. virtual void SetPrintMode(int mode) { m_nPrintMode = mode; }
  60. virtual int GetPrintMode(void) const { return m_nPrintMode; }
  61. // implementation only
  62. void OnIdle(wxIdleEvent& rEvent);
  63. void OnEndSession(wxCloseEvent& rEvent);
  64. void OnQueryEndSession(wxCloseEvent& rEvent);
  65. int AddSocketHandler(int handle, int mask,
  66. void (*callback)(void*), void * gsock);
  67. void RemoveSocketHandler(int handle);
  68. void HandleSockets();
  69. protected:
  70. bool m_bShowOnInit;
  71. int m_nPrintMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
  72. //
  73. // PM-specific wxApp definitions */
  74. //
  75. private:
  76. int m_maxSocketHandles;
  77. int m_maxSocketNr;
  78. int m_lastUsedHandle;
  79. fd_set m_readfds;
  80. fd_set m_writefds;
  81. void* m_sockCallbackInfo;
  82. public:
  83. // Implementation
  84. static bool RegisterWindowClasses(HAB vHab);
  85. public:
  86. int m_nCmdShow;
  87. HMQ m_hMq;
  88. protected:
  89. DECLARE_EVENT_TABLE()
  90. wxDECLARE_NO_COPY_CLASS(wxApp);
  91. };
  92. #endif
  93. // _WX_APP_H_