]>
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 | 230 | |
0e320a79 DW |
231 | // For implementation purposes - sometimes decorations make the client area |
232 | // smaller | |
776d87d5 | 233 | virtual wxPoint GetClientAreaOrigin(void) const; |
0e320a79 | 234 | |
86de7616 DW |
235 | // Windows subclassing |
236 | void SubclassWin(WXHWND hWnd); | |
776d87d5 | 237 | void UnsubclassWin(void); |
86de7616 | 238 | |
776d87d5 DW |
239 | WXFARPROC OS2GetOldWndProc(void) const { return m_fnOldWndProc; } |
240 | void OS2SetOldWndProc(WXFARPROC fnProc) { m_fnOldWndProc = fnProc; } | |
47df2b8c DW |
241 | // |
242 | // Return TRUE if the window is of a standard (i.e. not wxWindows') class | |
243 | // | |
244 | bool IsOfStandardClass(void) const { return m_fnOldWndProc != NULL; } | |
86de7616 | 245 | |
776d87d5 DW |
246 | wxWindow* FindItem(long lId) const; |
247 | wxWindow* FindItemByHWND( WXHWND hWnd | |
248 | ,bool bControlOnly = FALSE | |
249 | ) const; | |
86de7616 | 250 | |
776d87d5 DW |
251 | // Make a Windows extended style from the given wxWindows window style ?? applicable to OS/2?? |
252 | static WXDWORD MakeExtendedStyle( long lStyle | |
253 | ,bool bEliminateBorders = TRUE | |
254 | ); | |
86de7616 | 255 | // Determine whether 3D effects are wanted |
776d87d5 DW |
256 | WXDWORD Determine3DEffects( WXDWORD dwDefaultBorderStyle |
257 | ,bool* pbWant3D | |
258 | ) const; | |
86de7616 | 259 | |
776d87d5 | 260 | // PM only: TRUE if this control is part of the main control |
86de7616 DW |
261 | virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; |
262 | ||
b9b1d6c8 DW |
263 | // translate wxWindows style flags for this control into the PM style |
264 | // and optional extended style for the corresponding native control | |
265 | // | |
266 | // this is the function that should be overridden in the derived classes, | |
267 | // but you will mostly use OS2GetCreateWindowFlags() below | |
268 | virtual WXDWORD OS2GetStyle( long lFlags | |
269 | ,WXDWORD* pdwExstyle = NULL | |
270 | ) const; | |
271 | ||
272 | // get the MSW window flags corresponding to wxWindows ones | |
273 | // | |
274 | // the functions returns the flags (WS_XXX) directly and puts the ext | |
275 | // (WS_EX_XXX) flags into the provided pointer if not NULL | |
276 | WXDWORD OS2GetCreateWindowFlags(WXDWORD* pdwExflags = NULL) const | |
277 | { return OS2GetStyle(GetWindowStyle(), pdwExflags); } | |
278 | ||
279 | ||
6ed98c6a DW |
280 | // get the HWND to be used as parent of this window with CreateWindow() |
281 | virtual WXHWND OS2GetParent(void) const; | |
282 | ||
cdf1e714 | 283 | // returns TRUE if the window has been created |
3011bf2b DW |
284 | bool OS2Create( PSZ zClass |
285 | ,const char* zTitle | |
286 | ,WXDWORD dwStyle | |
287 | ,const wxPoint& rPos | |
288 | ,const wxSize& rSize | |
289 | ,void* pCtlData | |
290 | ,WXDWORD dwExStyle | |
291 | ,bool bIsChild | |
292 | ); | |
776d87d5 DW |
293 | virtual bool OS2Command( WXUINT uParam |
294 | ,WXWORD nId | |
295 | ); | |
cdf1e714 DW |
296 | |
297 | #if WXWIN_COMPATIBILITY | |
776d87d5 DW |
298 | wxObject* GetChild(int nNumber) const; |
299 | virtual void OS2DeviceToLogical( float* pfX | |
300 | ,float* pfY | |
301 | ) const; | |
cdf1e714 DW |
302 | #endif // WXWIN_COMPATIBILITY |
303 | ||
19193a2c | 304 | #ifndef __WXUNIVERSAL__ |
cdf1e714 | 305 | // Create an appropriate wxWindow from a HWND |
776d87d5 DW |
306 | virtual wxWindow* CreateWindowFromHWND( wxWindow* pParent |
307 | ,WXHWND hWnd | |
308 | ); | |
cdf1e714 DW |
309 | |
310 | // Make sure the window style reflects the HWND style (roughly) | |
776d87d5 | 311 | virtual void AdoptAttributesFromHWND(void); |
19193a2c | 312 | #endif |
cdf1e714 DW |
313 | |
314 | // Setup background and foreground colours correctly | |
776d87d5 | 315 | virtual void SetupColours(void); |
cdf1e714 DW |
316 | |
317 | // ------------------------------------------------------------------------ | |
318 | // helpers for message handlers: these perform the same function as the | |
319 | // message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into | |
320 | // the correct parameters | |
321 | // ------------------------------------------------------------------------ | |
322 | ||
776d87d5 DW |
323 | void UnpackCommand( WXWPARAM wParam |
324 | ,WXLPARAM lParam, | |
325 | WXWORD* pId | |
326 | ,WXHWND* pHwnd | |
327 | ,WXWORD* pCmd | |
328 | ); | |
329 | void UnpackActivate( WXWPARAM wParam | |
330 | ,WXLPARAM lParam | |
331 | ,WXWORD* pState | |
776d87d5 DW |
332 | ,WXHWND* pHwnd |
333 | ); | |
334 | void UnpackScroll( WXWPARAM wParam | |
335 | ,WXLPARAM lParam | |
336 | ,WXWORD* pCode | |
337 | ,WXWORD* pPos | |
338 | ,WXHWND* pHwnd | |
339 | ); | |
776d87d5 DW |
340 | void UnpackMenuSelect( WXWPARAM wParam |
341 | ,WXLPARAM lParam | |
342 | ,WXWORD* pTtem | |
343 | ,WXWORD* pFlags | |
344 | ,WXHMENU* pHmenu | |
345 | ); | |
cdf1e714 DW |
346 | |
347 | // ------------------------------------------------------------------------ | |
776d87d5 | 348 | // internal handlers for OS2 messages: all handlers return a boolen value: |
cdf1e714 DW |
349 | // TRUE means that the handler processed the event and FALSE that it didn't |
350 | // ------------------------------------------------------------------------ | |
351 | ||
776d87d5 | 352 | // there are several cases where we have virtual functions for PM |
cdf1e714 DW |
353 | // message processing: this is because these messages often require to be |
354 | // processed in a different manner in the derived classes. For all other | |
776d87d5 | 355 | // messages, however, we do *not* have corresponding OS2OnXXX() function |
cdf1e714 | 356 | // and if the derived class wants to process them, it should override |
776d87d5 | 357 | // OS2WindowProc() directly. |
cdf1e714 DW |
358 | |
359 | // scroll event (both horizontal and vertical) | |
776d87d5 DW |
360 | virtual bool OS2OnScroll( int nOrientation |
361 | ,WXWORD nSBCode | |
362 | ,WXWORD pos | |
363 | ,WXHWND control | |
364 | ); | |
cdf1e714 | 365 | |
cdf1e714 | 366 | // owner-drawn controls need to process these messages |
776d87d5 DW |
367 | virtual bool OS2OnDrawItem( int nId |
368 | ,WXDRAWITEMSTRUCT* pItem | |
369 | ); | |
f5ea767e | 370 | virtual long OS2OnMeasureItem( int nId |
776d87d5 DW |
371 | ,WXMEASUREITEMSTRUCT* pItem |
372 | ); | |
cdf1e714 | 373 | |
9794cae1 DW |
374 | virtual void OnPaint(wxPaintEvent& rEvent); |
375 | ||
cdf1e714 | 376 | // the rest are not virtual |
776d87d5 DW |
377 | bool HandleCreate( WXLPCREATESTRUCT vCs |
378 | ,bool* pMayCreate | |
379 | ); | |
cdf1e714 | 380 | bool HandleInitDialog(WXHWND hWndFocus); |
776d87d5 DW |
381 | bool HandleDestroy(void); |
382 | bool HandlePaint(void); | |
383 | bool HandleEraseBkgnd(WXHDC vDC); | |
384 | bool HandleMinimize(void); | |
385 | bool HandleMaximize(void); | |
386 | bool HandleSize( int nX | |
387 | ,int nY | |
388 | ,WXUINT uFlag | |
389 | ); | |
61243a51 | 390 | bool HandleGetMinMaxInfo(PSWP pMmInfo); |
776d87d5 DW |
391 | bool HandleShow( bool bShow |
392 | ,int nStatus | |
393 | ); | |
394 | bool HandleActivate( int nFlag | |
776d87d5 DW |
395 | ,WXHWND hActivate |
396 | ); | |
397 | bool HandleCommand( WXWORD nId | |
398 | ,WXWORD nCmd | |
399 | ,WXHWND hControl | |
400 | ); | |
401 | bool HandleSysCommand( WXWPARAM wParam | |
402 | ,WXLPARAM lParam | |
403 | ); | |
1d0edc0f DW |
404 | bool HandlePaletteChanged(void); |
405 | bool HandleQueryNewPalette(void); | |
776d87d5 | 406 | bool HandleSysColorChange(void); |
1d0edc0f DW |
407 | bool HandleDisplayChange(void); |
408 | bool HandleCaptureChanged(WXHWND hBainedCapture); | |
409 | ||
61243a51 | 410 | bool HandleCtlColor(WXHBRUSH* hBrush); |
776d87d5 DW |
411 | bool HandleSetFocus(WXHWND hWnd); |
412 | bool HandleKillFocus(WXHWND hWnd); | |
61243a51 | 413 | bool HandleEndDrag(WXWPARAM wParam); |
776d87d5 DW |
414 | bool HandleMouseEvent( WXUINT uMsg |
415 | ,int nX | |
416 | ,int nY | |
417 | ,WXUINT uFlags | |
418 | ); | |
419 | bool HandleMouseMove( int nX | |
420 | ,int nY | |
421 | ,WXUINT uFlags | |
422 | ); | |
598d8cac | 423 | bool HandleChar( WXWPARAM wParam |
776d87d5 DW |
424 | ,WXLPARAM lParam |
425 | ,bool bIsASCII = FALSE | |
426 | ); | |
a086de98 | 427 | bool HandleKeyDown( WXWPARAM wParam |
776d87d5 DW |
428 | ,WXLPARAM lParam |
429 | ); | |
a086de98 | 430 | bool HandleKeyUp( WXWPARAM wParam |
776d87d5 DW |
431 | ,WXLPARAM lParam |
432 | ); | |
433 | bool HandleQueryDragIcon(WXHICON* phIcon); | |
61243a51 DW |
434 | bool HandleSetCursor( USHORT vId |
435 | ,WXHWND hWnd | |
776d87d5 | 436 | ); |
0e320a79 | 437 | |
f9efbe3a DW |
438 | bool IsMouseInWindow(void) const; |
439 | bool OS2GetCreateWindowCoords( const wxPoint& rPos | |
440 | ,const wxSize& rSize | |
441 | ,int& rnX | |
442 | ,int& rnY | |
443 | ,int& rnWidth | |
444 | ,int& rnHeight | |
445 | ) const; | |
446 | ||
cdf1e714 | 447 | // Window procedure |
a885d89a | 448 | virtual MRESULT OS2WindowProc( WXUINT uMsg |
776d87d5 DW |
449 | ,WXWPARAM wParam |
450 | ,WXLPARAM lParam | |
451 | ); | |
0e320a79 | 452 | |
cdf1e714 | 453 | // Calls an appropriate default window procedure |
a885d89a | 454 | virtual MRESULT OS2DefWindowProc( WXUINT uMsg |
776d87d5 DW |
455 | ,WXWPARAM wParam |
456 | ,WXLPARAM lParam | |
457 | ); | |
458 | virtual bool OS2ProcessMessage(WXMSG* pMsg); | |
f140b352 | 459 | virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg); |
776d87d5 DW |
460 | virtual bool OS2TranslateMessage(WXMSG* pMsg); |
461 | virtual void OS2DestroyWindow(void); | |
0e320a79 | 462 | |
cdf1e714 DW |
463 | // this function should return the brush to paint the window background |
464 | // with or 0 for the default brush | |
776d87d5 DW |
465 | virtual WXHBRUSH OnCtlColor( WXHDC hDC |
466 | ,WXHWND hWnd | |
467 | ,WXUINT uCtlColor | |
468 | ,WXUINT uMessage | |
469 | ,WXWPARAM wParam | |
470 | ,WXLPARAM lParam | |
471 | ); | |
27476f73 | 472 | |
cdf1e714 | 473 | #if WXWIN_COMPATIBILITY |
776d87d5 DW |
474 | void SetShowing(bool bShow) { (void)Show(show); } |
475 | bool IsUserEnabled(void) const { return IsEnabled(); } | |
cdf1e714 | 476 | #endif // WXWIN_COMPATIBILITY |
0e320a79 | 477 | |
cdf1e714 | 478 | // Responds to colour changes: passes event on to children. |
776d87d5 | 479 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); |
0e320a79 | 480 | |
776d87d5 DW |
481 | // initialize various fields of wxMouseEvent (common part of OS2OnMouseXXX) |
482 | void InitMouseEvent( wxMouseEvent& rEvent | |
483 | ,int nX | |
484 | ,int nY | |
485 | ,WXUINT uFlags | |
486 | ); | |
0e320a79 | 487 | |
3a50d19c | 488 | void MoveChildren(int nDiff); |
1b7735e1 | 489 | PSWP GetSwp(void) {return &m_vWinSwp;} |
3a50d19c | 490 | |
cdf1e714 | 491 | protected: |
a885d89a DW |
492 | // PM can't create some MSW styles natively but can perform these after |
493 | // creation by sending messages | |
494 | typedef enum extra_flags { kFrameToolWindow = 0x0001 | |
495 | ,kVertCaption = 0x0002 | |
496 | ,kHorzCaption = 0x0004 | |
497 | } EExtraFlags; | |
498 | // Some internal sizeing id's to make it easy for event handlers | |
499 | typedef enum size_types { kSizeNormal | |
500 | ,kSizeMax | |
501 | ,kSizeMin | |
502 | } ESizeTypes; | |
cdf1e714 | 503 | // the window handle |
776d87d5 | 504 | WXHWND m_hWnd; |
cdf1e714 DW |
505 | |
506 | // the old window proc (we subclass all windows) | |
776d87d5 | 507 | WXFARPROC m_fnOldWndProc; |
cdf1e714 | 508 | |
008089f6 | 509 | // additional (OS2 specific) flags |
776d87d5 DW |
510 | bool m_bUseCtl3D:1; // Using CTL3D for this control |
511 | bool m_bBackgroundTransparent:1; | |
512 | bool m_bMouseInWindow:1; | |
3437f881 | 513 | bool m_bLastKeydownProcessed:1; |
776d87d5 | 514 | bool m_bWinCaptured:1; |
008089f6 | 515 | WXDWORD m_dwExStyle; |
849949b1 DW |
516 | |
517 | // the size of one page for scrolling | |
776d87d5 DW |
518 | int m_nXThumbSize; |
519 | int m_nYThumbSize; | |
0e320a79 | 520 | |
cdf1e714 DW |
521 | #if wxUSE_MOUSEEVENT_HACK |
522 | // the coordinates of the last mouse event and the type of it | |
776d87d5 DW |
523 | long m_lLastMouseX, |
524 | long m_lLastMouseY; | |
525 | int m_nLastMouseEvent; | |
cdf1e714 DW |
526 | #endif // wxUSE_MOUSEEVENT_HACK |
527 | ||
776d87d5 | 528 | WXHMENU m_hMenu; // Menu, if any |
0fe536e3 | 529 | unsigned long m_ulMenubarId; // it's Id, if any |
cdf1e714 DW |
530 | |
531 | // the return value of WM_GETDLGCODE handler | |
776d87d5 | 532 | long m_lDlgCode; |
cdf1e714 DW |
533 | |
534 | // implement the base class pure virtuals | |
776d87d5 DW |
535 | virtual void DoClientToScreen( int* pX |
536 | ,int* pY | |
537 | ) const; | |
538 | virtual void DoScreenToClient( int* pX | |
539 | ,int* pY | |
540 | ) const; | |
541 | virtual void DoGetPosition( int* pX | |
542 | ,int* pY | |
543 | ) const; | |
544 | virtual void DoGetSize( int* pWidth | |
545 | ,int* pHeight | |
546 | ) const; | |
547 | virtual void DoGetClientSize( int* pWidth | |
548 | ,int* pHeight | |
549 | ) const; | |
550 | virtual void DoSetSize( int nX | |
551 | ,int nY | |
552 | ,int nWidth | |
553 | ,int nHeight | |
554 | ,int nSizeFlags = wxSIZE_AUTO | |
555 | ); | |
556 | virtual void DoSetClientSize( int nWidth | |
557 | ,int nHeight | |
558 | ); | |
cdf1e714 | 559 | |
4116c221 VZ |
560 | virtual void DoCaptureMouse(void); |
561 | virtual void DoReleaseMouse(void); | |
b9b1d6c8 | 562 | |
cdf1e714 DW |
563 | // move the window to the specified location and resize it: this is called |
564 | // from both DoSetSize() and DoSetClientSize() and would usually just call | |
3e282d33 | 565 | // ::WinSetWindowPos() except for composite controls which will want to arrange |
cdf1e714 | 566 | // themselves inside the given rectangle |
776d87d5 DW |
567 | virtual void DoMoveWindow( int nX |
568 | ,int nY | |
569 | ,int nWidth | |
570 | ,int nHeight | |
571 | ); | |
cdf1e714 DW |
572 | |
573 | #if wxUSE_TOOLTIPS | |
776d87d5 | 574 | virtual void DoSetToolTip(wxToolTip* pTip); |
cdf1e714 DW |
575 | #endif // wxUSE_TOOLTIPS |
576 | ||
3a50d19c DW |
577 | int GetOS2ParentHeight(wxWindowOS2* pParent); |
578 | ||
0e320a79 | 579 | private: |
cdf1e714 | 580 | // common part of all ctors |
776d87d5 | 581 | void Init(void); |
0e320a79 | 582 | |
cdf1e714 | 583 | // the (non-virtual) handlers for the events |
776d87d5 DW |
584 | bool HandleMove( int nX |
585 | ,int nY | |
586 | ); | |
587 | bool HandleJoystickEvent( WXUINT uMsg | |
588 | ,int pX | |
589 | ,int pY | |
590 | ,WXUINT uFlags | |
591 | ); | |
592 | ||
593 | bool HandleNotify( int nIdCtrl | |
594 | ,WXLPARAM lParam | |
595 | ,WXLPARAM* pResult | |
596 | ); | |
a885d89a | 597 | // the helper functions used by HandleChar/KeyXXX methods |
a086de98 DW |
598 | wxKeyEvent CreateKeyEvent( wxEventType evType |
599 | ,int nId | |
600 | ,WXLPARAM lParam = 0 | |
601 | ,WXWPARAM wParam = 0 | |
602 | ) const; | |
a885d89a | 603 | |
018d3030 | 604 | wxWindowList* m_pChildrenDisabled; |
c8b5f745 DW |
605 | HWND m_hWndScrollBarHorz; |
606 | HWND m_hWndScrollBarVert; | |
1b7735e1 | 607 | SWP m_vWinSwp; |
1c84ee88 | 608 | |
018d3030 DW |
609 | DECLARE_DYNAMIC_CLASS(wxWindowOS2); |
610 | DECLARE_NO_COPY_CLASS(wxWindowOS2) | |
611 | DECLARE_EVENT_TABLE() | |
612 | ||
613 | // | |
63415778 | 614 | // Virtual function hiding supression |
018d3030 | 615 | // |
776d87d5 | 616 | inline virtual bool Reparent(wxWindowBase* pNewParent) |
018d3030 | 617 | { return(wxWindowBase::Reparent(pNewParent));} |
a885d89a | 618 | }; // end of wxWindow |
0e320a79 | 619 | |
06519806 DW |
620 | class wxWindowCreationHook |
621 | { | |
622 | public: | |
623 | wxWindowCreationHook(wxWindow* pWinBeingCreated); | |
624 | ~wxWindowCreationHook(); | |
625 | }; // end of CLASS wxWindowCreationHook | |
626 | ||
cdf1e714 DW |
627 | // --------------------------------------------------------------------------- |
628 | // global functions | |
629 | // --------------------------------------------------------------------------- | |
0e320a79 | 630 | |
cdf1e714 | 631 | // kbd code translation |
776d87d5 DW |
632 | WXDLLEXPORT int wxCharCodeOS2ToWX(int nKeySym); |
633 | WXDLLEXPORT int wxCharCodeWXToOS2( int nId | |
634 | ,bool* pbIsVirtual | |
635 | ); | |
0e320a79 DW |
636 | #endif |
637 | // _WX_WINDOW_H_ |