toplevel.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/toplevel.h
  3. // Purpose: wxTopLevelWindowOS2 is the OS2 implementation of wxTLW
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 20.09.01
  7. // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSW_TOPLEVEL_H_
  11. #define _WX_MSW_TOPLEVEL_H_
  12. enum ETemplateID
  13. {
  14. kResizeableDialog = 130,
  15. kCaptionDialog,
  16. kNoCaptionDialog
  17. };
  18. // ----------------------------------------------------------------------------
  19. // wxTopLevelWindowOS2
  20. // ----------------------------------------------------------------------------
  21. class WXDLLIMPEXP_CORE wxTopLevelWindowOS2 : public wxTopLevelWindowBase
  22. {
  23. public:
  24. // constructors and such
  25. wxTopLevelWindowOS2() { Init(); }
  26. wxTopLevelWindowOS2( wxWindow* pParent
  27. ,wxWindowID vId
  28. ,const wxString& rsTitle
  29. ,const wxPoint& rPos = wxDefaultPosition
  30. ,const wxSize& rSize = wxDefaultSize
  31. ,long lStyle = wxDEFAULT_FRAME_STYLE
  32. ,const wxString& rsName = wxFrameNameStr
  33. )
  34. {
  35. Init();
  36. (void)Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
  37. }
  38. bool Create( wxWindow* pParent
  39. ,wxWindowID vId
  40. ,const wxString& rsTitle
  41. ,const wxPoint& rPos = wxDefaultPosition
  42. ,const wxSize& rSize = wxDefaultSize
  43. ,long lStyle = wxDEFAULT_FRAME_STYLE
  44. ,const wxString& rsName = wxFrameNameStr
  45. );
  46. virtual ~wxTopLevelWindowOS2();
  47. //
  48. // Implement base class pure virtuals
  49. //
  50. virtual void SetTitle( const wxString& title);
  51. virtual wxString GetTitle() const;
  52. virtual void Iconize(bool bIconize = true);
  53. virtual bool IsFullScreen(void) const { return m_bFsIsShowing; }
  54. virtual bool IsIconized(void) const;
  55. virtual bool IsMaximized(void) const;
  56. virtual void Maximize(bool bMaximize = true);
  57. virtual void Restore(void);
  58. virtual void SendSizeEvent(int flags = 0);
  59. virtual void SetIcons(const wxIconBundle& rIcons);
  60. virtual bool Show(bool bShow = true);
  61. virtual bool ShowFullScreen( bool bShow,
  62. long lStyle = wxFULLSCREEN_ALL );
  63. //
  64. // EnableCloseButton(false) may be used to remove the "Close"
  65. // button from the title bar
  66. //
  67. bool EnableCloseButton(bool bEnable = true);
  68. HWND GetFrame(void) const { return m_hFrame; }
  69. //
  70. // Implementation from now on
  71. // --------------------------
  72. //
  73. PSWP GetSwpClient(void) { return &m_vSwpClient; }
  74. void OnActivate(wxActivateEvent& rEvent);
  75. void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; }
  76. wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; }
  77. protected:
  78. //
  79. // Common part of all ctors
  80. //
  81. void Init(void);
  82. //
  83. // Create a new frame, return false if it couldn't be created
  84. //
  85. bool CreateFrame( const wxString& rsTitle
  86. ,const wxPoint& rPos
  87. ,const wxSize& rSize
  88. );
  89. //
  90. // Create a new dialog using the given dialog template from resources,
  91. // return false if it couldn't be created
  92. //
  93. bool CreateDialog( ULONG ulDlgTemplate
  94. ,const wxString& rsTitle
  95. ,const wxPoint& rPos
  96. ,const wxSize& rSize
  97. );
  98. //
  99. // Common part of Iconize(), Maximize() and Restore()
  100. //
  101. void DoShowWindow(int nShowCmd);
  102. //
  103. // Implement the geometry-related methods for a top level window
  104. //
  105. virtual void DoSetClientSize( int nWidth
  106. ,int nHeight
  107. );
  108. virtual void DoGetClientSize( int* pnWidth
  109. ,int* pnHeight
  110. ) const;
  111. //
  112. // Translate wxWidgets flags into OS flags
  113. //
  114. virtual WXDWORD OS2GetStyle( long lFlag
  115. ,WXDWORD* pdwExstyle
  116. ) const;
  117. //
  118. // Choose the right parent to use with CreateWindow()
  119. //
  120. virtual WXHWND OS2GetParent(void) const;
  121. //
  122. // Is the frame currently iconized?
  123. //
  124. bool m_bIconized;
  125. //
  126. // Should the frame be maximized when it will be shown? set by Maximize()
  127. // when it is called while the frame is hidden
  128. //
  129. bool m_bMaximizeOnShow;
  130. //
  131. // Data to save/restore when calling ShowFullScreen
  132. //
  133. long m_lFsStyle; // Passed to ShowFullScreen
  134. wxRect m_vFsOldSize;
  135. long m_lFsOldWindowStyle;
  136. bool m_bFsIsMaximized;
  137. bool m_bFsIsShowing;
  138. wxWindow* m_pWinLastFocused;
  139. WXHWND m_hFrame;
  140. SWP m_vSwp;
  141. SWP m_vSwpClient;
  142. static bool m_sbInitialized;
  143. static wxWindow* m_spHiddenParent;
  144. DECLARE_EVENT_TABLE()
  145. }; // end of CLASS wxTopLevelWindowOS2
  146. #endif // _WX_MSW_TOPLEVEL_H_