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