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