]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/toplevel.h
Don't include <CoreFoundation/CFBase.h> because it in turn includes MacTypes.h which...
[wxWidgets.git] / include / wx / os2 / toplevel.h
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 // 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 enum ETemplateID
16 {
17 kResizeableDialog = 130,
18 kCaptionDialog,
19 kNoCaptionDialog
20 };
21
22 // ----------------------------------------------------------------------------
23 // wxTopLevelWindowOS2
24 // ----------------------------------------------------------------------------
25
26 class WXDLLEXPORT wxTopLevelWindowOS2 : public wxTopLevelWindowBase
27 {
28 public:
29 // constructors and such
30 wxTopLevelWindowOS2() { Init(); }
31
32 wxTopLevelWindowOS2( wxWindow* pParent
33 ,wxWindowID vId
34 ,const wxString& rsTitle
35 ,const wxPoint& rPos = wxDefaultPosition
36 ,const wxSize& rSize = wxDefaultSize
37 ,long lStyle = wxDEFAULT_FRAME_STYLE
38 ,const wxString& rsName = wxFrameNameStr
39 )
40 {
41 Init();
42
43 (void)Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
44 }
45
46 bool Create( wxWindow* pParent
47 ,wxWindowID vId
48 ,const wxString& rsTitle
49 ,const wxPoint& rPos = wxDefaultPosition
50 ,const wxSize& rSize = wxDefaultSize
51 ,long lStyle = wxDEFAULT_FRAME_STYLE
52 ,const wxString& rsName = wxFrameNameStr
53 );
54
55 virtual ~wxTopLevelWindowOS2();
56
57 //
58 // Implement base class pure virtuals
59 //
60 virtual void SetTitle( const wxString& title);
61 virtual wxString GetTitle() const;
62
63 virtual void Iconize(bool bIconize = true);
64 virtual bool IsFullScreen(void) const { return m_bFsIsShowing; }
65 virtual bool IsIconized(void) const;
66 virtual bool IsMaximized(void) const;
67 virtual void Maximize(bool bMaximize = true);
68 virtual void Restore(void);
69 virtual void SendSizeEvent(void);
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 // EnableCloseButton(false) may be used to remove the "Close"
78 // button from the title bar
79 //
80 bool EnableCloseButton(bool bEnable = true);
81 HWND GetFrame(void) const { return m_hFrame; }
82
83 //
84 // Implementation from now on
85 // --------------------------
86 //
87 PSWP GetSwpClient(void) { return &m_vSwpClient; }
88
89 void OnActivate(wxActivateEvent& rEvent);
90
91 void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; }
92 wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; }
93
94 protected:
95
96 //
97 // Common part of all ctors
98 //
99 void Init(void);
100
101 //
102 // Create a new frame, return false if it couldn't be created
103 //
104 bool CreateFrame( const wxString& rsTitle
105 ,const wxPoint& rPos
106 ,const wxSize& rSize
107 );
108
109 //
110 // Create a new dialog using the given dialog template from resources,
111 // return false if it couldn't be created
112 //
113 bool CreateDialog( ULONG ulDlgTemplate
114 ,const wxString& rsTitle
115 ,const wxPoint& rPos
116 ,const wxSize& rSize
117 );
118
119 //
120 // Common part of Iconize(), Maximize() and Restore()
121 //
122 void DoShowWindow(int nShowCmd);
123
124 //
125 // Implement the geometry-related methods for a top level window
126 //
127 virtual void DoSetClientSize( int nWidth
128 ,int nHeight
129 );
130 virtual void DoGetClientSize( int* pnWidth
131 ,int* pnHeight
132 ) const;
133
134 //
135 // Translate wxWidgets flags into OS flags
136 //
137 virtual WXDWORD OS2GetStyle( long lFlag
138 ,WXDWORD* pdwExstyle
139 ) const;
140
141 //
142 // Choose the right parent to use with CreateWindow()
143 //
144 virtual WXHWND OS2GetParent(void) const;
145
146 //
147 // Is the frame currently iconized?
148 //
149 bool m_bIconized;
150
151 //
152 // Should the frame be maximized when it will be shown? set by Maximize()
153 // when it is called while the frame is hidden
154 //
155 bool m_bMaximizeOnShow;
156
157 //
158 // Data to save/restore when calling ShowFullScreen
159 //
160 long m_lFsStyle; // Passed to ShowFullScreen
161 wxRect m_vFsOldSize;
162 long m_lFsOldWindowStyle;
163 bool m_bFsIsMaximized;
164 bool m_bFsIsShowing;
165
166 wxWindow* m_pWinLastFocused;
167
168 WXHWND m_hFrame;
169 SWP m_vSwp;
170 SWP m_vSwpClient;
171 static bool m_sbInitialized;
172 static wxWindow* m_spHiddenParent;
173
174 DECLARE_EVENT_TABLE()
175 }; // end of CLASS wxTopLevelWindowOS2
176
177 #endif // _WX_MSW_TOPLEVEL_H_