]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/toplevel.h
Don't create multiple parent-less top level frames in layout sample.
[wxWidgets.git] / include / wx / os2 / toplevel.h
CommitLineData
076d1afa 1///////////////////////////////////////////////////////////////////////////////
743e24aa
WS
2// Name: wx/os2/toplevel.h
3// Purpose: wxTopLevelWindowOS2 is the OS2 implementation of wxTLW
076d1afa
DW
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)
65571936 9// Licence: wxWindows licence
076d1afa
DW
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_MSW_TOPLEVEL_H_
13#define _WX_MSW_TOPLEVEL_H_
14
743e24aa
WS
15enum ETemplateID
16{
17 kResizeableDialog = 130,
18 kCaptionDialog,
19 kNoCaptionDialog
20};
076d1afa
DW
21
22// ----------------------------------------------------------------------------
23// wxTopLevelWindowOS2
24// ----------------------------------------------------------------------------
25
53a2db12 26class WXDLLIMPEXP_CORE wxTopLevelWindowOS2 : public wxTopLevelWindowBase
076d1afa
DW
27{
28public:
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 //
743e24aa
WS
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);
ecdc1183 69 virtual void SendSizeEvent(int flags = 0);
743e24aa 70 virtual void SetIcons(const wxIconBundle& rIcons);
f618020a 71
743e24aa
WS
72 virtual bool Show(bool bShow = true);
73 virtual bool ShowFullScreen( bool bShow,
74 long lStyle = wxFULLSCREEN_ALL );
076d1afa
DW
75
76 //
743e24aa 77 // EnableCloseButton(false) may be used to remove the "Close"
076d1afa
DW
78 // button from the title bar
79 //
743e24aa
WS
80 bool EnableCloseButton(bool bEnable = true);
81 HWND GetFrame(void) const { return m_hFrame; }
076d1afa
DW
82
83 //
84 // Implementation from now on
85 // --------------------------
86 //
743e24aa
WS
87 PSWP GetSwpClient(void) { return &m_vSwpClient; }
88
89 void OnActivate(wxActivateEvent& rEvent);
47df2b8c 90
743e24aa
WS
91 void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; }
92 wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; }
47df2b8c 93
076d1afa 94protected:
743e24aa 95
076d1afa
DW
96 //
97 // Common part of all ctors
98 //
99 void Init(void);
100
101 //
743e24aa 102 // Create a new frame, return false if it couldn't be created
076d1afa
DW
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,
743e24aa 111 // return false if it couldn't be created
076d1afa
DW
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 //
77ffb593 135 // Translate wxWidgets flags into OS flags
076d1afa 136 //
b9b1d6c8
DW
137 virtual WXDWORD OS2GetStyle( long lFlag
138 ,WXDWORD* pdwExstyle
139 ) const;
6ed98c6a
DW
140
141 //
142 // Choose the right parent to use with CreateWindow()
143 //
144 virtual WXHWND OS2GetParent(void) const;
145
076d1afa
DW
146 //
147 // Is the frame currently iconized?
148 //
743e24aa 149 bool m_bIconized;
076d1afa
DW
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 //
743e24aa 155 bool m_bMaximizeOnShow;
076d1afa
DW
156
157 //
158 // Data to save/restore when calling ShowFullScreen
159 //
743e24aa
WS
160 long m_lFsStyle; // Passed to ShowFullScreen
161 wxRect m_vFsOldSize;
162 long m_lFsOldWindowStyle;
163 bool m_bFsIsMaximized;
164 bool m_bFsIsShowing;
076d1afa 165
743e24aa 166 wxWindow* m_pWinLastFocused;
47df2b8c 167
743e24aa
WS
168 WXHWND m_hFrame;
169 SWP m_vSwp;
170 SWP m_vSwpClient;
171 static bool m_sbInitialized;
172 static wxWindow* m_spHiddenParent;
47df2b8c
DW
173
174 DECLARE_EVENT_TABLE()
076d1afa
DW
175}; // end of CLASS wxTopLevelWindowOS2
176
076d1afa 177#endif // _WX_MSW_TOPLEVEL_H_