frame.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/frame.h
  3. // Purpose: wxFrame class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/27/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_FRAME_H_
  11. #define _WX_FRAME_H_
  12. //
  13. // Get the default resource ID's for frames
  14. //
  15. #include "wx/os2/wxrsc.h"
  16. class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
  17. {
  18. public:
  19. // construction
  20. wxFrame() { Init(); }
  21. wxFrame( wxWindow* pParent
  22. ,wxWindowID vId
  23. ,const wxString& rsTitle
  24. ,const wxPoint& rPos = wxDefaultPosition
  25. ,const wxSize& rSize = wxDefaultSize
  26. ,long lStyle = wxDEFAULT_FRAME_STYLE
  27. ,const wxString& rsName = wxFrameNameStr
  28. )
  29. {
  30. Init();
  31. Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
  32. }
  33. bool Create( wxWindow* pParent
  34. ,wxWindowID vId
  35. ,const wxString& rsTitle
  36. ,const wxPoint& rPos = wxDefaultPosition
  37. ,const wxSize& rSize = wxDefaultSize
  38. ,long lStyle = wxDEFAULT_FRAME_STYLE
  39. ,const wxString& rsName = wxFrameNameStr
  40. );
  41. virtual ~wxFrame();
  42. // implement base class pure virtuals
  43. #if wxUSE_MENUS_NATIVE
  44. virtual void SetMenuBar(wxMenuBar* pMenubar);
  45. #endif
  46. virtual bool ShowFullScreen( bool bShow
  47. ,long lStyle = wxFULLSCREEN_ALL
  48. );
  49. // implementation only from now on
  50. // -------------------------------
  51. virtual void Raise(void);
  52. // event handlers
  53. void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
  54. // Toolbar
  55. #if wxUSE_TOOLBAR
  56. virtual wxToolBar* CreateToolBar( long lStyle = -1
  57. ,wxWindowID vId = -1
  58. ,const wxString& rsName = wxToolBarNameStr
  59. );
  60. virtual wxToolBar* OnCreateToolBar( long lStyle
  61. ,wxWindowID vId
  62. ,const wxString& rsName
  63. );
  64. virtual void PositionToolBar(void);
  65. #endif // wxUSE_TOOLBAR
  66. // Status bar
  67. #if wxUSE_STATUSBAR
  68. virtual wxStatusBar* OnCreateStatusBar( int nNumber = 1
  69. ,long lStyle = wxSTB_DEFAULT_STYLE
  70. ,wxWindowID vId = 0
  71. ,const wxString& rsName = wxStatusLineNameStr
  72. );
  73. virtual void PositionStatusBar(void);
  74. // Hint to tell framework which status bar to use: the default is to use
  75. // native one for the platforms which support it (Win32), the generic one
  76. // otherwise
  77. // TODO: should this go into a wxFrameworkSettings class perhaps?
  78. static void UseNativeStatusBar(bool bUseNative)
  79. { m_bUseNativeStatusBar = bUseNative; }
  80. static bool UsesNativeStatusBar()
  81. { return m_bUseNativeStatusBar; }
  82. #endif // wxUSE_STATUSBAR
  83. WXHMENU GetWinMenu() const { return m_hMenu; }
  84. // Returns the origin of client area (may be different from (0,0) if the
  85. // frame has a toolbar)
  86. virtual wxPoint GetClientAreaOrigin() const;
  87. // event handlers
  88. bool HandlePaint(void);
  89. bool HandleSize( int nX
  90. ,int nY
  91. ,WXUINT uFlag
  92. );
  93. bool HandleCommand( WXWORD wId
  94. ,WXWORD wCmd
  95. ,WXHWND wControl
  96. );
  97. bool HandleMenuSelect( WXWORD wItem
  98. ,WXWORD wFlags
  99. ,WXHMENU hMenu
  100. );
  101. // tooltip management
  102. #if wxUSE_TOOLTIPS
  103. WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
  104. void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
  105. #endif // tooltips
  106. void SetClient(WXHWND c_Hwnd);
  107. void SetClient(wxWindow* c_Window);
  108. wxWindow *GetClient();
  109. friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
  110. friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
  111. protected:
  112. // common part of all ctors
  113. void Init(void);
  114. virtual WXHICON GetDefaultIcon(void) const;
  115. // override base class virtuals
  116. virtual void DoGetClientSize( int* pWidth
  117. ,int* pHeight
  118. ) const;
  119. virtual void DoSetClientSize( int nWidth
  120. ,int nWeight
  121. );
  122. inline virtual bool IsMDIChild(void) const { return FALSE; }
  123. #if wxUSE_MENUS_NATIVE
  124. // helper
  125. void DetachMenuBar(void);
  126. // perform MSW-specific action when menubar is changed
  127. virtual void AttachMenuBar(wxMenuBar* pMenubar);
  128. // a plug in for MDI frame classes which need to do something special when
  129. // the menubar is set
  130. virtual void InternalSetMenuBar(void);
  131. #endif
  132. // propagate our state change to all child frames
  133. void IconizeChildFrames(bool bIconize);
  134. // we add menu bar accel processing
  135. bool OS2TranslateMessage(WXMSG* pMsg);
  136. // window proc for the frames
  137. MRESULT OS2WindowProc( WXUINT uMessage
  138. ,WXWPARAM wParam
  139. ,WXLPARAM lParam
  140. );
  141. bool m_bIconized;
  142. WXHICON m_hDefaultIcon;
  143. #if wxUSE_STATUSBAR
  144. static bool m_bUseNativeStatusBar;
  145. #endif // wxUSE_STATUSBAR
  146. // Data to save/restore when calling ShowFullScreen
  147. long m_lFsStyle; // Passed to ShowFullScreen
  148. wxRect m_vFsOldSize;
  149. long m_lFsOldWindowStyle;
  150. int m_nFsStatusBarFields; // 0 for no status bar
  151. int m_nFsStatusBarHeight;
  152. int m_nFsToolBarHeight;
  153. bool m_bFsIsMaximized;
  154. bool m_bFsIsShowing;
  155. bool m_bWasMinimized;
  156. bool m_bIsShown;
  157. private:
  158. #if wxUSE_TOOLTIPS
  159. WXHWND m_hWndToolTip;
  160. #endif // tooltips
  161. //
  162. // Handles to child windows of the Frame, and the frame itself,
  163. // that we don't have child objects for (m_hWnd in wxWindow is the
  164. // handle of the Frame's client window!
  165. //
  166. WXHWND m_hTitleBar;
  167. WXHWND m_hHScroll;
  168. WXHWND m_hVScroll;
  169. //
  170. // Swp structures for various client data
  171. // DW: Better off in attached RefData?
  172. //
  173. SWP m_vSwpTitleBar;
  174. SWP m_vSwpMenuBar;
  175. SWP m_vSwpHScroll;
  176. SWP m_vSwpVScroll;
  177. SWP m_vSwpStatusBar;
  178. SWP m_vSwpToolBar;
  179. DECLARE_EVENT_TABLE()
  180. DECLARE_DYNAMIC_CLASS(wxFrame)
  181. };
  182. MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
  183. MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
  184. #endif
  185. // _WX_FRAME_H_