1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
21 #include "wx/window.h"
26 #include "wx/dcclient.h"
30 #include "wx/layout.h"
31 #include "wx/dialog.h"
33 #include "wx/listbox.h"
34 #include "wx/button.h"
35 #include "wx/msgdlg.h"
41 #include "wx/ownerdrw.h"
44 #if wxUSE_DRAG_AND_DROP
48 #include "wx/menuitem.h"
51 #include "wx/os2/private.h"
54 #include "wx/tooltip.h"
65 #include "wx/textctrl.h"
70 // Place compiler, OS specific includes here
74 // Standard macros -- these are for OS/2 PM, but most GUI's have something similar
78 // SHORT1FROMMP -- LOWORD
80 #define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp))
82 // SHORT2FROMMP -- HIWORD
84 #define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16))
85 #endif // GET_X_LPARAM
88 # define CW_USEDEFAULT ((int)0x80000000)
91 // ---------------------------------------------------------------------------
93 // ---------------------------------------------------------------------------
96 // The last Windows message we got (MT-UNSAFE)
100 wxMenu
* wxCurrentPopupMenu
= NULL
;
101 extern wxList WXDLLEXPORT wxPendingDelete
;
102 #if !defined(__VISAGECPP__) || (__IBMCPP__ < 400)
103 extern wxChar wxCanvasClassName
[];
105 wxList
* wxWinHandleList
= NULL
;
107 // ---------------------------------------------------------------------------
109 // ---------------------------------------------------------------------------
112 // the window proc for all our windows; most gui's have something similar
114 MRESULT EXPENTRY
wxWndProc( HWND hWnd
121 const char *wxGetMessageName(int message
);
124 void wxRemoveHandleAssociation(wxWindow
* pWin
);
125 void wxAssociateWinWithHandle( HWND hWnd
128 wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
131 // This magical function is used to translate VK_APPS key presses to right
134 static void TranslateKbdEventToMouse( wxWindow
* pWin
141 // get the current state of SHIFT/CTRL keys
143 static inline bool IsShiftDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x8000) != 0; }
144 static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x8000) != 0; }
145 // ---------------------------------------------------------------------------
147 // ---------------------------------------------------------------------------
149 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxWindowBase
)
151 BEGIN_EVENT_TABLE(wxWindow
, wxWindowBase
)
152 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground
)
153 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged
)
154 EVT_INIT_DIALOG(wxWindow::OnInitDialog
)
155 EVT_IDLE(wxWindow::OnIdle
)
156 EVT_SET_FOCUS(wxWindow::OnSetFocus
)
159 // ===========================================================================
161 // ===========================================================================
164 // Find an item given the PM Window id
166 wxWindow
* wxWindow::FindItem(
170 wxControl
* pItem
= wxDynamicCast( this
177 // I it we or one of our "internal" children?
179 if (pItem
->GetId() == lId
||
180 (pItem
->GetSubcontrols().Index(lId
) != wxNOT_FOUND
))
186 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
190 wxWindow
* pChildWin
= pCurrent
->GetData();
191 wxWindow
* pWnd
= pChildWin
->FindItem(lId
);
196 pCurrent
= pCurrent
->GetNext();
199 } // end of wxWindow::FindItem
202 // Find an item given the PM Window handle
204 wxWindow
* wxWindow::FindItemByHWND(
209 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
213 wxWindow
* pParent
= pCurrent
->GetData();
216 // Do a recursive search.
218 wxWindow
* pWnd
= pParent
->FindItemByHWND(hWnd
);
223 if (!bControlOnly
|| pParent
->IsKindOf(CLASSINFO(wxControl
)))
225 wxWindow
* pItem
= pCurrent
->GetData();
227 if (pItem
->GetHWND() == hWnd
)
231 if (pItem
->ContainsHWND(hWnd
))
235 pCurrent
= pCurrent
->GetNext();
238 } // end of wxWindow::FindItemByHWND
241 // Default command handler
243 bool wxWindow::OS2Command(
244 WXUINT
WXUNUSED(uParam
)
245 , WXWORD
WXUNUSED(uId
)
251 // ----------------------------------------------------------------------------
252 // constructors and such
253 // ----------------------------------------------------------------------------
255 void wxWindow::Init()
265 m_bDoubleClickAllowed
= 0;
266 m_bWinCaptured
= FALSE
;
268 m_isBeingDeleted
= FALSE
;
271 m_bMouseInWindow
= FALSE
;
278 m_hWndScrollBarHorz
= 0L;
279 m_hWndScrollBarVert
= 0L;
282 // Pass WM_GETDLGCODE to DefWindowProc()
287 m_bBackgroundTransparent
= FALSE
;
290 // As all windows are created with WS_VISIBLE style...
294 #if wxUSE_MOUSEEVENT_HACK
297 m_nLastMouseEvent
= -1;
298 #endif // wxUSE_MOUSEEVENT_HACK
304 wxWindow::~wxWindow()
306 m_isBeingDeleted
= TRUE
;
308 OS2DetachWindowMenu();
310 m_parent
->RemoveChild(this);
315 if(!::WinDestroyWindow(GetHWND()))
316 wxLogLastError(wxT("DestroyWindow"));
318 // remove hWnd <-> wxWindow association
320 wxRemoveHandleAssociation(this);
322 } // end of wxWindow::~wxWindow
324 bool wxWindow::Create(
327 , const wxPoint
& rPos
328 , const wxSize
& rSize
330 , const wxString
& rName
333 HWND hParent
= NULLHANDLE
;
334 wxPoint vPos
= rPos
; // The OS/2 position
335 ULONG ulCreateFlags
= 0L;
337 wxCHECK_MSG(pParent
, FALSE
, wxT("can't create wxWindow without parent"));
339 if ( !CreateBase( pParent
353 pParent
->AddChild(this);
354 hParent
= GetWinHwnd(pParent
);
356 // OS2 uses normal coordinates, no bassackwards Windows ones
358 if (pParent
->IsKindOf(CLASSINFO(wxGenericScrolledWindow
)) ||
359 pParent
->IsKindOf(CLASSINFO(wxScrolledWindow
))
362 wxWindow
* pGrandParent
= NULL
;
364 pGrandParent
= pParent
->GetParent();
366 nTempy
= pGrandParent
->GetSize().y
- (vPos
.y
+ rSize
.y
);
368 nTempy
= pParent
->GetSize().y
- (vPos
.y
+ rSize
.y
);
371 nTempy
= pParent
->GetSize().y
- (vPos
.y
+ rSize
.y
);
373 if ( pParent
->IsKindOf(CLASSINFO(wxGenericScrolledWindow
)) ||
374 pParent
->IsKindOf(CLASSINFO(wxScrolledWindow
))
376 ulCreateFlags
|= WS_CLIPSIBLINGS
;
382 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
383 hParent
= HWND_DESKTOP
;
384 vPos
.y
= vRect
.yTop
- (vPos
.y
+ rSize
.y
);
388 // Most wxSTYLES are really PM Class specific styles and will be
389 // set in those class create procs. PM's basic windows styles are
392 ulCreateFlags
|= WS_VISIBLE
;
395 if (lStyle
& wxCLIP_SIBLINGS
)
396 ulCreateFlags
|= WS_CLIPSIBLINGS
;
398 if (lStyle
& wxCLIP_CHILDREN
)
399 ulCreateFlags
|= WS_CLIPCHILDREN
;
405 WXDWORD dwExStyle
= Determine3DEffects( WS_EX_CLIENTEDGE
410 // Add the simple border style as we'll use this to draw borders
412 if (lStyle
& wxSIMPLE_BORDER
)
413 dwExStyle
|= wxSIMPLE_BORDER
;
416 // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
417 // and no presentation parameters
420 ,(PSZ
)wxCanvasClassName
425 ,WidthDefault(rSize
.x
)
426 ,HeightDefault(rSize
.y
)
436 } // end of wxWindow::Create
438 // ---------------------------------------------------------------------------
440 // ---------------------------------------------------------------------------
442 void wxWindow::SetFocus()
444 HWND hWnd
= GetHwnd();
447 ::WinSetFocus(HWND_DESKTOP
, hWnd
);
448 } // end of wxWindow::SetFocus
450 wxWindow
* wxWindowBase::FindFocus()
452 HWND hWnd
= ::WinQueryFocus(HWND_DESKTOP
);
456 return wxFindWinFromHandle((WXHWND
)hWnd
);
459 } // wxWindowBase::FindFocus
461 bool wxWindow::Enable(
465 if (!wxWindowBase::Enable(bEnable
))
468 HWND hWnd
= GetHwnd();
471 ::WinEnableWindow(hWnd
, (BOOL
)bEnable
);
473 wxWindowList::Node
* pNode
= GetChildren().GetFirst();
477 wxWindow
* pChild
= pNode
->GetData();
479 pChild
->Enable(bEnable
);
480 pNode
= pNode
->GetNext();
483 } // end of wxWindow::Enable
489 if (!wxWindowBase::Show(bShow
))
492 HWND hWnd
= GetHwnd();
494 ::WinShowWindow(hWnd
, bShow
);
498 ::WinSetWindowPos(hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_ACTIVATE
| SWP_ZORDER
);
501 } // end of wxWindow::Show
503 void wxWindow::Raise()
505 ::WinSetWindowPos(GetHwnd(), HWND_TOP
, 0, 0, 0, 0, SWP_ZORDER
| SWP_ACTIVATE
);
506 } // end of wxWindow::Raise
508 void wxWindow::Lower()
510 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_ZORDER
| SWP_DEACTIVATE
);
511 } // end of wxWindow::Lower
513 void wxWindow::SetTitle(
514 const wxString
& rTitle
517 ::WinSetWindowText(GetHwnd(), rTitle
.c_str());
518 } // end of wxWindow::SetTitle
520 wxString
wxWindow::GetTitle() const
522 return wxGetWindowText(GetHWND());
523 } // end of wxWindow::GetTitle
525 void wxWindow::CaptureMouse()
527 HWND hWnd
= GetHwnd();
529 if (hWnd
&& !m_bWinCaptured
)
531 ::WinSetCapture(HWND_DESKTOP
, hWnd
);
532 m_bWinCaptured
= TRUE
;
534 } // end of wxWindow::GetTitle
536 void wxWindow::ReleaseMouse()
540 ::WinSetCapture(HWND_DESKTOP
, NULLHANDLE
);
541 m_bWinCaptured
= FALSE
;
543 } // end of wxWindow::ReleaseMouse
545 bool wxWindow::SetFont(
549 if (!wxWindowBase::SetFont(rFont
))
555 HWND hWnd
= GetHwnd();
561 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), rFont
.GetFaceName().c_str());
562 return(::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
), (PVOID
)zFont
));
567 bool wxWindow::SetCursor(
568 const wxCursor
& rCursor
569 ) // check if base implementation is OK
571 if ( !wxWindowBase::SetCursor(rCursor
))
577 wxASSERT_MSG( m_cursor
.Ok(),
578 wxT("cursor must be valid after call to the base version"));
580 HWND hWnd
= GetHwnd();
586 hPS
= ::WinGetPS(hWnd
);
588 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
589 ::WinQueryWindowRect(hWnd
, &vRect
);
591 hRGN
= ::GpiCreateRegion(hPS
, 1L, &vRect
);
593 if ((::GpiPtInRegion(hPS
, hRGN
, &vPoint
) == PRGN_INSIDE
) && !wxIsBusy())
595 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)m_cursor
.GetHCURSOR());
598 } // end of wxWindow::SetCursor
600 void wxWindow::WarpPointer(
609 ::WinQueryWindowRect(GetHwnd(), &vRect
);
613 ::WinSetPointerPos(HWND_DESKTOP
, (LONG
)nX
, (LONG
)(nY
));
614 } // end of wxWindow::WarpPointer
616 #if WXWIN_COMPATIBILITY
617 void wxWindow::OS2DeviceToLogical (float *x
, float *y
) const
620 #endif // WXWIN_COMPATIBILITY
622 // ---------------------------------------------------------------------------
624 // ---------------------------------------------------------------------------
626 #if WXWIN_COMPATIBILITY
627 void wxWindow::SetScrollRange(
633 int nRange1
= nRange
;
634 int nPageSize
= GetScrollPage(nOrient
);
636 if (nPpageSize
> 1 && nRange
> 0)
638 nRange1
+= (nPageSize
- 1);
641 if (nOrient
== wxHORIZONTAL
)
643 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, (SHORT
)nRange1
));
644 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
648 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, (SHORT
)nRange1
));
649 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
651 } // end of wxWindow::SetScrollRange
653 void wxWindow::SetScrollPage(
659 if (nOrient
== wxHORIZONTAL
)
660 m_nXThumbSize
= nPage
;
662 m_nYThumbSize
= nPage
;
663 } // end of wxWindow::SetScrollPage
665 int wxWindow::OldGetScrollRange(
670 HWND hWnd
= GetHwnd();
674 mRc
= WinSendMsg(hWnd
, SBM_QUERYRANGE
, (MPARAM
)0L, (MPARAM
)0L);
675 return(SHORT2FROMMR(mRc
));
678 } // end of wxWindow::OldGetScrollRange
680 int wxWindow::GetScrollPage(
684 if (nOrient
== wxHORIZONTAL
)
685 return m_nXThumbSize
;
687 return m_nYThumbSize
;
688 } // end of wxWindow::GetScrollPage
689 #endif // WXWIN_COMPATIBILITY
691 int wxWindow::GetScrollPos(
695 if (nOrient
== wxHORIZONTAL
)
696 return((int)::WinSendMsg(m_hWndScrollBarHorz
, SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
698 return((int)::WinSendMsg(m_hWndScrollBarVert
, SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
699 } // end of wxWindow::GetScrollPos
701 int wxWindow::GetScrollRange(
707 if (nOrient
== wxHORIZONTAL
)
708 mr
= ::WinSendMsg(m_hWndScrollBarHorz
, SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
710 mr
= ::WinSendMsg(m_hWndScrollBarVert
, SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
711 return((int)SHORT2FROMMR(mr
));
712 } // end of wxWindow::GetScrollRange
714 int wxWindow::GetScrollThumb(
718 if (nOrient
== wxHORIZONTAL
)
719 return m_nXThumbSize
;
721 return m_nYThumbSize
;
722 } // end of wxWindow::GetScrollThumb
724 void wxWindow::SetScrollPos(
730 if (nOrient
== wxHORIZONTAL
)
731 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
733 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
734 } // end of wxWindow::SetScrollPos(
736 void wxWindow::SetScrollbar(
744 int nOldRange
= nRange
- nThumbVisible
;
745 int nRange1
= nOldRange
;
746 int nPageSize
= nThumbVisible
;
748 HWND hWnd
= GetHwnd();
749 ULONG ulStyle
= WS_VISIBLE
| WS_SYNCPAINT
;
752 ::WinQueryWindowRect(hWnd
, &vRect
);
753 if (nPageSize
> 1 && nRange
> 0)
755 nRange1
+= (nPageSize
- 1);
758 vInfo
.cb
= sizeof(SBCDATA
);
760 vInfo
.posLast
= (SHORT
)nRange1
;
761 vInfo
.posThumb
= nPos
;
763 if (nOrient
== wxHORIZONTAL
)
766 if (m_hWndScrollBarHorz
== 0L)
769 // We create the scrollbars with the desktop so that they are not
770 // registered as child windows of the window in order that child
771 // windows may be scrolled without scrolling the scrollbars themselves!
773 m_hWndScrollBarHorz
= ::WinCreateWindow( hWnd
779 ,vRect
.xRight
- vRect
.xLeft
793 // Only want to resize the scrollbar if it changes, otherwise
794 // we'd probably end up in a recursive loop until we crash the call stack
795 // because this method is called in a ScrolledWindow OnSize event and SWP_MOVE | SWP_SIZE
796 // generates those events.
798 ::WinQueryWindowRect(m_hWndScrollBarHorz
, &vRect2
);
799 if (!(vRect2
.xLeft
== vRect
.xLeft
&&
800 vRect2
.xRight
== vRect
.xRight
&&
801 vRect2
.yBottom
== vRect
.yBottom
&&
802 vRect2
.yTop
== vRect
.yTop
805 ::WinSetWindowPos( m_hWndScrollBarHorz
809 ,vRect
.xRight
- vRect
.xLeft
811 ,SWP_ACTIVATE
| SWP_MOVE
| SWP_SIZE
| SWP_SHOW
814 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, (SHORT
)nRange1
));
815 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
821 if (m_hWndScrollBarVert
== 0L)
823 m_hWndScrollBarVert
= ::WinCreateWindow( hWnd
830 ,vRect
.yTop
- (vRect
.yBottom
+ 20)
843 // Only want to resize the scrollbar if it changes, otherwise
844 // we'd probably end up in a recursive loop until we crash the call stack
845 // because this method is called in a ScrolledWindow OnSize event and SWP_MOVE | SWP_SIZE
846 // generates those events.
848 ::WinQueryWindowRect(m_hWndScrollBarVert
, &vRect2
);
849 if (!(vRect2
.xLeft
== vRect
.xLeft
&&
850 vRect2
.xRight
== vRect
.xRight
&&
851 vRect2
.yBottom
== vRect
.yBottom
&&
852 vRect2
.yTop
== vRect
.yTop
855 ::WinSetWindowPos( m_hWndScrollBarVert
860 ,vRect
.yTop
- (vRect
.yBottom
+ 20)
861 ,SWP_ACTIVATE
| SWP_MOVE
| SWP_SIZE
| SWP_SHOW
864 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, (SHORT
)nRange1
));
865 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
867 m_nYThumbSize
= nThumbVisible
;
869 } // end of wxWindow::SetScrollbar
871 void wxWindow::ScrollWindow(
874 , const wxRect
* pRect
880 nDy
*= -1; // flip the sign of Dy as OS/2 is opposite wxWin.
883 vRect2
.xLeft
= pRect
->x
;
884 vRect2
.yTop
= pRect
->y
+ pRect
->height
;
885 vRect2
.xRight
= pRect
->x
+ pRect
->width
;
886 vRect2
.yBottom
= pRect
->y
;
890 ::WinQueryWindowRect(GetHwnd(), &vRect2
);
891 ::WinQueryWindowRect(m_hWndScrollBarHorz
, &vRect
);
892 vRect2
.yBottom
+= vRect
.yTop
- vRect
.yBottom
;
893 ::WinQueryWindowRect(m_hWndScrollBarVert
, &vRect
);
894 vRect2
.xRight
-= vRect
.xRight
- vRect
.xLeft
;
898 ::WinScrollWindow( GetHwnd()
908 ::WinScrollWindow( GetHwnd()
920 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
925 wxWindow
* pChildWin
= pCurrent
->GetData();
927 if (pChildWin
->GetHWND() != NULLHANDLE
)
929 ::WinQueryWindowPos(pChildWin
->GetHWND(), &vSwp
);
930 ::WinQueryWindowRect(pChildWin
->GetHWND(), &vRect
);
931 if (pChildWin
->GetHWND() == m_hWndScrollBarVert
||
932 pChildWin
->GetHWND() == m_hWndScrollBarHorz
)
934 ::WinSetWindowPos( pChildWin
->GetHWND()
940 ,SWP_MOVE
| SWP_SHOW
| SWP_ZORDER
945 ::WinSetWindowPos( pChildWin
->GetHWND()
951 ,SWP_MOVE
| SWP_ZORDER
953 ::WinInvalidateRect(pChildWin
->GetHWND(), &vRect
, FALSE
);
956 pCurrent
= pCurrent
->GetNext();
958 } // end of wxWindow::ScrollWindow
960 // ---------------------------------------------------------------------------
962 // ---------------------------------------------------------------------------
964 void wxWindow::SubclassWin(
968 HWND hwnd
= (HWND
)hWnd
;
970 wxASSERT_MSG( !m_fnOldWndProc
, wxT("subclassing window twice?") );
971 wxCHECK_RET(::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in SubclassWin") );
972 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(hwnd
, (PFNWP
)wxWndProc
);
973 } // end of wxWindow::SubclassWin
975 void wxWindow::UnsubclassWin()
978 // Restore old Window proc
980 HWND hwnd
= GetHWND();
984 wxCHECK_RET( ::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in UnsubclassWin") );
986 PFNWP fnProc
= (PFNWP
)::WinQueryWindowPtr(hwnd
, QWP_PFNWP
);
988 if ( (m_fnOldWndProc
!= 0) && (fnProc
!= (PFNWP
) m_fnOldWndProc
))
990 WinSubclassWindow(hwnd
, (PFNWP
)m_fnOldWndProc
);
994 } // end of wxWindow::UnsubclassWin
997 // Make a Windows extended style from the given wxWindows window style
999 WXDWORD
wxWindow::MakeExtendedStyle(
1001 , bool bEliminateBorders
1005 // Simply fill out with wxWindow extended styles. We'll conjure
1006 // something up in OS2Create and all window redrawing pieces later
1008 WXDWORD dwStyle
= 0;
1010 if (lStyle
& wxTRANSPARENT_WINDOW
)
1011 dwStyle
|= wxTRANSPARENT_WINDOW
;
1013 if (!bEliminateBorders
)
1015 if (lStyle
& wxSUNKEN_BORDER
)
1016 dwStyle
|= wxSUNKEN_BORDER
;
1017 if (lStyle
& wxDOUBLE_BORDER
)
1018 dwStyle
|= wxDOUBLE_BORDER
;
1019 if (lStyle
& wxRAISED_BORDER
)
1020 dwStyle
|= wxRAISED_BORDER
;
1021 if (lStyle
& wxSTATIC_BORDER
)
1022 dwStyle
|= wxSTATIC_BORDER
;
1025 } // end of wxWindow::MakeExtendedStyle
1028 // Determines whether simulated 3D effects or CTL3D should be used,
1029 // applying a default border style if required, and returning an extended
1030 // style to pass to OS2Create.
1032 WXDWORD
wxWindow::Determine3DEffects(
1033 WXDWORD dwDefaultBorderStyle
1037 WXDWORD dwStyle
= 0L;
1040 // Native PM does not have any specialize 3D effects like WIN32 does,
1041 // so we have to try and invent them.
1045 // If matches certain criteria, then assume no 3D effects
1046 // unless specifically requested (dealt with in MakeExtendedStyle)
1049 !IsKindOf(CLASSINFO(wxControl
)) ||
1050 (m_windowStyle
& wxNO_BORDER
)
1054 return MakeExtendedStyle(m_windowStyle
, FALSE
);
1058 // 1) App can specify global 3D effects
1060 *pbWant3D
= wxTheApp
->GetAuto3D();
1063 // 2) If the parent is being drawn with user colours, or simple border
1064 // specified, switch effects off.
1067 (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS
) ||
1068 (m_windowStyle
& wxSIMPLE_BORDER
)
1073 // 3) Control can override this global setting by defining
1074 // a border style, e.g. wxSUNKEN_BORDER
1076 if ((m_windowStyle
& wxDOUBLE_BORDER
) ||
1077 (m_windowStyle
& wxRAISED_BORDER
) ||
1078 (m_windowStyle
& wxSTATIC_BORDER
) ||
1079 (m_windowStyle
& wxSUNKEN_BORDER
)
1083 dwStyle
= MakeExtendedStyle( m_windowStyle
1088 // If we want 3D, but haven't specified a border here,
1089 // apply the default border style specified.
1091 if (dwDefaultBorderStyle
&& (*pbWant3D
) &&
1092 !((m_windowStyle
& wxDOUBLE_BORDER
) ||
1093 (m_windowStyle
& wxRAISED_BORDER
) ||
1094 (m_windowStyle
& wxSTATIC_BORDER
) ||
1095 (m_windowStyle
& wxSIMPLE_BORDER
)
1098 dwStyle
|= dwDefaultBorderStyle
;
1100 } // end of wxWindow::Determine3DEffects
1102 #if WXWIN_COMPATIBILITY
1103 void wxWindow::OnCommand(
1105 , wxCommandEvent
& rEvent
1108 if (GetEventHandler()->ProcessEvent(rEvent
))
1111 m_parent
->GetEventHandler()->OnCommand( rWin
1114 } // end of wxWindow::OnCommand
1116 wxObject
* wxWindow::GetChild(
1121 // Return a pointer to the Nth object in the Panel
1123 wxNode
* pNode
= GetChildren().First();
1126 while (pNode
&& n
--)
1127 pNode
= pNode
->Next();
1130 wxObject
* pObj
= (wxObject
*)pNode
->Data();
1135 } // end of wxWindow::GetChild
1137 #endif // WXWIN_COMPATIBILITY
1140 // Setup background and foreground colours correctly
1142 void wxWindow::SetupColours()
1145 SetBackgroundColour(GetParent()->GetBackgroundColour());
1146 } // end of wxWindow::SetupColours
1148 void wxWindow::OnIdle(
1153 // Check if we need to send a LEAVE event
1155 if (m_bMouseInWindow
)
1159 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
1160 if (::WinWindowFromPoint(HWND_DESKTOP
, &vPoint
, FALSE
) != (HWND
)GetHwnd())
1163 // Generate a LEAVE event
1165 m_bMouseInWindow
= FALSE
;
1168 // Unfortunately the mouse button and keyboard state may have changed
1169 // by the time the OnIdle function is called, so 'state' may be
1174 if (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) != 0)
1176 if (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) != 0);
1179 wxMouseEvent
rEvent(wxEVT_LEAVE_WINDOW
);
1181 InitMouseEvent( rEvent
1186 (void)GetEventHandler()->ProcessEvent(rEvent
);
1190 } // end of wxWindow::OnIdle
1193 // Set this window to be the child of 'parent'.
1195 bool wxWindow::Reparent(
1199 if (!wxWindowBase::Reparent(pParent
))
1202 HWND hWndChild
= GetHwnd();
1203 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
1205 ::WinSetParent(hWndChild
, hWndParent
, TRUE
);
1207 } // end of wxWindow::Reparent
1209 void wxWindow::Clear()
1211 wxClientDC
vDc(this);
1212 wxBrush
vBrush( GetBackgroundColour()
1216 vDc
.SetBackground(vBrush
);
1218 } // end of wxWindow::Clear
1220 void wxWindow::Refresh(
1222 , const wxRect
* pRect
1225 HWND hWnd
= GetHwnd();
1233 vOs2Rect
.xLeft
= pRect
->x
;
1234 vOs2Rect
.yTop
= pRect
->y
;
1235 vOs2Rect
.xRight
= pRect
->x
+ pRect
->width
;
1236 vOs2Rect
.yBottom
= pRect
->y
+ pRect
->height
;
1238 ::WinInvalidateRect(hWnd
, &vOs2Rect
, bEraseBack
);
1241 ::WinInvalidateRect(hWnd
, NULL
, bEraseBack
);
1243 } // end of wxWindow::Refresh
1245 // ---------------------------------------------------------------------------
1247 // ---------------------------------------------------------------------------
1249 #if wxUSE_DRAG_AND_DROP
1250 void wxWindow::SetDropTarget(
1251 wxDropTarget
* pDropTarget
1254 if (m_dropTarget
!= 0)
1256 m_dropTarget
->Revoke(m_hWnd
);
1257 delete m_dropTarget
;
1259 m_dropTarget
= pDropTarget
;
1260 if (m_dropTarget
!= 0)
1261 m_dropTarget
->Register(m_hWnd
);
1262 } // end of wxWindow::SetDropTarget
1266 // old style file-manager drag&drop support: we retain the old-style
1267 // DragAcceptFiles in parallel with SetDropTarget.
1269 void wxWindow::DragAcceptFiles(
1273 HWND hWnd
= GetHwnd();
1275 if (hWnd
&& bAccept
)
1276 ::DrgAcceptDroppedFiles(hWnd
, NULL
, NULL
, DO_COPY
, 0L);
1277 } // end of wxWindow::DragAcceptFiles
1279 // ----------------------------------------------------------------------------
1281 // ----------------------------------------------------------------------------
1285 void wxWindow::DoSetToolTip(
1289 wxWindowBase::DoSetToolTip(pTooltip
);
1292 m_tooltip
->SetWindow(this);
1293 } // end of wxWindow::DoSetToolTip
1295 #endif // wxUSE_TOOLTIPS
1297 // ---------------------------------------------------------------------------
1298 // moving and resizing
1299 // ---------------------------------------------------------------------------
1302 void wxWindow::DoGetSize(
1307 HWND hWnd
= GetHwnd();
1310 ::WinQueryWindowRect(hWnd
, &vRect
);
1313 *pWidth
= vRect
.xRight
- vRect
.xLeft
;
1315 // OS/2 PM is backwards from windows
1316 *pHeight
= vRect
.yTop
- vRect
.yBottom
;
1317 } // end of wxWindow::DoGetSize
1319 void wxWindow::DoGetPosition(
1324 HWND hWnd
= GetHwnd();
1328 ::WinQueryWindowRect(hWnd
, &vRect
);
1330 vPoint
.x
= vRect
.xLeft
;
1331 vPoint
.y
= vRect
.yBottom
;
1334 // We do the adjustments with respect to the parent only for the "real"
1335 // children, not for the dialogs/frames
1339 HWND hParentWnd
= 0;
1340 wxWindow
* pParent
= GetParent();
1343 hParentWnd
= GetWinHwnd(pParent
);
1346 // Since we now have the absolute screen coords, if there's a parent we
1347 // must subtract its bottom left corner
1353 ::WinQueryWindowRect(hParentWnd
, &vRect2
);
1354 vPoint
.x
-= vRect
.xLeft
;
1355 vPoint
.y
-= vRect
.yBottom
;
1359 // We may be faking the client origin. So a window that's really at (0,
1360 // 30) may appear (to wxWin apps) to be at (0, 0).
1362 wxPoint
vPt(pParent
->GetClientAreaOrigin());
1372 } // end of wxWindow::DoGetPosition
1374 void wxWindow::DoScreenToClient(
1379 HWND hWnd
= GetHwnd();
1382 ::WinQueryWindowPos(hWnd
, &vSwp
);
1388 } // end of wxWindow::DoScreenToClient
1390 void wxWindow::DoClientToScreen(
1395 HWND hWnd
= GetHwnd();
1398 ::WinQueryWindowPos(hWnd
, &vSwp
);
1404 } // end of wxWindow::DoClientToScreen
1407 // Get size *available for subwindows* i.e. excluding menu bar etc.
1408 // Must be a frame type window
1410 void wxWindow::DoGetClientSize(
1415 HWND hWnd
= GetHwnd();
1419 if (IsKindOf(CLASSINFO(wxFrame
)))
1420 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1422 hWndClient
= NULLHANDLE
;
1423 if( hWndClient
== NULLHANDLE
)
1424 ::WinQueryWindowRect(GetHwnd(), &vRect
);
1426 ::WinQueryWindowRect(hWndClient
, &vRect
);
1429 *pWidth
= vRect
.xRight
;
1431 *pHeight
= vRect
.yTop
;
1432 } // end of wxWindow::DoGetClientSize
1434 void wxWindow::DoMoveWindow(
1441 if ( !::WinSetWindowPos( GetHwnd()
1447 ,SWP_SIZE
| SWP_MOVE
1450 wxLogLastError("MoveWindow");
1452 } // end of wxWindow::DoMoveWindow
1455 // Set the size of the window: if the dimensions are positive, just use them,
1456 // but if any of them is equal to -1, it means that we must find the value for
1457 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
1458 // which case -1 is a valid value for x and y)
1460 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
1461 // the width/height to best suit our contents, otherwise we reuse the current
1464 void wxWindow::DoSetSize(
1473 // Get the current size and position...
1479 wxSize
vSize(-1, -1);
1481 GetPosition( &nCurrentX
1484 GetSize( &nCurrentWidth
1489 // ... and don't do anything (avoiding flicker) if it's already ok
1491 if ( nX
== nCurrentX
&&
1493 nWidth
== nCurrentWidth
&&
1494 nHeight
== nCurrentHeight
1500 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1502 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1505 AdjustForParentClientOrigin( nX
1512 if (nSizeFlags
& wxSIZE_AUTO_WIDTH
)
1514 vSize
= DoGetBestSize();
1520 // Just take the current one
1522 nWidth
= nCurrentWidth
;
1528 if (nSizeFlags
& wxSIZE_AUTO_HEIGHT
)
1532 vSize
= DoGetBestSize();
1538 // just take the current one
1539 nHeight
= nCurrentHeight
;
1548 } // end of wxWindow::DoSetSize
1550 void wxWindow::DoSetClientSize(
1555 wxWindow
* pParent
= GetParent();
1556 HWND hWnd
= GetHwnd();
1557 HWND hParentWnd
= (HWND
)0;
1558 HWND hClientWnd
= (HWND
)0;
1563 hClientWnd
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1564 ::WinQueryWindowRect(hClientWnd
, &vRect2
);
1567 hParentWnd
= (HWND
) pParent
->GetHWND();
1569 ::WinQueryWindowRect(hWnd
, &vRect
);
1570 ::WinQueryWindowRect(hParentWnd
, &vRect3
);
1572 // Find the difference between the entire window (title bar and all)
1573 // and the client area; add this to the new client size to move the
1574 // window. OS/2 is backward from windows on height
1576 int nActualWidth
= vRect2
.xRight
- vRect2
.xLeft
- vRect
.xRight
+ nWidth
;
1577 int nActualHeight
= vRect2
.yTop
- vRect2
.yBottom
- vRect
.yTop
+ nHeight
;
1580 // If there's a parent, must subtract the parent's bottom left corner
1581 // since MoveWindow moves relative to the parent
1585 vPoint
.x
= vRect2
.xLeft
;
1586 vPoint
.y
= vRect2
.yBottom
;
1589 vPoint
.x
-= vRect3
.xLeft
;
1590 vPoint
.y
-= vRect3
.yBottom
;
1593 DoMoveWindow( vPoint
.x
1599 wxSizeEvent
vEvent( wxSize( nWidth
1605 vEvent
.SetEventObject(this);
1606 GetEventHandler()->ProcessEvent(vEvent
);
1607 } // end of wxWindow::DoSetClientSize
1609 wxPoint
wxWindow::GetClientAreaOrigin() const
1611 return wxPoint(0, 0);
1612 } // end of wxWindow::GetClientAreaOrigin
1614 void wxWindow::AdjustForParentClientOrigin(
1621 // Don't do it for the dialogs/frames - they float independently of their
1626 wxWindow
* pParent
= GetParent();
1628 if (!(nSizeFlags
& wxSIZE_NO_ADJUSTMENTS
) && pParent
)
1630 wxPoint
vPoint(pParent
->GetClientAreaOrigin());
1635 } // end of wxWindow::AdjustForParentClientOrigin
1637 // ---------------------------------------------------------------------------
1639 // ---------------------------------------------------------------------------
1641 int wxWindow::GetCharHeight() const
1644 FONTMETRICS vFontMetrics
;
1647 hPs
= ::WinGetPS(GetHwnd());
1649 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1651 ::WinReleasePS(hPs
);
1654 ::WinReleasePS(hPs
);
1655 return(vFontMetrics
.lMaxAscender
+ vFontMetrics
.lMaxDescender
);
1656 } // end of wxWindow::GetCharHeight
1658 int wxWindow::GetCharWidth() const
1661 FONTMETRICS vFontMetrics
;
1663 hPs
= ::WinGetPS(GetHwnd());
1665 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1667 ::WinReleasePS(hPs
);
1670 ::WinReleasePS(hPs
);
1671 return(vFontMetrics
.lAveCharWidth
);
1672 } // end of wxWindow::GetCharWidth
1674 void wxWindow::GetTextExtent(
1675 const wxString
& rString
1679 , int* pExternalLeading
1680 , const wxFont
* pTheFont
1683 const wxFont
* pFontToUse
= pTheFont
;
1686 hPs
= ::WinGetPS(GetHwnd());
1688 // TODO: Will have to play with fonts later
1691 pFontToUse = &m_font;
1694 HFONT hFfontOld = 0;
1696 if (pFontToUse && pFontToUse->Ok())
1699 hFnt = (HFONT)((wxFont *)pFontToUse)->GetResourceHandle(); // const_cast
1701 hFontOld = (HFONT)SelectObject(dc,fnt);
1706 GetTextExtentPoint(dc, string, (int)string.Length(), &sizeRect);
1707 GetTextMetrics(dc, &tm);
1709 if ( fontToUse && fnt && hfontOld )
1710 SelectObject(dc, hfontOld);
1712 ReleaseDC(hWnd, dc);
1719 *descent = tm.tmDescent;
1720 if ( externalLeading )
1721 *externalLeading = tm.tmExternalLeading;
1723 ::WinReleasePS(hPs
);
1726 #if wxUSE_CARET && WXWIN_COMPATIBILITY
1727 // ---------------------------------------------------------------------------
1728 // Caret manipulation
1729 // ---------------------------------------------------------------------------
1731 void wxWindow::CreateCaret(
1736 SetCaret(new wxCaret( this
1740 } // end of wxWindow::CreateCaret
1742 void wxWindow::CreateCaret(
1743 const wxBitmap
* pBitmap
1746 wxFAIL_MSG("not implemented");
1747 } // end of wxWindow::CreateCaret
1749 void wxWindow::ShowCaret(
1753 wxCHECK_RET( m_caret
, "no caret to show" );
1755 m_caret
->Show(bShow
);
1756 } // end of wxWindow::ShowCaret
1758 void wxWindow::DestroyCaret()
1761 } // end of wxWindow::DestroyCaret
1763 void wxWindow::SetCaretPos(
1767 wxCHECK_RET( m_caret
, "no caret to move" );
1772 } // end of wxWindow::SetCaretPos
1774 void wxWindow::GetCaretPos(
1779 wxCHECK_RET( m_caret
, "no caret to get position of" );
1781 m_caret
->GetPosition( pX
1784 } // end of wxWindow::GetCaretPos
1786 #endif //wxUSE_CARET
1788 // ---------------------------------------------------------------------------
1790 // ---------------------------------------------------------------------------
1792 bool wxWindow::DoPopupMenu(
1798 HWND hWnd
= GetHwnd();
1799 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
1800 HWND hMenu
= GetHmenuOf(pMenu
);
1802 pMenu
->SetInvokingWindow(this);
1805 DoClientToScreen( &nX
1808 wxCurrentPopupMenu
= pMenu
;
1810 ::WinPopupMenu( hWndParent
1816 ,PU_MOUSEBUTTON2DOWN
| PU_MOUSEBUTTON2
| PU_KEYBOARD
1819 wxCurrentPopupMenu
= NULL
;
1821 pMenu
->SetInvokingWindow(NULL
);
1823 } // end of wxWindow::DoPopupMenu
1825 // ===========================================================================
1826 // pre/post message processing
1827 // ===========================================================================
1829 MRESULT
wxWindow::OS2DefWindowProc(
1836 return (MRESULT
)m_fnOldWndProc(GetHWND(), (ULONG
)uMsg
, (MPARAM
)wParam
, (MPARAM
)lParam
);
1838 return ::WinDefWindowProc(GetHWND(), (ULONG
)uMsg
, (MPARAM
)wParam
, (MPARAM
)lParam
);
1839 } // end of wxWindow::OS2DefWindowProc
1841 bool wxWindow::OS2ProcessMessage(
1845 QMSG
* pQMsg
= (QMSG
*)pMsg
;
1847 if (m_hWnd
!= 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL
))
1850 // Intercept dialog navigation keys
1852 bool bProcess
= TRUE
;
1853 USHORT uKeyFlags
= SHORT1FROMMP(pQMsg
->mp1
);
1855 if (uKeyFlags
& KC_KEYUP
)
1858 if (uKeyFlags
& KC_ALT
)
1861 if (!(uKeyFlags
& KC_VIRTUALKEY
))
1866 bool bCtrlDown
= IsCtrlDown();
1867 bool bShiftDown
= IsShiftDown();
1870 // WM_QUERYDLGCODE: ask the control if it wants the key for itself,
1871 // don't process it if it's the case (except for Ctrl-Tab/Enter
1872 // combinations which are always processed)
1874 ULONG ulDlgCode
= 0;
1878 ulDlgCode
= (ULONG
)::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0);
1881 bool bForward
= TRUE
;
1882 bool bWindowChange
= FALSE
;
1884 switch (SHORT2FROMMP(pQMsg
->mp2
))
1887 // Going to make certain assumptions about specific types of controls
1888 // here, so we may have to alter some things later if they prove invalid
1892 // Shift tabl will always be a nav-key but tabs may be wanted
1901 // Entry Fields want tabs for themselve usually
1905 case DLGC_ENTRYFIELD
:
1915 // Ctrl-Tab cycles thru notebook pages
1917 bWindowChange
= bCtrlDown
;
1918 bForward
= !bShiftDown
;
1941 // ctrl-enter is not processed
1945 else if (ulDlgCode
& DLGC_BUTTON
)
1948 // buttons want process Enter themselevs
1954 wxPanel
* pPanel
= wxDynamicCast(this, wxPanel
);
1955 wxButton
* pBtn
= NULL
;
1960 // Panel may have a default button which should
1961 // be activated by Enter
1963 pBtn
= pPanel
->GetDefaultItem();
1966 if (pBtn
&& pBtn
->IsEnabled())
1969 // If we do have a default button, do press it
1971 pBtn
->OS2Command(BN_CLICKED
, 0 /* unused */);
1974 // else: but if it does not it makes sense to make
1975 // it work like a TAB - and that's what we do.
1976 // Note that Ctrl-Enter always works this way.
1987 wxNavigationKeyEvent vEvent
;
1989 vEvent
.SetDirection(bForward
);
1990 vEvent
.SetWindowChange(bWindowChange
);
1991 vEvent
.SetEventObject(this);
1993 if (GetEventHandler()->ProcessEvent(vEvent
))
1995 wxButton
* pBtn
= wxDynamicCast(FindFocus(), wxButton
);
2000 // The button which has focus should be default
2009 // Let Dialogs process
2011 if (::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0));
2018 // relay mouse move events to the tooltip control
2019 QMSG
* pQMsg
= (QMSG
*)pMsg
;
2021 if (pQMsg
->msg
== WM_MOUSEMOVE
)
2022 m_tooltip
->RelayEvent(pMsg
);
2024 #endif // wxUSE_TOOLTIPS
2027 } // end of wxWindow::OS2ProcessMessage
2029 bool wxWindow::OS2TranslateMessage(
2034 return m_acceleratorTable
.Translate(m_hWnd
, pMsg
);
2037 #endif //wxUSE_ACCEL
2038 } // end of wxWindow::OS2TranslateMessage
2040 // ---------------------------------------------------------------------------
2041 // message params unpackers
2042 // ---------------------------------------------------------------------------
2044 void wxWindow::UnpackCommand(
2052 *pId
= LOWORD(wParam
);
2053 *phWnd
= NULL
; // or may be GetHWND() ?
2054 *pCmd
= LOWORD(lParam
);
2055 } // end of wxWindow::UnpackCommand
2057 void wxWindow::UnpackActivate(
2064 *pState
= LOWORD(wParam
);
2065 *phWnd
= (WXHWND
)lParam
;
2066 } // end of wxWindow::UnpackActivate
2068 void wxWindow::UnpackScroll(
2079 ulId
= (ULONG
)LONGFROMMP(wParam
);
2080 hWnd
= ::WinWindowFromID(GetHwnd(), ulId
);
2081 if (hWnd
== m_hWndScrollBarHorz
|| hWnd
== m_hWndScrollBarVert
)
2082 *phWnd
= NULLHANDLE
;
2086 *pPos
= SHORT1FROMMP(lParam
);
2087 *pCode
= SHORT2FROMMP(lParam
);
2088 } // end of wxWindow::UnpackScroll
2090 void wxWindow::UnpackMenuSelect(
2098 *pItem
= (WXWORD
)LOWORD(wParam
);
2099 *pFlags
= HIWORD(wParam
);
2100 *phMenu
= (WXHMENU
)lParam
;
2101 } // end of wxWindow::UnpackMenuSelect
2103 // ---------------------------------------------------------------------------
2104 // Main wxWindows window proc and the window proc for wxWindow
2105 // ---------------------------------------------------------------------------
2108 // Hook for new window just as it's being created, when the window isn't yet
2109 // associated with the handle
2111 wxWindow
* wxWndHook
= NULL
;
2116 MRESULT EXPENTRY
wxWndProc(
2124 // Trace all ulMsgs - useful for the debugging
2127 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
2128 wxGetMessageName(ulMsg
), wParam
, lParam
);
2129 #endif // __WXDEBUG__
2131 wxWindow
* pWnd
= wxFindWinFromHandle((WXHWND
)hWnd
);
2134 // When we get the first message for the HWND we just created, we associate
2135 // it with wxWindow stored in wxWndHook
2137 if (!pWnd
&& wxWndHook
)
2139 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
2142 pWnd
->SetHWND((WXHWND
)hWnd
);
2145 MRESULT rc
= (MRESULT
)0;
2149 // Stop right here if we don't have a valid handle in our wxWindow object.
2151 if (pWnd
&& !pWnd
->GetHWND())
2153 pWnd
->SetHWND((WXHWND
) hWnd
);
2154 rc
= pWnd
->OS2DefWindowProc(ulMsg
, wParam
, lParam
);
2160 rc
= pWnd
->OS2WindowProc(ulMsg
, wParam
, lParam
);
2162 rc
= ::WinDefWindowProc(hWnd
, ulMsg
, wParam
, lParam
);
2166 } // end of wxWndProc
2169 // We will add (or delete) messages we need to handle at this default
2172 MRESULT
wxWindow::OS2WindowProc(
2179 // Did we process the uMsg?
2181 bool bProcessed
= FALSE
;
2188 // For most messages we should return 0 when we do process the message
2190 mResult
= (MRESULT
)0;
2198 bProcessed
= HandleCreate( (WXLPCREATESTRUCT
)lParam
2204 // Return 0 to bAllow window creation
2206 mResult
= (MRESULT
)(bMayCreate
? 0 : -1);
2217 bProcessed
= HandleMove( LOWORD(lParam
)
2223 bProcessed
= HandleSize( LOWORD(lParam
)
2234 UnpackActivate( wParam
2240 bProcessed
= HandleActivate( wState
2248 if (SHORT1FROMMP((MPARAM
)lParam
) == TRUE
)
2249 bProcessed
= HandleSetFocus((WXHWND
)(HWND
)wParam
);
2251 bProcessed
= HandleKillFocus((WXHWND
)(HWND
)wParam
);
2255 bProcessed
= HandlePaint();
2260 // Don't let the DefWindowProc() destroy our window - we'll do it
2261 // ourselves in ~wxWindow
2264 mResult
= (MRESULT
)TRUE
;
2268 bProcessed
= HandleShow(wParam
!= 0, (int)lParam
);
2272 // Under OS2 PM Joysticks are treated just like mouse events
2273 // The "Motion" events will be prevelent in joysticks
2276 case WM_BUTTON1DOWN
:
2278 case WM_BUTTON1DBLCLK
:
2279 case WM_BUTTON1MOTIONEND
:
2280 case WM_BUTTON1MOTIONSTART
:
2281 case WM_BUTTON2DOWN
:
2283 case WM_BUTTON2DBLCLK
:
2284 case WM_BUTTON2MOTIONEND
:
2285 case WM_BUTTON2MOTIONSTART
:
2286 case WM_BUTTON3DOWN
:
2288 case WM_BUTTON3DBLCLK
:
2289 case WM_BUTTON3MOTIONEND
:
2290 case WM_BUTTON3MOTIONSTART
:
2292 short x
= LOWORD(lParam
);
2293 short y
= HIWORD(lParam
);
2295 bProcessed
= HandleMouseEvent(uMsg
, x
, y
, (WXUINT
)wParam
);
2299 bProcessed
= HandleSysCommand(wParam
, lParam
);
2306 UnpackCommand(wParam
, lParam
, &id
, &hwnd
, &cmd
);
2308 bProcessed
= HandleCommand(id
, cmd
, hwnd
);
2313 // For these messages we must return TRUE if process the message
2316 case WM_MEASUREITEM
:
2318 int nIdCtrl
= (UINT
)wParam
;
2320 if ( uMsg
== WM_DRAWITEM
)
2322 bProcessed
= OS2OnDrawItem(nIdCtrl
,
2323 (WXDRAWITEMSTRUCT
*)lParam
);
2327 bProcessed
= OS2OnMeasureItem(nIdCtrl
,
2328 (WXMEASUREITEMSTRUCT
*)lParam
);
2332 mResult
= (MRESULT
)TRUE
;
2336 case WM_QUERYDLGCODE
:
2339 mResult
= (MRESULT
)m_lDlgCode
;
2343 //else: get the dlg code from the DefWindowProc()
2348 // In OS/2 PM all keyboard events are of the WM_CHAR type. Virtual key and key-up
2349 // and key-down events are obtained from the WM_CHAR params.
2353 USHORT uKeyFlags
= SHORT1FROMMP((MPARAM
)wParam
);
2355 if (uKeyFlags
& KC_KEYUP
)
2357 bProcessed
= HandleKeyUp((WXDWORD
)wParam
, lParam
);
2360 else // keydown event
2363 // If this has been processed by an event handler,
2364 // return 0 now (we've handled it). DON't RETURN
2365 // we still need to process further
2367 HandleKeyDown((WXDWORD
)wParam
, lParam
);
2368 if (uKeyFlags
& KC_VIRTUALKEY
)
2370 USHORT uVk
= SHORT2FROMMP((MPARAM
)lParam
);
2373 // We consider these message "not interesting" to OnChar
2375 if (uVk
== VK_SHIFT
|| uVk
== VK_CTRL
)
2383 // Avoid duplicate messages to OnChar for these ASCII keys: they
2384 // will be translated by TranslateMessage() and received in WM_CHAR
2390 // But set processed to FALSE, not TRUE to still pass them to
2391 // the control's default window proc - otherwise built-in
2392 // keyboard handling won't work
2401 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
);
2405 else // WM_CHAR -- Always an ASCII character
2407 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
, TRUE
);
2419 UnpackScroll( wParam
2426 bProcessed
= OS2OnScroll( uMsg
== WM_HSCROLL
? wxHORIZONTAL
2435 #if defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
2436 case WM_CTLCOLORCHANGE
:
2438 bProcessed
= HandleCtlColor(&hBrush
);
2442 case WM_ERASEBACKGROUND
:
2444 // Returning TRUE to requestw PM to paint the window background
2445 // in SYSCLR_WINDOW. We don't really want that
2447 bProcessed
= HandleEraseBkgnd((WXHDC
)(HPS
)wParam
);
2448 mResult
= (MRESULT
)(FALSE
);
2452 // Instead of CTLCOLOR messages PM sends QUERYWINDOWPARAMS to
2453 // things such as colors and fonts and such
2455 case WM_QUERYWINDOWPARAMS
:
2457 PWNDPARAMS pWndParams
= (PWNDPARAMS
)wParam
;
2459 bProcessed
= HandleWindowParams( pWndParams
2465 // the return value for this message is ignored
2466 case WM_SYSCOLORCHANGE
:
2467 bProcessed
= HandleSysColorChange();
2470 case WM_REALIZEPALETTE
:
2471 bProcessed
= HandlePaletteChanged();
2474 case WM_PRESPARAMCHANGED
:
2475 bProcessed
= HandlePresParamChanged(wParam
);
2479 // move all drag and drops to wxDrg
2481 bProcessed
= HandleEndDrag(wParam
);
2485 bProcessed
= HandleInitDialog((WXHWND
)(HWND
)wParam
);
2489 // we never set focus from here
2494 // wxFrame specific message
2495 case WM_MINMAXFRAME
:
2496 bProcessed
= HandleGetMinMaxInfo((PSWP
)wParam
);
2499 case WM_SYSVALUECHANGED
:
2500 // TODO: do something
2501 mResult
= (MRESULT
)TRUE
;
2505 // Comparable to WM_SETPOINTER for windows, only for just controls
2507 case WM_CONTROLPOINTER
:
2508 bProcessed
= HandleSetCursor( SHORT1FROMMP(wParam
) // Control ID
2509 ,(HWND
)lParam
// Cursor Handle
2514 // Returning TRUE stops the DefWindowProc() from further
2515 // processing this message - exactly what we need because we've
2516 // just set the cursor.
2518 mResult
= (MRESULT
)TRUE
;
2525 wxLogTrace(wxTraceMessages
, wxT("Forwarding %s to DefWindowProc."),
2526 wxGetMessageName(uMsg
));
2527 #endif // __WXDEBUG__
2528 if (IsKindOf(CLASSINFO(wxFrame
)))
2529 mResult
= ::WinDefWindowProc(m_hWnd
, uMsg
, wParam
, lParam
);
2531 mResult
= OS2DefWindowProc(uMsg
, wParam
, lParam
);
2534 } // end of wxWindow::OS2WindowProc
2537 // Dialog window proc
2545 if (uMsg
== WM_INITDLG
)
2548 // For this message, returning TRUE tells system to set focus to the
2549 // first control in the dialog box
2551 return (MRESULT
)TRUE
;
2556 // For all the other ones, FALSE means that we didn't process the
2561 } // end of wxDlgProc
2563 wxWindow
* wxFindWinFromHandle(
2567 wxNode
* pNode
= wxWinHandleList
->Find((long)hWnd
);
2571 return (wxWindow
*)pNode
->Data();
2572 } // end of wxFindWinFromHandle
2574 void wxAssociateWinWithHandle(
2580 // Adding NULL hWnd is (first) surely a result of an error and
2581 // (secondly) breaks menu command processing
2583 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
2584 wxT("attempt to add a NULL hWnd to window list ignored") );
2587 wxWindow
* pOldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
2589 if (pOldWin
&& (pOldWin
!= pWin
))
2591 wxString
str(pWin
->GetClassInfo()->GetClassName());
2592 wxLogError( "Bug! Found existing HWND %X for new window of class %s"
2599 wxWinHandleList
->Append( (long)hWnd
2603 } // end of wxAssociateWinWithHandle
2605 void wxRemoveHandleAssociation(
2609 wxWinHandleList
->DeleteObject(pWin
);
2610 } // end of wxRemoveHandleAssociation
2613 // Default destroyer - override if you destroy it in some other way
2614 // (e.g. with MDI child windows)
2616 void wxWindow::OS2DestroyWindow()
2620 void wxWindow::OS2DetachWindowMenu()
2624 HMENU hMenu
= (HMENU
)m_hMenu
;
2626 int nN
= (int)::WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
2629 for (i
= 0; i
< nN
; i
++)
2632 int nChars
= (int)::WinSendMsg( hMenu
2634 ,MPFROM2SHORT(i
, nN
)
2639 wxLogLastError(wxT("GetMenuString"));
2643 if (wxStrcmp(zBuf
, wxT("&Window")) == 0)
2645 ::WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
2650 } // end of wxWindow::OS2DetachWindowMenu
2652 bool wxWindow::OS2Create(
2655 , const wxChar
* zTitle
2663 , unsigned long ulId
2674 long lHeight1
= 20L;
2676 int nNeedsubclass
= 0;
2677 PCSZ pszClass
= zClass
;
2680 // Find parent's size, if it exists, to set up a possible default
2681 // panel size the size of the parent window
2696 // check to see if the new window is a standard control
2698 if ((ULONG
)zClass
== (ULONG
)WC_BUTTON
||
2699 (ULONG
)zClass
== (ULONG
)WC_COMBOBOX
||
2700 (ULONG
)zClass
== (ULONG
)WC_CONTAINER
||
2701 (ULONG
)zClass
== (ULONG
)WC_ENTRYFIELD
||
2702 (ULONG
)zClass
== (ULONG
)WC_FRAME
||
2703 (ULONG
)zClass
== (ULONG
)WC_LISTBOX
||
2704 (ULONG
)zClass
== (ULONG
)WC_MENU
||
2705 (ULONG
)zClass
== (ULONG
)WC_NOTEBOOK
||
2706 (ULONG
)zClass
== (ULONG
)WC_SCROLLBAR
||
2707 (ULONG
)zClass
== (ULONG
)WC_SPINBUTTON
||
2708 (ULONG
)zClass
== (ULONG
)WC_STATIC
||
2709 (ULONG
)zClass
== (ULONG
)WC_TITLEBAR
||
2710 (ULONG
)zClass
== (ULONG
)WC_VALUESET
2717 // no standard controls
2718 if(wxString (wxT("wxFrameClass")) == wxString(zClass
) )
2720 pszClass
= WC_FRAME
;
2727 nControlId
= FID_CLIENT
;
2732 // We will either have a registered class via string name or a standard PM Class via a long
2734 m_hWnd
= (WXHWND
)::WinCreateWindow( (HWND
)hParent
2736 ,(PSZ
)zTitle
? zTitle
: wxT("")
2750 vError
= ::WinGetLastError(vHabmain
);
2751 sError
= wxPMErrorToStr(vError
);
2752 wxLogError("Can't create window of class %s!. Error: %s\n", zClass
, sError
);
2755 m_dwExStyle
= dwExStyle
;
2756 ::WinSetWindowULong(m_hWnd
, QWL_USER
, (ULONG
) this);
2760 wxNode
* pNode
= wxWinHandleList
->Member(this);
2764 HWND hWnd
= (HWND
)pNode
->GetKeyInteger();
2766 if (hWnd
!= (HWND
)m_hWnd
)
2769 wxLogError("A second HWND association is being added for the same window!");
2773 wxAssociateWinWithHandle((HWND
)m_hWnd
2777 // Now need to subclass window.
2781 wxAssociateWinWithHandle((HWND
)m_hWnd
,this);
2785 SubclassWin(GetHWND());
2788 } // end of wxWindow::OS2Create
2790 // ===========================================================================
2791 // OS2 PM message handlers
2792 // ===========================================================================
2794 // ---------------------------------------------------------------------------
2795 // window creation/destruction
2796 // ---------------------------------------------------------------------------
2798 bool wxWindow::HandleCreate(
2799 WXLPCREATESTRUCT vCs
2803 wxWindowCreateEvent
vEvent(this);
2805 (void)GetEventHandler()->ProcessEvent(vEvent
);
2806 *pbMayCreate
= TRUE
;
2808 } // end of wxWindow::HandleCreate
2810 bool wxWindow::HandleDestroy()
2812 wxWindowDestroyEvent
vEvent(this);
2814 (void)GetEventHandler()->ProcessEvent(vEvent
);
2817 // Delete our drop target if we've got one
2819 #if wxUSE_DRAG_AND_DROP
2820 if (m_dropTarget
!= NULL
)
2822 m_dropTarget
->Revoke(m_hWnd
);
2823 delete m_dropTarget
;
2824 m_dropTarget
= NULL
;
2826 #endif // wxUSE_DRAG_AND_DROP
2829 // WM_DESTROY handled
2832 } // end of wxWindow::HandleDestroy
2834 // ---------------------------------------------------------------------------
2836 // ---------------------------------------------------------------------------
2837 void wxWindow::OnSetFocus(
2838 wxFocusEvent
& rEvent
2842 // Panel wants to track the window which was the last to have focus in it,
2843 // so we want to set ourselves as the window which last had focus
2845 // Notice that it's also important to do it upwards the tree becaus
2846 // otherwise when the top level panel gets focus, it won't set it back to
2847 // us, but to some other sibling
2849 wxWindow
* pWin
= this;
2853 wxWindow
* pParent
= pWin
->GetParent();
2854 wxPanel
* pPanel
= wxDynamicCast( pParent
2859 pPanel
->SetLastFocus(pWin
);
2864 wxLogTrace(_T("focus"), _T("%s (0x%08x) gets focus"),
2865 GetClassInfo()->GetClassName(), GetHandle());
2868 } // end of wxWindow::OnSetFocus
2870 bool wxWindow::HandleActivate(
2872 , WXHWND
WXUNUSED(hActivate
)
2875 wxActivateEvent
vEvent( wxEVT_ACTIVATE
2879 vEvent
.SetEventObject(this);
2880 return GetEventHandler()->ProcessEvent(vEvent
);
2881 } // end of wxWindow::HandleActivate
2883 bool wxWindow::HandleSetFocus(
2884 WXHWND
WXUNUSED(hWnd
)
2893 m_caret
->OnSetFocus();
2895 #endif // wxUSE_CARET
2898 // Panel wants to track the window which was the last to have focus in it
2900 wxPanel
* pPanel
= wxDynamicCast( GetParent()
2905 pPanel
->SetLastFocus(this);
2908 wxFocusEvent
vEvent(wxEVT_SET_FOCUS
, m_windowId
);
2910 vEvent
.SetEventObject(this);
2911 return GetEventHandler()->ProcessEvent(vEvent
);
2912 } // end of wxWindow::HandleSetFocus
2914 bool wxWindow::HandleKillFocus(
2915 WXHWND
WXUNUSED(hWnd
)
2924 m_caret
->OnKillFocus();
2926 #endif // wxUSE_CARET
2928 wxFocusEvent
vEvent( wxEVT_KILL_FOCUS
2932 vEvent
.SetEventObject(this);
2933 return GetEventHandler()->ProcessEvent(vEvent
);
2934 } // end of wxWindow::HandleKillFocus
2936 // ---------------------------------------------------------------------------
2938 // ---------------------------------------------------------------------------
2940 bool wxWindow::HandleShow(
2945 wxShowEvent
vEvent( GetId()
2949 vEvent
.m_eventObject
= this;
2950 return GetEventHandler()->ProcessEvent(vEvent
);
2951 } // end of wxWindow::HandleShow
2953 bool wxWindow::HandleInitDialog(
2954 WXHWND
WXUNUSED(hWndFocus
)
2957 wxInitDialogEvent
vEvent(GetId());
2959 vEvent
.m_eventObject
= this;
2960 return GetEventHandler()->ProcessEvent(vEvent
);
2961 } // end of wxWindow::HandleInitDialog
2963 bool wxWindow::HandleEndDrag(WXWPARAM wParam
)
2965 // TODO: We'll handle drag and drop later
2969 bool wxWindow::HandleSetCursor(
2975 // Under OS/2 PM this allows the pointer to be changed
2976 // as it passes over a control
2978 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)hPointer
);
2980 } // end of wxWindow::HandleSetCursor
2982 // ---------------------------------------------------------------------------
2983 // owner drawn stuff
2984 // ---------------------------------------------------------------------------
2985 bool wxWindow::OS2OnDrawItem(
2987 , WXDRAWITEMSTRUCT
* pItemStruct
2992 #if wxUSE_OWNER_DRAWN
2994 // Is it a menu item?
3000 POWNERITEM pMeasureStruct
= (POWNERITEM
)pItemStruct
;
3001 wxFrame
* pFrame
= (wxFrame
*)this;
3002 wxMenuItem
* pMenuItem
= pFrame
->GetMenuBar()->FindItem(pMeasureStruct
->idItem
, pMeasureStruct
->hItem
);
3003 HDC hDC
= ::GpiQueryDevice(pMeasureStruct
->hps
);
3004 wxRect
vRect( pMeasureStruct
->rclItem
.xLeft
3005 ,pMeasureStruct
->rclItem
.yBottom
3006 ,pMeasureStruct
->rclItem
.xRight
- pMeasureStruct
->rclItem
.xLeft
3007 ,pMeasureStruct
->rclItem
.yTop
- pMeasureStruct
->rclItem
.yBottom
3012 vDc
.SetHPS(pMeasureStruct
->hps
);
3014 // Load the wxWindows Pallete and set to RGB mode
3016 if (!::GpiCreateLogColorTable( pMeasureStruct
->hps
3020 ,(LONG
)wxTheColourDatabase
->m_nSize
3021 ,(PLONG
)wxTheColourDatabase
->m_palTable
3024 vError
= ::WinGetLastError(vHabmain
);
3025 sError
= wxPMErrorToStr(vError
);
3026 wxLogError("Unable to set current color table. Error: %s\n", sError
);
3029 // Set the color table to RGB mode
3031 if (!::GpiCreateLogColorTable( pMeasureStruct
->hps
3039 vError
= ::WinGetLastError(vHabmain
);
3040 sError
= wxPMErrorToStr(vError
);
3041 wxLogError("Unable to set current color table. Error: %s\n", sError
);
3044 wxCHECK( pMenuItem
->IsKindOf(CLASSINFO(wxMenuItem
)), FALSE
);
3050 if (pMeasureStruct
->fsAttribute
== pMeasureStruct
->fsAttributeOld
)
3053 // Entire Item needs to be redrawn (either it has reappeared from
3054 // behind another window or is being displayed for the first time
3056 eAction
= wxOwnerDrawn::wxODDrawAll
;
3058 if (pMeasureStruct
->fsAttribute
& MIA_HILITED
)
3061 // If it is currently selected we let the system handle it
3063 eStatus
|= wxOwnerDrawn::wxODSelected
;
3065 if (pMeasureStruct
->fsAttribute
& MIA_CHECKED
)
3068 // If it is currently checked we draw our own
3070 eStatus
|= wxOwnerDrawn::wxODChecked
;
3071 pMeasureStruct
->fsAttributeOld
= pMeasureStruct
->fsAttribute
&= ~MIA_CHECKED
;
3073 if (pMeasureStruct
->fsAttribute
& MIA_DISABLED
)
3076 // If it is currently disabled we let the system handle it
3078 eStatus
|= wxOwnerDrawn::wxODDisabled
;
3081 // Don't really care about framed (indicationg focus) or NoDismiss
3086 if (pMeasureStruct
->fsAttribute
& MIA_HILITED
)
3088 eAction
= wxOwnerDrawn::wxODDrawAll
;
3089 eStatus
|= wxOwnerDrawn::wxODSelected
;
3091 // Keep the system from trying to highlight with its bogus colors
3093 pMeasureStruct
->fsAttributeOld
= pMeasureStruct
->fsAttribute
&= ~MIA_HILITED
;
3095 else if (!(pMeasureStruct
->fsAttribute
& MIA_HILITED
))
3097 eAction
= wxOwnerDrawn::wxODDrawAll
;
3100 // Keep the system from trying to highlight with its bogus colors
3102 pMeasureStruct
->fsAttribute
= pMeasureStruct
->fsAttributeOld
&= ~MIA_HILITED
;
3107 // For now we don't care about anything else
3108 // just ignore the entire message!
3114 // Now redraw the item
3116 return(pMenuItem
->OnDrawItem( vDc
3118 ,(wxOwnerDrawn::wxODAction
)eAction
3119 ,(wxOwnerDrawn::wxODStatus
)eStatus
3122 // leave the fsAttribute and fsOldAttribute unchanged. If different,
3123 // the system will do the highlight or fraeming or disabling for us,
3124 // otherwise, we'd have to do it ourselves.
3128 wxWindow
* pItem
= FindItem(vId
);
3130 if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxControl
)))
3132 return ((wxControl
*)pItem
)->OS2OnDraw(pItemStruct
);
3136 } // end of wxWindow::OS2OnDrawItem
3138 bool wxWindow::OS2OnMeasureItem(
3140 , WXMEASUREITEMSTRUCT
* pItemStruct
3144 // Is it a menu item?
3146 if (lId
== 65536) // I really don't like this...has to be a better indicator
3148 if (IsKindOf(CLASSINFO(wxFrame
))) // we'll assume if Frame then a menu
3152 POWNERITEM pMeasureStruct
= (POWNERITEM
)pItemStruct
;
3153 wxFrame
* pFrame
= (wxFrame
*)this;
3154 wxMenuItem
* pMenuItem
= pFrame
->GetMenuBar()->FindItem(pMeasureStruct
->idItem
, pMeasureStruct
->hItem
);
3156 wxCHECK( pMenuItem
->IsKindOf(CLASSINFO(wxMenuItem
)), FALSE
);
3159 if (pMenuItem
->OnMeasureItem( &nWidth
3163 pMeasureStruct
->rclItem
.xRight
= nWidth
;
3164 pMeasureStruct
->rclItem
.xLeft
= 0L;
3165 pMeasureStruct
->rclItem
.yTop
= nHeight
;
3166 pMeasureStruct
->rclItem
.yBottom
= 0L;
3172 wxWindow
* pItem
= FindItem(lId
);
3174 if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxControl
)))
3176 return ((wxControl
*)pItem
)->OS2OnMeasure(pItemStruct
);
3181 // ---------------------------------------------------------------------------
3182 // colours and palettes
3183 // ---------------------------------------------------------------------------
3185 bool wxWindow::HandleSysColorChange()
3187 wxSysColourChangedEvent vEvent
;
3189 vEvent
.SetEventObject(this);
3190 return GetEventHandler()->ProcessEvent(vEvent
);
3191 } // end of wxWindow::HandleSysColorChange
3193 bool wxWindow::HandleCtlColor(
3198 // Not much provided with message. So not sure I can do anything with it
3201 } // end of wxWindow::HandleCtlColor
3203 bool wxWindow::HandleWindowParams(
3204 PWNDPARAMS pWndParams
3208 // TODO: I'll do something here, just not sure what yet
3212 // Define for each class of dialog and control
3213 WXHBRUSH
wxWindow::OnCtlColor(WXHDC hDC
,
3223 bool wxWindow::HandlePaletteChanged()
3225 // need to set this to something first
3226 WXHWND hWndPalChange
= NULLHANDLE
;
3228 wxPaletteChangedEvent
vEvent(GetId());
3230 vEvent
.SetEventObject(this);
3231 vEvent
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
3233 return GetEventHandler()->ProcessEvent(vEvent
);
3234 } // end of wxWindow::HandlePaletteChanged
3236 bool wxWindow::HandlePresParamChanged(
3241 // TODO: Once again I'll do something here when I need it
3243 //wxQueryNewPaletteEvent event(GetId());
3244 //event.SetEventObject(this);
3245 // if the background is erased
3246 // bProcessed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
3248 return FALSE
; //GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized();
3252 // Responds to colour changes: passes event on to children.
3254 void wxWindow::OnSysColourChanged(
3255 wxSysColourChangedEvent
& rEvent
3258 wxNode
* pNode
= GetChildren().First();
3263 // Only propagate to non-top-level windows
3265 wxWindow
* pWin
= (wxWindow
*)pNode
->Data();
3267 if (pWin
->GetParent())
3269 wxSysColourChangedEvent vEvent
;
3271 rEvent
.m_eventObject
= pWin
;
3272 pWin
->GetEventHandler()->ProcessEvent(vEvent
);
3274 pNode
= pNode
->Next();
3276 } // end of wxWindow::OnSysColourChanged
3278 // ---------------------------------------------------------------------------
3280 // ---------------------------------------------------------------------------
3282 bool wxWindow::HandlePaint()
3284 HRGN hRgn
= NULLHANDLE
;
3285 wxPaintEvent vEvent
;
3289 if (::WinQueryUpdateRegion(GetHwnd(), hRgn
) == RGN_NULL
)
3291 wxLogLastError("CreateRectRgn");
3295 m_updateRegion
= wxRegion(hRgn
);
3296 vEvent
.SetEventObject(this);
3297 if (!GetEventHandler()->ProcessEvent(vEvent
))
3301 hPS
= ::WinBeginPaint( GetHwnd()
3307 ::GpiCreateLogColorTable( hPS
3311 ,(LONG
)wxTheColourDatabase
->m_nSize
3312 ,(PLONG
)wxTheColourDatabase
->m_palTable
3314 ::GpiCreateLogColorTable( hPS
3322 ::WinFillRect(hPS
, &vRect
, GetBackgroundColour().GetPixel());
3326 LINEBUNDLE vLineBundle
;
3328 vLineBundle
.lColor
= 0x00000000; // Black
3329 vLineBundle
.usMixMode
= FM_OVERPAINT
;
3330 vLineBundle
.fxWidth
= 1;
3331 vLineBundle
.lGeomWidth
= 1;
3332 vLineBundle
.usType
= LINETYPE_SOLID
;
3333 vLineBundle
.usEnd
= 0;
3334 vLineBundle
.usJoin
= 0;
3337 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
3341 ::WinQueryWindowRect(GetHwnd(), &vRect
);
3350 return (GetEventHandler()->ProcessEvent(vEvent
));
3351 } // end of wxWindow::HandlePaint
3353 bool wxWindow::HandleEraseBkgnd(
3359 ::WinQueryWindowPos(GetHwnd(), &vSwp
);
3360 if (vSwp
.fl
& SWP_MINIMIZE
)
3365 vDC
.m_hPS
= (HPS
)hDC
; // this is really a PS
3366 vDC
.SetWindow(this);
3369 wxEraseEvent
vEvent(m_windowId
, &vDC
);
3371 vEvent
.SetEventObject(this);
3373 bool rc
= GetEventHandler()->ProcessEvent(vEvent
);
3376 vDC
.m_hPS
= NULLHANDLE
;
3378 } // end of wxWindow::HandleEraseBkgnd
3380 void wxWindow::OnEraseBackground(
3381 wxEraseEvent
& rEvent
3385 HPS hPS
= rEvent
.m_dc
->m_hPS
;
3387 ::WinQueryWindowRect(GetHwnd(), &vRect
);
3388 ::WinFillRect(hPS
, &vRect
, m_backgroundColour
.GetPixel());
3389 } // end of wxWindow::OnEraseBackground
3391 // ---------------------------------------------------------------------------
3392 // moving and resizing
3393 // ---------------------------------------------------------------------------
3395 bool wxWindow::HandleMinimize()
3397 wxIconizeEvent
vEvent(m_windowId
);
3399 vEvent
.SetEventObject(this);
3400 return GetEventHandler()->ProcessEvent(vEvent
);
3401 } // end of wxWindow::HandleMinimize
3403 bool wxWindow::HandleMaximize()
3405 wxMaximizeEvent
vEvent(m_windowId
);
3407 vEvent
.SetEventObject(this);
3408 return GetEventHandler()->ProcessEvent(vEvent
);
3409 } // end of wxWindow::HandleMaximize
3411 bool wxWindow::HandleMove(
3416 wxMoveEvent
vEvent( wxPoint( nX
3422 vEvent
.SetEventObject(this);
3423 return GetEventHandler()->ProcessEvent(vEvent
);
3424 } // end of wxWindow::HandleMove
3426 bool wxWindow::HandleSize(
3429 , WXUINT
WXUNUSED(nFlag
)
3432 wxSizeEvent
vEvent( wxSize( nWidth
3438 vEvent
.SetEventObject(this);
3439 return GetEventHandler()->ProcessEvent(vEvent
);
3440 } // end of wxWindow::HandleSize
3442 bool wxWindow::HandleGetMinMaxInfo(
3452 ::WinGetMaxPosition(GetHwnd(), pSwp
);
3453 m_maxWidth
= pSwp
->cx
;
3454 m_maxHeight
= pSwp
->cy
;
3458 ::WinGetMinPosition(GetHwnd(), pSwp
, &vPoint
);
3459 m_minWidth
= pSwp
->cx
;
3460 m_minHeight
= pSwp
->cy
;
3467 } // end of wxWindow::HandleGetMinMaxInfo
3469 // ---------------------------------------------------------------------------
3471 // ---------------------------------------------------------------------------
3472 bool wxWindow::HandleCommand(
3478 if (wxCurrentPopupMenu
)
3480 wxMenu
* pPopupMenu
= wxCurrentPopupMenu
;
3482 wxCurrentPopupMenu
= NULL
;
3483 return pPopupMenu
->OS2Command(wCmd
, wId
);
3486 wxWindow
* pWin
= FindItem(wId
);
3490 pWin
= wxFindWinFromHandle(hControl
);
3494 return pWin
->OS2Command( wCmd
3498 } // end of wxWindow::HandleCommand
3500 bool wxWindow::HandleSysCommand(
3506 // 4 bits are reserved
3508 switch (SHORT1FROMMP(wParam
))
3511 return HandleMaximize();
3514 return HandleMinimize();
3517 } // end of wxWindow::HandleSysCommand
3519 // ---------------------------------------------------------------------------
3521 // ---------------------------------------------------------------------------
3523 void wxWindow::InitMouseEvent(
3524 wxMouseEvent
& rEvent
3532 rEvent
.m_shiftDown
= ((uFlags
& VK_SHIFT
) != 0);
3533 rEvent
.m_controlDown
= ((uFlags
& VK_CTRL
) != 0);
3534 rEvent
.m_leftDown
= ((uFlags
& VK_BUTTON1
) != 0);
3535 rEvent
.m_middleDown
= ((uFlags
& VK_BUTTON3
) != 0);
3536 rEvent
.m_rightDown
= ((uFlags
& VK_BUTTON2
) != 0);
3537 rEvent
.SetTimestamp(s_currentMsg
.time
);
3538 rEvent
.m_eventObject
= this;
3540 #if wxUSE_MOUSEEVENT_HACK
3543 m_lastMouseEvent
= rEvent
.GetEventType();
3544 #endif // wxUSE_MOUSEEVENT_HACK
3545 } // end of wxWindow::InitMouseEvent
3547 bool wxWindow::HandleMouseEvent(
3555 // The mouse events take consecutive IDs from WM_MOUSEFIRST to
3556 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
3557 // from the message id and take the value in the table to get wxWin event
3560 static const wxEventType eventsMouse
[] =
3574 wxMouseEvent
vEvent(eventsMouse
[uMsg
- WM_MOUSEMOVE
]);
3576 InitMouseEvent( vEvent
3582 return GetEventHandler()->ProcessEvent(vEvent
);
3583 } // end of wxWindow::HandleMouseEvent
3585 bool wxWindow::HandleMouseMove(
3591 if (!m_bMouseInWindow
)
3594 // Generate an ENTER event
3596 m_bMouseInWindow
= TRUE
;
3598 wxMouseEvent
vEvent(wxEVT_ENTER_WINDOW
);
3600 InitMouseEvent( vEvent
3606 (void)GetEventHandler()->ProcessEvent(vEvent
);
3608 return HandleMouseEvent( WM_MOUSEMOVE
3613 } // end of wxWindow::HandleMouseMove
3615 // ---------------------------------------------------------------------------
3616 // keyboard handling
3617 // ---------------------------------------------------------------------------
3620 // Create the key event of the given type for the given key - used by
3621 // HandleChar and HandleKeyDown/Up
3623 wxKeyEvent
wxWindow::CreateKeyEvent(
3629 wxKeyEvent
vEvent(eType
);
3631 vEvent
.SetId(GetId());
3632 vEvent
.m_shiftDown
= IsShiftDown();
3633 vEvent
.m_controlDown
= IsCtrlDown();
3634 vEvent
.m_altDown
= (HIWORD(lParam
) & KC_ALT
) == KC_ALT
;
3636 vEvent
.m_eventObject
= (wxWindow
*)this; // const_cast
3637 vEvent
.m_keyCode
= nId
;
3638 vEvent
.SetTimestamp(s_currentMsg
.time
);
3641 // Translate the position to client coords
3646 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
3647 ::WinQueryWindowRect( GetHwnd()
3651 vPoint
.x
-= vRect
.xLeft
;
3652 vPoint
.y
-= vRect
.yBottom
;
3654 vEvent
.m_x
= vPoint
.x
;
3655 vEvent
.m_y
= vPoint
.y
;
3658 } // end of wxWindow::CreateKeyEvent
3661 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
3664 bool wxWindow::HandleChar(
3670 bool bCtrlDown
= FALSE
;
3676 // If 1 -> 26, translate to CTRL plus a letter.
3679 if ((vId
> 0) && (vId
< 27))
3701 else if ( (vId
= wxCharCodeOS2ToWX(wParam
)) == 0)
3704 // It's ASCII and will be processed here only when called from
3705 // WM_CHAR (i.e. when isASCII = TRUE), don't process it now
3712 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_CHAR
3719 vEvent
.m_controlDown
= TRUE
;
3722 if (GetEventHandler()->ProcessEvent(vEvent
))
3728 bool wxWindow::HandleKeyDown(
3733 int nId
= wxCharCodeOS2ToWX(wParam
);
3738 // Normal ASCII char
3745 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_DOWN
3750 if (GetEventHandler()->ProcessEvent(vEvent
))
3756 } // end of wxWindow::HandleKeyDown
3758 bool wxWindow::HandleKeyUp(
3763 int nId
= wxCharCodeOS2ToWX(wParam
);
3768 // Normal ASCII char
3775 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_UP
3780 if (GetEventHandler()->ProcessEvent(vEvent
))
3784 } // end of wxWindow::HandleKeyUp
3786 // ---------------------------------------------------------------------------
3788 // ---------------------------------------------------------------------------
3790 // ---------------------------------------------------------------------------
3792 // ---------------------------------------------------------------------------
3794 bool wxWindow::OS2OnScroll(
3803 wxWindow
* pChild
= wxFindWinFromHandle(hControl
);
3806 return pChild
->OS2OnScroll( nOrientation
3813 wxScrollWinEvent vEvent
;
3815 vEvent
.SetPosition(wPos
);
3816 vEvent
.SetOrientation(nOrientation
);
3817 vEvent
.m_eventObject
= this;
3822 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEUP
;
3826 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEDOWN
;
3830 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEUP
;
3834 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEDOWN
;
3837 case SB_SLIDERPOSITION
:
3838 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBRELEASE
;
3841 case SB_SLIDERTRACK
:
3842 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBTRACK
;
3848 return GetEventHandler()->ProcessEvent(vEvent
);
3849 } // end of wxWindow::OS2OnScroll
3851 // ===========================================================================
3853 // ===========================================================================
3862 // TODO: we'll do this later
3863 } // end of wxGetCharSize
3866 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
3867 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
3869 int wxCharCodeOS2ToWX(
3877 case VK_BACKTAB
: nId
= WXK_BACK
; break;
3878 case VK_TAB
: nId
= WXK_TAB
; break;
3879 case VK_CLEAR
: nId
= WXK_CLEAR
; break;
3880 case VK_ENTER
: nId
= WXK_RETURN
; break;
3881 case VK_SHIFT
: nId
= WXK_SHIFT
; break;
3882 case VK_CTRL
: nId
= WXK_CONTROL
; break;
3883 case VK_PAUSE
: nId
= WXK_PAUSE
; break;
3884 case VK_SPACE
: nId
= WXK_SPACE
; break;
3885 case VK_ESC
: nId
= WXK_ESCAPE
; break;
3886 case VK_END
: nId
= WXK_END
; break;
3887 case VK_HOME
: nId
= WXK_HOME
; break;
3888 case VK_LEFT
: nId
= WXK_LEFT
; break;
3889 case VK_UP
: nId
= WXK_UP
; break;
3890 case VK_RIGHT
: nId
= WXK_RIGHT
; break;
3891 case VK_DOWN
: nId
= WXK_DOWN
; break;
3892 case VK_PRINTSCRN
: nId
= WXK_PRINT
; break;
3893 case VK_INSERT
: nId
= WXK_INSERT
; break;
3894 case VK_DELETE
: nId
= WXK_DELETE
; break;
3895 case VK_F1
: nId
= WXK_F1
; break;
3896 case VK_F2
: nId
= WXK_F2
; break;
3897 case VK_F3
: nId
= WXK_F3
; break;
3898 case VK_F4
: nId
= WXK_F4
; break;
3899 case VK_F5
: nId
= WXK_F5
; break;
3900 case VK_F6
: nId
= WXK_F6
; break;
3901 case VK_F7
: nId
= WXK_F7
; break;
3902 case VK_F8
: nId
= WXK_F8
; break;
3903 case VK_F9
: nId
= WXK_F9
; break;
3904 case VK_F10
: nId
= WXK_F10
; break;
3905 case VK_F11
: nId
= WXK_F11
; break;
3906 case VK_F12
: nId
= WXK_F12
; break;
3907 case VK_F13
: nId
= WXK_F13
; break;
3908 case VK_F14
: nId
= WXK_F14
; break;
3909 case VK_F15
: nId
= WXK_F15
; break;
3910 case VK_F16
: nId
= WXK_F16
; break;
3911 case VK_F17
: nId
= WXK_F17
; break;
3912 case VK_F18
: nId
= WXK_F18
; break;
3913 case VK_F19
: nId
= WXK_F19
; break;
3914 case VK_F20
: nId
= WXK_F20
; break;
3915 case VK_F21
: nId
= WXK_F21
; break;
3916 case VK_F22
: nId
= WXK_F22
; break;
3917 case VK_F23
: nId
= WXK_F23
; break;
3918 case VK_F24
: nId
= WXK_F24
; break;
3919 case VK_NUMLOCK
: nId
= WXK_NUMLOCK
; break;
3920 case VK_SCRLLOCK
: nId
= WXK_SCROLL
; break;
3927 } // end of wxCharCodeOS2ToWX
3929 int wxCharCodeWXToOS2(
3939 case WXK_CLEAR
: nKeySym
= VK_CLEAR
; break;
3940 case WXK_SHIFT
: nKeySym
= VK_SHIFT
; break;
3941 case WXK_CONTROL
: nKeySym
= VK_CTRL
; break;
3942 case WXK_PAUSE
: nKeySym
= VK_PAUSE
; break;
3943 case WXK_END
: nKeySym
= VK_END
; break;
3944 case WXK_HOME
: nKeySym
= VK_HOME
; break;
3945 case WXK_LEFT
: nKeySym
= VK_LEFT
; break;
3946 case WXK_UP
: nKeySym
= VK_UP
; break;
3947 case WXK_RIGHT
: nKeySym
= VK_RIGHT
; break;
3948 case WXK_DOWN
: nKeySym
= VK_DOWN
; break;
3949 case WXK_PRINT
: nKeySym
= VK_PRINTSCRN
; break;
3950 case WXK_INSERT
: nKeySym
= VK_INSERT
; break;
3951 case WXK_DELETE
: nKeySym
= VK_DELETE
; break;
3952 case WXK_F1
: nKeySym
= VK_F1
; break;
3953 case WXK_F2
: nKeySym
= VK_F2
; break;
3954 case WXK_F3
: nKeySym
= VK_F3
; break;
3955 case WXK_F4
: nKeySym
= VK_F4
; break;
3956 case WXK_F5
: nKeySym
= VK_F5
; break;
3957 case WXK_F6
: nKeySym
= VK_F6
; break;
3958 case WXK_F7
: nKeySym
= VK_F7
; break;
3959 case WXK_F8
: nKeySym
= VK_F8
; break;
3960 case WXK_F9
: nKeySym
= VK_F9
; break;
3961 case WXK_F10
: nKeySym
= VK_F10
; break;
3962 case WXK_F11
: nKeySym
= VK_F11
; break;
3963 case WXK_F12
: nKeySym
= VK_F12
; break;
3964 case WXK_F13
: nKeySym
= VK_F13
; break;
3965 case WXK_F14
: nKeySym
= VK_F14
; break;
3966 case WXK_F15
: nKeySym
= VK_F15
; break;
3967 case WXK_F16
: nKeySym
= VK_F16
; break;
3968 case WXK_F17
: nKeySym
= VK_F17
; break;
3969 case WXK_F18
: nKeySym
= VK_F18
; break;
3970 case WXK_F19
: nKeySym
= VK_F19
; break;
3971 case WXK_F20
: nKeySym
= VK_F20
; break;
3972 case WXK_F21
: nKeySym
= VK_F21
; break;
3973 case WXK_F22
: nKeySym
= VK_F22
; break;
3974 case WXK_F23
: nKeySym
= VK_F23
; break;
3975 case WXK_F24
: nKeySym
= VK_F24
; break;
3976 case WXK_NUMLOCK
: nKeySym
= VK_NUMLOCK
; break;
3977 case WXK_SCROLL
: nKeySym
= VK_SCRLLOCK
; break;
3980 *bIsVirtual
= FALSE
;
3986 } // end of wxCharCodeWXToOS2
3988 wxWindow
* wxGetActiveWindow()
3990 HWND hWnd
= ::WinQueryActiveWindow(HWND_DESKTOP
);
3994 return wxFindWinFromHandle((WXHWND
)hWnd
);
3997 } // end of wxGetActiveWindow
4000 const char* wxGetMessageName(
4005 case 0x0000: return "WM_NULL";
4006 case 0x0001: return "WM_CREATE";
4007 case 0x0002: return "WM_DESTROY";
4008 case 0x0004: return "WM_ENABLE";
4009 case 0x0005: return "WM_SHOW";
4010 case 0x0006: return "WM_MOVE";
4011 case 0x0007: return "WM_SIZE";
4012 case 0x0008: return "WM_ADJUSTWINDOWPOS";
4013 case 0x0009: return "WM_CALCVALIDRECTS";
4014 case 0x000A: return "WM_SETWINDOWPARAMS";
4015 case 0x000B: return "WM_QUERYWINDOWPARAMS";
4016 case 0x000C: return "WM_HITTEST";
4017 case 0x000D: return "WM_ACTIVATE";
4018 case 0x000F: return "WM_SETFOCUS";
4019 case 0x0010: return "WM_SETSELECTION";
4020 case 0x0011: return "WM_PPAINT";
4021 case 0x0012: return "WM_PSETFOCUS";
4022 case 0x0013: return "WM_PSYSCOLORCHANGE";
4023 case 0x0014: return "WM_PSIZE";
4024 case 0x0015: return "WM_PACTIVATE";
4025 case 0x0016: return "WM_PCONTROL";
4026 case 0x0020: return "WM_COMMAND";
4027 case 0x0021: return "WM_SYSCOMMAND";
4028 case 0x0022: return "WM_HELP";
4029 case 0x0023: return "WM_PAINT";
4030 case 0x0024: return "WM_TIMER";
4031 case 0x0025: return "WM_SEM1";
4032 case 0x0026: return "WM_SEM2";
4033 case 0x0027: return "WM_SEM3";
4034 case 0x0028: return "WM_SEM4";
4035 case 0x0029: return "WM_CLOSE";
4036 case 0x002A: return "WM_QUIT";
4037 case 0x002B: return "WM_SYSCOLORCHANGE";
4038 case 0x002D: return "WM_SYSVALUECHANGE";
4039 case 0x002E: return "WM_APPTERMINATENOTIFY";
4040 case 0x002F: return "WM_PRESPARAMCHANGED";
4041 // Control notification messages
4042 case 0x0030: return "WM_CONTROL";
4043 case 0x0031: return "WM_VSCROLL";
4044 case 0x0032: return "WM_HSCROLL";
4045 case 0x0033: return "WM_INITMENU";
4046 case 0x0034: return "WM_MENUSELECT";
4047 case 0x0035: return "WM_MENUSEND";
4048 case 0x0036: return "WM_DRAWITEM";
4049 case 0x0037: return "WM_MEASUREITEM";
4050 case 0x0038: return "WM_CONTROLPOINTER";
4051 case 0x003A: return "WM_QUERYDLGCODE";
4052 case 0x003B: return "WM_INITDLG";
4053 case 0x003C: return "WM_SUBSTITUTESTRING";
4054 case 0x003D: return "WM_MATCHMNEMONIC";
4055 case 0x003E: return "WM_SAVEAPPLICATION";
4056 case 0x0129: return "WM_CTLCOLORCHANGE";
4057 case 0x0130: return "WM_QUERYCTLTYPE";
4059 case 0x0040: return "WM_FLASHWINDOW";
4060 case 0x0041: return "WM_FORMATFRAME";
4061 case 0x0042: return "WM_UPDATEFRAME";
4062 case 0x0043: return "WM_FOCUSCHANGE";
4063 case 0x0044: return "WM_SETBORDERSIZE";
4064 case 0x0045: return "WM_TRACKFRAME";
4065 case 0x0046: return "WM_MINMAXFRAME";
4066 case 0x0047: return "WM_SETICON";
4067 case 0x0048: return "WM_QUERYICON";
4068 case 0x0049: return "WM_SETACCELTABLE";
4069 case 0x004A: return "WM_QUERYACCELTABLE";
4070 case 0x004B: return "WM_TRANSLATEACCEL";
4071 case 0x004C: return "WM_QUERYTRACKINFO";
4072 case 0x004D: return "WM_QUERYBORDERSIZE";
4073 case 0x004E: return "WM_NEXTMENU";
4074 case 0x004F: return "WM_ERASEBACKGROUND";
4075 case 0x0050: return "WM_QUERYFRAMEINFO";
4076 case 0x0051: return "WM_QUERYFOCUSCHAIN";
4077 case 0x0052: return "WM_OWNERPOSCHANGE";
4078 case 0x0053: return "WM_CACLFRAMERECT";
4079 case 0x0055: return "WM_WINDOWPOSCHANGED";
4080 case 0x0056: return "WM_ADJUSTFRAMEPOS";
4081 case 0x0059: return "WM_QUERYFRAMECTLCOUNT";
4082 case 0x005B: return "WM_QUERYHELPINFO";
4083 case 0x005C: return "WM_SETHELPINFO";
4084 case 0x005D: return "WM_ERROR";
4085 case 0x005E: return "WM_REALIZEPALETTE";
4086 // Clipboard messages
4087 case 0x0060: return "WM_RENDERFMT";
4088 case 0x0061: return "WM_RENDERALLFMTS";
4089 case 0x0062: return "WM_DESTROYCLIPBOARD";
4090 case 0x0063: return "WM_PAINTCLIPBOARD";
4091 case 0x0064: return "WM_SIZECLIPBOARD";
4092 case 0x0065: return "WM_HSCROLLCLIPBOARD";
4093 case 0x0066: return "WM_VSCROLLCLIPBOARD";
4094 case 0x0067: return "WM_DRAWCLIPBOARD";
4096 case 0x0070: return "WM_MOUSEMOVE";
4097 case 0x0071: return "WM_BUTTON1DOWN";
4098 case 0x0072: return "WM_BUTTON1UP";
4099 case 0x0073: return "WM_BUTTON1DBLCLK";
4100 case 0x0074: return "WM_BUTTON2DOWN";
4101 case 0x0075: return "WM_BUTTON2UP";
4102 case 0x0076: return "WM_BUTTON2DBLCLK";
4103 case 0x0077: return "WM_BUTTON3DOWN";
4104 case 0x0078: return "WM_BUTTON3UP";
4105 case 0x0079: return "WM_BUTTON3DBLCLK";
4106 case 0x007D: return "WM_MOUSEMAP";
4107 case 0x007E: return "WM_VRNDISABLED";
4108 case 0x007F: return "WM_VRNENABLED";
4109 case 0x0410: return "WM_CHORD";
4110 case 0x0411: return "WM_BUTTON1MOTIONSTART";
4111 case 0x0412: return "WM_BUTTON1MOTIONEND";
4112 case 0x0413: return "WM_BUTTON1CLICK";
4113 case 0x0414: return "WM_BUTTON2MOTIONSTART";
4114 case 0x0415: return "WM_BUTTON2MOTIONEND";
4115 case 0x0416: return "WM_BUTTON2CLICK";
4116 case 0x0417: return "WM_BUTTON3MOTIONSTART";
4117 case 0x0418: return "WM_BUTTON3MOTIONEND";
4118 case 0x0419: return "WM_BUTTON3CLICK";
4119 case 0x0420: return "WM_BEGINDRAG";
4120 case 0x0421: return "WM_ENDDRAG";
4121 case 0x0422: return "WM_SINGLESELECT";
4122 case 0x0423: return "WM_OPEN";
4123 case 0x0424: return "WM_CONTEXTMENU";
4124 case 0x0425: return "WM_CONTEXTHELP";
4125 case 0x0426: return "WM_TEXTEDIT";
4126 case 0x0427: return "WM_BEGINSELECT";
4127 case 0x0228: return "WM_ENDSELECT";
4128 case 0x0429: return "WM_PICKUP";
4129 case 0x04C0: return "WM_PENFIRST";
4130 case 0x04FF: return "WM_PENLAST";
4131 case 0x0500: return "WM_MMPMFIRST";
4132 case 0x05FF: return "WM_MMPMLAST";
4133 case 0x0600: return "WM_STDDLGFIRST";
4134 case 0x06FF: return "WM_STDDLGLAST";
4135 case 0x0BD0: return "WM_BIDI_FIRST";
4136 case 0x0BFF: return "WM_BIDI_LAST";
4138 case 0x007A: return "WM_CHAR";
4139 case 0x007B: return "WM_VIOCHAR";
4141 case 0x00A0: return "WM_DDE_INITIATE";
4142 case 0x00A1: return "WM_DDE_REQUEST";
4143 case 0x00A2: return "WM_DDE_ACK";
4144 case 0x00A3: return "WM_DDE_DATA";
4145 case 0x00A4: return "WM_DDE_ADVISE";
4146 case 0x00A5: return "WM_DDE_UNADVISE";
4147 case 0x00A6: return "WM_DDE_POKE";
4148 case 0x00A7: return "WM_DDE_EXECUTE";
4149 case 0x00A8: return "WM_DDE_TERMINATE";
4150 case 0x00A9: return "WM_DDE_INITIATEACK";
4151 case 0x00AF: return "WM_DDE_LAST";
4153 case 0x0120: return "BM_CLICK";
4154 case 0x0121: return "BM_QUERYCHECKINDEX";
4155 case 0x0122: return "BM_QUERYHILITE";
4156 case 0x0123: return "BM_SETHILITE";
4157 case 0x0124: return "BM_QUERYCHECK";
4158 case 0x0125: return "BM_SETCHECK";
4159 case 0x0126: return "BM_SETDEFAULT";
4160 case 0x0128: return "BM_AUTOSIZE";
4162 case 0x029A: return "CBID_LIST";
4163 case 0x029B: return "CBID_EDIT";
4164 case 0x0170: return "CBM_SHOWLIST";
4165 case 0x0171: return "CBM_HILITE";
4166 case 0x0172: return "CBM_ISLISTSHOWING";
4168 case 0x0140: return "EM_QUERYCHANGED";
4169 case 0x0141: return "EM_QUERYSEL";
4170 case 0x0142: return "EM_SETSEL";
4171 case 0x0143: return "EM_SETTEXTLIMIT";
4172 case 0x0144: return "EM_CUT";
4173 case 0x0145: return "EM_COPY";
4174 case 0x0146: return "EM_CLEAR";
4175 case 0x0147: return "EM_PASTE";
4176 case 0x0148: return "EM_QUERYFIRSTCHAR";
4177 case 0x0149: return "EM_SETFIRSTCHAR";
4178 case 0x014A: return "EM_QUERYREADONLY";
4179 case 0x014B: return "EM_SETREADONLY";
4180 case 0x014C: return "EM_SETINSERTMODE";
4182 case 0x0160: return "LM_QUERYITEMCOUNT";
4183 case 0x0161: return "LM_INSERTITEM";
4184 case 0x0162: return "LM_SETOPENINDEX";
4185 case 0x0163: return "LM_DELETEITEM";
4186 case 0x0164: return "LM_SELECTITEM";
4187 case 0x0165: return "LM_QUERYSELECTION";
4188 case 0x0166: return "LM_SETITEMTEXT";
4189 case 0x0167: return "LM_QUERYITEMTEXTLENGTH";
4190 case 0x0168: return "LM_QUERYITEMTEXT";
4191 case 0x0169: return "LM_SETITEMHANDLE";
4192 case 0x016A: return "LM_QUERYITEMHANDLE";
4193 case 0x016B: return "LM_SEARCHSTRING";
4194 case 0x016C: return "LM_SETITEMHEIGHT";
4195 case 0x016D: return "LM_QUERYTOPINDEX";
4196 case 0x016E: return "LM_DELETEALL";
4197 case 0x016F: return "LM_INSERTMULITEMS";
4198 case 0x0660: return "LM_SETITEMWIDTH";
4200 case 0x0180: return "MM_INSERTITEM";
4201 case 0x0181: return "MM_DELETEITEM";
4202 case 0x0182: return "MM_QUERYITEM";
4203 case 0x0183: return "MM_SETITEM";
4204 case 0x0184: return "MM_QUERYITEMCOUNT";
4205 case 0x0185: return "MM_STARTMENUMODE";
4206 case 0x0186: return "MM_ENDMENUMODE";
4207 case 0x0188: return "MM_REMOVEITEM";
4208 case 0x0189: return "MM_SELECTITEM";
4209 case 0x018A: return "MM_QUERYSELITEMID";
4210 case 0x018B: return "MM_QUERYITEMTEXT";
4211 case 0x018C: return "MM_QUERYITEMTEXTLENGTH";
4212 case 0x018D: return "MM_SETITEMHANDLE";
4213 case 0x018E: return "MM_SETITEMTEXT";
4214 case 0x018F: return "MM_ITEMPOSITIONFROMID";
4215 case 0x0190: return "MM_ITEMIDFROMPOSITION";
4216 case 0x0191: return "MM_QUERYITEMATTR";
4217 case 0x0192: return "MM_SETITEMATTR";
4218 case 0x0193: return "MM_ISITEMVALID";
4219 case 0x0194: return "MM_QUERYITEMRECT";
4220 case 0x0431: return "MM_QUERYDEFAULTITEMID";
4221 case 0x0432: return "MM_SETDEFAULTITEMID";
4223 case 0x01A0: return "SBM_SETSCROLLBAR";
4224 case 0x01A1: return "SBM_SETPOS";
4225 case 0x01A2: return "SBM_QUERYPOS";
4226 case 0x01A3: return "SBM_QUERYRANGE";
4227 case 0x01A6: return "SBM_SETTHUMBSIZE";
4230 case 0x0F00: return "WM_HELPBASE";
4231 case 0x0FFF: return "WM_HELPTOP";
4232 // Beginning of user defined messages
4233 case 0x1000: return "WM_USER";
4235 // wxWindows user defined types
4238 // case 0x1000 + 0: return "LVM_GETBKCOLOR";
4239 case 0x1000 + 1: return "LVM_SETBKCOLOR";
4240 case 0x1000 + 2: return "LVM_GETIMAGELIST";
4241 case 0x1000 + 3: return "LVM_SETIMAGELIST";
4242 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
4243 case 0x1000 + 5: return "LVM_GETITEMA";
4244 case 0x1000 + 75: return "LVM_GETITEMW";
4245 case 0x1000 + 6: return "LVM_SETITEMA";
4246 case 0x1000 + 76: return "LVM_SETITEMW";
4247 case 0x1000 + 7: return "LVM_INSERTITEMA";
4248 case 0x1000 + 77: return "LVM_INSERTITEMW";
4249 case 0x1000 + 8: return "LVM_DELETEITEM";
4250 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
4251 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
4252 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
4253 case 0x1000 + 12: return "LVM_GETNEXTITEM";
4254 case 0x1000 + 13: return "LVM_FINDITEMA";
4255 case 0x1000 + 83: return "LVM_FINDITEMW";
4256 case 0x1000 + 14: return "LVM_GETITEMRECT";
4257 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
4258 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
4259 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
4260 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
4261 case 0x1000 + 18: return "LVM_HITTEST";
4262 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
4263 case 0x1000 + 20: return "LVM_SCROLL";
4264 case 0x1000 + 21: return "LVM_REDRAWITEMS";
4265 case 0x1000 + 22: return "LVM_ARRANGE";
4266 case 0x1000 + 23: return "LVM_EDITLABELA";
4267 case 0x1000 + 118: return "LVM_EDITLABELW";
4268 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
4269 case 0x1000 + 25: return "LVM_GETCOLUMNA";
4270 case 0x1000 + 95: return "LVM_GETCOLUMNW";
4271 case 0x1000 + 26: return "LVM_SETCOLUMNA";
4272 case 0x1000 + 96: return "LVM_SETCOLUMNW";
4273 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
4274 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
4275 case 0x1000 + 28: return "LVM_DELETECOLUMN";
4276 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
4277 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
4278 case 0x1000 + 31: return "LVM_GETHEADER";
4279 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
4280 case 0x1000 + 34: return "LVM_GETVIEWRECT";
4281 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
4282 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
4283 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
4284 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
4285 case 0x1000 + 39: return "LVM_GETTOPINDEX";
4286 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
4287 case 0x1000 + 41: return "LVM_GETORIGIN";
4288 case 0x1000 + 42: return "LVM_UPDATE";
4289 case 0x1000 + 43: return "LVM_SETITEMSTATE";
4290 case 0x1000 + 44: return "LVM_GETITEMSTATE";
4291 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
4292 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
4293 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
4294 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
4295 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
4296 case 0x1000 + 48: return "LVM_SORTITEMS";
4297 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
4298 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
4299 case 0x1000 + 51: return "LVM_GETITEMSPACING";
4300 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
4301 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
4302 case 0x1000 + 53: return "LVM_SETICONSPACING";
4303 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
4304 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
4305 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
4306 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
4307 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
4308 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
4309 case 0x1000 + 60: return "LVM_SETHOTITEM";
4310 case 0x1000 + 61: return "LVM_GETHOTITEM";
4311 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
4312 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
4313 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
4314 case 0x1000 + 65: return "LVM_SETWORKAREA";
4317 case 0x1100 + 0: return "TVM_INSERTITEMA";
4318 case 0x1100 + 50: return "TVM_INSERTITEMW";
4319 case 0x1100 + 1: return "TVM_DELETEITEM";
4320 case 0x1100 + 2: return "TVM_EXPAND";
4321 case 0x1100 + 4: return "TVM_GETITEMRECT";
4322 case 0x1100 + 5: return "TVM_GETCOUNT";
4323 case 0x1100 + 6: return "TVM_GETINDENT";
4324 case 0x1100 + 7: return "TVM_SETINDENT";
4325 case 0x1100 + 8: return "TVM_GETIMAGELIST";
4326 case 0x1100 + 9: return "TVM_SETIMAGELIST";
4327 case 0x1100 + 10: return "TVM_GETNEXTITEM";
4328 case 0x1100 + 11: return "TVM_SELECTITEM";
4329 case 0x1100 + 12: return "TVM_GETITEMA";
4330 case 0x1100 + 62: return "TVM_GETITEMW";
4331 case 0x1100 + 13: return "TVM_SETITEMA";
4332 case 0x1100 + 63: return "TVM_SETITEMW";
4333 case 0x1100 + 14: return "TVM_EDITLABELA";
4334 case 0x1100 + 65: return "TVM_EDITLABELW";
4335 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
4336 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
4337 case 0x1100 + 17: return "TVM_HITTEST";
4338 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
4339 case 0x1100 + 19: return "TVM_SORTCHILDREN";
4340 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
4341 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
4342 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
4343 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
4344 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
4345 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
4346 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
4349 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
4350 case 0x1200 + 1: return "HDM_INSERTITEMA";
4351 case 0x1200 + 10: return "HDM_INSERTITEMW";
4352 case 0x1200 + 2: return "HDM_DELETEITEM";
4353 case 0x1200 + 3: return "HDM_GETITEMA";
4354 case 0x1200 + 11: return "HDM_GETITEMW";
4355 case 0x1200 + 4: return "HDM_SETITEMA";
4356 case 0x1200 + 12: return "HDM_SETITEMW";
4357 case 0x1200 + 5: return "HDM_LAYOUT";
4358 case 0x1200 + 6: return "HDM_HITTEST";
4359 case 0x1200 + 7: return "HDM_GETITEMRECT";
4360 case 0x1200 + 8: return "HDM_SETIMAGELIST";
4361 case 0x1200 + 9: return "HDM_GETIMAGELIST";
4362 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
4363 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
4364 case 0x1200 + 17: return "HDM_GETORDERARRAY";
4365 case 0x1200 + 18: return "HDM_SETORDERARRAY";
4366 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
4369 case 0x1300 + 2: return "TCM_GETIMAGELIST";
4370 case 0x1300 + 3: return "TCM_SETIMAGELIST";
4371 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
4372 case 0x1300 + 5: return "TCM_GETITEMA";
4373 case 0x1300 + 60: return "TCM_GETITEMW";
4374 case 0x1300 + 6: return "TCM_SETITEMA";
4375 case 0x1300 + 61: return "TCM_SETITEMW";
4376 case 0x1300 + 7: return "TCM_INSERTITEMA";
4377 case 0x1300 + 62: return "TCM_INSERTITEMW";
4378 case 0x1300 + 8: return "TCM_DELETEITEM";
4379 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
4380 case 0x1300 + 10: return "TCM_GETITEMRECT";
4381 case 0x1300 + 11: return "TCM_GETCURSEL";
4382 case 0x1300 + 12: return "TCM_SETCURSEL";
4383 case 0x1300 + 13: return "TCM_HITTEST";
4384 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
4385 case 0x1300 + 40: return "TCM_ADJUSTRECT";
4386 case 0x1300 + 41: return "TCM_SETITEMSIZE";
4387 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
4388 case 0x1300 + 43: return "TCM_SETPADDING";
4389 case 0x1300 + 44: return "TCM_GETROWCOUNT";
4390 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
4391 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
4392 case 0x1300 + 47: return "TCM_GETCURFOCUS";
4393 case 0x1300 + 48: return "TCM_SETCURFOCUS";
4394 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
4395 case 0x1300 + 50: return "TCM_DESELECTALL";
4398 case WM_USER
+1000+1: return "TB_ENABLEBUTTON";
4399 case WM_USER
+1000+2: return "TB_CHECKBUTTON";
4400 case WM_USER
+1000+3: return "TB_PRESSBUTTON";
4401 case WM_USER
+1000+4: return "TB_HIDEBUTTON";
4402 case WM_USER
+1000+5: return "TB_INDETERMINATE";
4403 case WM_USER
+1000+9: return "TB_ISBUTTONENABLED";
4404 case WM_USER
+1000+10: return "TB_ISBUTTONCHECKED";
4405 case WM_USER
+1000+11: return "TB_ISBUTTONPRESSED";
4406 case WM_USER
+1000+12: return "TB_ISBUTTONHIDDEN";
4407 case WM_USER
+1000+13: return "TB_ISBUTTONINDETERMINATE";
4408 case WM_USER
+1000+17: return "TB_SETSTATE";
4409 case WM_USER
+1000+18: return "TB_GETSTATE";
4410 case WM_USER
+1000+19: return "TB_ADDBITMAP";
4411 case WM_USER
+1000+20: return "TB_ADDBUTTONS";
4412 case WM_USER
+1000+21: return "TB_INSERTBUTTON";
4413 case WM_USER
+1000+22: return "TB_DELETEBUTTON";
4414 case WM_USER
+1000+23: return "TB_GETBUTTON";
4415 case WM_USER
+1000+24: return "TB_BUTTONCOUNT";
4416 case WM_USER
+1000+25: return "TB_COMMANDTOINDEX";
4417 case WM_USER
+1000+26: return "TB_SAVERESTOREA";
4418 case WM_USER
+1000+76: return "TB_SAVERESTOREW";
4419 case WM_USER
+1000+27: return "TB_CUSTOMIZE";
4420 case WM_USER
+1000+28: return "TB_ADDSTRINGA";
4421 case WM_USER
+1000+77: return "TB_ADDSTRINGW";
4422 case WM_USER
+1000+29: return "TB_GETITEMRECT";
4423 case WM_USER
+1000+30: return "TB_BUTTONSTRUCTSIZE";
4424 case WM_USER
+1000+31: return "TB_SETBUTTONSIZE";
4425 case WM_USER
+1000+32: return "TB_SETBITMAPSIZE";
4426 case WM_USER
+1000+33: return "TB_AUTOSIZE";
4427 case WM_USER
+1000+35: return "TB_GETTOOLTIPS";
4428 case WM_USER
+1000+36: return "TB_SETTOOLTIPS";
4429 case WM_USER
+1000+37: return "TB_SETPARENT";
4430 case WM_USER
+1000+39: return "TB_SETROWS";
4431 case WM_USER
+1000+40: return "TB_GETROWS";
4432 case WM_USER
+1000+42: return "TB_SETCMDID";
4433 case WM_USER
+1000+43: return "TB_CHANGEBITMAP";
4434 case WM_USER
+1000+44: return "TB_GETBITMAP";
4435 case WM_USER
+1000+45: return "TB_GETBUTTONTEXTA";
4436 case WM_USER
+1000+75: return "TB_GETBUTTONTEXTW";
4437 case WM_USER
+1000+46: return "TB_REPLACEBITMAP";
4438 case WM_USER
+1000+47: return "TB_SETINDENT";
4439 case WM_USER
+1000+48: return "TB_SETIMAGELIST";
4440 case WM_USER
+1000+49: return "TB_GETIMAGELIST";
4441 case WM_USER
+1000+50: return "TB_LOADIMAGES";
4442 case WM_USER
+1000+51: return "TB_GETRECT";
4443 case WM_USER
+1000+52: return "TB_SETHOTIMAGELIST";
4444 case WM_USER
+1000+53: return "TB_GETHOTIMAGELIST";
4445 case WM_USER
+1000+54: return "TB_SETDISABLEDIMAGELIST";
4446 case WM_USER
+1000+55: return "TB_GETDISABLEDIMAGELIST";
4447 case WM_USER
+1000+56: return "TB_SETSTYLE";
4448 case WM_USER
+1000+57: return "TB_GETSTYLE";
4449 case WM_USER
+1000+58: return "TB_GETBUTTONSIZE";
4450 case WM_USER
+1000+59: return "TB_SETBUTTONWIDTH";
4451 case WM_USER
+1000+60: return "TB_SETMAXTEXTROWS";
4452 case WM_USER
+1000+61: return "TB_GETTEXTROWS";
4453 case WM_USER
+1000+41: return "TB_GETBITMAPFLAGS";
4456 static char s_szBuf
[128];
4457 sprintf(s_szBuf
, "<unknown message = %d>", nMessage
);
4461 } // end of wxGetMessageName
4463 #endif // __WXDEBUG__
4465 static void TranslateKbdEventToMouse(
4473 // Construct the key mask
4474 ULONG
& fwKeys
= *pFlags
;
4476 fwKeys
= VK_BUTTON2
;
4477 if ((::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x100) != 0)
4479 if ((::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x100) != 0)
4483 // Simulate right mouse button click
4487 ::WinQueryMsgPos(vHabmain
, &vPoint
);
4491 pWin
->ScreenToClient(pX
, pY
);
4492 } // end of TranslateKbdEventToMouse
4494 // Find the wxWindow at the current mouse position, returning the mouse
4496 wxWindow
* wxFindWindowAtPointer(
4500 return wxFindWindowAtPoint(wxGetMousePosition());
4503 wxWindow
* wxFindWindowAtPoint(
4512 HWND hWndHit
= ::WinWindowFromPoint(HWND_DESKTOP
, &vPt2
, FALSE
);
4513 wxWindow
* pWin
= wxFindWinFromHandle((WXHWND
)hWndHit
) ;
4514 HWND hWnd
= hWndHit
;
4517 // Try to find a window with a wxWindow associated with it
4519 while (!pWin
&& (hWnd
!= 0))
4521 hWnd
= ::WinQueryWindow(hWnd
, QW_PARENT
);
4522 pWin
= wxFindWinFromHandle((WXHWND
)hWnd
) ;
4527 // Get the current mouse position.
4528 wxPoint
wxGetMousePosition()
4532 ::WinQueryPointerPos(HWND_DESKTOP
, &vPt
);
4533 return wxPoint(vPt
.x
, vPt
.y
);