]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: window.h | |
3 | // Purpose: wxWindow class | |
54da4255 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
cdf1e714 | 6 | // Created: 10/12/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
cdf1e714 DW |
8 | // Copyright: (c) David Webster |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_WINDOW_H_ | |
13 | #define _WX_WINDOW_H_ | |
14 | ||
cdf1e714 | 15 | #define wxUSE_MOUSEEVENT_HACK 0 |
0e320a79 | 16 | |
cdf1e714 DW |
17 | // --------------------------------------------------------------------------- |
18 | // headers | |
19 | // --------------------------------------------------------------------------- | |
63415778 DW |
20 | #define INCL_DOS |
21 | #define INCL_PM | |
22 | #define INCL_GPI | |
23 | #include <os2.h> | |
24 | ||
0e320a79 | 25 | |
3011bf2b DW |
26 | // --------------------------------------------------------------------------- |
27 | // forward declarations | |
28 | // --------------------------------------------------------------------------- | |
29 | #ifndef CW_USEDEFAULT | |
30 | # define CW_USEDEFAULT ((int)0x80000000) | |
31 | #endif | |
32 | ||
0e320a79 DW |
33 | // --------------------------------------------------------------------------- |
34 | // forward declarations | |
35 | // --------------------------------------------------------------------------- | |
36 | ||
37 | class WXDLLEXPORT wxButton; | |
38 | ||
cdf1e714 DW |
39 | // --------------------------------------------------------------------------- |
40 | // constants | |
41 | // --------------------------------------------------------------------------- | |
0e320a79 | 42 | |
cdf1e714 DW |
43 | // FIXME does anybody use those? they're unused by wxWindows... |
44 | enum | |
45 | { | |
46 | wxKEY_SHIFT = 1, | |
47 | wxKEY_CTRL = 2 | |
48 | }; | |
54da4255 | 49 | |
cdf1e714 DW |
50 | // --------------------------------------------------------------------------- |
51 | // wxWindow declaration for OS/2 PM | |
52 | // --------------------------------------------------------------------------- | |
54da4255 | 53 | |
210a651b | 54 | class WXDLLEXPORT wxWindowOS2 : public wxWindowBase |
0e320a79 | 55 | { |
0e320a79 | 56 | public: |
210a651b | 57 | wxWindowOS2() |
3e282d33 DW |
58 | { |
59 | Init(); | |
60 | } | |
cdf1e714 | 61 | |
210a651b DW |
62 | wxWindowOS2( wxWindow* pParent |
63 | ,wxWindowID vId | |
64 | ,const wxPoint& rPos = wxDefaultPosition | |
65 | ,const wxSize& rSize = wxDefaultSize | |
66 | ,long lStyle = 0 | |
67 | ,const wxString& rName = wxPanelNameStr | |
68 | ) | |
0e320a79 DW |
69 | { |
70 | Init(); | |
776d87d5 DW |
71 | Create( pParent |
72 | ,vId | |
73 | ,rPos | |
74 | ,rSize | |
75 | ,lStyle | |
76 | ,rName | |
77 | ); | |
0e320a79 DW |
78 | } |
79 | ||
210a651b | 80 | virtual ~wxWindowOS2(); |
0e320a79 | 81 | |
776d87d5 DW |
82 | bool Create( wxWindow* pParent |
83 | ,wxWindowID vId | |
84 | ,const wxPoint& rPos = wxDefaultPosition | |
85 | ,const wxSize& rSize = wxDefaultSize | |
86 | ,long lStyle = 0 | |
87 | ,const wxString& rName = wxPanelNameStr | |
88 | ); | |
0e320a79 | 89 | |
cdf1e714 | 90 | // implement base class pure virtuals |
776d87d5 DW |
91 | virtual void SetTitle(const wxString& rTitle); |
92 | virtual wxString GetTitle(void) const; | |
93 | virtual void Raise(void); | |
94 | virtual void Lower(void); | |
95 | virtual bool Show(bool bShow = TRUE); | |
96 | virtual bool Enable(bool bEnable = TRUE); | |
97 | virtual void SetFocus(void); | |
1cee3f60 | 98 | virtual void SetFocusFromKbd(void); |
776d87d5 DW |
99 | virtual bool Reparent(wxWindow* pNewParent); |
100 | virtual void WarpPointer( int x | |
101 | ,int y | |
102 | ); | |
776d87d5 DW |
103 | virtual void Refresh( bool bEraseBackground = TRUE |
104 | ,const wxRect* pRect = (const wxRect *)NULL | |
105 | ); | |
06519806 DW |
106 | virtual void Freeze(void); |
107 | virtual void Update(void); | |
108 | virtual void Thaw(void); | |
b9b1d6c8 | 109 | virtual void SetWindowStyleFlag(long lStyle); |
776d87d5 DW |
110 | virtual bool SetCursor(const wxCursor& rCursor); |
111 | virtual bool SetFont(const wxFont& rFont); | |
112 | virtual int GetCharHeight(void) const; | |
113 | virtual int GetCharWidth(void) const; | |
114 | virtual void GetTextExtent( const wxString& rString | |
115 | ,int* pX | |
116 | ,int* pY | |
117 | ,int* pDescent = (int *)NULL | |
118 | ,int* pExternalLeading = (int *)NULL | |
119 | ,const wxFont* pTheFont = (const wxFont *)NULL | |
120 | ) const; | |
19193a2c | 121 | #if wxUSE_MENUS_NATIVE |
776d87d5 DW |
122 | virtual bool DoPopupMenu( wxMenu* pMenu |
123 | ,int nX | |
124 | ,int nY | |
125 | ); | |
19193a2c | 126 | #endif // wxUSE_MENUS_NATIVE |
776d87d5 DW |
127 | |
128 | virtual void SetScrollbar( int nOrient | |
129 | ,int nPos | |
130 | ,int nThumbVisible | |
131 | ,int nRange | |
132 | ,bool bRefresh = TRUE | |
133 | ); | |
134 | virtual void SetScrollPos( int nOrient | |
135 | ,int nPos | |
136 | ,bool bRefresh = TRUE | |
137 | ); | |
138 | virtual int GetScrollPos(int nOrient) const; | |
139 | virtual int GetScrollThumb(int nOrient) const; | |
140 | virtual int GetScrollRange(int nOrient) const; | |
141 | virtual void ScrollWindow( int nDx | |
142 | ,int nDy | |
143 | ,const wxRect* pRect = (wxRect *)NULL | |
144 | ); | |
0e320a79 | 145 | |
45e0dc94 DW |
146 | inline HWND GetScrollBarHorz(void) const {return m_hWndScrollBarHorz;} |
147 | inline HWND GetScrollBarVert(void) const {return m_hWndScrollBarVert;}; | |
cdf1e714 | 148 | #if wxUSE_DRAG_AND_DROP |
776d87d5 | 149 | virtual void SetDropTarget(wxDropTarget* pDropTarget); |
cdf1e714 | 150 | #endif // wxUSE_DRAG_AND_DROP |
0e320a79 DW |
151 | |
152 | // Accept files for dragging | |
776d87d5 | 153 | virtual void DragAcceptFiles(bool bAccept); |
0e320a79 | 154 | |
cdf1e714 DW |
155 | #if WXWIN_COMPATIBILITY |
156 | // Set/get scroll attributes | |
776d87d5 DW |
157 | virtual void SetScrollRange( int nOrient |
158 | ,int nRange | |
159 | ,bool bRefresh = TRUE | |
160 | ); | |
161 | virtual void SetScrollPage( int nOrient | |
162 | ,int nPage | |
163 | ,bool bRefresh = TRUE | |
164 | ); | |
165 | virtual int OldGetScrollRange(int nOrient) const; | |
166 | virtual int GetScrollPage(int nOrient) const; | |
167 | ||
168 | // | |
cdf1e714 | 169 | // event handlers |
776d87d5 | 170 | // |
cdf1e714 | 171 | // Handle a control command |
776d87d5 DW |
172 | virtual void OnCommand( wxWindow& rWin |
173 | ,wxCommandEvent& rEvent | |
174 | ); | |
0e320a79 | 175 | |
cdf1e714 DW |
176 | // Override to define new behaviour for default action (e.g. double |
177 | // clicking on a listbox) | |
776d87d5 | 178 | virtual void OnDefaultAction(wxControl* WXUNUSED(pInitiatingItem)) { } |
cdf1e714 | 179 | #endif // WXWIN_COMPATIBILITY |
0e320a79 | 180 | |
cdf1e714 | 181 | #if wxUSE_CARET && WXWIN_COMPATIBILITY |
776d87d5 DW |
182 | void CreateCaret( int nWidth |
183 | ,int nHeight | |
184 | ); | |
185 | void CreateCaret(const wxBitmap* pBitmap); | |
186 | void DestroyCaret(void); | |
187 | void ShowCaret(bool bShow); | |
188 | void SetCaretPos( int nX | |
189 | ,int nY | |
190 | ); | |
191 | void GetCaretPos( int* pX | |
192 | ,int* pY | |
193 | ) const; | |
cdf1e714 DW |
194 | #endif // wxUSE_CARET |
195 | ||
19193a2c | 196 | #ifndef __WXUNIVERSAL__ |
776d87d5 | 197 | // Native resource loading (implemented in src/os2/nativdlg.cpp) |
cdf1e714 | 198 | // FIXME: should they really be all virtual? |
776d87d5 DW |
199 | virtual bool LoadNativeDialog( wxWindow* pParent |
200 | ,wxWindowID& vId | |
201 | ); | |
202 | virtual bool LoadNativeDialog( wxWindow* pParent | |
203 | ,const wxString& rName | |
204 | ); | |
205 | wxWindow* GetWindowChild1(wxWindowID vId); | |
206 | wxWindow* GetWindowChild(wxWindowID vId); | |
19193a2c | 207 | #endif //__WXUNIVERSAL__ |
cdf1e714 DW |
208 | |
209 | // implementation from now on | |
210 | // -------------------------- | |
211 | ||
212 | // simple accessors | |
213 | // ---------------- | |
86de7616 | 214 | |
776d87d5 DW |
215 | WXHWND GetHWND(void) const { return m_hWnd; } |
216 | void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } | |
217 | virtual WXWidget GetHandle(void) const { return GetHWND(); } | |
218 | bool GetUseCtl3D(void) const { return m_bUseCtl3D; } | |
219 | bool GetTransparentBackground(void) const { return m_bBackgroundTransparent; } | |
220 | void SetTransparent(bool bT = TRUE) { m_bBackgroundTransparent = bT; } | |
54da4255 | 221 | |
cdf1e714 DW |
222 | // event handlers |
223 | // -------------- | |
a885d89a | 224 | void OnSetFocus(wxFocusEvent& rEvent); |
776d87d5 DW |
225 | void OnEraseBackground(wxEraseEvent& rEvent); |
226 | void OnIdle(wxIdleEvent& rEvent); | |
cdf1e714 DW |
227 | |
228 | public: | |
f289196b | 229 | |
0e320a79 DW |
230 | // For implementation purposes - sometimes decorations make the client area |
231 | // smaller | |
776d87d5 | 232 | virtual wxPoint GetClientAreaOrigin(void) const; |
0e320a79 | 233 | |
86de7616 DW |
234 | // Windows subclassing |
235 | void SubclassWin(WXHWND hWnd); | |
776d87d5 | 236 | void UnsubclassWin(void); |
86de7616 | 237 | |
776d87d5 DW |
238 | WXFARPROC OS2GetOldWndProc(void) const { return m_fnOldWndProc; } |
239 | void OS2SetOldWndProc(WXFARPROC fnProc) { m_fnOldWndProc = fnProc; } | |
47df2b8c DW |
240 | // |
241 | // Return TRUE if the window is of a standard (i.e. not wxWindows') class | |
242 | // | |
243 | bool IsOfStandardClass(void) const { return m_fnOldWndProc != NULL; } | |
86de7616 | 244 | |
776d87d5 DW |
245 | wxWindow* FindItem(long lId) const; |
246 | wxWindow* FindItemByHWND( WXHWND hWnd | |
247 | ,bool bControlOnly = FALSE | |
248 | ) const; | |
86de7616 | 249 | |
776d87d5 DW |
250 | // Make a Windows extended style from the given wxWindows window style ?? applicable to OS/2?? |
251 | static WXDWORD MakeExtendedStyle( long lStyle | |
252 | ,bool bEliminateBorders = TRUE | |
253 | ); | |
86de7616 | 254 | // Determine whether 3D effects are wanted |
776d87d5 DW |
255 | WXDWORD Determine3DEffects( WXDWORD dwDefaultBorderStyle |
256 | ,bool* pbWant3D | |
257 | ) const; | |
86de7616 | 258 | |
776d87d5 | 259 | // PM only: TRUE if this control is part of the main control |
86de7616 DW |
260 | virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; |
261 | ||
b9b1d6c8 DW |
262 | // translate wxWindows style flags for this control into the PM style |
263 | // and optional extended style for the corresponding native control | |
264 | // | |
265 | // this is the function that should be overridden in the derived classes, | |
266 | // but you will mostly use OS2GetCreateWindowFlags() below | |
267 | virtual WXDWORD OS2GetStyle( long lFlags | |
268 | ,WXDWORD* pdwExstyle = NULL | |
269 | ) const; | |
270 | ||
271 | // get the MSW window flags corresponding to wxWindows ones | |
272 | // | |
273 | // the functions returns the flags (WS_XXX) directly and puts the ext | |
274 | // (WS_EX_XXX) flags into the provided pointer if not NULL | |
275 | WXDWORD OS2GetCreateWindowFlags(WXDWORD* pdwExflags = NULL) const | |
276 | { return OS2GetStyle(GetWindowStyle(), pdwExflags); } | |
277 | ||
278 | ||
6ed98c6a DW |
279 | // get the HWND to be used as parent of this window with CreateWindow() |
280 | virtual WXHWND OS2GetParent(void) const; | |
281 | ||
cdf1e714 | 282 | // returns TRUE if the window has been created |
3011bf2b DW |
283 | bool OS2Create( PSZ zClass |
284 | ,const char* zTitle | |
285 | ,WXDWORD dwStyle | |
286 | ,const wxPoint& rPos | |
287 | ,const wxSize& rSize | |
288 | ,void* pCtlData | |
289 | ,WXDWORD dwExStyle | |
290 | ,bool bIsChild | |
291 | ); | |
776d87d5 DW |
292 | virtual bool OS2Command( WXUINT uParam |
293 | ,WXWORD nId | |
294 | ); | |
cdf1e714 DW |
295 | |
296 | #if WXWIN_COMPATIBILITY | |
776d87d5 DW |
297 | wxObject* GetChild(int nNumber) const; |
298 | virtual void OS2DeviceToLogical( float* pfX | |
299 | ,float* pfY | |
300 | ) const; | |
cdf1e714 DW |
301 | #endif // WXWIN_COMPATIBILITY |
302 | ||
19193a2c | 303 | #ifndef __WXUNIVERSAL__ |
cdf1e714 | 304 | // Create an appropriate wxWindow from a HWND |
776d87d5 DW |
305 | virtual wxWindow* CreateWindowFromHWND( wxWindow* pParent |
306 | ,WXHWND hWnd | |
307 | ); | |
cdf1e714 DW |
308 | |
309 | // Make sure the window style reflects the HWND style (roughly) | |
776d87d5 | 310 | virtual void AdoptAttributesFromHWND(void); |
19193a2c | 311 | #endif |
cdf1e714 DW |
312 | |
313 | // Setup background and foreground colours correctly | |
776d87d5 | 314 | virtual void SetupColours(void); |
cdf1e714 DW |
315 | |
316 | // ------------------------------------------------------------------------ | |
317 | // helpers for message handlers: these perform the same function as the | |
318 | // message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into | |
319 | // the correct parameters | |
320 | // ------------------------------------------------------------------------ | |
321 | ||
776d87d5 DW |
322 | void UnpackCommand( WXWPARAM wParam |
323 | ,WXLPARAM lParam, | |
324 | WXWORD* pId | |
325 | ,WXHWND* pHwnd | |
326 | ,WXWORD* pCmd | |
327 | ); | |
328 | void UnpackActivate( WXWPARAM wParam | |
329 | ,WXLPARAM lParam | |
330 | ,WXWORD* pState | |
776d87d5 DW |
331 | ,WXHWND* pHwnd |
332 | ); | |
333 | void UnpackScroll( WXWPARAM wParam | |
334 | ,WXLPARAM lParam | |
335 | ,WXWORD* pCode | |
336 | ,WXWORD* pPos | |
337 | ,WXHWND* pHwnd | |
338 | ); | |
776d87d5 DW |
339 | void UnpackMenuSelect( WXWPARAM wParam |
340 | ,WXLPARAM lParam | |
341 | ,WXWORD* pTtem | |
342 | ,WXWORD* pFlags | |
343 | ,WXHMENU* pHmenu | |
344 | ); | |
cdf1e714 DW |
345 | |
346 | // ------------------------------------------------------------------------ | |
776d87d5 | 347 | // internal handlers for OS2 messages: all handlers return a boolen value: |
cdf1e714 DW |
348 | // TRUE means that the handler processed the event and FALSE that it didn't |
349 | // ------------------------------------------------------------------------ | |
350 | ||
776d87d5 | 351 | // there are several cases where we have virtual functions for PM |
cdf1e714 DW |
352 | // message processing: this is because these messages often require to be |
353 | // processed in a different manner in the derived classes. For all other | |
776d87d5 | 354 | // messages, however, we do *not* have corresponding OS2OnXXX() function |
cdf1e714 | 355 | // and if the derived class wants to process them, it should override |
776d87d5 | 356 | // OS2WindowProc() directly. |
cdf1e714 DW |
357 | |
358 | // scroll event (both horizontal and vertical) | |
776d87d5 DW |
359 | virtual bool OS2OnScroll( int nOrientation |
360 | ,WXWORD nSBCode | |
361 | ,WXWORD pos | |
362 | ,WXHWND control | |
363 | ); | |
cdf1e714 | 364 | |
cdf1e714 | 365 | // owner-drawn controls need to process these messages |
776d87d5 DW |
366 | virtual bool OS2OnDrawItem( int nId |
367 | ,WXDRAWITEMSTRUCT* pItem | |
368 | ); | |
f5ea767e | 369 | virtual long OS2OnMeasureItem( int nId |
776d87d5 DW |
370 | ,WXMEASUREITEMSTRUCT* pItem |
371 | ); | |
cdf1e714 | 372 | |
9794cae1 DW |
373 | virtual void OnPaint(wxPaintEvent& rEvent); |
374 | ||
cdf1e714 | 375 | // the rest are not virtual |
776d87d5 DW |
376 | bool HandleCreate( WXLPCREATESTRUCT vCs |
377 | ,bool* pMayCreate | |
378 | ); | |
cdf1e714 | 379 | bool HandleInitDialog(WXHWND hWndFocus); |
776d87d5 DW |
380 | bool HandleDestroy(void); |
381 | bool HandlePaint(void); | |
382 | bool HandleEraseBkgnd(WXHDC vDC); | |
383 | bool HandleMinimize(void); | |
384 | bool HandleMaximize(void); | |
385 | bool HandleSize( int nX | |
386 | ,int nY | |
387 | ,WXUINT uFlag | |
388 | ); | |
61243a51 | 389 | bool HandleGetMinMaxInfo(PSWP pMmInfo); |
776d87d5 DW |
390 | bool HandleShow( bool bShow |
391 | ,int nStatus | |
392 | ); | |
393 | bool HandleActivate( int nFlag | |
776d87d5 DW |
394 | ,WXHWND hActivate |
395 | ); | |
396 | bool HandleCommand( WXWORD nId | |
397 | ,WXWORD nCmd | |
398 | ,WXHWND hControl | |
399 | ); | |
400 | bool HandleSysCommand( WXWPARAM wParam | |
401 | ,WXLPARAM lParam | |
402 | ); | |
1d0edc0f DW |
403 | bool HandlePaletteChanged(void); |
404 | bool HandleQueryNewPalette(void); | |
776d87d5 | 405 | bool HandleSysColorChange(void); |
1d0edc0f DW |
406 | bool HandleDisplayChange(void); |
407 | bool HandleCaptureChanged(WXHWND hBainedCapture); | |
408 | ||
61243a51 | 409 | bool HandleCtlColor(WXHBRUSH* hBrush); |
776d87d5 DW |
410 | bool HandleSetFocus(WXHWND hWnd); |
411 | bool HandleKillFocus(WXHWND hWnd); | |
61243a51 | 412 | bool HandleEndDrag(WXWPARAM wParam); |
776d87d5 DW |
413 | bool HandleMouseEvent( WXUINT uMsg |
414 | ,int nX | |
415 | ,int nY | |
416 | ,WXUINT uFlags | |
417 | ); | |
418 | bool HandleMouseMove( int nX | |
419 | ,int nY | |
420 | ,WXUINT uFlags | |
421 | ); | |
598d8cac | 422 | bool HandleChar( WXWPARAM wParam |
776d87d5 DW |
423 | ,WXLPARAM lParam |
424 | ,bool bIsASCII = FALSE | |
425 | ); | |
a086de98 | 426 | bool HandleKeyDown( WXWPARAM wParam |
776d87d5 DW |
427 | ,WXLPARAM lParam |
428 | ); | |
a086de98 | 429 | bool HandleKeyUp( WXWPARAM wParam |
776d87d5 DW |
430 | ,WXLPARAM lParam |
431 | ); | |
432 | bool HandleQueryDragIcon(WXHICON* phIcon); | |
61243a51 DW |
433 | bool HandleSetCursor( USHORT vId |
434 | ,WXHWND hWnd | |
776d87d5 | 435 | ); |
0e320a79 | 436 | |
f9efbe3a DW |
437 | bool IsMouseInWindow(void) const; |
438 | bool OS2GetCreateWindowCoords( const wxPoint& rPos | |
439 | ,const wxSize& rSize | |
440 | ,int& rnX | |
441 | ,int& rnY | |
442 | ,int& rnWidth | |
443 | ,int& rnHeight | |
444 | ) const; | |
445 | ||
cdf1e714 | 446 | // Window procedure |
a885d89a | 447 | virtual MRESULT OS2WindowProc( WXUINT uMsg |
776d87d5 DW |
448 | ,WXWPARAM wParam |
449 | ,WXLPARAM lParam | |
450 | ); | |
0e320a79 | 451 | |
cdf1e714 | 452 | // Calls an appropriate default window procedure |
a885d89a | 453 | virtual MRESULT OS2DefWindowProc( WXUINT uMsg |
776d87d5 DW |
454 | ,WXWPARAM wParam |
455 | ,WXLPARAM lParam | |
456 | ); | |
457 | virtual bool OS2ProcessMessage(WXMSG* pMsg); | |
f140b352 | 458 | virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg); |
776d87d5 DW |
459 | virtual bool OS2TranslateMessage(WXMSG* pMsg); |
460 | virtual void OS2DestroyWindow(void); | |
0e320a79 | 461 | |
cdf1e714 DW |
462 | // this function should return the brush to paint the window background |
463 | // with or 0 for the default brush | |
776d87d5 DW |
464 | virtual WXHBRUSH OnCtlColor( WXHDC hDC |
465 | ,WXHWND hWnd | |
466 | ,WXUINT uCtlColor | |
467 | ,WXUINT uMessage | |
468 | ,WXWPARAM wParam | |
469 | ,WXLPARAM lParam | |
470 | ); | |
27476f73 | 471 | |
cdf1e714 | 472 | #if WXWIN_COMPATIBILITY |
776d87d5 DW |
473 | void SetShowing(bool bShow) { (void)Show(show); } |
474 | bool IsUserEnabled(void) const { return IsEnabled(); } | |
cdf1e714 | 475 | #endif // WXWIN_COMPATIBILITY |
0e320a79 | 476 | |
cdf1e714 | 477 | // Responds to colour changes: passes event on to children. |
776d87d5 | 478 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); |
0e320a79 | 479 | |
776d87d5 DW |
480 | // initialize various fields of wxMouseEvent (common part of OS2OnMouseXXX) |
481 | void InitMouseEvent( wxMouseEvent& rEvent | |
482 | ,int nX | |
483 | ,int nY | |
484 | ,WXUINT uFlags | |
485 | ); | |
0e320a79 | 486 | |
3a50d19c | 487 | void MoveChildren(int nDiff); |
1b7735e1 | 488 | PSWP GetSwp(void) {return &m_vWinSwp;} |
3a50d19c | 489 | |
cdf1e714 | 490 | protected: |
a885d89a DW |
491 | // PM can't create some MSW styles natively but can perform these after |
492 | // creation by sending messages | |
493 | typedef enum extra_flags { kFrameToolWindow = 0x0001 | |
494 | ,kVertCaption = 0x0002 | |
495 | ,kHorzCaption = 0x0004 | |
496 | } EExtraFlags; | |
497 | // Some internal sizeing id's to make it easy for event handlers | |
498 | typedef enum size_types { kSizeNormal | |
499 | ,kSizeMax | |
500 | ,kSizeMin | |
501 | } ESizeTypes; | |
cdf1e714 | 502 | // the window handle |
776d87d5 | 503 | WXHWND m_hWnd; |
cdf1e714 DW |
504 | |
505 | // the old window proc (we subclass all windows) | |
776d87d5 | 506 | WXFARPROC m_fnOldWndProc; |
cdf1e714 | 507 | |
008089f6 | 508 | // additional (OS2 specific) flags |
776d87d5 DW |
509 | bool m_bUseCtl3D:1; // Using CTL3D for this control |
510 | bool m_bBackgroundTransparent:1; | |
511 | bool m_bMouseInWindow:1; | |
3437f881 | 512 | bool m_bLastKeydownProcessed:1; |
776d87d5 | 513 | bool m_bWinCaptured:1; |
008089f6 | 514 | WXDWORD m_dwExStyle; |
849949b1 DW |
515 | |
516 | // the size of one page for scrolling | |
776d87d5 DW |
517 | int m_nXThumbSize; |
518 | int m_nYThumbSize; | |
0e320a79 | 519 | |
cdf1e714 DW |
520 | #if wxUSE_MOUSEEVENT_HACK |
521 | // the coordinates of the last mouse event and the type of it | |
776d87d5 DW |
522 | long m_lLastMouseX, |
523 | long m_lLastMouseY; | |
524 | int m_nLastMouseEvent; | |
cdf1e714 DW |
525 | #endif // wxUSE_MOUSEEVENT_HACK |
526 | ||
776d87d5 | 527 | WXHMENU m_hMenu; // Menu, if any |
0fe536e3 | 528 | unsigned long m_ulMenubarId; // it's Id, if any |
cdf1e714 DW |
529 | |
530 | // the return value of WM_GETDLGCODE handler | |
776d87d5 | 531 | long m_lDlgCode; |
cdf1e714 DW |
532 | |
533 | // implement the base class pure virtuals | |
776d87d5 DW |
534 | virtual void DoClientToScreen( int* pX |
535 | ,int* pY | |
536 | ) const; | |
537 | virtual void DoScreenToClient( int* pX | |
538 | ,int* pY | |
539 | ) const; | |
540 | virtual void DoGetPosition( int* pX | |
541 | ,int* pY | |
542 | ) const; | |
543 | virtual void DoGetSize( int* pWidth | |
544 | ,int* pHeight | |
545 | ) const; | |
546 | virtual void DoGetClientSize( int* pWidth | |
547 | ,int* pHeight | |
548 | ) const; | |
549 | virtual void DoSetSize( int nX | |
550 | ,int nY | |
551 | ,int nWidth | |
552 | ,int nHeight | |
553 | ,int nSizeFlags = wxSIZE_AUTO | |
554 | ); | |
555 | virtual void DoSetClientSize( int nWidth | |
556 | ,int nHeight | |
557 | ); | |
cdf1e714 | 558 | |
4116c221 VZ |
559 | virtual void DoCaptureMouse(void); |
560 | virtual void DoReleaseMouse(void); | |
b9b1d6c8 | 561 | |
cdf1e714 DW |
562 | // move the window to the specified location and resize it: this is called |
563 | // from both DoSetSize() and DoSetClientSize() and would usually just call | |
3e282d33 | 564 | // ::WinSetWindowPos() except for composite controls which will want to arrange |
cdf1e714 | 565 | // themselves inside the given rectangle |
776d87d5 DW |
566 | virtual void DoMoveWindow( int nX |
567 | ,int nY | |
568 | ,int nWidth | |
569 | ,int nHeight | |
570 | ); | |
cdf1e714 DW |
571 | |
572 | #if wxUSE_TOOLTIPS | |
776d87d5 | 573 | virtual void DoSetToolTip(wxToolTip* pTip); |
cdf1e714 DW |
574 | #endif // wxUSE_TOOLTIPS |
575 | ||
3a50d19c DW |
576 | int GetOS2ParentHeight(wxWindowOS2* pParent); |
577 | ||
0e320a79 | 578 | private: |
cdf1e714 | 579 | // common part of all ctors |
776d87d5 | 580 | void Init(void); |
0e320a79 | 581 | |
cdf1e714 | 582 | // the (non-virtual) handlers for the events |
776d87d5 DW |
583 | bool HandleMove( int nX |
584 | ,int nY | |
585 | ); | |
586 | bool HandleJoystickEvent( WXUINT uMsg | |
587 | ,int pX | |
588 | ,int pY | |
589 | ,WXUINT uFlags | |
590 | ); | |
591 | ||
592 | bool HandleNotify( int nIdCtrl | |
593 | ,WXLPARAM lParam | |
594 | ,WXLPARAM* pResult | |
595 | ); | |
a885d89a | 596 | // the helper functions used by HandleChar/KeyXXX methods |
a086de98 DW |
597 | wxKeyEvent CreateKeyEvent( wxEventType evType |
598 | ,int nId | |
599 | ,WXLPARAM lParam = 0 | |
600 | ,WXWPARAM wParam = 0 | |
601 | ) const; | |
a885d89a | 602 | |
018d3030 | 603 | wxWindowList* m_pChildrenDisabled; |
c8b5f745 DW |
604 | HWND m_hWndScrollBarHorz; |
605 | HWND m_hWndScrollBarVert; | |
1b7735e1 | 606 | SWP m_vWinSwp; |
1c84ee88 | 607 | |
018d3030 DW |
608 | DECLARE_DYNAMIC_CLASS(wxWindowOS2); |
609 | DECLARE_NO_COPY_CLASS(wxWindowOS2) | |
610 | DECLARE_EVENT_TABLE() | |
611 | ||
612 | // | |
63415778 | 613 | // Virtual function hiding supression |
018d3030 | 614 | // |
776d87d5 | 615 | inline virtual bool Reparent(wxWindowBase* pNewParent) |
018d3030 | 616 | { return(wxWindowBase::Reparent(pNewParent));} |
a885d89a | 617 | }; // end of wxWindow |
0e320a79 | 618 | |
06519806 DW |
619 | class wxWindowCreationHook |
620 | { | |
621 | public: | |
622 | wxWindowCreationHook(wxWindow* pWinBeingCreated); | |
623 | ~wxWindowCreationHook(); | |
624 | }; // end of CLASS wxWindowCreationHook | |
625 | ||
cdf1e714 DW |
626 | // --------------------------------------------------------------------------- |
627 | // global functions | |
628 | // --------------------------------------------------------------------------- | |
0e320a79 | 629 | |
cdf1e714 | 630 | // kbd code translation |
776d87d5 DW |
631 | WXDLLEXPORT int wxCharCodeOS2ToWX(int nKeySym); |
632 | WXDLLEXPORT int wxCharCodeWXToOS2( int nId | |
633 | ,bool* pbIsVirtual | |
634 | ); | |
0e320a79 DW |
635 | #endif |
636 | // _WX_WINDOW_H_ |