]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/toplevel.h
wxVsnprintf() implementation with positional parameters support (patch 1462778);...
[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 SetIcon(const wxIcon& rIcon);
71 virtual void SetIcons(const wxIconBundle& rIcons);
72
73 virtual bool Show(bool bShow = true);
74 virtual bool ShowFullScreen( bool bShow,
75 long lStyle = wxFULLSCREEN_ALL );
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
90 void OnActivate(wxActivateEvent& rEvent);
91
92 void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; }
93 wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; }
94
95 protected:
96
97 //
98 // Common part of all ctors
99 //
100 void Init(void);
101
102 //
103 // Create a new frame, return false if it couldn't be created
104 //
105 bool CreateFrame( const wxString& rsTitle
106 ,const wxPoint& rPos
107 ,const wxSize& rSize
108 );
109
110 //
111 // Create a new dialog using the given dialog template from resources,
112 // return false if it couldn't be created
113 //
114 bool CreateDialog( ULONG ulDlgTemplate
115 ,const wxString& rsTitle
116 ,const wxPoint& rPos
117 ,const wxSize& rSize
118 );
119
120 //
121 // Common part of Iconize(), Maximize() and Restore()
122 //
123 void DoShowWindow(int nShowCmd);
124
125 //
126 // Implement the geometry-related methods for a top level window
127 //
128 virtual void DoSetClientSize( int nWidth
129 ,int nHeight
130 );
131 virtual void DoGetClientSize( int* pnWidth
132 ,int* pnHeight
133 ) const;
134
135 //
136 // Translate wxWidgets flags into OS flags
137 //
138 virtual WXDWORD OS2GetStyle( long lFlag
139 ,WXDWORD* pdwExstyle
140 ) const;
141
142 //
143 // Choose the right parent to use with CreateWindow()
144 //
145 virtual WXHWND OS2GetParent(void) const;
146
147 //
148 // Is the frame currently iconized?
149 //
150 bool m_bIconized;
151
152 //
153 // Should the frame be maximized when it will be shown? set by Maximize()
154 // when it is called while the frame is hidden
155 //
156 bool m_bMaximizeOnShow;
157
158 //
159 // Data to save/restore when calling ShowFullScreen
160 //
161 long m_lFsStyle; // Passed to ShowFullScreen
162 wxRect m_vFsOldSize;
163 long m_lFsOldWindowStyle;
164 bool m_bFsIsMaximized;
165 bool m_bFsIsShowing;
166
167 wxWindow* m_pWinLastFocused;
168
169 WXHWND m_hFrame;
170 SWP m_vSwp;
171 SWP m_vSwpClient;
172 static bool m_sbInitialized;
173 static wxWindow* m_spHiddenParent;
174
175 DECLARE_EVENT_TABLE()
176 }; // end of CLASS wxTopLevelWindowOS2
177
178 #endif // _WX_MSW_TOPLEVEL_H_