]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/toplevel.h
Fix memory leak by letting the base class version handle the
[wxWidgets.git] / include / wx / os2 / toplevel.h
CommitLineData
076d1afa
DW
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)
77ffb593 9// Licence: wxWidgets licence
076d1afa
DW
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
10769d8c 19enum ETemplateID { kResizeableDialog = 130
076d1afa
DW
20 ,kCaptionDialog
21 ,kNoCaptionDialog
22 };
23
24// ----------------------------------------------------------------------------
25// wxTopLevelWindowOS2
26// ----------------------------------------------------------------------------
27
28class WXDLLEXPORT wxTopLevelWindowOS2 : public wxTopLevelWindowBase
29{
30public:
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);
b82186f0 68 virtual void SendSizeEvent(void);
076d1afa 69 virtual void SetIcon(const wxIcon& rIcon);
3437f881 70 virtual void SetIcons(const wxIconBundle& rIcons);
f618020a 71
076d1afa
DW
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 //
45e0dc94 88 PSWP GetSwpClient(void) { return &m_vSwpClient; }
47df2b8c
DW
89
90 void OnActivate(wxActivateEvent& rEvent);
91
92 void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; }
93 wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; }
076d1afa
DW
94protected:
95 //
96 // Common part of all ctors
97 //
98 void Init(void);
99
100 //
101 // Create a new frame, return FALSE if it couldn't be created
102 //
103 bool CreateFrame( const wxString& rsTitle
104 ,const wxPoint& rPos
105 ,const wxSize& rSize
106 );
107
108 //
109 // Create a new dialog using the given dialog template from resources,
110 // return FALSE if it couldn't be created
111 //
112 bool CreateDialog( ULONG ulDlgTemplate
113 ,const wxString& rsTitle
114 ,const wxPoint& rPos
115 ,const wxSize& rSize
116 );
117
118 //
119 // Common part of Iconize(), Maximize() and Restore()
120 //
121 void DoShowWindow(int nShowCmd);
122
123 //
124 // Implement the geometry-related methods for a top level window
125 //
126 virtual void DoSetClientSize( int nWidth
127 ,int nHeight
128 );
129 virtual void DoGetClientSize( int* pnWidth
130 ,int* pnHeight
131 ) const;
132
133 //
77ffb593 134 // Translate wxWidgets flags into OS flags
076d1afa 135 //
b9b1d6c8
DW
136 virtual WXDWORD OS2GetStyle( long lFlag
137 ,WXDWORD* pdwExstyle
138 ) const;
6ed98c6a
DW
139
140 //
141 // Choose the right parent to use with CreateWindow()
142 //
143 virtual WXHWND OS2GetParent(void) const;
144
076d1afa
DW
145 //
146 // Is the frame currently iconized?
147 //
148 bool m_bIconized;
149
150 //
151 // Should the frame be maximized when it will be shown? set by Maximize()
152 // when it is called while the frame is hidden
153 //
154 bool m_bMaximizeOnShow;
155
156 //
157 // Data to save/restore when calling ShowFullScreen
158 //
159 long m_lFsStyle; // Passed to ShowFullScreen
160 wxRect m_vFsOldSize;
161 long m_lFsOldWindowStyle;
162 bool m_bFsIsMaximized;
163 bool m_bFsIsShowing;
164
47df2b8c
DW
165 wxWindow* m_pWinLastFocused;
166
076d1afa
DW
167 WXHWND m_hFrame;
168 SWP m_vSwp;
169 SWP m_vSwpClient;
45e0dc94 170 static bool m_sbInitialized;
6ed98c6a 171 static wxWindow* m_spHiddenParent;
47df2b8c
DW
172
173 DECLARE_EVENT_TABLE()
076d1afa
DW
174}; // end of CLASS wxTopLevelWindowOS2
175
176//
177// List of all frames and modeless dialogs
178//
179extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
180
181#endif // _WX_MSW_TOPLEVEL_H_
182