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