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