]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: windows.cpp | |
3 | // Purpose: wxWindow | |
cdf1e714 | 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 | ||
cdf1e714 DW |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
0e320a79 | 14 | |
849949b1 DW |
15 | #ifndef WX_PRECOMP |
16 | #define INCL_DOS | |
17 | #define INCL_PM | |
18 | #include <os2.h> | |
19 | #include "wx/window.h" | |
20 | #include "wx/accel.h" | |
21 | #include "wx/setup.h" | |
22 | #include "wx/menu.h" | |
23 | #include "wx/dc.h" | |
24 | #include "wx/dcclient.h" | |
25 | #include "wx/utils.h" | |
26 | #include "wx/app.h" | |
27 | #include "wx/panel.h" | |
28 | #include "wx/layout.h" | |
29 | #include "wx/dialog.h" | |
30 | #include "wx/frame.h" | |
31 | #include "wx/listbox.h" | |
32 | #include "wx/button.h" | |
33 | #include "wx/msgdlg.h" | |
34 | ||
35 | #include <stdio.h> | |
36 | #endif | |
37 | ||
38 | #if wxUSE_OWNER_DRAWN | |
39 | #include "wx/ownerdrw.h" | |
40 | #endif | |
41 | ||
42 | #if wxUSE_DRAG_AND_DROP | |
43 | #include "wx/dnd.h" | |
44 | #endif | |
0e320a79 DW |
45 | |
46 | #include "wx/menuitem.h" | |
47 | #include "wx/log.h" | |
48 | ||
cdf1e714 DW |
49 | #include "wx/os2/private.h" |
50 | ||
849949b1 DW |
51 | #if wxUSE_TOOLTIPS |
52 | #include "wx/tooltip.h" | |
0e320a79 DW |
53 | #endif |
54 | ||
849949b1 DW |
55 | #if wxUSE_CARET |
56 | #include "wx/caret.h" | |
57 | #endif // wxUSE_CARET | |
58 | ||
59 | #include "wx/intl.h" | |
60 | #include "wx/log.h" | |
61 | ||
62 | ||
63 | #include "wx/textctrl.h" | |
64 | ||
0e320a79 DW |
65 | #include <string.h> |
66 | ||
849949b1 DW |
67 | // place compiler, OS specific includes here |
68 | ||
69 | ||
70 | // standard macros -- these are for OS/2 PM, but most GUI's have something similar | |
71 | #ifndef GET_X_LPARAM | |
72 | // SHORT1FROMMP -- LOWORD | |
73 | #define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp)) | |
74 | // SHORT2FROMMP -- HIWORD | |
75 | #define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16)) | |
76 | #endif // GET_X_LPARAM | |
77 | ||
78 | // --------------------------------------------------------------------------- | |
79 | // global variables | |
80 | // --------------------------------------------------------------------------- | |
81 | ||
82 | // the last Windows message we got (MT-UNSAFE) | |
83 | extern WXMSGID s_currentMsg; | |
84 | extern wxList WXDLLEXPORT wxPendingDelete; | |
85 | extern wxChar wxCanvasClassName[]; | |
86 | ||
87 | wxMenu *wxCurrentPopupMenu = NULL; | |
88 | wxList *wxWinHandleList = NULL; | |
89 | ||
90 | // --------------------------------------------------------------------------- | |
91 | // private functions | |
92 | // --------------------------------------------------------------------------- | |
93 | // the window proc for all our windows; most gui's have something similar | |
94 | MRESULT wxWndProc( HWND hWnd | |
95 | ,ULONG message | |
96 | ,MPARAM mp1 | |
97 | ,MPARAM mp2 | |
98 | ); | |
11e59d47 DW |
99 | |
100 | #ifdef __WXDEBUG__ | |
101 | const char *wxGetMessageName(int message); | |
102 | #endif //__WXDEBUG__ | |
103 | ||
849949b1 DW |
104 | void wxRemoveHandleAssociation(wxWindow *win); |
105 | void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); | |
106 | wxWindow *wxFindWinFromHandle(WXHWND hWnd); | |
107 | ||
108 | // --------------------------------------------------------------------------- | |
109 | // event tables | |
110 | // --------------------------------------------------------------------------- | |
0e320a79 | 111 | |
849949b1 | 112 | IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) |
0e320a79 | 113 | |
849949b1 DW |
114 | BEGIN_EVENT_TABLE(wxWindow, wxWindowBase) |
115 | EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) | |
116 | EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) | |
117 | EVT_INIT_DIALOG(wxWindow::OnInitDialog) | |
118 | EVT_IDLE(wxWindow::OnIdle) | |
119 | END_EVENT_TABLE() | |
0e320a79 | 120 | |
849949b1 DW |
121 | // =========================================================================== |
122 | // implementation | |
123 | // =========================================================================== | |
0e320a79 | 124 | |
776d87d5 DW |
125 | // Find an item given the PM Window id |
126 | wxWindow* wxWindow::FindItem( | |
127 | long ulId | |
128 | ) const | |
cdf1e714 | 129 | { |
776d87d5 DW |
130 | wxWindowList::Node* pCurrent = GetChildren().GetFirst(); |
131 | ||
132 | while (pCurrent) | |
cdf1e714 | 133 | { |
776d87d5 DW |
134 | wxWindow* pChildWin = pCurrent->GetData(); |
135 | wxWindow* pWnd = pChildWin->FindItem(ulId); | |
cdf1e714 | 136 | |
776d87d5 DW |
137 | if (pWnd) |
138 | return pWnd; | |
cdf1e714 | 139 | |
776d87d5 | 140 | if (pChildWin->IsKindOf(CLASSINFO(wxControl))) |
cdf1e714 | 141 | { |
776d87d5 DW |
142 | wxControl* pItem = (wxControl *)pChildWin; |
143 | ||
144 | if (pItem->GetId() == ulId) | |
145 | return(pItem); | |
cdf1e714 DW |
146 | else |
147 | { | |
148 | // In case it's a 'virtual' control (e.g. radiobox) | |
776d87d5 DW |
149 | if (pItem->GetSubcontrols().Member((wxObject *)ulId)) |
150 | return(pItem); | |
cdf1e714 DW |
151 | } |
152 | } | |
776d87d5 | 153 | pCurrent = pCurrent->GetNext(); |
cdf1e714 | 154 | } |
776d87d5 | 155 | return(NULL); |
cdf1e714 DW |
156 | } |
157 | ||
776d87d5 DW |
158 | // Find an item given the PM Window handle |
159 | wxWindow* wxWindow::FindItemByHWND( | |
160 | WXHWND hWnd | |
161 | , bool bControlOnly | |
162 | ) const | |
cdf1e714 | 163 | { |
776d87d5 DW |
164 | wxWindowList::Node* pCurrent = GetChildren().GetFirst(); |
165 | ||
166 | while (pCurrent) | |
cdf1e714 | 167 | { |
776d87d5 | 168 | wxWindow* pParent = pCurrent->GetData(); |
cdf1e714 DW |
169 | |
170 | // Do a recursive search. | |
776d87d5 DW |
171 | wxWindow* pWnd = pParent->FindItemByHWND(hWnd); |
172 | ||
173 | if (pWnd) | |
174 | return(pWnd); | |
cdf1e714 | 175 | |
776d87d5 | 176 | if (!bControlOnly || pParent->IsKindOf(CLASSINFO(wxControl))) |
cdf1e714 | 177 | { |
776d87d5 DW |
178 | wxWindow* pItem = pCurrent->GetData(); |
179 | ||
180 | if (pItem->GetHWND() == hWnd) | |
181 | return(pItem); | |
cdf1e714 DW |
182 | else |
183 | { | |
776d87d5 DW |
184 | if (pItem->ContainsHWND(hWnd)) |
185 | return(pItem); | |
cdf1e714 DW |
186 | } |
187 | } | |
776d87d5 | 188 | pCurrent = pCurrent->GetNext(); |
cdf1e714 | 189 | } |
776d87d5 | 190 | return(NULL); |
cdf1e714 DW |
191 | } |
192 | ||
193 | // Default command handler | |
776d87d5 DW |
194 | bool wxWindow::OS2Command( |
195 | WXUINT WXUNUSED(uParam) | |
196 | , WXWORD WXUNUSED(uId) | |
197 | ) | |
cdf1e714 | 198 | { |
776d87d5 | 199 | return(FALSE); |
cdf1e714 DW |
200 | } |
201 | ||
202 | // ---------------------------------------------------------------------------- | |
203 | // constructors and such | |
204 | // ---------------------------------------------------------------------------- | |
205 | ||
849949b1 | 206 | void wxWindow::Init() |
0e320a79 | 207 | { |
849949b1 DW |
208 | // generic |
209 | InitBase(); | |
0e320a79 | 210 | |
849949b1 | 211 | // PM specific |
776d87d5 DW |
212 | m_bDoubleClickAllowed = 0; |
213 | m_bWinCaptured = FALSE; | |
cdf1e714 | 214 | |
849949b1 | 215 | m_isBeingDeleted = FALSE; |
776d87d5 DW |
216 | m_fnOldWndProc = 0; |
217 | m_bUseCtl3D = FALSE; | |
218 | m_bMouseInWindow = FALSE; | |
0e320a79 | 219 | |
849949b1 DW |
220 | // wxWnd |
221 | m_hMenu = 0; | |
0e320a79 | 222 | |
849949b1 | 223 | m_hWnd = 0; |
0e320a79 | 224 | |
849949b1 DW |
225 | // pass WM_GETDLGCODE to DefWindowProc() |
226 | m_lDlgCode = 0; | |
0e320a79 | 227 | |
776d87d5 DW |
228 | m_nXThumbSize = 0; |
229 | m_nYThumbSize = 0; | |
230 | m_bBackgroundTransparent = FALSE; | |
0e320a79 | 231 | |
849949b1 DW |
232 | // as all windows are created with WS_VISIBLE style... |
233 | m_isShown = TRUE; | |
0e320a79 | 234 | |
cdf1e714 | 235 | #if wxUSE_MOUSEEVENT_HACK |
776d87d5 DW |
236 | m_lLastMouseX = |
237 | m_lLastMouseY = -1; | |
238 | m_nLastMouseEvent = -1; | |
cdf1e714 | 239 | #endif // wxUSE_MOUSEEVENT_HACK |
0e320a79 DW |
240 | } |
241 | ||
849949b1 DW |
242 | // Destructor |
243 | wxWindow::~wxWindow() | |
0e320a79 | 244 | { |
849949b1 | 245 | m_isBeingDeleted = TRUE; |
0e320a79 | 246 | |
cdf1e714 | 247 | OS2DetachWindowMenu(); |
849949b1 DW |
248 | // delete handlers? |
249 | if (m_parent) | |
250 | m_parent->RemoveChild(this); | |
251 | DestroyChildren(); | |
252 | if (m_hWnd) | |
253 | { | |
86de7616 | 254 | if(!WinDestroyWindow(GetHWND())) |
223d09f6 | 255 | wxLogLastError(wxT("DestroyWindow")); |
849949b1 DW |
256 | // remove hWnd <-> wxWindow association |
257 | wxRemoveHandleAssociation(this); | |
258 | } | |
0e320a79 DW |
259 | } |
260 | ||
776d87d5 DW |
261 | bool wxWindow::Create( |
262 | wxWindow* pParent | |
263 | , wxWindowID vId | |
264 | , const wxPoint& rPos | |
265 | , const wxSize& rSize | |
266 | , long lStyle | |
267 | , const wxString& rName | |
268 | ) | |
269 | { | |
270 | wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent")); | |
271 | ||
272 | if ( !CreateBase( pParent | |
273 | ,vId | |
274 | ,rPos | |
275 | ,rSize | |
276 | ,lStyle | |
277 | ,wxDefaultValidator | |
278 | ,rName | |
279 | )) | |
280 | return(FALSE); | |
281 | ||
282 | pParent->AddChild(this); | |
283 | ||
284 | bool bWant3D; | |
285 | WXDWORD dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D); | |
286 | DWORD ulFlags = 0L; | |
287 | ||
288 | OS2Create( m_windowId | |
289 | ,pParent | |
290 | ,wxCanvasClassName | |
291 | ,this | |
292 | ,NULL | |
293 | ,rPos.x | |
294 | ,rPos.y | |
295 | ,WidthDefault(rSize.x) | |
296 | ,HeightDefault(rSize.y) | |
297 | ,ulFlags | |
298 | ,NULL | |
299 | ,dwExStyle | |
300 | ); | |
301 | return(TRUE); | |
0e320a79 DW |
302 | } |
303 | ||
cdf1e714 DW |
304 | // --------------------------------------------------------------------------- |
305 | // basic operations | |
306 | // --------------------------------------------------------------------------- | |
0e320a79 | 307 | |
cdf1e714 | 308 | void wxWindow::SetFocus() |
0e320a79 | 309 | { |
bbdc9a87 DW |
310 | HWND hWnd = GetHwnd(); |
311 | ||
312 | if (hWnd) | |
313 | ::WinSetFocus(HWND_DESKTOP, hWnd); | |
0e320a79 DW |
314 | } |
315 | ||
11e59d47 | 316 | wxWindow* wxWindowBase::FindFocus() |
0e320a79 | 317 | { |
bbdc9a87 DW |
318 | HWND hWnd = ::WinQueryFocus(HWND_DESKTOP); |
319 | ||
320 | if (hWnd) | |
321 | { | |
322 | return wxFindWinFromHandle((WXHWND)hWnd); | |
323 | } | |
324 | return NULL; | |
0e320a79 DW |
325 | } |
326 | ||
bbdc9a87 DW |
327 | bool wxWindow::Enable( |
328 | bool bEnable | |
329 | ) | |
0e320a79 | 330 | { |
bbdc9a87 DW |
331 | if (!wxWindowBase::Enable(bEnable)) |
332 | return(FALSE); | |
333 | ||
334 | HWND hWnd = GetHwnd(); | |
335 | ||
336 | if ( hWnd ) | |
337 | ::WinEnableWindow(hWnd, (BOOL)bEnable); | |
338 | ||
339 | wxWindowList::Node* pNode = GetChildren().GetFirst(); | |
340 | ||
341 | while (pNode) | |
342 | { | |
343 | wxWindow* pChild = pNode->GetData(); | |
344 | ||
345 | pChild->Enable(bEnable); | |
346 | pNode = pNode->GetNext(); | |
347 | } | |
cdf1e714 | 348 | return(TRUE); |
0e320a79 DW |
349 | } |
350 | ||
bbdc9a87 DW |
351 | bool wxWindow::Show( |
352 | bool bShow | |
353 | ) | |
0e320a79 | 354 | { |
bbdc9a87 DW |
355 | if (!wxWindowBase::Show(bShow)) |
356 | return(FALSE); | |
357 | ||
358 | HWND hWnd = GetHwnd(); | |
359 | ||
360 | ::WinShowWindow(hWnd, bShow); | |
361 | ||
362 | if (bShow) | |
363 | { | |
364 | ::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); | |
365 | } | |
849949b1 | 366 | return(TRUE); |
0e320a79 DW |
367 | } |
368 | ||
cdf1e714 | 369 | void wxWindow::Raise() |
0e320a79 | 370 | { |
bbdc9a87 | 371 | ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ACTIVATE); |
0e320a79 DW |
372 | } |
373 | ||
cdf1e714 | 374 | void wxWindow::Lower() |
0e320a79 | 375 | { |
bbdc9a87 | 376 | ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_DEACTIVATE); |
0e320a79 DW |
377 | } |
378 | ||
bbdc9a87 DW |
379 | void wxWindow::SetTitle( |
380 | const wxString& rTitle | |
381 | ) | |
0e320a79 | 382 | { |
f38374d0 | 383 | ::WinSetWindowText(GetHwnd(), rTitle.c_str()); |
0e320a79 DW |
384 | } |
385 | ||
cdf1e714 | 386 | wxString wxWindow::GetTitle() const |
0e320a79 | 387 | { |
cdf1e714 | 388 | return wxGetWindowText(GetHWND()); |
0e320a79 DW |
389 | } |
390 | ||
cdf1e714 | 391 | void wxWindow::CaptureMouse() |
0e320a79 | 392 | { |
f38374d0 DW |
393 | HWND hWnd = GetHwnd(); |
394 | ||
395 | if (hWnd && !m_bWinCaptured) | |
396 | { | |
397 | ::WinSetCapture(HWND_DESKTOP, hWnd); | |
398 | m_bWinCaptured = TRUE; | |
399 | } | |
0e320a79 DW |
400 | } |
401 | ||
cdf1e714 | 402 | void wxWindow::ReleaseMouse() |
0e320a79 | 403 | { |
f38374d0 DW |
404 | if ( m_bWinCaptured ) |
405 | { | |
406 | ::WinSetCapture(HWND_DESKTOP, NULLHANDLE); | |
407 | m_bWinCaptured = FALSE; | |
408 | } | |
0e320a79 DW |
409 | } |
410 | ||
f38374d0 DW |
411 | bool wxWindow::SetFont( |
412 | const wxFont& rFont | |
413 | ) | |
0e320a79 | 414 | { |
f38374d0 DW |
415 | if (!wxWindowBase::SetFont(rFont)) |
416 | { | |
417 | // nothing to do | |
418 | return(FALSE); | |
419 | } | |
420 | ||
421 | HWND hWnd = GetHwnd(); | |
422 | ||
423 | if (hWnd != 0) | |
424 | { | |
425 | wxChar zFont[128]; | |
426 | ||
427 | sprintf(zFont, "%d.%s", rFont.GetPointSize(), rFont.GetFaceName().c_str()); | |
428 | return(::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont)); | |
429 | } | |
cdf1e714 | 430 | return(TRUE); |
0e320a79 DW |
431 | } |
432 | ||
f38374d0 DW |
433 | bool wxWindow::SetCursor( |
434 | const wxCursor& rCursor | |
435 | ) // check if base implementation is OK | |
0e320a79 | 436 | { |
f38374d0 DW |
437 | if ( !wxWindowBase::SetCursor(rCursor)) |
438 | { | |
439 | // no change | |
440 | return FALSE; | |
441 | } | |
442 | ||
443 | wxASSERT_MSG( m_cursor.Ok(), | |
444 | wxT("cursor must be valid after call to the base version")); | |
445 | ||
446 | HWND hWnd = GetHwnd(); | |
447 | POINTL vPoint; | |
448 | RECTL vRect; | |
449 | HPS hPS; | |
450 | HRGN hRGN; | |
451 | ||
452 | hPS = ::WinGetPS(hWnd); | |
453 | ||
454 | ::WinQueryPointerPos(HWND_DESKTOP, &vPoint); | |
455 | ::WinQueryWindowRect(hWnd, &vRect); | |
456 | ||
457 | hRGN = ::GpiCreateRegion(hPS, 1L, &vRect); | |
458 | ||
459 | if ((::GpiPtInRegion(hPS, hRGN, &vPoint) == PRGN_INSIDE) && !wxIsBusy()) | |
460 | { | |
461 | // ::SetCursor((HCURSOR)m_cursor.GetHCURSOR()); | |
462 | } | |
463 | return TRUE; | |
0e320a79 DW |
464 | } |
465 | ||
cdf1e714 | 466 | void wxWindow::WarpPointer(int x_pos, int y_pos) |
0e320a79 | 467 | { |
849949b1 | 468 | // TODO: |
0e320a79 DW |
469 | } |
470 | ||
cdf1e714 DW |
471 | #if WXWIN_COMPATIBILITY |
472 | void wxWindow::OS2DeviceToLogical (float *x, float *y) const | |
0e320a79 | 473 | { |
0e320a79 | 474 | } |
cdf1e714 | 475 | #endif // WXWIN_COMPATIBILITY |
0e320a79 | 476 | |
cdf1e714 DW |
477 | // --------------------------------------------------------------------------- |
478 | // scrolling stuff | |
479 | // --------------------------------------------------------------------------- | |
0e320a79 | 480 | |
cdf1e714 DW |
481 | #if WXWIN_COMPATIBILITY |
482 | void wxWindow::SetScrollRange(int orient, int range, bool refresh) | |
0e320a79 | 483 | { |
cdf1e714 | 484 | // TODO: |
0e320a79 DW |
485 | } |
486 | ||
cdf1e714 | 487 | void wxWindow::SetScrollPage(int orient, int page, bool refresh) |
0e320a79 | 488 | { |
cdf1e714 | 489 | // TODO: |
0e320a79 DW |
490 | } |
491 | ||
cdf1e714 | 492 | int wxWindow::OldGetScrollRange(int orient) const |
0e320a79 | 493 | { |
cdf1e714 DW |
494 | // TODO: |
495 | return 0; | |
0e320a79 DW |
496 | } |
497 | ||
cdf1e714 | 498 | int wxWindow::GetScrollPage(int orient) const |
0e320a79 | 499 | { |
849949b1 | 500 | // TODO: |
cdf1e714 | 501 | return(1); |
0e320a79 | 502 | } |
11e59d47 | 503 | #endif // WXWIN_COMPATIBILITY |
0e320a79 | 504 | |
cdf1e714 | 505 | int wxWindow::GetScrollPos(int orient) const |
0e320a79 | 506 | { |
849949b1 | 507 | // TODO: |
cdf1e714 | 508 | return(1); |
0e320a79 DW |
509 | } |
510 | ||
cdf1e714 | 511 | int wxWindow::GetScrollRange(int orient) const |
0e320a79 | 512 | { |
849949b1 | 513 | // TODO: |
cdf1e714 | 514 | return(1); |
0e320a79 DW |
515 | } |
516 | ||
cdf1e714 | 517 | int wxWindow::GetScrollThumb(int orient) const |
0e320a79 | 518 | { |
849949b1 | 519 | // TODO: |
cdf1e714 | 520 | return(1); |
0e320a79 DW |
521 | } |
522 | ||
cdf1e714 DW |
523 | void wxWindow::SetScrollPos( int orient |
524 | ,int pos | |
525 | ,bool refresh | |
526 | ) | |
0e320a79 | 527 | { |
849949b1 | 528 | // TODO: |
0e320a79 DW |
529 | } |
530 | ||
cdf1e714 DW |
531 | void wxWindow::SetScrollbar( int orient |
532 | ,int pos | |
533 | ,int thumbVisible | |
534 | ,int range | |
535 | ,bool refresh | |
536 | ) | |
0e320a79 | 537 | { |
849949b1 | 538 | // TODO: |
0e320a79 DW |
539 | } |
540 | ||
cdf1e714 DW |
541 | void wxWindow::ScrollWindow( int dx |
542 | ,int dy | |
543 | ,const wxRect* rect | |
544 | ) | |
0e320a79 | 545 | { |
849949b1 | 546 | // TODO: |
0e320a79 DW |
547 | } |
548 | ||
cdf1e714 DW |
549 | // --------------------------------------------------------------------------- |
550 | // subclassing | |
551 | // --------------------------------------------------------------------------- | |
0e320a79 | 552 | |
cdf1e714 | 553 | void wxWindow::SubclassWin(WXHWND hWnd) |
0e320a79 | 554 | { |
776d87d5 | 555 | wxASSERT_MSG( !m_fnOldWndProc, wxT("subclassing window twice?") ); |
0e320a79 | 556 | |
cdf1e714 DW |
557 | HWND hwnd = (HWND)hWnd; |
558 | /* | |
559 | * TODO: implement something like this: | |
560 | * wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in SubclassWin") ); | |
561 | * | |
562 | * wxAssociateWinWithHandle(hwnd, this); | |
563 | * | |
564 | * m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC); | |
565 | * SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc); | |
566 | */ | |
0e320a79 DW |
567 | } |
568 | ||
cdf1e714 | 569 | void wxWindow::UnsubclassWin() |
0e320a79 | 570 | { |
cdf1e714 DW |
571 | /* |
572 | * TODO: | |
0e320a79 | 573 | |
cdf1e714 | 574 | wxRemoveHandleAssociation(this); |
0e320a79 | 575 | |
cdf1e714 DW |
576 | // Restore old Window proc |
577 | HWND hwnd = GetHwnd(); | |
578 | if ( hwnd ) | |
579 | { | |
580 | m_hWnd = 0; | |
0e320a79 | 581 | |
cdf1e714 | 582 | wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in UnsubclassWin") ); |
0e320a79 | 583 | |
cdf1e714 DW |
584 | FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC); |
585 | if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) ) | |
586 | { | |
587 | SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc); | |
588 | m_oldWndProc = 0; | |
589 | } | |
590 | } | |
591 | */ | |
0e320a79 DW |
592 | } |
593 | ||
cdf1e714 DW |
594 | // Make a Windows extended style from the given wxWindows window style |
595 | WXDWORD wxWindow::MakeExtendedStyle(long style, bool eliminateBorders) | |
0e320a79 | 596 | { |
cdf1e714 DW |
597 | // TODO: |
598 | WXDWORD exStyle = 0; | |
599 | /* | |
600 | if ( style & wxTRANSPARENT_WINDOW ) | |
601 | exStyle |= WS_EX_TRANSPARENT; | |
0e320a79 | 602 | |
cdf1e714 DW |
603 | if ( !eliminateBorders ) |
604 | { | |
605 | if ( style & wxSUNKEN_BORDER ) | |
606 | exStyle |= WS_EX_CLIENTEDGE; | |
607 | if ( style & wxDOUBLE_BORDER ) | |
608 | exStyle |= WS_EX_DLGMODALFRAME; | |
609 | if ( style & wxRAISED_BORDER ) | |
610 | exStyle |= WS_EX_WINDOWEDGE; | |
611 | if ( style & wxSTATIC_BORDER ) | |
612 | exStyle |= WS_EX_STATICEDGE; | |
613 | } | |
614 | */ | |
615 | return exStyle; | |
616 | } | |
617 | ||
618 | // Determines whether native 3D effects or CTL3D should be used, | |
619 | // applying a default border style if required, and returning an extended | |
620 | // style to pass to CreateWindowEx. | |
621 | WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle, | |
622 | bool *want3D) const | |
623 | { | |
9dea36ef | 624 | DWORD exStyle = 0L; // remove after implementation doe |
cdf1e714 DW |
625 | /* TODO: this ought to be fun |
626 | * | |
627 | // If matches certain criteria, then assume no 3D effects | |
628 | // unless specifically requested (dealt with in MakeExtendedStyle) | |
629 | if ( !GetParent() || !IsKindOf(CLASSINFO(wxControl)) || (m_windowStyle & wxNO_BORDER) ) | |
630 | { | |
631 | *want3D = FALSE; | |
632 | return MakeExtendedStyle(m_windowStyle, FALSE); | |
633 | } | |
634 | ||
635 | // Determine whether we should be using 3D effects or not. | |
636 | bool nativeBorder = FALSE; // by default, we don't want a Win95 effect | |
637 | ||
638 | // 1) App can specify global 3D effects | |
639 | *want3D = wxTheApp->GetAuto3D(); | |
640 | ||
641 | // 2) If the parent is being drawn with user colours, or simple border specified, | |
642 | // switch effects off. TODO: replace wxUSER_COLOURS with wxNO_3D | |
643 | if ( GetParent() && (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) || (m_windowStyle & wxSIMPLE_BORDER) ) | |
644 | *want3D = FALSE; | |
645 | ||
646 | // 3) Control can override this global setting by defining | |
647 | // a border style, e.g. wxSUNKEN_BORDER | |
648 | if ( m_windowStyle & wxSUNKEN_BORDER ) | |
649 | *want3D = TRUE; | |
650 | ||
651 | // 4) If it's a special border, CTL3D can't cope so we want a native border | |
652 | if ( (m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) || | |
653 | (m_windowStyle & wxSTATIC_BORDER) ) | |
654 | { | |
655 | *want3D = TRUE; | |
656 | nativeBorder = TRUE; | |
657 | } | |
658 | ||
659 | // 5) If this isn't a Win95 app, and we are using CTL3D, remove border | |
660 | // effects from extended style | |
661 | #if wxUSE_CTL3D | |
662 | if ( *want3D ) | |
663 | nativeBorder = FALSE; | |
664 | #endif | |
665 | ||
666 | DWORD exStyle = MakeExtendedStyle(m_windowStyle, !nativeBorder); | |
667 | ||
668 | // If we want 3D, but haven't specified a border here, | |
669 | // apply the default border style specified. | |
670 | // TODO what about non-Win95 WIN32? Does it have borders? | |
671 | #if defined(__WIN95__) && !wxUSE_CTL3D | |
672 | if ( defaultBorderStyle && (*want3D) && ! ((m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) || | |
673 | (m_windowStyle & wxSTATIC_BORDER) || (m_windowStyle & wxSIMPLE_BORDER) )) | |
674 | exStyle |= defaultBorderStyle; // WS_EX_CLIENTEDGE; | |
675 | #endif | |
676 | */ | |
677 | return exStyle; | |
678 | } | |
679 | ||
680 | #if WXWIN_COMPATIBILITY | |
681 | void wxWindow::OnCommand(wxWindow& win, wxCommandEvent& event) | |
682 | { | |
683 | // TODO: | |
684 | } | |
685 | ||
686 | wxObject* wxWindow::GetChild(int number) const | |
687 | { | |
688 | // TODO: | |
689 | return((wxObject*)this); | |
690 | } | |
691 | ||
692 | void wxWindow::OnDefaultAction(wxControl *initiatingItem) | |
693 | { | |
694 | // TODO: | |
695 | } | |
696 | ||
697 | #endif // WXWIN_COMPATIBILITY | |
698 | ||
699 | // Setup background and foreground colours correctly | |
700 | void wxWindow::SetupColours() | |
701 | { | |
702 | if ( GetParent() ) | |
703 | SetBackgroundColour(GetParent()->GetBackgroundColour()); | |
704 | } | |
705 | ||
706 | void wxWindow::OnIdle(wxIdleEvent& event) | |
707 | { | |
708 | // TODO: | |
709 | } | |
710 | ||
711 | // Set this window to be the child of 'parent'. | |
712 | bool wxWindow::Reparent(wxWindow *parent) | |
713 | { | |
714 | if ( !wxWindowBase::Reparent(parent) ) | |
715 | return FALSE; | |
716 | // TODO: | |
717 | return FALSE; | |
718 | } | |
719 | ||
720 | void wxWindow::Clear() | |
721 | { | |
722 | // TODO: | |
723 | } | |
724 | ||
725 | void wxWindow::Refresh(bool eraseBack, const wxRect *rect) | |
726 | { | |
727 | // TODO: | |
728 | } | |
729 | ||
730 | // --------------------------------------------------------------------------- | |
731 | // drag and drop | |
732 | // --------------------------------------------------------------------------- | |
733 | ||
734 | #if wxUSE_DRAG_AND_DROP | |
735 | void wxWindow::SetDropTarget(wxDropTarget *pDropTarget) | |
736 | { | |
737 | // TODO: | |
738 | } | |
739 | #endif | |
740 | ||
741 | // old style file-manager drag&drop support: we retain the old-style | |
742 | // DragAcceptFiles in parallel with SetDropTarget. | |
743 | void wxWindow::DragAcceptFiles(bool accept) | |
744 | { | |
745 | // TODO: | |
746 | } | |
747 | ||
748 | // ---------------------------------------------------------------------------- | |
749 | // tooltips | |
750 | // ---------------------------------------------------------------------------- | |
751 | ||
752 | #if wxUSE_TOOLTIPS | |
753 | ||
754 | void wxWindow::DoSetToolTip(wxToolTip *tooltip) | |
755 | { | |
756 | wxWindowBase::DoSetToolTip(tooltip); | |
757 | ||
758 | if ( m_tooltip ) | |
759 | m_tooltip->SetWindow(this); | |
760 | } | |
761 | ||
762 | #endif // wxUSE_TOOLTIPS | |
763 | ||
764 | // --------------------------------------------------------------------------- | |
765 | // moving and resizing | |
766 | // --------------------------------------------------------------------------- | |
767 | ||
768 | // Get total size | |
769 | void wxWindow::DoGetSize( int *width, int *height ) const | |
770 | { | |
771 | // TODO: | |
772 | } | |
773 | ||
774 | void wxWindow::DoGetPosition( int *x, int *y ) const | |
775 | { | |
776 | // TODO: | |
777 | } | |
778 | ||
779 | void wxWindow::DoScreenToClient( int *x, int *y ) const | |
780 | { | |
781 | // TODO: | |
782 | } | |
783 | ||
784 | void wxWindow::DoClientToScreen( int *x, int *y ) const | |
785 | { | |
786 | // TODO: | |
787 | } | |
788 | ||
789 | // Get size *available for subwindows* i.e. excluding menu bar etc. | |
790 | void wxWindow::DoGetClientSize( int *width, int *height ) const | |
791 | { | |
792 | // TODO: | |
793 | } | |
794 | ||
795 | void wxWindow::DoMoveWindow(int x, int y, int width, int height) | |
796 | { | |
797 | // TODO: | |
798 | } | |
799 | ||
800 | // set the size of the window: if the dimensions are positive, just use them, | |
801 | // but if any of them is equal to -1, it means that we must find the value for | |
802 | // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in | |
803 | // which case -1 is a valid value for x and y) | |
804 | // | |
805 | // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate | |
806 | // the width/height to best suit our contents, otherwise we reuse the current | |
807 | // width/height | |
808 | void wxWindow::DoSetSize(int x, int y, | |
809 | int width, int height, | |
810 | int sizeFlags) | |
811 | { | |
812 | // TODO: | |
813 | } | |
814 | ||
cdf1e714 DW |
815 | void wxWindow::DoSetClientSize(int width, int height) |
816 | { | |
817 | // TODO: | |
818 | } | |
819 | ||
820 | wxPoint wxWindow::GetClientAreaOrigin() const | |
821 | { | |
822 | return wxPoint(0, 0); | |
823 | } | |
824 | ||
825 | void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) | |
826 | { | |
827 | // TODO: | |
828 | } | |
829 | ||
830 | // --------------------------------------------------------------------------- | |
831 | // text metrics | |
832 | // --------------------------------------------------------------------------- | |
833 | ||
834 | int wxWindow::GetCharHeight() const | |
835 | { | |
836 | // TODO: | |
837 | return(1); | |
838 | } | |
839 | ||
840 | int wxWindow::GetCharWidth() const | |
841 | { | |
842 | // TODO: | |
843 | return(1); | |
844 | } | |
845 | ||
846 | void wxWindow::GetTextExtent( const wxString& string | |
847 | ,int* x | |
848 | ,int* y | |
849 | ,int* descent | |
850 | ,int* externalLeading | |
851 | ,const wxFont* theFont | |
852 | ) const | |
853 | { | |
854 | // TODO: | |
855 | } | |
856 | ||
857 | #if wxUSE_CARET && WXWIN_COMPATIBILITY | |
858 | // --------------------------------------------------------------------------- | |
859 | // Caret manipulation | |
860 | // --------------------------------------------------------------------------- | |
861 | ||
862 | void wxWindow::CreateCaret(int w, int h) | |
863 | { | |
864 | // TODO: | |
865 | } | |
866 | ||
867 | void wxWindow::CreateCaret(const wxBitmap *bitmap) | |
868 | { | |
869 | // TODO: | |
870 | } | |
871 | ||
872 | void wxWindow::ShowCaret(bool show) | |
873 | { | |
874 | // TODO: | |
875 | } | |
876 | ||
877 | void wxWindow::DestroyCaret() | |
878 | { | |
879 | // TODO: | |
880 | } | |
881 | ||
882 | void wxWindow::SetCaretPos(int x, int y) | |
883 | { | |
884 | // TODO: | |
885 | } | |
886 | ||
887 | void wxWindow::GetCaretPos(int *x, int *y) const | |
888 | { | |
889 | // TODO: | |
890 | } | |
891 | ||
892 | #endif //wxUSE_CARET | |
893 | ||
894 | // --------------------------------------------------------------------------- | |
895 | // popup menu | |
896 | // --------------------------------------------------------------------------- | |
897 | ||
898 | bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y ) | |
899 | { | |
900 | // TODO: | |
901 | return(TRUE); | |
902 | } | |
903 | ||
904 | // =========================================================================== | |
905 | // pre/post message processing | |
906 | // =========================================================================== | |
907 | ||
908 | MRESULT wxWindow::OS2DefWindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) | |
909 | { | |
910 | // TODO: | |
911 | return (MRESULT)0; | |
912 | } | |
913 | ||
914 | bool wxWindow::OS2ProcessMessage(WXMSG* pMsg) | |
915 | { | |
916 | // TODO: | |
917 | return FALSE; | |
918 | } | |
919 | ||
920 | bool wxWindow::OS2TranslateMessage(WXMSG* pMsg) | |
921 | { | |
922 | return m_acceleratorTable.Translate(this, pMsg); | |
923 | } | |
924 | ||
925 | // --------------------------------------------------------------------------- | |
926 | // message params unpackers (different for Win16 and Win32) | |
927 | // --------------------------------------------------------------------------- | |
928 | ||
929 | void wxWindow::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, | |
930 | WORD *id, WXHWND *hwnd, WORD *cmd) | |
931 | { | |
932 | *id = LOWORD(wParam); | |
933 | *hwnd = (WXHWND)lParam; | |
934 | *cmd = HIWORD(wParam); | |
935 | } | |
936 | ||
937 | void wxWindow::UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, | |
938 | WXWORD *state, WXWORD *minimized, WXHWND *hwnd) | |
939 | { | |
940 | *state = LOWORD(wParam); | |
941 | *minimized = HIWORD(wParam); | |
942 | *hwnd = (WXHWND)lParam; | |
943 | } | |
944 | ||
945 | void wxWindow::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, | |
946 | WXWORD *code, WXWORD *pos, WXHWND *hwnd) | |
947 | { | |
948 | *code = LOWORD(wParam); | |
949 | *pos = HIWORD(wParam); | |
950 | *hwnd = (WXHWND)lParam; | |
951 | } | |
952 | ||
953 | void wxWindow::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, | |
954 | WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd) | |
955 | { | |
11e59d47 | 956 | *nCtlColor = 0; // TODO: CTLCOLOR_BTN; |
cdf1e714 DW |
957 | *hwnd = (WXHWND)lParam; |
958 | *hdc = (WXHDC)wParam; | |
959 | } | |
960 | ||
961 | void wxWindow::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, | |
962 | WXWORD *item, WXWORD *flags, WXHMENU *hmenu) | |
963 | { | |
11e59d47 | 964 | *item = (WXWORD)LOWORD(wParam); |
cdf1e714 DW |
965 | *flags = HIWORD(wParam); |
966 | *hmenu = (WXHMENU)lParam; | |
967 | } | |
968 | ||
969 | // --------------------------------------------------------------------------- | |
970 | // Main wxWindows window proc and the window proc for wxWindow | |
971 | // --------------------------------------------------------------------------- | |
972 | ||
973 | // Hook for new window just as it's being created, when the window isn't yet | |
974 | // associated with the handle | |
975 | wxWindow *wxWndHook = NULL; | |
976 | ||
977 | // Main window proc | |
9dea36ef | 978 | MRESULT wxWndProc(HWND hWnd, ULONG message, MPARAM wParam, MPARAM lParam) |
cdf1e714 DW |
979 | { |
980 | // trace all messages - useful for the debugging | |
981 | #ifdef __WXDEBUG__ | |
982 | wxLogTrace(wxTraceMessages, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"), | |
983 | wxGetMessageName(message), wParam, lParam); | |
984 | #endif // __WXDEBUG__ | |
985 | ||
986 | wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd); | |
987 | ||
988 | // when we get the first message for the HWND we just created, we associate | |
989 | // it with wxWindow stored in wxWndHook | |
990 | if ( !wnd && wxWndHook ) | |
991 | { | |
992 | #if 0 // def __WXDEBUG__ | |
993 | char buf[512]; | |
994 | ::GetClassNameA((HWND) hWnd, buf, 512); | |
995 | wxString className(buf); | |
996 | #endif | |
997 | ||
998 | wxAssociateWinWithHandle(hWnd, wxWndHook); | |
999 | wnd = wxWndHook; | |
1000 | wxWndHook = NULL; | |
1001 | wnd->SetHWND((WXHWND)hWnd); | |
1002 | } | |
1003 | ||
1004 | MRESULT rc; | |
1005 | ||
1006 | // Stop right here if we don't have a valid handle in our wxWindow object. | |
1007 | if ( wnd && !wnd->GetHWND() ) | |
1008 | { | |
1009 | // FIXME: why do we do this? | |
1010 | wnd->SetHWND((WXHWND) hWnd); | |
11e59d47 | 1011 | rc = wnd->OS2DefWindowProc(hWnd, message, wParam, lParam ); |
cdf1e714 DW |
1012 | wnd->SetHWND(0); |
1013 | } | |
1014 | else | |
1015 | { | |
1016 | if ( wnd ) | |
1017 | rc = wnd->OS2WindowProc(hWnd, message, wParam, lParam); | |
1018 | else | |
11e59d47 | 1019 | rc = 0; //TODO: DefWindowProc( hWnd, message, wParam, lParam ); |
cdf1e714 DW |
1020 | } |
1021 | ||
1022 | return rc; | |
1023 | } | |
1024 | ||
1025 | MRESULT wxWindow::OS2WindowProc(HWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) | |
1026 | { | |
1027 | // did we process the message? | |
1028 | bool processed = FALSE; | |
1029 | ||
1030 | // the return value | |
1031 | union | |
1032 | { | |
1033 | bool allow; | |
1034 | long result; | |
1035 | WXHICON hIcon; | |
1036 | WXHBRUSH hBrush; | |
1037 | } rc; | |
1038 | ||
1039 | // for most messages we should return 0 when we do process the message | |
1040 | rc.result = 0; | |
1041 | // TODO: | |
1042 | /* | |
1043 | switch ( message ) | |
1044 | { | |
1045 | case WM_CREATE: | |
1046 | { | |
1047 | bool mayCreate; | |
1048 | processed = HandleCreate((WXLPCREATESTRUCT)lParam, &mayCreate); | |
1049 | if ( processed ) | |
1050 | { | |
1051 | // return 0 to allow window creation | |
1052 | rc.result = mayCreate ? 0 : -1; | |
1053 | } | |
1054 | } | |
1055 | break; | |
1056 | ||
1057 | case WM_DESTROY: | |
1058 | processed = HandleDestroy(); | |
1059 | break; | |
1060 | ||
1061 | case WM_MOVE: | |
1062 | processed = HandleMove(LOWORD(lParam), HIWORD(lParam)); | |
1063 | break; | |
1064 | ||
1065 | case WM_SIZE: | |
1066 | processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam); | |
1067 | break; | |
1068 | ||
1069 | case WM_ACTIVATE: | |
1070 | { | |
1071 | WXWORD state, minimized; | |
1072 | WXHWND hwnd; | |
1073 | UnpackActivate(wParam, lParam, &state, &minimized, &hwnd); | |
1074 | ||
1075 | processed = HandleActivate(state, minimized != 0, (WXHWND)hwnd); | |
1076 | } | |
1077 | break; | |
1078 | ||
1079 | case WM_SETFOCUS: | |
1080 | processed = HandleSetFocus((WXHWND)(HWND)wParam); | |
1081 | break; | |
1082 | ||
1083 | case WM_KILLFOCUS: | |
1084 | processed = HandleKillFocus((WXHWND)(HWND)wParam); | |
1085 | break; | |
1086 | ||
1087 | case WM_PAINT: | |
1088 | processed = HandlePaint(); | |
1089 | break; | |
1090 | ||
1091 | case WM_CLOSE: | |
1092 | // don't let the DefWindowProc() destroy our window - we'll do it | |
1093 | // ourselves in ~wxWindow | |
1094 | processed = TRUE; | |
1095 | rc.result = TRUE; | |
1096 | break; | |
1097 | ||
1098 | case WM_SHOWWINDOW: | |
1099 | processed = HandleShow(wParam != 0, (int)lParam); | |
1100 | break; | |
1101 | ||
1102 | case WM_MOUSEMOVE: | |
1103 | case WM_LBUTTONDOWN: | |
1104 | case WM_LBUTTONUP: | |
1105 | case WM_LBUTTONDBLCLK: | |
1106 | case WM_RBUTTONDOWN: | |
1107 | case WM_RBUTTONUP: | |
1108 | case WM_RBUTTONDBLCLK: | |
1109 | case WM_MBUTTONDOWN: | |
1110 | case WM_MBUTTONUP: | |
1111 | case WM_MBUTTONDBLCLK: | |
1112 | { | |
1113 | short x = LOWORD(lParam); | |
1114 | short y = HIWORD(lParam); | |
1115 | ||
1116 | processed = HandleMouseEvent(message, x, y, wParam); | |
1117 | } | |
1118 | break; | |
1119 | ||
1120 | case MM_JOY1MOVE: | |
1121 | case MM_JOY2MOVE: | |
1122 | case MM_JOY1ZMOVE: | |
1123 | case MM_JOY2ZMOVE: | |
1124 | case MM_JOY1BUTTONDOWN: | |
1125 | case MM_JOY2BUTTONDOWN: | |
1126 | case MM_JOY1BUTTONUP: | |
1127 | case MM_JOY2BUTTONUP: | |
1128 | { | |
1129 | int x = LOWORD(lParam); | |
1130 | int y = HIWORD(lParam); | |
1131 | ||
1132 | processed = HandleJoystickEvent(message, x, y, wParam); | |
1133 | } | |
1134 | break; | |
1135 | ||
1136 | case WM_SYSCOMMAND: | |
1137 | processed = HandleSysCommand(wParam, lParam); | |
1138 | break; | |
1139 | ||
1140 | case WM_COMMAND: | |
1141 | { | |
1142 | WORD id, cmd; | |
1143 | WXHWND hwnd; | |
1144 | UnpackCommand(wParam, lParam, &id, &hwnd, &cmd); | |
1145 | ||
1146 | processed = HandleCommand(id, cmd, hwnd); | |
1147 | } | |
1148 | break; | |
1149 | ||
1150 | #ifdef __WIN95__ | |
1151 | case WM_NOTIFY: | |
1152 | processed = HandleNotify((int)wParam, lParam, &rc.result); | |
1153 | break; | |
1154 | #endif // Win95 | |
1155 | ||
1156 | // for these messages we must return TRUE if process the message | |
1157 | case WM_DRAWITEM: | |
1158 | case WM_MEASUREITEM: | |
1159 | { | |
1160 | int idCtrl = (UINT)wParam; | |
1161 | if ( message == WM_DRAWITEM ) | |
1162 | { | |
1163 | processed = MSWOnDrawItem(idCtrl, | |
1164 | (WXDRAWITEMSTRUCT *)lParam); | |
1165 | } | |
1166 | else | |
1167 | { | |
1168 | processed = MSWOnMeasureItem(idCtrl, | |
1169 | (WXMEASUREITEMSTRUCT *)lParam); | |
1170 | } | |
1171 | ||
1172 | if ( processed ) | |
1173 | rc.result = TRUE; | |
1174 | } | |
1175 | break; | |
1176 | ||
1177 | case WM_GETDLGCODE: | |
1178 | if ( m_lDlgCode ) | |
1179 | { | |
1180 | rc.result = m_lDlgCode; | |
1181 | processed = TRUE; | |
1182 | } | |
1183 | //else: get the dlg code from the DefWindowProc() | |
1184 | break; | |
1185 | ||
1186 | case WM_KEYDOWN: | |
1187 | // If this has been processed by an event handler, | |
1188 | // return 0 now (we've handled it). | |
1189 | if ( HandleKeyDown((WORD) wParam, lParam) ) | |
1190 | { | |
1191 | processed = TRUE; | |
1192 | ||
1193 | break; | |
1194 | } | |
1195 | ||
1196 | // we consider these message "not interesting" to OnChar | |
1197 | if ( wParam == VK_SHIFT || wParam == VK_CONTROL ) | |
1198 | { | |
1199 | processed = TRUE; | |
1200 | ||
1201 | break; | |
1202 | } | |
1203 | ||
1204 | switch ( wParam ) | |
1205 | { | |
1206 | // avoid duplicate messages to OnChar for these ASCII keys: they | |
1207 | // will be translated by TranslateMessage() and received in WM_CHAR | |
1208 | case VK_ESCAPE: | |
1209 | case VK_SPACE: | |
1210 | case VK_RETURN: | |
1211 | case VK_BACK: | |
1212 | case VK_TAB: | |
1213 | // but set processed to FALSE, not TRUE to still pass them to | |
1214 | // the control's default window proc - otherwise built-in | |
1215 | // keyboard handling won't work | |
1216 | processed = FALSE; | |
1217 | ||
1218 | break; | |
1219 | ||
1220 | #ifdef VK_APPS | |
1221 | // special case of VK_APPS: treat it the same as right mouse | |
1222 | // click because both usually pop up a context menu | |
1223 | case VK_APPS: | |
1224 | { | |
1225 | // construct the key mask | |
1226 | WPARAM fwKeys = MK_RBUTTON; | |
1227 | if ( (::GetKeyState(VK_CONTROL) & 0x100) != 0 ) | |
1228 | fwKeys |= MK_CONTROL; | |
1229 | if ( (::GetKeyState(VK_SHIFT) & 0x100) != 0 ) | |
1230 | fwKeys |= MK_SHIFT; | |
1231 | ||
1232 | // simulate right mouse button click | |
1233 | DWORD dwPos = ::GetMessagePos(); | |
1234 | int x = GET_X_LPARAM(dwPos), | |
1235 | y = GET_Y_LPARAM(dwPos); | |
1236 | ||
1237 | ScreenToClient(&x, &y); | |
1238 | processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, fwKeys); | |
1239 | } | |
1240 | break; | |
1241 | #endif // VK_APPS | |
1242 | ||
1243 | case VK_LEFT: | |
1244 | case VK_RIGHT: | |
1245 | case VK_DOWN: | |
1246 | case VK_UP: | |
1247 | default: | |
1248 | processed = HandleChar((WORD)wParam, lParam); | |
1249 | } | |
1250 | break; | |
1251 | ||
1252 | case WM_KEYUP: | |
1253 | processed = HandleKeyUp((WORD) wParam, lParam); | |
1254 | break; | |
1255 | ||
1256 | case WM_CHAR: // Always an ASCII character | |
1257 | processed = HandleChar((WORD)wParam, lParam, TRUE); | |
1258 | break; | |
1259 | ||
1260 | case WM_HSCROLL: | |
1261 | case WM_VSCROLL: | |
1262 | { | |
1263 | WXWORD code, pos; | |
1264 | WXHWND hwnd; | |
1265 | UnpackScroll(wParam, lParam, &code, &pos, &hwnd); | |
1266 | ||
1267 | processed = MSWOnScroll(message == WM_HSCROLL ? wxHORIZONTAL | |
1268 | : wxVERTICAL, | |
1269 | code, pos, hwnd); | |
1270 | } | |
1271 | break; | |
1272 | ||
1273 | // CTLCOLOR messages are sent by children to query the parent for their | |
1274 | // colors | |
1275 | #ifdef __WIN32__ | |
1276 | case WM_CTLCOLORMSGBOX: | |
1277 | case WM_CTLCOLOREDIT: | |
1278 | case WM_CTLCOLORLISTBOX: | |
1279 | case WM_CTLCOLORBTN: | |
1280 | case WM_CTLCOLORDLG: | |
1281 | case WM_CTLCOLORSCROLLBAR: | |
1282 | case WM_CTLCOLORSTATIC: | |
1283 | #else // Win16 | |
1284 | case WM_CTLCOLOR: | |
1285 | #endif // Win32/16 | |
1286 | { | |
1287 | WXWORD nCtlColor; | |
1288 | WXHDC hdc; | |
1289 | WXHWND hwnd; | |
1290 | UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd); | |
1291 | ||
1292 | processed = HandleCtlColor(&rc.hBrush, | |
1293 | (WXHDC)hdc, | |
1294 | (WXHWND)hwnd, | |
1295 | nCtlColor, | |
1296 | message, | |
1297 | wParam, | |
1298 | lParam); | |
1299 | } | |
1300 | break; | |
1301 | ||
1302 | // the return value for this message is ignored | |
1303 | case WM_SYSCOLORCHANGE: | |
1304 | processed = HandleSysColorChange(); | |
1305 | break; | |
1306 | ||
1307 | case WM_PALETTECHANGED: | |
1308 | processed = HandlePaletteChanged((WXHWND) (HWND) wParam); | |
1309 | break; | |
1310 | ||
1311 | case WM_QUERYNEWPALETTE: | |
1312 | processed = HandleQueryNewPalette(); | |
1313 | break; | |
1314 | ||
1315 | case WM_ERASEBKGND: | |
1316 | processed = HandleEraseBkgnd((WXHDC)(HDC)wParam); | |
1317 | if ( processed ) | |
1318 | { | |
1319 | // we processed the message, i.e. erased the background | |
1320 | rc.result = TRUE; | |
1321 | } | |
1322 | break; | |
1323 | ||
1324 | case WM_DROPFILES: | |
1325 | processed = HandleDropFiles(wParam); | |
1326 | break; | |
1327 | ||
1328 | case WM_INITDIALOG: | |
1329 | processed = HandleInitDialog((WXHWND)(HWND)wParam); | |
1330 | ||
1331 | if ( processed ) | |
1332 | { | |
1333 | // we never set focus from here | |
1334 | rc.result = FALSE; | |
1335 | } | |
1336 | break; | |
1337 | ||
1338 | case WM_QUERYENDSESSION: | |
1339 | processed = HandleQueryEndSession(lParam, &rc.allow); | |
1340 | break; | |
1341 | ||
1342 | case WM_ENDSESSION: | |
1343 | processed = HandleEndSession(wParam != 0, lParam); | |
1344 | break; | |
1345 | ||
1346 | case WM_GETMINMAXINFO: | |
1347 | processed = HandleGetMinMaxInfo((MINMAXINFO*)lParam); | |
1348 | break; | |
1349 | ||
1350 | case WM_SETCURSOR: | |
1351 | processed = HandleSetCursor((WXHWND)(HWND)wParam, | |
1352 | LOWORD(lParam), // hit test | |
1353 | HIWORD(lParam)); // mouse msg | |
1354 | ||
1355 | if ( processed ) | |
1356 | { | |
1357 | // returning TRUE stops the DefWindowProc() from further | |
1358 | // processing this message - exactly what we need because we've | |
1359 | // just set the cursor. | |
1360 | rc.result = TRUE; | |
1361 | } | |
1362 | break; | |
1363 | } | |
1364 | ||
1365 | if ( !processed ) | |
1366 | { | |
1367 | #ifdef __WXDEBUG__ | |
1368 | wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."), | |
1369 | wxGetMessageName(message)); | |
1370 | #endif // __WXDEBUG__ | |
1371 | rc.result = MSWDefWindowProc(message, wParam, lParam); | |
1372 | } | |
1373 | */ | |
11e59d47 | 1374 | return (MRESULT)0; |
cdf1e714 DW |
1375 | } |
1376 | ||
1377 | // Dialog window proc | |
11e59d47 | 1378 | MRESULT wxDlgProc(HWND hWnd, UINT message, MPARAM wParam, MPARAM lParam) |
cdf1e714 DW |
1379 | { |
1380 | // TODO: | |
1381 | /* | |
1382 | if ( message == WM_INITDIALOG ) | |
1383 | { | |
1384 | // for this message, returning TRUE tells system to set focus to the | |
1385 | // first control in the dialog box | |
1386 | return TRUE; | |
1387 | } | |
1388 | else | |
1389 | { | |
1390 | // for all the other ones, FALSE means that we didn't process the | |
1391 | // message | |
1392 | return 0; | |
1393 | } | |
1394 | */ | |
1395 | return (MRESULT)0; | |
1396 | } | |
1397 | ||
cdf1e714 DW |
1398 | wxWindow *wxFindWinFromHandle(WXHWND hWnd) |
1399 | { | |
1400 | wxNode *node = wxWinHandleList->Find((long)hWnd); | |
1401 | if ( !node ) | |
1402 | return NULL; | |
1403 | return (wxWindow *)node->Data(); | |
1404 | } | |
1405 | ||
1406 | void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win) | |
1407 | { | |
1408 | // adding NULL hWnd is (first) surely a result of an error and | |
1409 | // (secondly) breaks menu command processing | |
1410 | wxCHECK_RET( hWnd != (HWND)NULL, | |
1411 | wxT("attempt to add a NULL hWnd to window list ignored") ); | |
1412 | ||
1413 | ||
1414 | wxWindow *oldWin = wxFindWinFromHandle((WXHWND) hWnd); | |
1415 | if ( oldWin && (oldWin != win) ) | |
1416 | { | |
1417 | wxString str(win->GetClassInfo()->GetClassName()); | |
1418 | wxLogError("Bug! Found existing HWND %X for new window of class %s", (int) hWnd, (const char*) str); | |
1419 | } | |
1420 | else if (!oldWin) | |
1421 | { | |
1422 | wxWinHandleList->Append((long)hWnd, win); | |
1423 | } | |
1424 | } | |
1425 | ||
1426 | void wxRemoveHandleAssociation(wxWindow *win) | |
1427 | { | |
1428 | wxWinHandleList->DeleteObject(win); | |
1429 | } | |
1430 | ||
1431 | // Default destroyer - override if you destroy it in some other way | |
1432 | // (e.g. with MDI child windows) | |
1433 | void wxWindow::OS2DestroyWindow() | |
1434 | { | |
1435 | } | |
1436 | ||
1437 | void wxWindow::OS2DetachWindowMenu() | |
1438 | { | |
1439 | if ( m_hMenu ) | |
1440 | { | |
1441 | HMENU hMenu = (HMENU)m_hMenu; | |
1442 | ||
1443 | int N = (int)WinSendMsg(hMenu, MM_QUERYITEMCOUNT, 0, 0); | |
1444 | int i; | |
1445 | for (i = 0; i < N; i++) | |
1446 | { | |
1447 | wxChar buf[100]; | |
1448 | int chars = (int)WinSendMsg(hMenu, MM_QUERYITEMTEXT, MPFROM2SHORT(i, N), buf); | |
1449 | if ( !chars ) | |
1450 | { | |
1451 | wxLogLastError(wxT("GetMenuString")); | |
1452 | ||
1453 | continue; | |
1454 | } | |
1455 | ||
1456 | if ( wxStrcmp(buf, wxT("&Window")) == 0 ) | |
1457 | { | |
1458 | WinSendMsg(hMenu, MM_DELETEITEM, MPFROM2SHORT(i, TRUE), 0); | |
1459 | break; | |
1460 | } | |
1461 | } | |
1462 | } | |
1463 | } | |
1464 | ||
1465 | bool wxWindow::OS2Create(int id, | |
1466 | wxWindow *parent, | |
1467 | const wxChar *wclass, | |
1468 | wxWindow *wx_win, | |
1469 | const wxChar *title, | |
1470 | int x, | |
1471 | int y, | |
1472 | int width, | |
1473 | int height, | |
1474 | WXDWORD style, | |
1475 | const wxChar *dialog_template, | |
1476 | WXDWORD extendedStyle) | |
1477 | { | |
1478 | // TODO: | |
1479 | /* | |
1480 | int x1 = CW_USEDEFAULT; | |
1481 | int y1 = 0; | |
1482 | int width1 = CW_USEDEFAULT; | |
1483 | int height1 = 100; | |
1484 | ||
1485 | // Find parent's size, if it exists, to set up a possible default | |
1486 | // panel size the size of the parent window | |
1487 | RECT parent_rect; | |
1488 | if ( parent ) | |
1489 | { | |
1490 | ::GetClientRect((HWND) parent->GetHWND(), &parent_rect); | |
1491 | ||
1492 | width1 = parent_rect.right - parent_rect.left; | |
1493 | height1 = parent_rect.bottom - parent_rect.top; | |
1494 | } | |
1495 | ||
1496 | if ( x > -1 ) x1 = x; | |
1497 | if ( y > -1 ) y1 = y; | |
1498 | if ( width > -1 ) width1 = width; | |
1499 | if ( height > -1 ) height1 = height; | |
1500 | ||
1501 | HWND hParent = (HWND)NULL; | |
1502 | if ( parent ) | |
1503 | hParent = (HWND) parent->GetHWND(); | |
1504 | ||
1505 | wxWndHook = this; | |
1506 | ||
1507 | if ( dialog_template ) | |
1508 | { | |
1509 | m_hWnd = (WXHWND)::CreateDialog(wxGetInstance(), | |
1510 | dialog_template, | |
1511 | hParent, | |
1512 | (DLGPROC)wxDlgProc); | |
1513 | ||
1514 | if ( m_hWnd == 0 ) | |
1515 | { | |
1516 | wxLogError(_("Can't find dummy dialog template!\n" | |
1517 | "Check resource include path for finding wx.rc.")); | |
1518 | ||
1519 | return FALSE; | |
1520 | } | |
1521 | ||
1522 | // ::SetWindowLong(GWL_EXSTYLE) doesn't work for the dialogs, so try | |
1523 | // to take care of (at least some) extended style flags ourselves | |
1524 | if ( extendedStyle & WS_EX_TOPMOST ) | |
1525 | { | |
1526 | if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0, | |
1527 | SWP_NOSIZE | SWP_NOMOVE) ) | |
1528 | { | |
1529 | wxLogLastError(wxT("SetWindowPos")); | |
1530 | } | |
1531 | } | |
1532 | ||
1533 | // move the dialog to its initial position without forcing repainting | |
1534 | if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) ) | |
1535 | { | |
1536 | wxLogLastError(wxT("MoveWindow")); | |
1537 | } | |
1538 | } | |
1539 | else | |
1540 | { | |
1541 | int controlId = 0; | |
1542 | if ( style & WS_CHILD ) | |
1543 | controlId = id; | |
1544 | ||
1545 | wxString className(wclass); | |
1546 | if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE ) | |
1547 | { | |
1548 | className += wxT("NR"); | |
1549 | } | |
1550 | ||
1551 | m_hWnd = (WXHWND)CreateWindowEx(extendedStyle, | |
1552 | className, | |
1553 | title ? title : wxT(""), | |
1554 | style, | |
1555 | x1, y1, | |
1556 | width1, height1, | |
1557 | hParent, (HMENU)controlId, | |
1558 | wxGetInstance(), | |
1559 | NULL); | |
1560 | ||
1561 | if ( !m_hWnd ) | |
1562 | { | |
1563 | wxLogError(_("Can't create window of class %s!\n" | |
1564 | "Possible Windows 3.x compatibility problem?"), | |
1565 | wclass); | |
1566 | ||
1567 | return FALSE; | |
1568 | } | |
1569 | } | |
1570 | ||
1571 | wxWndHook = NULL; | |
1572 | #ifdef __WXDEBUG__ | |
1573 | wxNode* node = wxWinHandleList->Member(this); | |
1574 | if (node) | |
1575 | { | |
1576 | HWND hWnd = (HWND) node->GetKeyInteger(); | |
1577 | if (hWnd != (HWND) m_hWnd) | |
1578 | { | |
1579 | wxLogError("A second HWND association is being added for the same window!"); | |
1580 | } | |
1581 | } | |
1582 | #endif | |
1583 | */ | |
1584 | wxAssociateWinWithHandle((HWND) m_hWnd, this); | |
1585 | ||
1586 | return TRUE; | |
1587 | } | |
1588 | ||
1589 | // =========================================================================== | |
1590 | // OS2 PM message handlers | |
1591 | // =========================================================================== | |
1592 | ||
1593 | // --------------------------------------------------------------------------- | |
1594 | // WM_NOTIFY | |
1595 | // --------------------------------------------------------------------------- | |
1596 | ||
1597 | bool wxWindow::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) | |
1598 | { | |
1599 | // TODO: | |
1600 | return FALSE; | |
1601 | } | |
1602 | ||
1603 | bool wxWindow::OS2OnNotify(int WXUNUSED(idCtrl), | |
1604 | WXLPARAM lParam, | |
1605 | WXLPARAM* WXUNUSED(result)) | |
1606 | { | |
1607 | // TODO: | |
1608 | return FALSE; | |
1609 | } | |
1610 | ||
1611 | // --------------------------------------------------------------------------- | |
1612 | // end session messages | |
1613 | // --------------------------------------------------------------------------- | |
1614 | ||
1615 | bool wxWindow::HandleQueryEndSession(long logOff, bool *mayEnd) | |
1616 | { | |
1617 | wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1); | |
1618 | event.SetEventObject(wxTheApp); | |
1619 | event.SetCanVeto(TRUE); | |
1620 | event.SetLoggingOff(logOff == ENDSESSION_LOGOFF); | |
1621 | ||
1622 | bool rc = wxTheApp->ProcessEvent(event); | |
1623 | ||
1624 | if ( rc ) | |
1625 | { | |
1626 | // we may end only if the app didn't veto session closing (double | |
1627 | // negation...) | |
1628 | *mayEnd = !event.GetVeto(); | |
1629 | } | |
1630 | ||
1631 | return rc; | |
1632 | } | |
1633 | ||
1634 | bool wxWindow::HandleEndSession(bool endSession, long logOff) | |
1635 | { | |
1636 | // do nothing if the session isn't ending | |
1637 | if ( !endSession ) | |
1638 | return FALSE; | |
1639 | ||
1640 | wxCloseEvent event(wxEVT_END_SESSION, -1); | |
1641 | event.SetEventObject(wxTheApp); | |
1642 | event.SetCanVeto(FALSE); | |
1643 | event.SetLoggingOff( (logOff == ENDSESSION_LOGOFF) ); | |
1644 | if ( (this == wxTheApp->GetTopWindow()) && // Only send once | |
1645 | wxTheApp->ProcessEvent(event)) | |
1646 | { | |
1647 | } | |
1648 | return TRUE; | |
1649 | } | |
1650 | ||
1651 | // --------------------------------------------------------------------------- | |
1652 | // window creation/destruction | |
1653 | // --------------------------------------------------------------------------- | |
1654 | ||
1655 | bool wxWindow::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) | |
1656 | { | |
1657 | // TODO: should generate this event from WM_NCCREATE | |
1658 | wxWindowCreateEvent event(this); | |
1659 | (void)GetEventHandler()->ProcessEvent(event); | |
1660 | ||
1661 | *mayCreate = TRUE; | |
1662 | ||
1663 | return TRUE; | |
1664 | } | |
1665 | ||
1666 | bool wxWindow::HandleDestroy() | |
1667 | { | |
1668 | wxWindowDestroyEvent event(this); | |
1669 | (void)GetEventHandler()->ProcessEvent(event); | |
1670 | ||
1671 | // delete our drop target if we've got one | |
1672 | #if wxUSE_DRAG_AND_DROP | |
1673 | if ( m_dropTarget != NULL ) | |
1674 | { | |
11e59d47 | 1675 | // m_dropTarget->Revoke(m_hWnd); |
cdf1e714 DW |
1676 | |
1677 | delete m_dropTarget; | |
1678 | m_dropTarget = NULL; | |
1679 | } | |
1680 | #endif // wxUSE_DRAG_AND_DROP | |
1681 | ||
1682 | // WM_DESTROY handled | |
1683 | return TRUE; | |
1684 | } | |
1685 | ||
1686 | // --------------------------------------------------------------------------- | |
1687 | // activation/focus | |
1688 | // --------------------------------------------------------------------------- | |
1689 | ||
1690 | bool wxWindow::HandleActivate(int state, | |
1691 | bool WXUNUSED(minimized), | |
1692 | WXHWND WXUNUSED(activate)) | |
1693 | { | |
11e59d47 DW |
1694 | // TODO: |
1695 | /* | |
cdf1e714 DW |
1696 | wxActivateEvent event(wxEVT_ACTIVATE, |
1697 | (state == WA_ACTIVE) || (state == WA_CLICKACTIVE), | |
1698 | m_windowId); | |
1699 | event.SetEventObject(this); | |
1700 | ||
1701 | return GetEventHandler()->ProcessEvent(event); | |
11e59d47 DW |
1702 | */ |
1703 | return FALSE; | |
cdf1e714 DW |
1704 | } |
1705 | ||
1706 | bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd)) | |
1707 | { | |
1708 | #if wxUSE_CARET | |
1709 | // Deal with caret | |
1710 | if ( m_caret ) | |
1711 | { | |
1712 | m_caret->OnSetFocus(); | |
1713 | } | |
1714 | #endif // wxUSE_CARET | |
1715 | ||
1716 | // panel wants to track the window which was the last to have focus in it | |
1717 | wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); | |
1718 | if ( panel ) | |
1719 | { | |
1720 | panel->SetLastFocus(this); | |
1721 | } | |
1722 | ||
1723 | wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId); | |
1724 | event.SetEventObject(this); | |
1725 | ||
1726 | return GetEventHandler()->ProcessEvent(event); | |
1727 | } | |
1728 | ||
1729 | bool wxWindow::HandleKillFocus(WXHWND WXUNUSED(hwnd)) | |
1730 | { | |
1731 | #if wxUSE_CARET | |
1732 | // Deal with caret | |
1733 | if ( m_caret ) | |
1734 | { | |
1735 | m_caret->OnKillFocus(); | |
1736 | } | |
1737 | #endif // wxUSE_CARET | |
1738 | ||
1739 | wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId); | |
1740 | event.SetEventObject(this); | |
1741 | ||
1742 | return GetEventHandler()->ProcessEvent(event); | |
1743 | } | |
1744 | ||
1745 | // --------------------------------------------------------------------------- | |
1746 | // miscellaneous | |
1747 | // --------------------------------------------------------------------------- | |
1748 | ||
1749 | bool wxWindow::HandleShow(bool show, int status) | |
1750 | { | |
1751 | wxShowEvent event(GetId(), show); | |
1752 | event.m_eventObject = this; | |
1753 | ||
1754 | return GetEventHandler()->ProcessEvent(event); | |
1755 | } | |
1756 | ||
1757 | bool wxWindow::HandleInitDialog(WXHWND WXUNUSED(hWndFocus)) | |
1758 | { | |
1759 | wxInitDialogEvent event(GetId()); | |
1760 | event.m_eventObject = this; | |
1761 | ||
1762 | return GetEventHandler()->ProcessEvent(event); | |
1763 | } | |
1764 | ||
1765 | bool wxWindow::HandleDropFiles(WXWPARAM wParam) | |
1766 | { | |
1767 | // TODO: | |
1768 | return FALSE; | |
1769 | } | |
1770 | ||
1771 | bool wxWindow::HandleSetCursor(WXHWND hWnd, | |
1772 | short nHitTest, | |
1773 | int WXUNUSED(mouseMsg)) | |
1774 | { | |
1775 | // don't set cursor for other windows, only for this one: this prevents | |
1776 | // children of this window from getting the same cursor as the parent has | |
1777 | // (don't forget that this message is propagated by default up the window | |
1778 | // parent-child hierarchy) | |
1779 | if ( GetHWND() == hWnd ) | |
1780 | { | |
1781 | // don't set cursor when the mouse is not in the client part | |
11e59d47 DW |
1782 | // TODO |
1783 | /* | |
cdf1e714 DW |
1784 | if ( nHitTest == HTCLIENT || nHitTest == HTERROR ) |
1785 | { | |
1786 | HCURSOR hcursor = 0; | |
1787 | if ( wxIsBusy() ) | |
1788 | { | |
1789 | // from msw\utils.cpp | |
1790 | extern HCURSOR gs_wxBusyCursor; | |
1791 | ||
1792 | hcursor = gs_wxBusyCursor; | |
1793 | } | |
1794 | else | |
1795 | { | |
1796 | wxCursor *cursor = NULL; | |
1797 | ||
1798 | if ( m_cursor.Ok() ) | |
1799 | { | |
1800 | cursor = &m_cursor; | |
1801 | } | |
1802 | else | |
1803 | { | |
1804 | // from msw\data.cpp | |
1805 | extern wxCursor *g_globalCursor; | |
1806 | ||
1807 | if ( g_globalCursor && g_globalCursor->Ok() ) | |
1808 | cursor = g_globalCursor; | |
1809 | } | |
1810 | ||
1811 | if ( cursor ) | |
1812 | hcursor = (HCURSOR)cursor->GetHCURSOR(); | |
1813 | } | |
1814 | ||
1815 | if ( hcursor ) | |
1816 | { | |
1817 | // ::SetCursor(hcursor); | |
1818 | ||
1819 | return TRUE; | |
1820 | } | |
1821 | } | |
11e59d47 | 1822 | */ |
cdf1e714 DW |
1823 | } |
1824 | ||
1825 | return FALSE; | |
1826 | } | |
1827 | ||
1828 | // --------------------------------------------------------------------------- | |
1829 | // owner drawn stuff | |
1830 | // --------------------------------------------------------------------------- | |
1831 | ||
11e59d47 | 1832 | bool wxWindow::OS2OnDrawItem(int id, WXDRAWITEMSTRUCT *itemStruct) |
cdf1e714 DW |
1833 | { |
1834 | // TODO: | |
1835 | /* | |
1836 | #if wxUSE_OWNER_DRAWN | |
1837 | // is it a menu item? | |
1838 | if ( id == 0 ) | |
1839 | { | |
1840 | DRAWITEMSTRUCT *pDrawStruct = (DRAWITEMSTRUCT *)itemStruct; | |
1841 | wxMenuItem *pMenuItem = (wxMenuItem *)(pDrawStruct->itemData); | |
1842 | ||
1843 | wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE ); | |
1844 | ||
1845 | // prepare to call OnDrawItem() | |
1846 | wxDC dc; | |
1847 | dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE); | |
1848 | wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top, | |
1849 | pDrawStruct->rcItem.right - pDrawStruct->rcItem.left, | |
1850 | pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top); | |
1851 | ||
1852 | return pMenuItem->OnDrawItem | |
1853 | ( | |
1854 | dc, rect, | |
1855 | (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction, | |
1856 | (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState | |
1857 | ); | |
1858 | } | |
1859 | ||
1860 | wxWindow *item = FindItem(id); | |
1861 | if ( item && item->IsKindOf(CLASSINFO(wxControl)) ) | |
1862 | { | |
1863 | return ((wxControl *)item)->MSWOnDraw(itemStruct); | |
1864 | } | |
1865 | else | |
1866 | #endif | |
1867 | return FALSE; | |
1868 | */ | |
1869 | return FALSE; | |
1870 | } | |
1871 | ||
1872 | bool wxWindow::OS2OnMeasureItem(int id, WXMEASUREITEMSTRUCT *itemStruct) | |
0e320a79 | 1873 | { |
cdf1e714 DW |
1874 | // TODO: |
1875 | /* | |
1876 | #if wxUSE_OWNER_DRAWN | |
1877 | // is it a menu item? | |
1878 | if ( id == 0 ) | |
1879 | { | |
1880 | MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct; | |
1881 | wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData); | |
1882 | ||
1883 | wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE ); | |
1884 | ||
1885 | return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth, | |
1886 | &pMeasureStruct->itemHeight); | |
1887 | } | |
1888 | ||
1889 | wxWindow *item = FindItem(id); | |
1890 | if ( item && item->IsKindOf(CLASSINFO(wxControl)) ) | |
1891 | { | |
1892 | return ((wxControl *)item)->MSWOnMeasure(itemStruct); | |
1893 | } | |
1894 | #endif // owner-drawn menus | |
1895 | */ | |
1896 | return FALSE; | |
0e320a79 DW |
1897 | } |
1898 | ||
cdf1e714 DW |
1899 | // --------------------------------------------------------------------------- |
1900 | // colours and palettes | |
1901 | // --------------------------------------------------------------------------- | |
849949b1 | 1902 | |
cdf1e714 | 1903 | bool wxWindow::HandleSysColorChange() |
0e320a79 | 1904 | { |
cdf1e714 DW |
1905 | wxSysColourChangedEvent event; |
1906 | event.SetEventObject(this); | |
1907 | ||
1908 | return GetEventHandler()->ProcessEvent(event); | |
0e320a79 DW |
1909 | } |
1910 | ||
cdf1e714 DW |
1911 | bool wxWindow::HandleCtlColor(WXHBRUSH *brush, |
1912 | WXHDC pDC, | |
1913 | WXHWND pWnd, | |
1914 | WXUINT nCtlColor, | |
1915 | WXUINT message, | |
1916 | WXWPARAM wParam, | |
1917 | WXLPARAM lParam) | |
0e320a79 | 1918 | { |
cdf1e714 | 1919 | WXHBRUSH hBrush = 0; |
11e59d47 DW |
1920 | // TODO: |
1921 | /* | |
cdf1e714 DW |
1922 | if ( nCtlColor == CTLCOLOR_DLG ) |
1923 | { | |
1924 | hBrush = OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam); | |
1925 | } | |
1926 | else | |
1927 | { | |
1928 | wxControl *item = (wxControl *)FindItemByHWND(pWnd, TRUE); | |
1929 | if ( item ) | |
1930 | hBrush = item->OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam); | |
1931 | } | |
1932 | ||
1933 | if ( hBrush ) | |
1934 | *brush = hBrush; | |
1935 | ||
1936 | return hBrush != 0; | |
11e59d47 DW |
1937 | */ |
1938 | return FALSE; | |
0e320a79 DW |
1939 | } |
1940 | ||
cdf1e714 DW |
1941 | // Define for each class of dialog and control |
1942 | WXHBRUSH wxWindow::OnCtlColor(WXHDC hDC, | |
1943 | WXHWND hWnd, | |
1944 | WXUINT nCtlColor, | |
1945 | WXUINT message, | |
1946 | WXWPARAM wParam, | |
1947 | WXLPARAM lParam) | |
0e320a79 | 1948 | { |
cdf1e714 | 1949 | return (WXHBRUSH)0; |
0e320a79 DW |
1950 | } |
1951 | ||
cdf1e714 | 1952 | bool wxWindow::HandlePaletteChanged(WXHWND hWndPalChange) |
0e320a79 | 1953 | { |
cdf1e714 DW |
1954 | wxPaletteChangedEvent event(GetId()); |
1955 | event.SetEventObject(this); | |
1956 | event.SetChangedWindow(wxFindWinFromHandle(hWndPalChange)); | |
1957 | ||
1958 | return GetEventHandler()->ProcessEvent(event); | |
0e320a79 DW |
1959 | } |
1960 | ||
cdf1e714 | 1961 | bool wxWindow::HandleQueryNewPalette() |
0e320a79 | 1962 | { |
cdf1e714 DW |
1963 | wxQueryNewPaletteEvent event(GetId()); |
1964 | event.SetEventObject(this); | |
1965 | ||
1966 | return GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized(); | |
0e320a79 DW |
1967 | } |
1968 | ||
cdf1e714 DW |
1969 | // Responds to colour changes: passes event on to children. |
1970 | void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event) | |
0e320a79 | 1971 | { |
cdf1e714 DW |
1972 | wxNode *node = GetChildren().First(); |
1973 | while ( node ) | |
1974 | { | |
1975 | // Only propagate to non-top-level windows | |
1976 | wxWindow *win = (wxWindow *)node->Data(); | |
1977 | if ( win->GetParent() ) | |
1978 | { | |
1979 | wxSysColourChangedEvent event2; | |
1980 | event.m_eventObject = win; | |
1981 | win->GetEventHandler()->ProcessEvent(event2); | |
1982 | } | |
1983 | ||
1984 | node = node->Next(); | |
1985 | } | |
0e320a79 DW |
1986 | } |
1987 | ||
cdf1e714 DW |
1988 | // --------------------------------------------------------------------------- |
1989 | // painting | |
1990 | // --------------------------------------------------------------------------- | |
1991 | ||
1992 | bool wxWindow::HandlePaint() | |
0e320a79 | 1993 | { |
cdf1e714 | 1994 | // TODO: |
11e59d47 | 1995 | return FALSE; |
0e320a79 DW |
1996 | } |
1997 | ||
cdf1e714 | 1998 | bool wxWindow::HandleEraseBkgnd(WXHDC hdc) |
0e320a79 | 1999 | { |
cdf1e714 | 2000 | // Prevents flicker when dragging |
11e59d47 DW |
2001 | // if ( ::IsIconic(GetHwnd()) ) |
2002 | // return TRUE; | |
cdf1e714 DW |
2003 | |
2004 | wxDC dc; | |
2005 | ||
2006 | dc.SetHDC(hdc); | |
2007 | dc.SetWindow(this); | |
2008 | dc.BeginDrawing(); | |
2009 | ||
2010 | wxEraseEvent event(m_windowId, &dc); | |
2011 | event.SetEventObject(this); | |
2012 | bool rc = GetEventHandler()->ProcessEvent(event); | |
2013 | ||
2014 | dc.EndDrawing(); | |
2015 | dc.SelectOldObjects(hdc); | |
2016 | dc.SetHDC((WXHDC) NULL); | |
2017 | ||
2018 | return rc; | |
0e320a79 DW |
2019 | } |
2020 | ||
cdf1e714 | 2021 | void wxWindow::OnEraseBackground(wxEraseEvent& event) |
0e320a79 | 2022 | { |
849949b1 | 2023 | // TODO: |
0e320a79 DW |
2024 | } |
2025 | ||
cdf1e714 DW |
2026 | // --------------------------------------------------------------------------- |
2027 | // moving and resizing | |
2028 | // --------------------------------------------------------------------------- | |
0e320a79 | 2029 | |
cdf1e714 | 2030 | bool wxWindow::HandleMinimize() |
0e320a79 | 2031 | { |
cdf1e714 DW |
2032 | wxIconizeEvent event(m_windowId); |
2033 | event.SetEventObject(this); | |
2034 | ||
2035 | return GetEventHandler()->ProcessEvent(event); | |
0e320a79 DW |
2036 | } |
2037 | ||
cdf1e714 | 2038 | bool wxWindow::HandleMaximize() |
0e320a79 | 2039 | { |
cdf1e714 DW |
2040 | wxMaximizeEvent event(m_windowId); |
2041 | event.SetEventObject(this); | |
2042 | ||
2043 | return GetEventHandler()->ProcessEvent(event); | |
0e320a79 DW |
2044 | } |
2045 | ||
cdf1e714 | 2046 | bool wxWindow::HandleMove(int x, int y) |
0e320a79 | 2047 | { |
cdf1e714 DW |
2048 | wxMoveEvent event(wxPoint(x, y), m_windowId); |
2049 | event.SetEventObject(this); | |
2050 | ||
2051 | return GetEventHandler()->ProcessEvent(event); | |
0e320a79 DW |
2052 | } |
2053 | ||
cdf1e714 | 2054 | bool wxWindow::HandleSize(int w, int h, WXUINT WXUNUSED(flag)) |
0e320a79 | 2055 | { |
cdf1e714 DW |
2056 | wxSizeEvent event(wxSize(w, h), m_windowId); |
2057 | event.SetEventObject(this); | |
2058 | ||
2059 | return GetEventHandler()->ProcessEvent(event); | |
0e320a79 DW |
2060 | } |
2061 | ||
cdf1e714 | 2062 | bool wxWindow::HandleGetMinMaxInfo(void *mmInfo) |
0e320a79 | 2063 | { |
11e59d47 DW |
2064 | // TODO: |
2065 | /* | |
cdf1e714 DW |
2066 | MINMAXINFO *info = (MINMAXINFO *)mmInfo; |
2067 | ||
2068 | bool rc = FALSE; | |
2069 | ||
2070 | if ( m_minWidth != -1 ) | |
2071 | { | |
2072 | info->ptMinTrackSize.x = m_minWidth; | |
2073 | rc = TRUE; | |
2074 | } | |
2075 | ||
2076 | if ( m_minHeight != -1 ) | |
2077 | { | |
2078 | info->ptMinTrackSize.y = m_minHeight; | |
2079 | rc = TRUE; | |
2080 | } | |
2081 | ||
2082 | if ( m_maxWidth != -1 ) | |
2083 | { | |
2084 | info->ptMaxTrackSize.x = m_maxWidth; | |
2085 | rc = TRUE; | |
2086 | } | |
2087 | ||
2088 | if ( m_maxHeight != -1 ) | |
2089 | { | |
2090 | info->ptMaxTrackSize.y = m_maxHeight; | |
2091 | rc = TRUE; | |
2092 | } | |
2093 | ||
2094 | return rc; | |
11e59d47 DW |
2095 | */ |
2096 | return FALSE; | |
0e320a79 DW |
2097 | } |
2098 | ||
cdf1e714 DW |
2099 | // --------------------------------------------------------------------------- |
2100 | // command messages | |
2101 | // --------------------------------------------------------------------------- | |
2102 | ||
2103 | bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) | |
0e320a79 | 2104 | { |
cdf1e714 | 2105 | if ( wxCurrentPopupMenu ) |
0e320a79 | 2106 | { |
cdf1e714 DW |
2107 | wxMenu *popupMenu = wxCurrentPopupMenu; |
2108 | wxCurrentPopupMenu = NULL; | |
0e320a79 | 2109 | |
11e59d47 | 2110 | return popupMenu->OS2Command(cmd, id); |
cdf1e714 | 2111 | } |
0e320a79 | 2112 | |
cdf1e714 DW |
2113 | wxWindow *win = FindItem(id); |
2114 | if ( !win ) | |
2115 | { | |
2116 | win = wxFindWinFromHandle(control); | |
0e320a79 | 2117 | } |
cdf1e714 DW |
2118 | |
2119 | if ( win ) | |
11e59d47 | 2120 | return win->OS2Command(cmd, id); |
cdf1e714 DW |
2121 | |
2122 | return FALSE; | |
0e320a79 | 2123 | } |
de44a9f0 | 2124 | |
cdf1e714 | 2125 | bool wxWindow::HandleSysCommand(WXWPARAM wParam, WXLPARAM lParam) |
0e320a79 | 2126 | { |
cdf1e714 DW |
2127 | // TODO: |
2128 | return FALSE; | |
2129 | } | |
2130 | ||
2131 | // --------------------------------------------------------------------------- | |
2132 | // mouse events | |
2133 | // --------------------------------------------------------------------------- | |
2134 | ||
2135 | void wxWindow::InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags) | |
2136 | { | |
11e59d47 DW |
2137 | // TODO: |
2138 | /* | |
cdf1e714 DW |
2139 | event.m_x = x; |
2140 | event.m_y = y; | |
2141 | event.m_shiftDown = ((flags & MK_SHIFT) != 0); | |
2142 | event.m_controlDown = ((flags & MK_CONTROL) != 0); | |
2143 | event.m_leftDown = ((flags & MK_LBUTTON) != 0); | |
2144 | event.m_middleDown = ((flags & MK_MBUTTON) != 0); | |
2145 | event.m_rightDown = ((flags & MK_RBUTTON) != 0); | |
2146 | event.SetTimestamp(s_currentMsg.time); | |
2147 | event.m_eventObject = this; | |
2148 | ||
2149 | #if wxUSE_MOUSEEVENT_HACK | |
2150 | m_lastMouseX = x; | |
2151 | m_lastMouseY = y; | |
2152 | m_lastMouseEvent = event.GetEventType(); | |
2153 | #endif // wxUSE_MOUSEEVENT_HACK | |
11e59d47 | 2154 | */ |
0e320a79 DW |
2155 | } |
2156 | ||
cdf1e714 | 2157 | bool wxWindow::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags) |
0e320a79 | 2158 | { |
cdf1e714 DW |
2159 | // the mouse events take consecutive IDs from WM_MOUSEFIRST to |
2160 | // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST | |
2161 | // from the message id and take the value in the table to get wxWin event | |
2162 | // id | |
2163 | static const wxEventType eventsMouse[] = | |
2164 | { | |
2165 | wxEVT_MOTION, | |
2166 | wxEVT_LEFT_DOWN, | |
2167 | wxEVT_LEFT_UP, | |
2168 | wxEVT_LEFT_DCLICK, | |
2169 | wxEVT_RIGHT_DOWN, | |
2170 | wxEVT_RIGHT_UP, | |
2171 | wxEVT_RIGHT_DCLICK, | |
2172 | wxEVT_MIDDLE_DOWN, | |
2173 | wxEVT_MIDDLE_UP, | |
2174 | wxEVT_MIDDLE_DCLICK | |
2175 | }; | |
2176 | ||
2177 | wxMouseEvent event(eventsMouse[msg - WM_MOUSEMOVE]); | |
2178 | InitMouseEvent(event, x, y, flags); | |
2179 | ||
2180 | return GetEventHandler()->ProcessEvent(event); | |
0e320a79 DW |
2181 | } |
2182 | ||
cdf1e714 | 2183 | bool wxWindow::HandleMouseMove(int x, int y, WXUINT flags) |
0e320a79 | 2184 | { |
776d87d5 | 2185 | if ( !m_bMouseInWindow ) |
cdf1e714 DW |
2186 | { |
2187 | // Generate an ENTER event | |
776d87d5 | 2188 | m_bMouseInWindow = TRUE; |
cdf1e714 DW |
2189 | |
2190 | wxMouseEvent event(wxEVT_ENTER_WINDOW); | |
2191 | InitMouseEvent(event, x, y, flags); | |
2192 | ||
2193 | (void)GetEventHandler()->ProcessEvent(event); | |
2194 | } | |
2195 | ||
2196 | #if wxUSE_MOUSEEVENT_HACK | |
2197 | // Window gets a click down message followed by a mouse move message even | |
2198 | // if position isn't changed! We want to discard the trailing move event | |
2199 | // if x and y are the same. | |
2200 | if ( (m_lastMouseEvent == wxEVT_RIGHT_DOWN || | |
2201 | m_lastMouseEvent == wxEVT_LEFT_DOWN || | |
2202 | m_lastMouseEvent == wxEVT_MIDDLE_DOWN) && | |
2203 | (m_lastMouseX == event.m_x && m_lastMouseY == event.m_y) ) | |
2204 | { | |
2205 | m_lastMouseEvent = wxEVT_MOTION; | |
2206 | ||
2207 | return FALSE; | |
2208 | } | |
2209 | #endif // wxUSE_MOUSEEVENT_HACK | |
2210 | ||
2211 | return HandleMouseEvent(WM_MOUSEMOVE, x, y, flags); | |
0e320a79 DW |
2212 | } |
2213 | ||
cdf1e714 DW |
2214 | // --------------------------------------------------------------------------- |
2215 | // keyboard handling | |
2216 | // --------------------------------------------------------------------------- | |
2217 | ||
2218 | // isASCII is TRUE only when we're called from WM_CHAR handler and not from | |
2219 | // WM_KEYDOWN one | |
2220 | bool wxWindow::HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII) | |
86de7616 | 2221 | { |
cdf1e714 DW |
2222 | // TODO: |
2223 | return FALSE; | |
2224 | } | |
86de7616 | 2225 | |
cdf1e714 DW |
2226 | bool wxWindow::HandleKeyDown(WXWORD wParam, WXLPARAM lParam) |
2227 | { | |
2228 | // TODO: | |
2229 | return FALSE; | |
86de7616 DW |
2230 | } |
2231 | ||
cdf1e714 | 2232 | bool wxWindow::HandleKeyUp(WXWORD wParam, WXLPARAM lParam) |
86de7616 | 2233 | { |
cdf1e714 DW |
2234 | // TODO: |
2235 | return FALSE; | |
2236 | } | |
86de7616 | 2237 | |
cdf1e714 DW |
2238 | // --------------------------------------------------------------------------- |
2239 | // joystick | |
2240 | // --------------------------------------------------------------------------- | |
86de7616 | 2241 | |
cdf1e714 DW |
2242 | bool wxWindow::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags) |
2243 | { | |
2244 | // TODO: | |
2245 | return FALSE; | |
2246 | } | |
2247 | ||
2248 | // --------------------------------------------------------------------------- | |
2249 | // scrolling | |
2250 | // --------------------------------------------------------------------------- | |
2251 | ||
2252 | bool wxWindow::OS2OnScroll(int orientation, WXWORD wParam, | |
2253 | WXWORD pos, WXHWND control) | |
2254 | { | |
2255 | if ( control ) | |
86de7616 | 2256 | { |
cdf1e714 DW |
2257 | wxWindow *child = wxFindWinFromHandle(control); |
2258 | if ( child ) | |
11e59d47 | 2259 | return child->OS2OnScroll(orientation, wParam, pos, control); |
cdf1e714 | 2260 | } |
86de7616 | 2261 | |
cdf1e714 DW |
2262 | wxScrollWinEvent event; |
2263 | event.SetPosition(pos); | |
2264 | event.SetOrientation(orientation); | |
2265 | event.m_eventObject = this; | |
2266 | // TODO: | |
2267 | return FALSE; | |
2268 | } | |
86de7616 | 2269 | |
cdf1e714 DW |
2270 | // =========================================================================== |
2271 | // global functions | |
2272 | // =========================================================================== | |
2273 | ||
2274 | void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font) | |
2275 | { | |
2276 | // TODO: | |
2277 | } | |
2278 | ||
2279 | // Returns 0 if was a normal ASCII value, not a special key. This indicates that | |
2280 | // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead. | |
2281 | int wxCharCodeOS2ToWX(int keySym) | |
2282 | { | |
2283 | int id = 0; | |
2284 | // TODO: | |
2285 | /* | |
2286 | switch (keySym) | |
2287 | { | |
2288 | case VK_CANCEL: id = WXK_CANCEL; break; | |
2289 | case VK_BACK: id = WXK_BACK; break; | |
2290 | case VK_TAB: id = WXK_TAB; break; | |
2291 | case VK_CLEAR: id = WXK_CLEAR; break; | |
2292 | case VK_RETURN: id = WXK_RETURN; break; | |
2293 | case VK_SHIFT: id = WXK_SHIFT; break; | |
2294 | case VK_CONTROL: id = WXK_CONTROL; break; | |
2295 | case VK_MENU : id = WXK_MENU; break; | |
2296 | case VK_PAUSE: id = WXK_PAUSE; break; | |
2297 | case VK_SPACE: id = WXK_SPACE; break; | |
2298 | case VK_ESCAPE: id = WXK_ESCAPE; break; | |
2299 | case VK_PRIOR: id = WXK_PRIOR; break; | |
2300 | case VK_NEXT : id = WXK_NEXT; break; | |
2301 | case VK_END: id = WXK_END; break; | |
2302 | case VK_HOME : id = WXK_HOME; break; | |
2303 | case VK_LEFT : id = WXK_LEFT; break; | |
2304 | case VK_UP: id = WXK_UP; break; | |
2305 | case VK_RIGHT: id = WXK_RIGHT; break; | |
2306 | case VK_DOWN : id = WXK_DOWN; break; | |
2307 | case VK_SELECT: id = WXK_SELECT; break; | |
2308 | case VK_PRINT: id = WXK_PRINT; break; | |
2309 | case VK_EXECUTE: id = WXK_EXECUTE; break; | |
2310 | case VK_INSERT: id = WXK_INSERT; break; | |
2311 | case VK_DELETE: id = WXK_DELETE; break; | |
2312 | case VK_HELP : id = WXK_HELP; break; | |
2313 | case VK_NUMPAD0: id = WXK_NUMPAD0; break; | |
2314 | case VK_NUMPAD1: id = WXK_NUMPAD1; break; | |
2315 | case VK_NUMPAD2: id = WXK_NUMPAD2; break; | |
2316 | case VK_NUMPAD3: id = WXK_NUMPAD3; break; | |
2317 | case VK_NUMPAD4: id = WXK_NUMPAD4; break; | |
2318 | case VK_NUMPAD5: id = WXK_NUMPAD5; break; | |
2319 | case VK_NUMPAD6: id = WXK_NUMPAD6; break; | |
2320 | case VK_NUMPAD7: id = WXK_NUMPAD7; break; | |
2321 | case VK_NUMPAD8: id = WXK_NUMPAD8; break; | |
2322 | case VK_NUMPAD9: id = WXK_NUMPAD9; break; | |
2323 | case VK_MULTIPLY: id = WXK_MULTIPLY; break; | |
2324 | case VK_ADD: id = WXK_ADD; break; | |
2325 | case VK_SUBTRACT: id = WXK_SUBTRACT; break; | |
2326 | case VK_DECIMAL: id = WXK_DECIMAL; break; | |
2327 | case VK_DIVIDE: id = WXK_DIVIDE; break; | |
2328 | case VK_F1: id = WXK_F1; break; | |
2329 | case VK_F2: id = WXK_F2; break; | |
2330 | case VK_F3: id = WXK_F3; break; | |
2331 | case VK_F4: id = WXK_F4; break; | |
2332 | case VK_F5: id = WXK_F5; break; | |
2333 | case VK_F6: id = WXK_F6; break; | |
2334 | case VK_F7: id = WXK_F7; break; | |
2335 | case VK_F8: id = WXK_F8; break; | |
2336 | case VK_F9: id = WXK_F9; break; | |
2337 | case VK_F10: id = WXK_F10; break; | |
2338 | case VK_F11: id = WXK_F11; break; | |
2339 | case VK_F12: id = WXK_F12; break; | |
2340 | case VK_F13: id = WXK_F13; break; | |
2341 | case VK_F14: id = WXK_F14; break; | |
2342 | case VK_F15: id = WXK_F15; break; | |
2343 | case VK_F16: id = WXK_F16; break; | |
2344 | case VK_F17: id = WXK_F17; break; | |
2345 | case VK_F18: id = WXK_F18; break; | |
2346 | case VK_F19: id = WXK_F19; break; | |
2347 | case VK_F20: id = WXK_F20; break; | |
2348 | case VK_F21: id = WXK_F21; break; | |
2349 | case VK_F22: id = WXK_F22; break; | |
2350 | case VK_F23: id = WXK_F23; break; | |
2351 | case VK_F24: id = WXK_F24; break; | |
2352 | case VK_NUMLOCK: id = WXK_NUMLOCK; break; | |
2353 | case VK_SCROLL: id = WXK_SCROLL; break; | |
2354 | default: | |
86de7616 | 2355 | { |
cdf1e714 | 2356 | return 0; |
86de7616 DW |
2357 | } |
2358 | } | |
2359 | */ | |
cdf1e714 | 2360 | return id; |
86de7616 DW |
2361 | } |
2362 | ||
cdf1e714 | 2363 | int wxCharCodeWXToOS2(int id, bool *isVirtual) |
86de7616 | 2364 | { |
cdf1e714 DW |
2365 | *isVirtual = TRUE; |
2366 | int keySym = 0; | |
2367 | // TODO | |
2368 | /* | |
2369 | switch (id) | |
86de7616 | 2370 | { |
cdf1e714 DW |
2371 | case WXK_CANCEL: keySym = VK_CANCEL; break; |
2372 | case WXK_CLEAR: keySym = VK_CLEAR; break; | |
2373 | case WXK_SHIFT: keySym = VK_SHIFT; break; | |
2374 | case WXK_CONTROL: keySym = VK_CONTROL; break; | |
2375 | case WXK_MENU : keySym = VK_MENU; break; | |
2376 | case WXK_PAUSE: keySym = VK_PAUSE; break; | |
2377 | case WXK_PRIOR: keySym = VK_PRIOR; break; | |
2378 | case WXK_NEXT : keySym = VK_NEXT; break; | |
2379 | case WXK_END: keySym = VK_END; break; | |
2380 | case WXK_HOME : keySym = VK_HOME; break; | |
2381 | case WXK_LEFT : keySym = VK_LEFT; break; | |
2382 | case WXK_UP: keySym = VK_UP; break; | |
2383 | case WXK_RIGHT: keySym = VK_RIGHT; break; | |
2384 | case WXK_DOWN : keySym = VK_DOWN; break; | |
2385 | case WXK_SELECT: keySym = VK_SELECT; break; | |
2386 | case WXK_PRINT: keySym = VK_PRINT; break; | |
2387 | case WXK_EXECUTE: keySym = VK_EXECUTE; break; | |
2388 | case WXK_INSERT: keySym = VK_INSERT; break; | |
2389 | case WXK_DELETE: keySym = VK_DELETE; break; | |
2390 | case WXK_HELP : keySym = VK_HELP; break; | |
2391 | case WXK_NUMPAD0: keySym = VK_NUMPAD0; break; | |
2392 | case WXK_NUMPAD1: keySym = VK_NUMPAD1; break; | |
2393 | case WXK_NUMPAD2: keySym = VK_NUMPAD2; break; | |
2394 | case WXK_NUMPAD3: keySym = VK_NUMPAD3; break; | |
2395 | case WXK_NUMPAD4: keySym = VK_NUMPAD4; break; | |
2396 | case WXK_NUMPAD5: keySym = VK_NUMPAD5; break; | |
2397 | case WXK_NUMPAD6: keySym = VK_NUMPAD6; break; | |
2398 | case WXK_NUMPAD7: keySym = VK_NUMPAD7; break; | |
2399 | case WXK_NUMPAD8: keySym = VK_NUMPAD8; break; | |
2400 | case WXK_NUMPAD9: keySym = VK_NUMPAD9; break; | |
2401 | case WXK_MULTIPLY: keySym = VK_MULTIPLY; break; | |
2402 | case WXK_ADD: keySym = VK_ADD; break; | |
2403 | case WXK_SUBTRACT: keySym = VK_SUBTRACT; break; | |
2404 | case WXK_DECIMAL: keySym = VK_DECIMAL; break; | |
2405 | case WXK_DIVIDE: keySym = VK_DIVIDE; break; | |
2406 | case WXK_F1: keySym = VK_F1; break; | |
2407 | case WXK_F2: keySym = VK_F2; break; | |
2408 | case WXK_F3: keySym = VK_F3; break; | |
2409 | case WXK_F4: keySym = VK_F4; break; | |
2410 | case WXK_F5: keySym = VK_F5; break; | |
2411 | case WXK_F6: keySym = VK_F6; break; | |
2412 | case WXK_F7: keySym = VK_F7; break; | |
2413 | case WXK_F8: keySym = VK_F8; break; | |
2414 | case WXK_F9: keySym = VK_F9; break; | |
2415 | case WXK_F10: keySym = VK_F10; break; | |
2416 | case WXK_F11: keySym = VK_F11; break; | |
2417 | case WXK_F12: keySym = VK_F12; break; | |
2418 | case WXK_F13: keySym = VK_F13; break; | |
2419 | case WXK_F14: keySym = VK_F14; break; | |
2420 | case WXK_F15: keySym = VK_F15; break; | |
2421 | case WXK_F16: keySym = VK_F16; break; | |
2422 | case WXK_F17: keySym = VK_F17; break; | |
2423 | case WXK_F18: keySym = VK_F18; break; | |
2424 | case WXK_F19: keySym = VK_F19; break; | |
2425 | case WXK_F20: keySym = VK_F20; break; | |
2426 | case WXK_F21: keySym = VK_F21; break; | |
2427 | case WXK_F22: keySym = VK_F22; break; | |
2428 | case WXK_F23: keySym = VK_F23; break; | |
2429 | case WXK_F24: keySym = VK_F24; break; | |
2430 | case WXK_NUMLOCK: keySym = VK_NUMLOCK; break; | |
2431 | case WXK_SCROLL: keySym = VK_SCROLL; break; | |
2432 | default: | |
2433 | { | |
2434 | *isVirtual = FALSE; | |
2435 | keySym = id; | |
2436 | break; | |
2437 | } | |
86de7616 | 2438 | } |
cdf1e714 DW |
2439 | */ |
2440 | return keySym; | |
2441 | } | |
86de7616 | 2442 | |
cdf1e714 DW |
2443 | wxWindow *wxGetActiveWindow() |
2444 | { | |
2445 | // TODO | |
2446 | return NULL; | |
2447 | } | |
86de7616 | 2448 | |
cdf1e714 DW |
2449 | // Windows keyboard hook. Allows interception of e.g. F1, ESCAPE |
2450 | // in active frames and dialogs, regardless of where the focus is. | |
11e59d47 DW |
2451 | //static HHOOK wxTheKeyboardHook = 0; |
2452 | //static FARPROC wxTheKeyboardHookProc = 0; | |
cdf1e714 | 2453 | int wxKeyboardHook(int nCode, WORD wParam, DWORD lParam); |
86de7616 | 2454 | |
cdf1e714 DW |
2455 | void wxSetKeyboardHook(bool doIt) |
2456 | { | |
2457 | // TODO: | |
2458 | } | |
86de7616 | 2459 | |
cdf1e714 DW |
2460 | int wxKeyboardHook(int nCode, WORD wParam, DWORD lParam) |
2461 | { | |
2462 | // TODO: | |
86de7616 | 2463 | |
cdf1e714 DW |
2464 | return 0; |
2465 | } | |
2466 | ||
2467 | #ifdef __WXDEBUG__ | |
2468 | const char *wxGetMessageName(int message) | |
2469 | { | |
2470 | // TODO | |
2471 | /* | |
2472 | switch ( message ) | |
86de7616 | 2473 | { |
cdf1e714 DW |
2474 | case 0x0000: return "WM_NULL"; |
2475 | case 0x0001: return "WM_CREATE"; | |
2476 | case 0x0002: return "WM_DESTROY"; | |
2477 | case 0x0003: return "WM_MOVE"; | |
2478 | case 0x0005: return "WM_SIZE"; | |
2479 | case 0x0006: return "WM_ACTIVATE"; | |
2480 | case 0x0007: return "WM_SETFOCUS"; | |
2481 | case 0x0008: return "WM_KILLFOCUS"; | |
2482 | case 0x000A: return "WM_ENABLE"; | |
2483 | case 0x000B: return "WM_SETREDRAW"; | |
2484 | case 0x000C: return "WM_SETTEXT"; | |
2485 | case 0x000D: return "WM_GETTEXT"; | |
2486 | case 0x000E: return "WM_GETTEXTLENGTH"; | |
2487 | case 0x000F: return "WM_PAINT"; | |
2488 | case 0x0010: return "WM_CLOSE"; | |
2489 | case 0x0011: return "WM_QUERYENDSESSION"; | |
2490 | case 0x0012: return "WM_QUIT"; | |
2491 | case 0x0013: return "WM_QUERYOPEN"; | |
2492 | case 0x0014: return "WM_ERASEBKGND"; | |
2493 | case 0x0015: return "WM_SYSCOLORCHANGE"; | |
2494 | case 0x0016: return "WM_ENDSESSION"; | |
2495 | case 0x0017: return "WM_SYSTEMERROR"; | |
2496 | case 0x0018: return "WM_SHOWWINDOW"; | |
2497 | case 0x0019: return "WM_CTLCOLOR"; | |
2498 | case 0x001A: return "WM_WININICHANGE"; | |
2499 | case 0x001B: return "WM_DEVMODECHANGE"; | |
2500 | case 0x001C: return "WM_ACTIVATEAPP"; | |
2501 | case 0x001D: return "WM_FONTCHANGE"; | |
2502 | case 0x001E: return "WM_TIMECHANGE"; | |
2503 | case 0x001F: return "WM_CANCELMODE"; | |
2504 | case 0x0020: return "WM_SETCURSOR"; | |
2505 | case 0x0021: return "WM_MOUSEACTIVATE"; | |
2506 | case 0x0022: return "WM_CHILDACTIVATE"; | |
2507 | case 0x0023: return "WM_QUEUESYNC"; | |
2508 | case 0x0024: return "WM_GETMINMAXINFO"; | |
2509 | case 0x0026: return "WM_PAINTICON"; | |
2510 | case 0x0027: return "WM_ICONERASEBKGND"; | |
2511 | case 0x0028: return "WM_NEXTDLGCTL"; | |
2512 | case 0x002A: return "WM_SPOOLERSTATUS"; | |
2513 | case 0x002B: return "WM_DRAWITEM"; | |
2514 | case 0x002C: return "WM_MEASUREITEM"; | |
2515 | case 0x002D: return "WM_DELETEITEM"; | |
2516 | case 0x002E: return "WM_VKEYTOITEM"; | |
2517 | case 0x002F: return "WM_CHARTOITEM"; | |
2518 | case 0x0030: return "WM_SETFONT"; | |
2519 | case 0x0031: return "WM_GETFONT"; | |
2520 | case 0x0037: return "WM_QUERYDRAGICON"; | |
2521 | case 0x0039: return "WM_COMPAREITEM"; | |
2522 | case 0x0041: return "WM_COMPACTING"; | |
2523 | case 0x0044: return "WM_COMMNOTIFY"; | |
2524 | case 0x0046: return "WM_WINDOWPOSCHANGING"; | |
2525 | case 0x0047: return "WM_WINDOWPOSCHANGED"; | |
2526 | case 0x0048: return "WM_POWER"; | |
2527 | ||
2528 | #ifdef __WIN32__ | |
2529 | case 0x004A: return "WM_COPYDATA"; | |
2530 | case 0x004B: return "WM_CANCELJOURNAL"; | |
2531 | case 0x004E: return "WM_NOTIFY"; | |
2532 | case 0x0050: return "WM_INPUTLANGCHANGEREQUEST"; | |
2533 | case 0x0051: return "WM_INPUTLANGCHANGE"; | |
2534 | case 0x0052: return "WM_TCARD"; | |
2535 | case 0x0053: return "WM_HELP"; | |
2536 | case 0x0054: return "WM_USERCHANGED"; | |
2537 | case 0x0055: return "WM_NOTIFYFORMAT"; | |
2538 | case 0x007B: return "WM_CONTEXTMENU"; | |
2539 | case 0x007C: return "WM_STYLECHANGING"; | |
2540 | case 0x007D: return "WM_STYLECHANGED"; | |
2541 | case 0x007E: return "WM_DISPLAYCHANGE"; | |
2542 | case 0x007F: return "WM_GETICON"; | |
2543 | case 0x0080: return "WM_SETICON"; | |
2544 | #endif //WIN32 | |
2545 | ||
2546 | case 0x0081: return "WM_NCCREATE"; | |
2547 | case 0x0082: return "WM_NCDESTROY"; | |
2548 | case 0x0083: return "WM_NCCALCSIZE"; | |
2549 | case 0x0084: return "WM_NCHITTEST"; | |
2550 | case 0x0085: return "WM_NCPAINT"; | |
2551 | case 0x0086: return "WM_NCACTIVATE"; | |
2552 | case 0x0087: return "WM_GETDLGCODE"; | |
2553 | case 0x00A0: return "WM_NCMOUSEMOVE"; | |
2554 | case 0x00A1: return "WM_NCLBUTTONDOWN"; | |
2555 | case 0x00A2: return "WM_NCLBUTTONUP"; | |
2556 | case 0x00A3: return "WM_NCLBUTTONDBLCLK"; | |
2557 | case 0x00A4: return "WM_NCRBUTTONDOWN"; | |
2558 | case 0x00A5: return "WM_NCRBUTTONUP"; | |
2559 | case 0x00A6: return "WM_NCRBUTTONDBLCLK"; | |
2560 | case 0x00A7: return "WM_NCMBUTTONDOWN"; | |
2561 | case 0x00A8: return "WM_NCMBUTTONUP"; | |
2562 | case 0x00A9: return "WM_NCMBUTTONDBLCLK"; | |
2563 | case 0x0100: return "WM_KEYDOWN"; | |
2564 | case 0x0101: return "WM_KEYUP"; | |
2565 | case 0x0102: return "WM_CHAR"; | |
2566 | case 0x0103: return "WM_DEADCHAR"; | |
2567 | case 0x0104: return "WM_SYSKEYDOWN"; | |
2568 | case 0x0105: return "WM_SYSKEYUP"; | |
2569 | case 0x0106: return "WM_SYSCHAR"; | |
2570 | case 0x0107: return "WM_SYSDEADCHAR"; | |
2571 | case 0x0108: return "WM_KEYLAST"; | |
2572 | ||
2573 | #ifdef __WIN32__ | |
2574 | case 0x010D: return "WM_IME_STARTCOMPOSITION"; | |
2575 | case 0x010E: return "WM_IME_ENDCOMPOSITION"; | |
2576 | case 0x010F: return "WM_IME_COMPOSITION"; | |
2577 | #endif //WIN32 | |
2578 | ||
2579 | case 0x0110: return "WM_INITDIALOG"; | |
2580 | case 0x0111: return "WM_COMMAND"; | |
2581 | case 0x0112: return "WM_SYSCOMMAND"; | |
2582 | case 0x0113: return "WM_TIMER"; | |
2583 | case 0x0114: return "WM_HSCROLL"; | |
2584 | case 0x0115: return "WM_VSCROLL"; | |
2585 | case 0x0116: return "WM_INITMENU"; | |
2586 | case 0x0117: return "WM_INITMENUPOPUP"; | |
2587 | case 0x011F: return "WM_MENUSELECT"; | |
2588 | case 0x0120: return "WM_MENUCHAR"; | |
2589 | case 0x0121: return "WM_ENTERIDLE"; | |
2590 | case 0x0200: return "WM_MOUSEMOVE"; | |
2591 | case 0x0201: return "WM_LBUTTONDOWN"; | |
2592 | case 0x0202: return "WM_LBUTTONUP"; | |
2593 | case 0x0203: return "WM_LBUTTONDBLCLK"; | |
2594 | case 0x0204: return "WM_RBUTTONDOWN"; | |
2595 | case 0x0205: return "WM_RBUTTONUP"; | |
2596 | case 0x0206: return "WM_RBUTTONDBLCLK"; | |
2597 | case 0x0207: return "WM_MBUTTONDOWN"; | |
2598 | case 0x0208: return "WM_MBUTTONUP"; | |
2599 | case 0x0209: return "WM_MBUTTONDBLCLK"; | |
2600 | case 0x0210: return "WM_PARENTNOTIFY"; | |
2601 | case 0x0211: return "WM_ENTERMENULOOP"; | |
2602 | case 0x0212: return "WM_EXITMENULOOP"; | |
2603 | ||
2604 | #ifdef __WIN32__ | |
2605 | case 0x0213: return "WM_NEXTMENU"; | |
2606 | case 0x0214: return "WM_SIZING"; | |
2607 | case 0x0215: return "WM_CAPTURECHANGED"; | |
2608 | case 0x0216: return "WM_MOVING"; | |
2609 | case 0x0218: return "WM_POWERBROADCAST"; | |
2610 | case 0x0219: return "WM_DEVICECHANGE"; | |
2611 | #endif //WIN32 | |
2612 | ||
2613 | case 0x0220: return "WM_MDICREATE"; | |
2614 | case 0x0221: return "WM_MDIDESTROY"; | |
2615 | case 0x0222: return "WM_MDIACTIVATE"; | |
2616 | case 0x0223: return "WM_MDIRESTORE"; | |
2617 | case 0x0224: return "WM_MDINEXT"; | |
2618 | case 0x0225: return "WM_MDIMAXIMIZE"; | |
2619 | case 0x0226: return "WM_MDITILE"; | |
2620 | case 0x0227: return "WM_MDICASCADE"; | |
2621 | case 0x0228: return "WM_MDIICONARRANGE"; | |
2622 | case 0x0229: return "WM_MDIGETACTIVE"; | |
2623 | case 0x0230: return "WM_MDISETMENU"; | |
2624 | case 0x0233: return "WM_DROPFILES"; | |
2625 | ||
2626 | #ifdef __WIN32__ | |
2627 | case 0x0281: return "WM_IME_SETCONTEXT"; | |
2628 | case 0x0282: return "WM_IME_NOTIFY"; | |
2629 | case 0x0283: return "WM_IME_CONTROL"; | |
2630 | case 0x0284: return "WM_IME_COMPOSITIONFULL"; | |
2631 | case 0x0285: return "WM_IME_SELECT"; | |
2632 | case 0x0286: return "WM_IME_CHAR"; | |
2633 | case 0x0290: return "WM_IME_KEYDOWN"; | |
2634 | case 0x0291: return "WM_IME_KEYUP"; | |
2635 | #endif //WIN32 | |
2636 | ||
2637 | case 0x0300: return "WM_CUT"; | |
2638 | case 0x0301: return "WM_COPY"; | |
2639 | case 0x0302: return "WM_PASTE"; | |
2640 | case 0x0303: return "WM_CLEAR"; | |
2641 | case 0x0304: return "WM_UNDO"; | |
2642 | case 0x0305: return "WM_RENDERFORMAT"; | |
2643 | case 0x0306: return "WM_RENDERALLFORMATS"; | |
2644 | case 0x0307: return "WM_DESTROYCLIPBOARD"; | |
2645 | case 0x0308: return "WM_DRAWCLIPBOARD"; | |
2646 | case 0x0309: return "WM_PAINTCLIPBOARD"; | |
2647 | case 0x030A: return "WM_VSCROLLCLIPBOARD"; | |
2648 | case 0x030B: return "WM_SIZECLIPBOARD"; | |
2649 | case 0x030C: return "WM_ASKCBFORMATNAME"; | |
2650 | case 0x030D: return "WM_CHANGECBCHAIN"; | |
2651 | case 0x030E: return "WM_HSCROLLCLIPBOARD"; | |
2652 | case 0x030F: return "WM_QUERYNEWPALETTE"; | |
2653 | case 0x0310: return "WM_PALETTEISCHANGING"; | |
2654 | case 0x0311: return "WM_PALETTECHANGED"; | |
2655 | ||
2656 | #ifdef __WIN32__ | |
2657 | // common controls messages - although they're not strictly speaking | |
2658 | // standard, it's nice to decode them nevertheless | |
2659 | ||
2660 | // listview | |
2661 | case 0x1000 + 0: return "LVM_GETBKCOLOR"; | |
2662 | case 0x1000 + 1: return "LVM_SETBKCOLOR"; | |
2663 | case 0x1000 + 2: return "LVM_GETIMAGELIST"; | |
2664 | case 0x1000 + 3: return "LVM_SETIMAGELIST"; | |
2665 | case 0x1000 + 4: return "LVM_GETITEMCOUNT"; | |
2666 | case 0x1000 + 5: return "LVM_GETITEMA"; | |
2667 | case 0x1000 + 75: return "LVM_GETITEMW"; | |
2668 | case 0x1000 + 6: return "LVM_SETITEMA"; | |
2669 | case 0x1000 + 76: return "LVM_SETITEMW"; | |
2670 | case 0x1000 + 7: return "LVM_INSERTITEMA"; | |
2671 | case 0x1000 + 77: return "LVM_INSERTITEMW"; | |
2672 | case 0x1000 + 8: return "LVM_DELETEITEM"; | |
2673 | case 0x1000 + 9: return "LVM_DELETEALLITEMS"; | |
2674 | case 0x1000 + 10: return "LVM_GETCALLBACKMASK"; | |
2675 | case 0x1000 + 11: return "LVM_SETCALLBACKMASK"; | |
2676 | case 0x1000 + 12: return "LVM_GETNEXTITEM"; | |
2677 | case 0x1000 + 13: return "LVM_FINDITEMA"; | |
2678 | case 0x1000 + 83: return "LVM_FINDITEMW"; | |
2679 | case 0x1000 + 14: return "LVM_GETITEMRECT"; | |
2680 | case 0x1000 + 15: return "LVM_SETITEMPOSITION"; | |
2681 | case 0x1000 + 16: return "LVM_GETITEMPOSITION"; | |
2682 | case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA"; | |
2683 | case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW"; | |
2684 | case 0x1000 + 18: return "LVM_HITTEST"; | |
2685 | case 0x1000 + 19: return "LVM_ENSUREVISIBLE"; | |
2686 | case 0x1000 + 20: return "LVM_SCROLL"; | |
2687 | case 0x1000 + 21: return "LVM_REDRAWITEMS"; | |
2688 | case 0x1000 + 22: return "LVM_ARRANGE"; | |
2689 | case 0x1000 + 23: return "LVM_EDITLABELA"; | |
2690 | case 0x1000 + 118: return "LVM_EDITLABELW"; | |
2691 | case 0x1000 + 24: return "LVM_GETEDITCONTROL"; | |
2692 | case 0x1000 + 25: return "LVM_GETCOLUMNA"; | |
2693 | case 0x1000 + 95: return "LVM_GETCOLUMNW"; | |
2694 | case 0x1000 + 26: return "LVM_SETCOLUMNA"; | |
2695 | case 0x1000 + 96: return "LVM_SETCOLUMNW"; | |
2696 | case 0x1000 + 27: return "LVM_INSERTCOLUMNA"; | |
2697 | case 0x1000 + 97: return "LVM_INSERTCOLUMNW"; | |
2698 | case 0x1000 + 28: return "LVM_DELETECOLUMN"; | |
2699 | case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH"; | |
2700 | case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH"; | |
2701 | case 0x1000 + 31: return "LVM_GETHEADER"; | |
2702 | case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE"; | |
2703 | case 0x1000 + 34: return "LVM_GETVIEWRECT"; | |
2704 | case 0x1000 + 35: return "LVM_GETTEXTCOLOR"; | |
2705 | case 0x1000 + 36: return "LVM_SETTEXTCOLOR"; | |
2706 | case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR"; | |
2707 | case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR"; | |
2708 | case 0x1000 + 39: return "LVM_GETTOPINDEX"; | |
2709 | case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE"; | |
2710 | case 0x1000 + 41: return "LVM_GETORIGIN"; | |
2711 | case 0x1000 + 42: return "LVM_UPDATE"; | |
2712 | case 0x1000 + 43: return "LVM_SETITEMSTATE"; | |
2713 | case 0x1000 + 44: return "LVM_GETITEMSTATE"; | |
2714 | case 0x1000 + 45: return "LVM_GETITEMTEXTA"; | |
2715 | case 0x1000 + 115: return "LVM_GETITEMTEXTW"; | |
2716 | case 0x1000 + 46: return "LVM_SETITEMTEXTA"; | |
2717 | case 0x1000 + 116: return "LVM_SETITEMTEXTW"; | |
2718 | case 0x1000 + 47: return "LVM_SETITEMCOUNT"; | |
2719 | case 0x1000 + 48: return "LVM_SORTITEMS"; | |
2720 | case 0x1000 + 49: return "LVM_SETITEMPOSITION32"; | |
2721 | case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT"; | |
2722 | case 0x1000 + 51: return "LVM_GETITEMSPACING"; | |
2723 | case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA"; | |
2724 | case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW"; | |
2725 | case 0x1000 + 53: return "LVM_SETICONSPACING"; | |
2726 | case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE"; | |
2727 | case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE"; | |
2728 | case 0x1000 + 56: return "LVM_GETSUBITEMRECT"; | |
2729 | case 0x1000 + 57: return "LVM_SUBITEMHITTEST"; | |
2730 | case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY"; | |
2731 | case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY"; | |
2732 | case 0x1000 + 60: return "LVM_SETHOTITEM"; | |
2733 | case 0x1000 + 61: return "LVM_GETHOTITEM"; | |
2734 | case 0x1000 + 62: return "LVM_SETHOTCURSOR"; | |
2735 | case 0x1000 + 63: return "LVM_GETHOTCURSOR"; | |
2736 | case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT"; | |
2737 | case 0x1000 + 65: return "LVM_SETWORKAREA"; | |
2738 | ||
2739 | // tree view | |
2740 | case 0x1100 + 0: return "TVM_INSERTITEMA"; | |
2741 | case 0x1100 + 50: return "TVM_INSERTITEMW"; | |
2742 | case 0x1100 + 1: return "TVM_DELETEITEM"; | |
2743 | case 0x1100 + 2: return "TVM_EXPAND"; | |
2744 | case 0x1100 + 4: return "TVM_GETITEMRECT"; | |
2745 | case 0x1100 + 5: return "TVM_GETCOUNT"; | |
2746 | case 0x1100 + 6: return "TVM_GETINDENT"; | |
2747 | case 0x1100 + 7: return "TVM_SETINDENT"; | |
2748 | case 0x1100 + 8: return "TVM_GETIMAGELIST"; | |
2749 | case 0x1100 + 9: return "TVM_SETIMAGELIST"; | |
2750 | case 0x1100 + 10: return "TVM_GETNEXTITEM"; | |
2751 | case 0x1100 + 11: return "TVM_SELECTITEM"; | |
2752 | case 0x1100 + 12: return "TVM_GETITEMA"; | |
2753 | case 0x1100 + 62: return "TVM_GETITEMW"; | |
2754 | case 0x1100 + 13: return "TVM_SETITEMA"; | |
2755 | case 0x1100 + 63: return "TVM_SETITEMW"; | |
2756 | case 0x1100 + 14: return "TVM_EDITLABELA"; | |
2757 | case 0x1100 + 65: return "TVM_EDITLABELW"; | |
2758 | case 0x1100 + 15: return "TVM_GETEDITCONTROL"; | |
2759 | case 0x1100 + 16: return "TVM_GETVISIBLECOUNT"; | |
2760 | case 0x1100 + 17: return "TVM_HITTEST"; | |
2761 | case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE"; | |
2762 | case 0x1100 + 19: return "TVM_SORTCHILDREN"; | |
2763 | case 0x1100 + 20: return "TVM_ENSUREVISIBLE"; | |
2764 | case 0x1100 + 21: return "TVM_SORTCHILDRENCB"; | |
2765 | case 0x1100 + 22: return "TVM_ENDEDITLABELNOW"; | |
2766 | case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA"; | |
2767 | case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW"; | |
2768 | case 0x1100 + 24: return "TVM_SETTOOLTIPS"; | |
2769 | case 0x1100 + 25: return "TVM_GETTOOLTIPS"; | |
2770 | ||
2771 | // header | |
2772 | case 0x1200 + 0: return "HDM_GETITEMCOUNT"; | |
2773 | case 0x1200 + 1: return "HDM_INSERTITEMA"; | |
2774 | case 0x1200 + 10: return "HDM_INSERTITEMW"; | |
2775 | case 0x1200 + 2: return "HDM_DELETEITEM"; | |
2776 | case 0x1200 + 3: return "HDM_GETITEMA"; | |
2777 | case 0x1200 + 11: return "HDM_GETITEMW"; | |
2778 | case 0x1200 + 4: return "HDM_SETITEMA"; | |
2779 | case 0x1200 + 12: return "HDM_SETITEMW"; | |
2780 | case 0x1200 + 5: return "HDM_LAYOUT"; | |
2781 | case 0x1200 + 6: return "HDM_HITTEST"; | |
2782 | case 0x1200 + 7: return "HDM_GETITEMRECT"; | |
2783 | case 0x1200 + 8: return "HDM_SETIMAGELIST"; | |
2784 | case 0x1200 + 9: return "HDM_GETIMAGELIST"; | |
2785 | case 0x1200 + 15: return "HDM_ORDERTOINDEX"; | |
2786 | case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE"; | |
2787 | case 0x1200 + 17: return "HDM_GETORDERARRAY"; | |
2788 | case 0x1200 + 18: return "HDM_SETORDERARRAY"; | |
2789 | case 0x1200 + 19: return "HDM_SETHOTDIVIDER"; | |
2790 | ||
2791 | // tab control | |
2792 | case 0x1300 + 2: return "TCM_GETIMAGELIST"; | |
2793 | case 0x1300 + 3: return "TCM_SETIMAGELIST"; | |
2794 | case 0x1300 + 4: return "TCM_GETITEMCOUNT"; | |
2795 | case 0x1300 + 5: return "TCM_GETITEMA"; | |
2796 | case 0x1300 + 60: return "TCM_GETITEMW"; | |
2797 | case 0x1300 + 6: return "TCM_SETITEMA"; | |
2798 | case 0x1300 + 61: return "TCM_SETITEMW"; | |
2799 | case 0x1300 + 7: return "TCM_INSERTITEMA"; | |
2800 | case 0x1300 + 62: return "TCM_INSERTITEMW"; | |
2801 | case 0x1300 + 8: return "TCM_DELETEITEM"; | |
2802 | case 0x1300 + 9: return "TCM_DELETEALLITEMS"; | |
2803 | case 0x1300 + 10: return "TCM_GETITEMRECT"; | |
2804 | case 0x1300 + 11: return "TCM_GETCURSEL"; | |
2805 | case 0x1300 + 12: return "TCM_SETCURSEL"; | |
2806 | case 0x1300 + 13: return "TCM_HITTEST"; | |
2807 | case 0x1300 + 14: return "TCM_SETITEMEXTRA"; | |
2808 | case 0x1300 + 40: return "TCM_ADJUSTRECT"; | |
2809 | case 0x1300 + 41: return "TCM_SETITEMSIZE"; | |
2810 | case 0x1300 + 42: return "TCM_REMOVEIMAGE"; | |
2811 | case 0x1300 + 43: return "TCM_SETPADDING"; | |
2812 | case 0x1300 + 44: return "TCM_GETROWCOUNT"; | |
2813 | case 0x1300 + 45: return "TCM_GETTOOLTIPS"; | |
2814 | case 0x1300 + 46: return "TCM_SETTOOLTIPS"; | |
2815 | case 0x1300 + 47: return "TCM_GETCURFOCUS"; | |
2816 | case 0x1300 + 48: return "TCM_SETCURFOCUS"; | |
2817 | case 0x1300 + 49: return "TCM_SETMINTABWIDTH"; | |
2818 | case 0x1300 + 50: return "TCM_DESELECTALL"; | |
2819 | ||
2820 | // toolbar | |
2821 | case WM_USER+1: return "TB_ENABLEBUTTON"; | |
2822 | case WM_USER+2: return "TB_CHECKBUTTON"; | |
2823 | case WM_USER+3: return "TB_PRESSBUTTON"; | |
2824 | case WM_USER+4: return "TB_HIDEBUTTON"; | |
2825 | case WM_USER+5: return "TB_INDETERMINATE"; | |
2826 | case WM_USER+9: return "TB_ISBUTTONENABLED"; | |
2827 | case WM_USER+10: return "TB_ISBUTTONCHECKED"; | |
2828 | case WM_USER+11: return "TB_ISBUTTONPRESSED"; | |
2829 | case WM_USER+12: return "TB_ISBUTTONHIDDEN"; | |
2830 | case WM_USER+13: return "TB_ISBUTTONINDETERMINATE"; | |
2831 | case WM_USER+17: return "TB_SETSTATE"; | |
2832 | case WM_USER+18: return "TB_GETSTATE"; | |
2833 | case WM_USER+19: return "TB_ADDBITMAP"; | |
2834 | case WM_USER+20: return "TB_ADDBUTTONS"; | |
2835 | case WM_USER+21: return "TB_INSERTBUTTON"; | |
2836 | case WM_USER+22: return "TB_DELETEBUTTON"; | |
2837 | case WM_USER+23: return "TB_GETBUTTON"; | |
2838 | case WM_USER+24: return "TB_BUTTONCOUNT"; | |
2839 | case WM_USER+25: return "TB_COMMANDTOINDEX"; | |
2840 | case WM_USER+26: return "TB_SAVERESTOREA"; | |
2841 | case WM_USER+76: return "TB_SAVERESTOREW"; | |
2842 | case WM_USER+27: return "TB_CUSTOMIZE"; | |
2843 | case WM_USER+28: return "TB_ADDSTRINGA"; | |
2844 | case WM_USER+77: return "TB_ADDSTRINGW"; | |
2845 | case WM_USER+29: return "TB_GETITEMRECT"; | |
2846 | case WM_USER+30: return "TB_BUTTONSTRUCTSIZE"; | |
2847 | case WM_USER+31: return "TB_SETBUTTONSIZE"; | |
2848 | case WM_USER+32: return "TB_SETBITMAPSIZE"; | |
2849 | case WM_USER+33: return "TB_AUTOSIZE"; | |
2850 | case WM_USER+35: return "TB_GETTOOLTIPS"; | |
2851 | case WM_USER+36: return "TB_SETTOOLTIPS"; | |
2852 | case WM_USER+37: return "TB_SETPARENT"; | |
2853 | case WM_USER+39: return "TB_SETROWS"; | |
2854 | case WM_USER+40: return "TB_GETROWS"; | |
2855 | case WM_USER+42: return "TB_SETCMDID"; | |
2856 | case WM_USER+43: return "TB_CHANGEBITMAP"; | |
2857 | case WM_USER+44: return "TB_GETBITMAP"; | |
2858 | case WM_USER+45: return "TB_GETBUTTONTEXTA"; | |
2859 | case WM_USER+75: return "TB_GETBUTTONTEXTW"; | |
2860 | case WM_USER+46: return "TB_REPLACEBITMAP"; | |
2861 | case WM_USER+47: return "TB_SETINDENT"; | |
2862 | case WM_USER+48: return "TB_SETIMAGELIST"; | |
2863 | case WM_USER+49: return "TB_GETIMAGELIST"; | |
2864 | case WM_USER+50: return "TB_LOADIMAGES"; | |
2865 | case WM_USER+51: return "TB_GETRECT"; | |
2866 | case WM_USER+52: return "TB_SETHOTIMAGELIST"; | |
2867 | case WM_USER+53: return "TB_GETHOTIMAGELIST"; | |
2868 | case WM_USER+54: return "TB_SETDISABLEDIMAGELIST"; | |
2869 | case WM_USER+55: return "TB_GETDISABLEDIMAGELIST"; | |
2870 | case WM_USER+56: return "TB_SETSTYLE"; | |
2871 | case WM_USER+57: return "TB_GETSTYLE"; | |
2872 | case WM_USER+58: return "TB_GETBUTTONSIZE"; | |
2873 | case WM_USER+59: return "TB_SETBUTTONWIDTH"; | |
2874 | case WM_USER+60: return "TB_SETMAXTEXTROWS"; | |
2875 | case WM_USER+61: return "TB_GETTEXTROWS"; | |
2876 | case WM_USER+41: return "TB_GETBITMAPFLAGS"; | |
2877 | ||
2878 | #endif //WIN32 | |
2879 | ||
2880 | default: | |
2881 | static char s_szBuf[128]; | |
2882 | sprintf(s_szBuf, "<unknown message = %d>", message); | |
2883 | return s_szBuf; | |
86de7616 | 2884 | } |
86de7616 | 2885 | */ |
cdf1e714 | 2886 | return NULL; |
86de7616 DW |
2887 | } |
2888 | ||
11e59d47 DW |
2889 | #endif // __WXDEBUG__ |
2890 |