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(wxWindowOS2::OnEraseBackground
)
153 EVT_SYS_COLOUR_CHANGED(wxWindowOS2::OnSysColourChanged
)
154 EVT_INIT_DIALOG(wxWindowOS2::OnInitDialog
)
155 EVT_IDLE(wxWindowOS2::OnIdle
)
156 EVT_SET_FOCUS(wxWindowOS2::OnSetFocus
)
159 // ===========================================================================
161 // ===========================================================================
164 // Find an item given the PM Window id
166 wxWindow
* wxWindowOS2::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 wxWindowOS2::FindItem
202 // Find an item given the PM Window handle
204 wxWindow
* wxWindowOS2::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 wxWindowOS2::FindItemByHWND
241 // Default command handler
243 bool wxWindowOS2::OS2Command(
244 WXUINT
WXUNUSED(uParam
)
245 , WXWORD
WXUNUSED(uId
)
251 // ----------------------------------------------------------------------------
252 // constructors and such
253 // ----------------------------------------------------------------------------
255 void wxWindowOS2::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
299 } // wxWindowOS2::Init
304 wxWindowOS2::~wxWindowOS2()
306 m_isBeingDeleted
= TRUE
;
308 OS2DetachWindowMenu();
309 for (wxWindow
* pWin
= GetParent(); pWin
; pWin
= pWin
->GetParent())
311 wxFrame
* pFrame
= wxDynamicCast(pWin
, wxFrame
);
315 if (pFrame
->GetLastFocus() == this)
316 pFrame
->SetLastFocus((wxWindow
*)NULL
);
320 m_parent
->RemoveChild(this);
325 if(!::WinDestroyWindow(GetHWND()))
326 wxLogLastError(wxT("DestroyWindow"));
328 // remove hWnd <-> wxWindow association
330 wxRemoveHandleAssociation(this);
332 } // end of wxWindowOS2::~wxWindowOS2
334 bool wxWindowOS2::Create(
337 , const wxPoint
& rPos
338 , const wxSize
& rSize
340 , const wxString
& rName
343 HWND hParent
= NULLHANDLE
;
344 wxPoint vPos
= rPos
; // The OS/2 position
345 ULONG ulCreateFlags
= 0L;
347 wxCHECK_MSG(pParent
, FALSE
, wxT("can't create wxWindow without parent"));
349 if ( !CreateBase( pParent
363 pParent
->AddChild(this);
364 hParent
= GetWinHwnd(pParent
);
366 // OS2 uses normal coordinates, no bassackwards Windows ones
368 if (pParent
->IsKindOf(CLASSINFO(wxGenericScrolledWindow
)) ||
369 pParent
->IsKindOf(CLASSINFO(wxScrolledWindow
))
372 wxWindow
* pGrandParent
= NULL
;
374 pGrandParent
= pParent
->GetParent();
376 nTempy
= pGrandParent
->GetSize().y
- (vPos
.y
+ rSize
.y
);
378 nTempy
= pParent
->GetSize().y
- (vPos
.y
+ rSize
.y
);
381 nTempy
= pParent
->GetSize().y
- (vPos
.y
+ rSize
.y
);
383 if ( pParent
->IsKindOf(CLASSINFO(wxGenericScrolledWindow
)) ||
384 pParent
->IsKindOf(CLASSINFO(wxScrolledWindow
))
386 ulCreateFlags
|= WS_CLIPSIBLINGS
;
392 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
393 hParent
= HWND_DESKTOP
;
394 vPos
.y
= vRect
.yTop
- (vPos
.y
+ rSize
.y
);
398 // Most wxSTYLES are really PM Class specific styles and will be
399 // set in those class create procs. PM's basic windows styles are
402 ulCreateFlags
|= WS_VISIBLE
;
405 if (lStyle
& wxCLIP_SIBLINGS
)
406 ulCreateFlags
|= WS_CLIPSIBLINGS
;
408 if (lStyle
& wxCLIP_CHILDREN
)
409 ulCreateFlags
|= WS_CLIPCHILDREN
;
415 WXDWORD dwExStyle
= Determine3DEffects( WS_EX_CLIENTEDGE
420 // Add the simple border style as we'll use this to draw borders
422 if (lStyle
& wxSIMPLE_BORDER
)
423 dwExStyle
|= wxSIMPLE_BORDER
;
426 // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
427 // and no presentation parameters
430 ,(PSZ
)wxCanvasClassName
435 ,WidthDefault(rSize
.x
)
436 ,HeightDefault(rSize
.y
)
446 } // end of wxWindowOS2::Create
448 // ---------------------------------------------------------------------------
450 // ---------------------------------------------------------------------------
452 void wxWindowOS2::SetFocus()
454 HWND hWnd
= GetHwnd();
457 ::WinSetFocus(HWND_DESKTOP
, hWnd
);
458 } // end of wxWindowOS2::SetFocus
460 wxWindow
* wxWindowBase::FindFocus()
462 HWND hWnd
= ::WinQueryFocus(HWND_DESKTOP
);
466 return wxFindWinFromHandle((WXHWND
)hWnd
);
469 } // wxWindowBase::FindFocus
471 bool wxWindowOS2::Enable(
475 if (!wxWindowBase::Enable(bEnable
))
478 HWND hWnd
= GetHwnd();
481 ::WinEnableWindow(hWnd
, (BOOL
)bEnable
);
483 wxWindowList::Node
* pNode
= GetChildren().GetFirst();
487 wxWindow
* pChild
= pNode
->GetData();
489 pChild
->Enable(bEnable
);
490 pNode
= pNode
->GetNext();
493 } // end of wxWindowOS2::Enable
495 bool wxWindowOS2::Show(
499 if (!wxWindowBase::Show(bShow
))
502 HWND hWnd
= GetHwnd();
504 ::WinShowWindow(hWnd
, bShow
);
508 ::WinSetWindowPos(hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_ACTIVATE
| SWP_ZORDER
);
511 } // end of wxWindowOS2::Show
513 void wxWindowOS2::Raise()
515 ::WinSetWindowPos(GetHwnd(), HWND_TOP
, 0, 0, 0, 0, SWP_ZORDER
| SWP_ACTIVATE
);
516 } // end of wxWindowOS2::Raise
518 void wxWindowOS2::Lower()
520 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_ZORDER
| SWP_DEACTIVATE
);
521 } // end of wxWindowOS2::Lower
523 void wxWindowOS2::SetTitle(
524 const wxString
& rTitle
527 ::WinSetWindowText(GetHwnd(), rTitle
.c_str());
528 } // end of wxWindowOS2::SetTitle
530 wxString
wxWindowOS2::GetTitle() const
532 return wxGetWindowText(GetHWND());
533 } // end of wxWindowOS2::GetTitle
535 void wxWindowOS2::CaptureMouse()
537 HWND hWnd
= GetHwnd();
539 if (hWnd
&& !m_bWinCaptured
)
541 ::WinSetCapture(HWND_DESKTOP
, hWnd
);
542 m_bWinCaptured
= TRUE
;
544 } // end of wxWindowOS2::GetTitle
546 void wxWindowOS2::ReleaseMouse()
550 ::WinSetCapture(HWND_DESKTOP
, NULLHANDLE
);
551 m_bWinCaptured
= FALSE
;
553 } // end of wxWindowOS2::ReleaseMouse
555 /* static */ wxWindow
* wxWindowBase::GetCapture()
557 HWND hwnd
= ::WinQueryCapture(HWND_DESKTOP
);
558 return hwnd
? wxFindWinFromHandle((WXHWND
)hwnd
) : (wxWindow
*)NULL
;
559 } // end of wxWindowBase::GetCapture
561 bool wxWindowOS2::SetFont(
565 if (!wxWindowBase::SetFont(rFont
))
571 HWND hWnd
= GetHwnd();
577 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), rFont
.GetFaceName().c_str());
578 return(::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
), (PVOID
)zFont
));
583 bool wxWindowOS2::SetCursor(
584 const wxCursor
& rCursor
585 ) // check if base implementation is OK
587 if ( !wxWindowBase::SetCursor(rCursor
))
593 wxASSERT_MSG( m_cursor
.Ok(),
594 wxT("cursor must be valid after call to the base version"));
596 HWND hWnd
= GetHwnd();
602 hPS
= ::WinGetPS(hWnd
);
604 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
605 ::WinQueryWindowRect(hWnd
, &vRect
);
607 hRGN
= ::GpiCreateRegion(hPS
, 1L, &vRect
);
609 if ((::GpiPtInRegion(hPS
, hRGN
, &vPoint
) == PRGN_INSIDE
) && !wxIsBusy())
611 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)m_cursor
.GetHCURSOR());
614 } // end of wxWindowOS2::SetCursor
616 void wxWindowOS2::WarpPointer(
625 ::WinQueryWindowRect(GetHwnd(), &vRect
);
629 ::WinSetPointerPos(HWND_DESKTOP
, (LONG
)nX
, (LONG
)(nY
));
630 } // end of wxWindowOS2::WarpPointer
632 #if WXWIN_COMPATIBILITY
633 void wxWindowOS2::OS2DeviceToLogical (float *x
, float *y
) const
636 #endif // WXWIN_COMPATIBILITY
638 // ---------------------------------------------------------------------------
640 // ---------------------------------------------------------------------------
642 #if WXWIN_COMPATIBILITY
643 void wxWindowOS2::SetScrollRange(
649 int nRange1
= nRange
;
650 int nPageSize
= GetScrollPage(nOrient
);
652 if (nPpageSize
> 1 && nRange
> 0)
654 nRange1
+= (nPageSize
- 1);
657 if (nOrient
== wxHORIZONTAL
)
659 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, (SHORT
)nRange1
));
660 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
664 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, (SHORT
)nRange1
));
665 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
667 } // end of wxWindowOS2::SetScrollRange
669 void wxWindowOS2::SetScrollPage(
675 if (nOrient
== wxHORIZONTAL
)
676 m_nXThumbSize
= nPage
;
678 m_nYThumbSize
= nPage
;
679 } // end of wxWindowOS2::SetScrollPage
681 int wxWindowOS2::OldGetScrollRange(
686 HWND hWnd
= GetHwnd();
690 mRc
= WinSendMsg(hWnd
, SBM_QUERYRANGE
, (MPARAM
)0L, (MPARAM
)0L);
691 return(SHORT2FROMMR(mRc
));
694 } // end of wxWindowOS2::OldGetScrollRange
696 int wxWindowOS2::GetScrollPage(
700 if (nOrient
== wxHORIZONTAL
)
701 return m_nXThumbSize
;
703 return m_nYThumbSize
;
704 } // end of wxWindowOS2::GetScrollPage
705 #endif // WXWIN_COMPATIBILITY
707 int wxWindowOS2::GetScrollPos(
711 if (nOrient
== wxHORIZONTAL
)
712 return((int)::WinSendMsg(m_hWndScrollBarHorz
, SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
714 return((int)::WinSendMsg(m_hWndScrollBarVert
, SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
715 } // end of wxWindowOS2::GetScrollPos
717 int wxWindowOS2::GetScrollRange(
723 if (nOrient
== wxHORIZONTAL
)
724 mr
= ::WinSendMsg(m_hWndScrollBarHorz
, SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
726 mr
= ::WinSendMsg(m_hWndScrollBarVert
, SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
727 return((int)SHORT2FROMMR(mr
));
728 } // end of wxWindowOS2::GetScrollRange
730 int wxWindowOS2::GetScrollThumb(
734 if (nOrient
== wxHORIZONTAL
)
735 return m_nXThumbSize
;
737 return m_nYThumbSize
;
738 } // end of wxWindowOS2::GetScrollThumb
740 void wxWindowOS2::SetScrollPos(
746 if (nOrient
== wxHORIZONTAL
)
747 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
749 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
750 } // end of wxWindowOS2::SetScrollPos(
752 void wxWindowOS2::SetScrollbar(
760 int nOldRange
= nRange
- nThumbVisible
;
761 int nRange1
= nOldRange
;
762 int nPageSize
= nThumbVisible
;
764 HWND hWnd
= GetHwnd();
765 ULONG ulStyle
= WS_VISIBLE
| WS_SYNCPAINT
;
768 ::WinQueryWindowRect(hWnd
, &vRect
);
769 if (nPageSize
> 1 && nRange
> 0)
771 nRange1
+= (nPageSize
- 1);
774 vInfo
.cb
= sizeof(SBCDATA
);
776 vInfo
.posLast
= (SHORT
)nRange1
;
777 vInfo
.posThumb
= nPos
;
779 if (nOrient
== wxHORIZONTAL
)
782 if (m_hWndScrollBarHorz
== 0L)
785 // We create the scrollbars with the desktop so that they are not
786 // registered as child windows of the window in order that child
787 // windows may be scrolled without scrolling the scrollbars themselves!
789 m_hWndScrollBarHorz
= ::WinCreateWindow( hWnd
795 ,vRect
.xRight
- vRect
.xLeft
809 // Only want to resize the scrollbar if it changes, otherwise
810 // we'd probably end up in a recursive loop until we crash the call stack
811 // because this method is called in a ScrolledWindow OnSize event and SWP_MOVE | SWP_SIZE
812 // generates those events.
814 ::WinQueryWindowRect(m_hWndScrollBarHorz
, &vRect2
);
815 if (!(vRect2
.xLeft
== vRect
.xLeft
&&
816 vRect2
.xRight
== vRect
.xRight
&&
817 vRect2
.yBottom
== vRect
.yBottom
&&
818 vRect2
.yTop
== vRect
.yTop
821 ::WinSetWindowPos( m_hWndScrollBarHorz
825 ,vRect
.xRight
- vRect
.xLeft
827 ,SWP_ACTIVATE
| SWP_MOVE
| SWP_SIZE
| SWP_SHOW
830 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, (SHORT
)nRange1
));
831 ::WinSendMsg(m_hWndScrollBarHorz
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
837 if (m_hWndScrollBarVert
== 0L)
839 m_hWndScrollBarVert
= ::WinCreateWindow( hWnd
846 ,vRect
.yTop
- (vRect
.yBottom
+ 20)
859 // Only want to resize the scrollbar if it changes, otherwise
860 // we'd probably end up in a recursive loop until we crash the call stack
861 // because this method is called in a ScrolledWindow OnSize event and SWP_MOVE | SWP_SIZE
862 // generates those events.
864 ::WinQueryWindowRect(m_hWndScrollBarVert
, &vRect2
);
865 if (!(vRect2
.xLeft
== vRect
.xLeft
&&
866 vRect2
.xRight
== vRect
.xRight
&&
867 vRect2
.yBottom
== vRect
.yBottom
&&
868 vRect2
.yTop
== vRect
.yTop
871 ::WinSetWindowPos( m_hWndScrollBarVert
876 ,vRect
.yTop
- (vRect
.yBottom
+ 20)
877 ,SWP_ACTIVATE
| SWP_MOVE
| SWP_SIZE
| SWP_SHOW
880 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, (SHORT
)nRange1
));
881 ::WinSendMsg(m_hWndScrollBarVert
, SBM_SETTHUMBSIZE
, MPFROM2SHORT((SHORT
)nThumbVisible
, (SHORT
)nRange1
), (MPARAM
)0);
883 m_nYThumbSize
= nThumbVisible
;
885 } // end of wxWindowOS2::SetScrollbar
887 void wxWindowOS2::ScrollWindow(
890 , const wxRect
* pRect
896 nDy
*= -1; // flip the sign of Dy as OS/2 is opposite wxWin.
899 vRect2
.xLeft
= pRect
->x
;
900 vRect2
.yTop
= pRect
->y
+ pRect
->height
;
901 vRect2
.xRight
= pRect
->x
+ pRect
->width
;
902 vRect2
.yBottom
= pRect
->y
;
906 ::WinQueryWindowRect(GetHwnd(), &vRect2
);
907 ::WinQueryWindowRect(m_hWndScrollBarHorz
, &vRect
);
908 vRect2
.yBottom
+= vRect
.yTop
- vRect
.yBottom
;
909 ::WinQueryWindowRect(m_hWndScrollBarVert
, &vRect
);
910 vRect2
.xRight
-= vRect
.xRight
- vRect
.xLeft
;
914 ::WinScrollWindow( GetHwnd()
924 ::WinScrollWindow( GetHwnd()
936 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
941 wxWindow
* pChildWin
= pCurrent
->GetData();
943 if (pChildWin
->GetHWND() != NULLHANDLE
)
945 ::WinQueryWindowPos(pChildWin
->GetHWND(), &vSwp
);
946 ::WinQueryWindowRect(pChildWin
->GetHWND(), &vRect
);
947 if (pChildWin
->GetHWND() == m_hWndScrollBarVert
||
948 pChildWin
->GetHWND() == m_hWndScrollBarHorz
)
950 ::WinSetWindowPos( pChildWin
->GetHWND()
956 ,SWP_MOVE
| SWP_SHOW
| SWP_ZORDER
961 ::WinSetWindowPos( pChildWin
->GetHWND()
967 ,SWP_MOVE
| SWP_ZORDER
969 ::WinInvalidateRect(pChildWin
->GetHWND(), &vRect
, FALSE
);
972 pCurrent
= pCurrent
->GetNext();
974 } // end of wxWindowOS2::ScrollWindow
976 // ---------------------------------------------------------------------------
978 // ---------------------------------------------------------------------------
980 void wxWindowOS2::SubclassWin(
984 HWND hwnd
= (HWND
)hWnd
;
986 wxASSERT_MSG( !m_fnOldWndProc
, wxT("subclassing window twice?") );
987 wxCHECK_RET(::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in SubclassWin") );
988 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(hwnd
, (PFNWP
)wxWndProc
);
989 } // end of wxWindowOS2::SubclassWin
991 void wxWindowOS2::UnsubclassWin()
994 // Restore old Window proc
996 HWND hwnd
= GetHWND();
1000 wxCHECK_RET( ::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in UnsubclassWin") );
1002 PFNWP fnProc
= (PFNWP
)::WinQueryWindowPtr(hwnd
, QWP_PFNWP
);
1004 if ( (m_fnOldWndProc
!= 0) && (fnProc
!= (PFNWP
) m_fnOldWndProc
))
1006 WinSubclassWindow(hwnd
, (PFNWP
)m_fnOldWndProc
);
1010 } // end of wxWindowOS2::UnsubclassWin
1013 // Make a Windows extended style from the given wxWindows window style
1015 WXDWORD
wxWindowOS2::MakeExtendedStyle(
1017 , bool bEliminateBorders
1021 // Simply fill out with wxWindow extended styles. We'll conjure
1022 // something up in OS2Create and all window redrawing pieces later
1024 WXDWORD dwStyle
= 0;
1026 if (lStyle
& wxTRANSPARENT_WINDOW
)
1027 dwStyle
|= wxTRANSPARENT_WINDOW
;
1029 if (!bEliminateBorders
)
1031 if (lStyle
& wxSUNKEN_BORDER
)
1032 dwStyle
|= wxSUNKEN_BORDER
;
1033 if (lStyle
& wxDOUBLE_BORDER
)
1034 dwStyle
|= wxDOUBLE_BORDER
;
1035 if (lStyle
& wxRAISED_BORDER
)
1036 dwStyle
|= wxRAISED_BORDER
;
1037 if (lStyle
& wxSTATIC_BORDER
)
1038 dwStyle
|= wxSTATIC_BORDER
;
1041 } // end of wxWindowOS2::MakeExtendedStyle
1044 // Determines whether simulated 3D effects or CTL3D should be used,
1045 // applying a default border style if required, and returning an extended
1046 // style to pass to OS2Create.
1048 WXDWORD
wxWindowOS2::Determine3DEffects(
1049 WXDWORD dwDefaultBorderStyle
1053 WXDWORD dwStyle
= 0L;
1056 // Native PM does not have any specialize 3D effects like WIN32 does,
1057 // so we have to try and invent them.
1061 // If matches certain criteria, then assume no 3D effects
1062 // unless specifically requested (dealt with in MakeExtendedStyle)
1065 !IsKindOf(CLASSINFO(wxControl
)) ||
1066 (m_windowStyle
& wxNO_BORDER
)
1070 return MakeExtendedStyle(m_windowStyle
, FALSE
);
1074 // 1) App can specify global 3D effects
1076 *pbWant3D
= wxTheApp
->GetAuto3D();
1079 // 2) If the parent is being drawn with user colours, or simple border
1080 // specified, switch effects off.
1083 (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS
) ||
1084 (m_windowStyle
& wxSIMPLE_BORDER
)
1089 // 3) Control can override this global setting by defining
1090 // a border style, e.g. wxSUNKEN_BORDER
1092 if ((m_windowStyle
& wxDOUBLE_BORDER
) ||
1093 (m_windowStyle
& wxRAISED_BORDER
) ||
1094 (m_windowStyle
& wxSTATIC_BORDER
) ||
1095 (m_windowStyle
& wxSUNKEN_BORDER
)
1099 dwStyle
= MakeExtendedStyle( m_windowStyle
1104 // If we want 3D, but haven't specified a border here,
1105 // apply the default border style specified.
1107 if (dwDefaultBorderStyle
&& (*pbWant3D
) &&
1108 !((m_windowStyle
& wxDOUBLE_BORDER
) ||
1109 (m_windowStyle
& wxRAISED_BORDER
) ||
1110 (m_windowStyle
& wxSTATIC_BORDER
) ||
1111 (m_windowStyle
& wxSIMPLE_BORDER
)
1114 dwStyle
|= dwDefaultBorderStyle
;
1116 } // end of wxWindowOS2::Determine3DEffects
1118 #if WXWIN_COMPATIBILITY
1119 void wxWindowOS2::OnCommand(
1121 , wxCommandEvent
& rEvent
1124 if (GetEventHandler()->ProcessEvent(rEvent
))
1127 m_parent
->GetEventHandler()->OnCommand( rWin
1130 } // end of wxWindowOS2::OnCommand
1132 wxObject
* wxWindowOS2::GetChild(
1137 // Return a pointer to the Nth object in the Panel
1139 wxNode
* pNode
= GetChildren().First();
1142 while (pNode
&& n
--)
1143 pNode
= pNode
->Next();
1146 wxObject
* pObj
= (wxObject
*)pNode
->Data();
1151 } // end of wxWindowOS2::GetChild
1153 #endif // WXWIN_COMPATIBILITY
1156 // Setup background and foreground colours correctly
1158 void wxWindowOS2::SetupColours()
1161 SetBackgroundColour(GetParent()->GetBackgroundColour());
1162 } // end of wxWindowOS2::SetupColours
1164 void wxWindowOS2::OnIdle(
1169 // Check if we need to send a LEAVE event
1171 if (m_bMouseInWindow
)
1175 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
1176 if (::WinWindowFromPoint(HWND_DESKTOP
, &vPoint
, FALSE
) != (HWND
)GetHwnd())
1179 // Generate a LEAVE event
1181 m_bMouseInWindow
= FALSE
;
1184 // Unfortunately the mouse button and keyboard state may have changed
1185 // by the time the OnIdle function is called, so 'state' may be
1190 if (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) != 0)
1192 if (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) != 0);
1195 wxMouseEvent
rEvent(wxEVT_LEAVE_WINDOW
);
1197 InitMouseEvent( rEvent
1202 (void)GetEventHandler()->ProcessEvent(rEvent
);
1206 } // end of wxWindowOS2::OnIdle
1209 // Set this window to be the child of 'parent'.
1211 bool wxWindowOS2::Reparent(
1215 if (!wxWindowBase::Reparent(pParent
))
1218 HWND hWndChild
= GetHwnd();
1219 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
1221 ::WinSetParent(hWndChild
, hWndParent
, TRUE
);
1223 } // end of wxWindowOS2::Reparent
1225 void wxWindowOS2::Clear()
1227 wxClientDC
vDc(this);
1228 wxBrush
vBrush( GetBackgroundColour()
1232 vDc
.SetBackground(vBrush
);
1234 } // end of wxWindowOS2::Clear
1236 void wxWindowOS2::Refresh(
1238 , const wxRect
* pRect
1241 HWND hWnd
= GetHwnd();
1249 vOs2Rect
.xLeft
= pRect
->x
;
1250 vOs2Rect
.yTop
= pRect
->y
;
1251 vOs2Rect
.xRight
= pRect
->x
+ pRect
->width
;
1252 vOs2Rect
.yBottom
= pRect
->y
+ pRect
->height
;
1254 ::WinInvalidateRect(hWnd
, &vOs2Rect
, bEraseBack
);
1257 ::WinInvalidateRect(hWnd
, NULL
, bEraseBack
);
1259 } // end of wxWindowOS2::Refresh
1261 // ---------------------------------------------------------------------------
1263 // ---------------------------------------------------------------------------
1265 #if wxUSE_DRAG_AND_DROP
1266 void wxWindowOS2::SetDropTarget(
1267 wxDropTarget
* pDropTarget
1270 if (m_dropTarget
!= 0)
1272 m_dropTarget
->Revoke(m_hWnd
);
1273 delete m_dropTarget
;
1275 m_dropTarget
= pDropTarget
;
1276 if (m_dropTarget
!= 0)
1277 m_dropTarget
->Register(m_hWnd
);
1278 } // end of wxWindowOS2::SetDropTarget
1282 // old style file-manager drag&drop support: we retain the old-style
1283 // DragAcceptFiles in parallel with SetDropTarget.
1285 void wxWindowOS2::DragAcceptFiles(
1289 HWND hWnd
= GetHwnd();
1291 if (hWnd
&& bAccept
)
1292 ::DrgAcceptDroppedFiles(hWnd
, NULL
, NULL
, DO_COPY
, 0L);
1293 } // end of wxWindowOS2::DragAcceptFiles
1295 // ----------------------------------------------------------------------------
1297 // ----------------------------------------------------------------------------
1301 void wxWindowOS2::DoSetToolTip(
1305 wxWindowBase::DoSetToolTip(pTooltip
);
1308 m_tooltip
->SetWindow(this);
1309 } // end of wxWindowOS2::DoSetToolTip
1311 #endif // wxUSE_TOOLTIPS
1313 // ---------------------------------------------------------------------------
1314 // moving and resizing
1315 // ---------------------------------------------------------------------------
1318 void wxWindowOS2::DoGetSize(
1323 HWND hWnd
= GetHwnd();
1326 ::WinQueryWindowRect(hWnd
, &vRect
);
1329 *pWidth
= vRect
.xRight
- vRect
.xLeft
;
1331 // OS/2 PM is backwards from windows
1332 *pHeight
= vRect
.yTop
- vRect
.yBottom
;
1333 } // end of wxWindowOS2::DoGetSize
1335 void wxWindowOS2::DoGetPosition(
1340 HWND hWnd
= GetHwnd();
1344 ::WinQueryWindowRect(hWnd
, &vRect
);
1346 vPoint
.x
= vRect
.xLeft
;
1347 vPoint
.y
= vRect
.yBottom
;
1350 // We do the adjustments with respect to the parent only for the "real"
1351 // children, not for the dialogs/frames
1355 HWND hParentWnd
= 0;
1356 wxWindow
* pParent
= GetParent();
1359 hParentWnd
= GetWinHwnd(pParent
);
1362 // Since we now have the absolute screen coords, if there's a parent we
1363 // must subtract its bottom left corner
1369 ::WinQueryWindowRect(hParentWnd
, &vRect2
);
1370 vPoint
.x
-= vRect
.xLeft
;
1371 vPoint
.y
-= vRect
.yBottom
;
1375 // We may be faking the client origin. So a window that's really at (0,
1376 // 30) may appear (to wxWin apps) to be at (0, 0).
1378 wxPoint
vPt(pParent
->GetClientAreaOrigin());
1388 } // end of wxWindowOS2::DoGetPosition
1390 void wxWindowOS2::DoScreenToClient(
1395 HWND hWnd
= GetHwnd();
1398 ::WinQueryWindowPos(hWnd
, &vSwp
);
1404 } // end of wxWindowOS2::DoScreenToClient
1406 void wxWindowOS2::DoClientToScreen(
1411 HWND hWnd
= GetHwnd();
1414 ::WinQueryWindowPos(hWnd
, &vSwp
);
1420 } // end of wxWindowOS2::DoClientToScreen
1423 // Get size *available for subwindows* i.e. excluding menu bar etc.
1424 // Must be a frame type window
1426 void wxWindowOS2::DoGetClientSize(
1431 HWND hWnd
= GetHwnd();
1435 if (IsKindOf(CLASSINFO(wxFrame
)))
1436 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1438 hWndClient
= NULLHANDLE
;
1439 if( hWndClient
== NULLHANDLE
)
1440 ::WinQueryWindowRect(GetHwnd(), &vRect
);
1442 ::WinQueryWindowRect(hWndClient
, &vRect
);
1445 *pWidth
= vRect
.xRight
;
1447 *pHeight
= vRect
.yTop
;
1448 } // end of wxWindowOS2::DoGetClientSize
1450 void wxWindowOS2::DoMoveWindow(
1459 wxWindow
* pParent
= GetParent();
1462 hParent
= GetWinHwnd(pParent
);
1464 hParent
= HWND_DESKTOP
;
1465 ::WinQueryWindowRect(hParent
, &vRect
);
1466 nY
= vRect
.yTop
- (nY
+ nHeight
);
1468 if ( !::WinSetWindowPos( GetHwnd()
1474 ,SWP_SIZE
| SWP_MOVE
1477 wxLogLastError("MoveWindow");
1479 } // end of wxWindowOS2::DoMoveWindow
1482 // Set the size of the window: if the dimensions are positive, just use them,
1483 // but if any of them is equal to -1, it means that we must find the value for
1484 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
1485 // which case -1 is a valid value for x and y)
1487 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
1488 // the width/height to best suit our contents, otherwise we reuse the current
1491 void wxWindowOS2::DoSetSize(
1500 // Get the current size and position...
1506 wxSize
vSize(-1, -1);
1508 GetPosition( &nCurrentX
1511 GetSize( &nCurrentWidth
1516 // ... and don't do anything (avoiding flicker) if it's already ok
1518 if ( nX
== nCurrentX
&&
1520 nWidth
== nCurrentWidth
&&
1521 nHeight
== nCurrentHeight
1527 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1529 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1532 AdjustForParentClientOrigin( nX
1539 if (nSizeFlags
& wxSIZE_AUTO_WIDTH
)
1541 vSize
= DoGetBestSize();
1547 // Just take the current one
1549 nWidth
= nCurrentWidth
;
1555 if (nSizeFlags
& wxSIZE_AUTO_HEIGHT
)
1559 vSize
= DoGetBestSize();
1565 // just take the current one
1566 nHeight
= nCurrentHeight
;
1575 } // end of wxWindowOS2::DoSetSize
1577 void wxWindowOS2::DoSetClientSize(
1582 wxWindow
* pParent
= GetParent();
1583 HWND hWnd
= GetHwnd();
1584 HWND hParentWnd
= (HWND
)0;
1585 HWND hClientWnd
= (HWND
)0;
1590 hClientWnd
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1591 ::WinQueryWindowRect(hClientWnd
, &vRect2
);
1594 hParentWnd
= (HWND
) pParent
->GetHWND();
1596 ::WinQueryWindowRect(hWnd
, &vRect
);
1597 ::WinQueryWindowRect(hParentWnd
, &vRect3
);
1599 // Find the difference between the entire window (title bar and all)
1600 // and the client area; add this to the new client size to move the
1601 // window. OS/2 is backward from windows on height
1603 int nActualWidth
= vRect2
.xRight
- vRect2
.xLeft
- vRect
.xRight
+ nWidth
;
1604 int nActualHeight
= vRect2
.yTop
- vRect2
.yBottom
- vRect
.yTop
+ nHeight
;
1607 // If there's a parent, must subtract the parent's bottom left corner
1608 // since MoveWindow moves relative to the parent
1612 vPoint
.x
= vRect2
.xLeft
;
1613 vPoint
.y
= vRect2
.yBottom
;
1616 vPoint
.x
-= vRect3
.xLeft
;
1617 vPoint
.y
-= vRect3
.yBottom
;
1620 DoMoveWindow( vPoint
.x
1626 wxSizeEvent
vEvent( wxSize( nWidth
1632 vEvent
.SetEventObject(this);
1633 GetEventHandler()->ProcessEvent(vEvent
);
1634 } // end of wxWindowOS2::DoSetClientSize
1636 wxPoint
wxWindowOS2::GetClientAreaOrigin() const
1638 return wxPoint(0, 0);
1639 } // end of wxWindowOS2::GetClientAreaOrigin
1641 void wxWindowOS2::AdjustForParentClientOrigin(
1648 // Don't do it for the dialogs/frames - they float independently of their
1653 wxWindow
* pParent
= GetParent();
1655 if (!(nSizeFlags
& wxSIZE_NO_ADJUSTMENTS
) && pParent
)
1657 wxPoint
vPoint(pParent
->GetClientAreaOrigin());
1662 } // end of wxWindowOS2::AdjustForParentClientOrigin
1664 // ---------------------------------------------------------------------------
1666 // ---------------------------------------------------------------------------
1668 int wxWindowOS2::GetCharHeight() const
1671 FONTMETRICS vFontMetrics
;
1674 hPs
= ::WinGetPS(GetHwnd());
1676 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1678 ::WinReleasePS(hPs
);
1681 ::WinReleasePS(hPs
);
1682 return(vFontMetrics
.lMaxAscender
+ vFontMetrics
.lMaxDescender
);
1683 } // end of wxWindowOS2::GetCharHeight
1685 int wxWindowOS2::GetCharWidth() const
1688 FONTMETRICS vFontMetrics
;
1690 hPs
= ::WinGetPS(GetHwnd());
1692 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1694 ::WinReleasePS(hPs
);
1697 ::WinReleasePS(hPs
);
1698 return(vFontMetrics
.lAveCharWidth
);
1699 } // end of wxWindowOS2::GetCharWidth
1701 void wxWindowOS2::GetTextExtent(
1702 const wxString
& rString
1706 , int* pExternalLeading
1707 , const wxFont
* pTheFont
1710 const wxFont
* pFontToUse
= pTheFont
;
1713 hPs
= ::WinGetPS(GetHwnd());
1715 // TODO: Will have to play with fonts later
1718 pFontToUse = &m_font;
1721 HFONT hFfontOld = 0;
1723 if (pFontToUse && pFontToUse->Ok())
1726 hFnt = (HFONT)((wxFont *)pFontToUse)->GetResourceHandle(); // const_cast
1728 hFontOld = (HFONT)SelectObject(dc,fnt);
1733 GetTextExtentPoint(dc, string, (int)string.Length(), &sizeRect);
1734 GetTextMetrics(dc, &tm);
1736 if ( fontToUse && fnt && hfontOld )
1737 SelectObject(dc, hfontOld);
1739 ReleaseDC(hWnd, dc);
1746 *descent = tm.tmDescent;
1747 if ( externalLeading )
1748 *externalLeading = tm.tmExternalLeading;
1750 ::WinReleasePS(hPs
);
1753 #if wxUSE_CARET && WXWIN_COMPATIBILITY
1754 // ---------------------------------------------------------------------------
1755 // Caret manipulation
1756 // ---------------------------------------------------------------------------
1758 void wxWindowOS2::CreateCaret(
1763 SetCaret(new wxCaret( this
1767 } // end of wxWindowOS2::CreateCaret
1769 void wxWindowOS2::CreateCaret(
1770 const wxBitmap
* pBitmap
1773 wxFAIL_MSG("not implemented");
1774 } // end of wxWindowOS2::CreateCaret
1776 void wxWindowOS2::ShowCaret(
1780 wxCHECK_RET( m_caret
, "no caret to show" );
1782 m_caret
->Show(bShow
);
1783 } // end of wxWindowOS2::ShowCaret
1785 void wxWindowOS2::DestroyCaret()
1788 } // end of wxWindowOS2::DestroyCaret
1790 void wxWindowOS2::SetCaretPos(
1794 wxCHECK_RET( m_caret
, "no caret to move" );
1799 } // end of wxWindowOS2::SetCaretPos
1801 void wxWindowOS2::GetCaretPos(
1806 wxCHECK_RET( m_caret
, "no caret to get position of" );
1808 m_caret
->GetPosition( pX
1811 } // end of wxWindowOS2::GetCaretPos
1813 #endif //wxUSE_CARET
1815 // ---------------------------------------------------------------------------
1817 // ---------------------------------------------------------------------------
1819 static void wxYieldForCommandsOnly()
1822 // Peek all WM_COMMANDs (it will always return WM_QUIT too but we don't
1823 // want to process it here)
1827 while (::WinPeekMsg( vHabmain
1833 ) && vMsg
.msg
!= WM_QUIT
)
1835 wxTheApp
->DoMessage((WXMSG
*)&vMsg
);
1839 bool wxWindowOS2::DoPopupMenu(
1845 HWND hWnd
= GetHwnd();
1846 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
1847 HWND hMenu
= GetHmenuOf(pMenu
);
1849 pMenu
->SetInvokingWindow(this);
1852 DoClientToScreen( &nX
1855 wxCurrentPopupMenu
= pMenu
;
1857 ::WinPopupMenu( hWndParent
1863 ,PU_MOUSEBUTTON2DOWN
| PU_MOUSEBUTTON2
| PU_KEYBOARD
1865 // we need to do it righ now as otherwise the events are never going to be
1866 // sent to wxCurrentPopupMenu from HandleCommand()
1868 // note that even eliminating (ugly) wxCurrentPopupMenu global wouldn't
1869 // help and we'd still need wxYieldForCommandsOnly() as the menu may be
1870 // destroyed as soon as we return (it can be a local variable in the caller
1871 // for example) and so we do need to process the event immediately
1872 wxYieldForCommandsOnly();
1873 wxCurrentPopupMenu
= NULL
;
1875 pMenu
->SetInvokingWindow(NULL
);
1877 } // end of wxWindowOS2::DoPopupMenu
1879 // ===========================================================================
1880 // pre/post message processing
1881 // ===========================================================================
1883 MRESULT
wxWindowOS2::OS2DefWindowProc(
1890 return (MRESULT
)m_fnOldWndProc(GetHWND(), (ULONG
)uMsg
, (MPARAM
)wParam
, (MPARAM
)lParam
);
1892 return ::WinDefWindowProc(GetHWND(), (ULONG
)uMsg
, (MPARAM
)wParam
, (MPARAM
)lParam
);
1893 } // end of wxWindowOS2::OS2DefWindowProc
1895 bool wxWindowOS2::OS2ProcessMessage(
1899 QMSG
* pQMsg
= (QMSG
*)pMsg
;
1901 if (m_hWnd
!= 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL
))
1904 // Intercept dialog navigation keys
1906 bool bProcess
= TRUE
;
1907 USHORT uKeyFlags
= SHORT1FROMMP(pQMsg
->mp1
);
1909 if (uKeyFlags
& KC_KEYUP
)
1912 if (uKeyFlags
& KC_ALT
)
1915 if (!(uKeyFlags
& KC_VIRTUALKEY
))
1920 bool bCtrlDown
= IsCtrlDown();
1921 bool bShiftDown
= IsShiftDown();
1924 // WM_QUERYDLGCODE: ask the control if it wants the key for itself,
1925 // don't process it if it's the case (except for Ctrl-Tab/Enter
1926 // combinations which are always processed)
1928 ULONG ulDlgCode
= 0;
1932 ulDlgCode
= (ULONG
)::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0);
1935 bool bForward
= TRUE
;
1936 bool bWindowChange
= FALSE
;
1938 switch (SHORT2FROMMP(pQMsg
->mp2
))
1941 // Going to make certain assumptions about specific types of controls
1942 // here, so we may have to alter some things later if they prove invalid
1946 // Shift tabl will always be a nav-key but tabs may be wanted
1955 // Entry Fields want tabs for themselve usually
1959 case DLGC_ENTRYFIELD
:
1969 // Ctrl-Tab cycles thru notebook pages
1971 bWindowChange
= bCtrlDown
;
1972 bForward
= !bShiftDown
;
1995 // ctrl-enter is not processed
1999 else if (ulDlgCode
& DLGC_BUTTON
)
2002 // buttons want process Enter themselevs
2008 wxPanel
* pPanel
= wxDynamicCast(this, wxPanel
);
2009 wxButton
* pBtn
= NULL
;
2014 // Panel may have a default button which should
2015 // be activated by Enter
2017 pBtn
= pPanel
->GetDefaultItem();
2020 if (pBtn
&& pBtn
->IsEnabled())
2023 // If we do have a default button, do press it
2025 pBtn
->OS2Command(BN_CLICKED
, 0 /* unused */);
2028 // else: but if it does not it makes sense to make
2029 // it work like a TAB - and that's what we do.
2030 // Note that Ctrl-Enter always works this way.
2041 wxNavigationKeyEvent vEvent
;
2043 vEvent
.SetDirection(bForward
);
2044 vEvent
.SetWindowChange(bWindowChange
);
2045 vEvent
.SetEventObject(this);
2047 if (GetEventHandler()->ProcessEvent(vEvent
))
2049 wxButton
* pBtn
= wxDynamicCast(FindFocus(), wxButton
);
2054 // The button which has focus should be default
2063 // Let Dialogs process
2065 if (::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0));
2072 // relay mouse move events to the tooltip control
2073 QMSG
* pQMsg
= (QMSG
*)pMsg
;
2075 if (pQMsg
->msg
== WM_MOUSEMOVE
)
2076 m_tooltip
->RelayEvent(pMsg
);
2078 #endif // wxUSE_TOOLTIPS
2081 } // end of wxWindowOS2::OS2ProcessMessage
2083 bool wxWindowOS2::OS2TranslateMessage(
2088 return m_acceleratorTable
.Translate(m_hWnd
, pMsg
);
2091 #endif //wxUSE_ACCEL
2092 } // end of wxWindowOS2::OS2TranslateMessage
2094 // ---------------------------------------------------------------------------
2095 // message params unpackers
2096 // ---------------------------------------------------------------------------
2098 void wxWindowOS2::UnpackCommand(
2106 *pId
= LOWORD(wParam
);
2107 *phWnd
= NULL
; // or may be GetHWND() ?
2108 *pCmd
= LOWORD(lParam
);
2109 } // end of wxWindowOS2::UnpackCommand
2111 void wxWindowOS2::UnpackActivate(
2118 *pState
= LOWORD(wParam
);
2119 *phWnd
= (WXHWND
)lParam
;
2120 } // end of wxWindowOS2::UnpackActivate
2122 void wxWindowOS2::UnpackScroll(
2133 ulId
= (ULONG
)LONGFROMMP(wParam
);
2134 hWnd
= ::WinWindowFromID(GetHwnd(), ulId
);
2135 if (hWnd
== m_hWndScrollBarHorz
|| hWnd
== m_hWndScrollBarVert
)
2136 *phWnd
= NULLHANDLE
;
2140 *pPos
= SHORT1FROMMP(lParam
);
2141 *pCode
= SHORT2FROMMP(lParam
);
2142 } // end of wxWindowOS2::UnpackScroll
2144 void wxWindowOS2::UnpackMenuSelect(
2152 *pItem
= (WXWORD
)LOWORD(wParam
);
2153 *pFlags
= HIWORD(wParam
);
2154 *phMenu
= (WXHMENU
)lParam
;
2155 } // end of wxWindowOS2::UnpackMenuSelect
2157 // ---------------------------------------------------------------------------
2158 // Main wxWindows window proc and the window proc for wxWindow
2159 // ---------------------------------------------------------------------------
2162 // Hook for new window just as it's being created, when the window isn't yet
2163 // associated with the handle
2165 wxWindow
* wxWndHook
= NULL
;
2170 MRESULT EXPENTRY
wxWndProc(
2178 // Trace all ulMsgs - useful for the debugging
2181 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
2182 wxGetMessageName(ulMsg
), wParam
, lParam
);
2183 #endif // __WXDEBUG__
2185 wxWindow
* pWnd
= wxFindWinFromHandle((WXHWND
)hWnd
);
2188 // When we get the first message for the HWND we just created, we associate
2189 // it with wxWindow stored in wxWndHook
2191 if (!pWnd
&& wxWndHook
)
2193 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
2196 pWnd
->SetHWND((WXHWND
)hWnd
);
2199 MRESULT rc
= (MRESULT
)0;
2203 // Stop right here if we don't have a valid handle in our wxWindow object.
2205 if (pWnd
&& !pWnd
->GetHWND())
2207 pWnd
->SetHWND((WXHWND
) hWnd
);
2208 rc
= pWnd
->OS2DefWindowProc(ulMsg
, wParam
, lParam
);
2214 rc
= pWnd
->OS2WindowProc(ulMsg
, wParam
, lParam
);
2216 rc
= ::WinDefWindowProc(hWnd
, ulMsg
, wParam
, lParam
);
2220 } // end of wxWndProc
2223 // We will add (or delete) messages we need to handle at this default
2226 MRESULT
wxWindowOS2::OS2WindowProc(
2233 // Did we process the uMsg?
2235 bool bProcessed
= FALSE
;
2242 // For most messages we should return 0 when we do process the message
2244 mResult
= (MRESULT
)0;
2252 bProcessed
= HandleCreate( (WXLPCREATESTRUCT
)lParam
2258 // Return 0 to bAllow window creation
2260 mResult
= (MRESULT
)(bMayCreate
? 0 : -1);
2271 bProcessed
= HandleMove( LOWORD(lParam
)
2277 bProcessed
= HandleSize( LOWORD(lParam
)
2288 UnpackActivate( wParam
2294 bProcessed
= HandleActivate( wState
2302 if (SHORT1FROMMP((MPARAM
)lParam
) == TRUE
)
2303 bProcessed
= HandleSetFocus((WXHWND
)(HWND
)wParam
);
2305 bProcessed
= HandleKillFocus((WXHWND
)(HWND
)wParam
);
2309 bProcessed
= HandlePaint();
2314 // Don't let the DefWindowProc() destroy our window - we'll do it
2315 // ourselves in ~wxWindow
2318 mResult
= (MRESULT
)TRUE
;
2322 bProcessed
= HandleShow(wParam
!= 0, (int)lParam
);
2326 // Under OS2 PM Joysticks are treated just like mouse events
2327 // The "Motion" events will be prevelent in joysticks
2330 case WM_BUTTON1DOWN
:
2332 case WM_BUTTON1DBLCLK
:
2333 case WM_BUTTON1MOTIONEND
:
2334 case WM_BUTTON1MOTIONSTART
:
2335 case WM_BUTTON2DOWN
:
2337 case WM_BUTTON2DBLCLK
:
2338 case WM_BUTTON2MOTIONEND
:
2339 case WM_BUTTON2MOTIONSTART
:
2340 case WM_BUTTON3DOWN
:
2342 case WM_BUTTON3DBLCLK
:
2343 case WM_BUTTON3MOTIONEND
:
2344 case WM_BUTTON3MOTIONSTART
:
2346 short x
= LOWORD(lParam
);
2347 short y
= HIWORD(lParam
);
2349 bProcessed
= HandleMouseEvent(uMsg
, x
, y
, (WXUINT
)wParam
);
2353 bProcessed
= HandleSysCommand(wParam
, lParam
);
2360 UnpackCommand(wParam
, lParam
, &id
, &hwnd
, &cmd
);
2362 bProcessed
= HandleCommand(id
, cmd
, hwnd
);
2367 // For these messages we must return TRUE if process the message
2370 case WM_MEASUREITEM
:
2372 int nIdCtrl
= (UINT
)wParam
;
2374 if ( uMsg
== WM_DRAWITEM
)
2376 bProcessed
= OS2OnDrawItem(nIdCtrl
,
2377 (WXDRAWITEMSTRUCT
*)lParam
);
2381 bProcessed
= OS2OnMeasureItem(nIdCtrl
,
2382 (WXMEASUREITEMSTRUCT
*)lParam
);
2386 mResult
= (MRESULT
)TRUE
;
2390 case WM_QUERYDLGCODE
:
2393 mResult
= (MRESULT
)m_lDlgCode
;
2397 //else: get the dlg code from the DefWindowProc()
2402 // In OS/2 PM all keyboard events are of the WM_CHAR type. Virtual key and key-up
2403 // and key-down events are obtained from the WM_CHAR params.
2407 USHORT uKeyFlags
= SHORT1FROMMP((MPARAM
)wParam
);
2409 if (uKeyFlags
& KC_KEYUP
)
2411 bProcessed
= HandleKeyUp((WXDWORD
)wParam
, lParam
);
2414 else // keydown event
2417 // If this has been processed by an event handler,
2418 // return 0 now (we've handled it). DON't RETURN
2419 // we still need to process further
2421 HandleKeyDown((WXDWORD
)wParam
, lParam
);
2422 if (uKeyFlags
& KC_VIRTUALKEY
)
2424 USHORT uVk
= SHORT2FROMMP((MPARAM
)lParam
);
2427 // We consider these message "not interesting" to OnChar
2429 if (uVk
== VK_SHIFT
|| uVk
== VK_CTRL
)
2437 // Avoid duplicate messages to OnChar for these ASCII keys: they
2438 // will be translated by TranslateMessage() and received in WM_CHAR
2444 // But set processed to FALSE, not TRUE to still pass them to
2445 // the control's default window proc - otherwise built-in
2446 // keyboard handling won't work
2455 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
);
2459 else // WM_CHAR -- Always an ASCII character
2461 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
, TRUE
);
2473 UnpackScroll( wParam
2480 bProcessed
= OS2OnScroll( uMsg
== WM_HSCROLL
? wxHORIZONTAL
2489 #if defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
2490 case WM_CTLCOLORCHANGE
:
2492 bProcessed
= HandleCtlColor(&hBrush
);
2496 case WM_ERASEBACKGROUND
:
2498 // Returning TRUE to requestw PM to paint the window background
2499 // in SYSCLR_WINDOW. We don't really want that
2501 bProcessed
= HandleEraseBkgnd((WXHDC
)(HPS
)wParam
);
2502 mResult
= (MRESULT
)(FALSE
);
2506 // Instead of CTLCOLOR messages PM sends QUERYWINDOWPARAMS to
2507 // things such as colors and fonts and such
2509 case WM_QUERYWINDOWPARAMS
:
2511 PWNDPARAMS pWndParams
= (PWNDPARAMS
)wParam
;
2513 bProcessed
= HandleWindowParams( pWndParams
2519 // the return value for this message is ignored
2520 case WM_SYSCOLORCHANGE
:
2521 bProcessed
= HandleSysColorChange();
2524 case WM_REALIZEPALETTE
:
2525 bProcessed
= HandlePaletteChanged();
2528 case WM_PRESPARAMCHANGED
:
2529 bProcessed
= HandlePresParamChanged(wParam
);
2533 // move all drag and drops to wxDrg
2535 bProcessed
= HandleEndDrag(wParam
);
2539 bProcessed
= HandleInitDialog((WXHWND
)(HWND
)wParam
);
2543 // we never set focus from here
2548 // wxFrame specific message
2549 case WM_MINMAXFRAME
:
2550 bProcessed
= HandleGetMinMaxInfo((PSWP
)wParam
);
2553 case WM_SYSVALUECHANGED
:
2554 // TODO: do something
2555 mResult
= (MRESULT
)TRUE
;
2559 // Comparable to WM_SETPOINTER for windows, only for just controls
2561 case WM_CONTROLPOINTER
:
2562 bProcessed
= HandleSetCursor( SHORT1FROMMP(wParam
) // Control ID
2563 ,(HWND
)lParam
// Cursor Handle
2568 // Returning TRUE stops the DefWindowProc() from further
2569 // processing this message - exactly what we need because we've
2570 // just set the cursor.
2572 mResult
= (MRESULT
)TRUE
;
2579 wxLogTrace(wxTraceMessages
, wxT("Forwarding %s to DefWindowProc."),
2580 wxGetMessageName(uMsg
));
2581 #endif // __WXDEBUG__
2582 if (IsKindOf(CLASSINFO(wxFrame
)))
2583 mResult
= ::WinDefWindowProc(m_hWnd
, uMsg
, wParam
, lParam
);
2585 mResult
= OS2DefWindowProc(uMsg
, wParam
, lParam
);
2588 } // end of wxWindowOS2::OS2WindowProc
2591 // Dialog window proc
2599 if (uMsg
== WM_INITDLG
)
2602 // For this message, returning TRUE tells system to set focus to the
2603 // first control in the dialog box
2605 return (MRESULT
)TRUE
;
2610 // For all the other ones, FALSE means that we didn't process the
2615 } // end of wxDlgProc
2617 wxWindow
* wxFindWinFromHandle(
2621 wxNode
* pNode
= wxWinHandleList
->Find((long)hWnd
);
2625 return (wxWindow
*)pNode
->Data();
2626 } // end of wxFindWinFromHandle
2628 void wxAssociateWinWithHandle(
2634 // Adding NULL hWnd is (first) surely a result of an error and
2635 // (secondly) breaks menu command processing
2637 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
2638 wxT("attempt to add a NULL hWnd to window list ignored") );
2641 wxWindow
* pOldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
2643 if (pOldWin
&& (pOldWin
!= pWin
))
2645 wxString
str(pWin
->GetClassInfo()->GetClassName());
2646 wxLogError( "Bug! Found existing HWND %X for new window of class %s"
2653 wxWinHandleList
->Append( (long)hWnd
2657 } // end of wxAssociateWinWithHandle
2659 void wxRemoveHandleAssociation(
2663 wxWinHandleList
->DeleteObject(pWin
);
2664 } // end of wxRemoveHandleAssociation
2667 // Default destroyer - override if you destroy it in some other way
2668 // (e.g. with MDI child windows)
2670 void wxWindowOS2::OS2DestroyWindow()
2674 void wxWindowOS2::OS2DetachWindowMenu()
2678 HMENU hMenu
= (HMENU
)m_hMenu
;
2680 int nN
= (int)::WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
2683 for (i
= 0; i
< nN
; i
++)
2686 int nChars
= (int)::WinSendMsg( hMenu
2688 ,MPFROM2SHORT(i
, nN
)
2693 wxLogLastError(wxT("GetMenuString"));
2697 if (wxStrcmp(zBuf
, wxT("&Window")) == 0)
2699 ::WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
2704 } // end of wxWindowOS2::OS2DetachWindowMenu
2706 bool wxWindowOS2::OS2Create(
2709 , const wxChar
* zTitle
2717 , unsigned long ulId
2728 long lHeight1
= 20L;
2730 int nNeedsubclass
= 0;
2731 PCSZ pszClass
= zClass
;
2734 // Find parent's size, if it exists, to set up a possible default
2735 // panel size the size of the parent window
2750 // check to see if the new window is a standard control
2752 if ((ULONG
)zClass
== (ULONG
)WC_BUTTON
||
2753 (ULONG
)zClass
== (ULONG
)WC_COMBOBOX
||
2754 (ULONG
)zClass
== (ULONG
)WC_CONTAINER
||
2755 (ULONG
)zClass
== (ULONG
)WC_ENTRYFIELD
||
2756 (ULONG
)zClass
== (ULONG
)WC_FRAME
||
2757 (ULONG
)zClass
== (ULONG
)WC_LISTBOX
||
2758 (ULONG
)zClass
== (ULONG
)WC_MENU
||
2759 (ULONG
)zClass
== (ULONG
)WC_NOTEBOOK
||
2760 (ULONG
)zClass
== (ULONG
)WC_SCROLLBAR
||
2761 (ULONG
)zClass
== (ULONG
)WC_SPINBUTTON
||
2762 (ULONG
)zClass
== (ULONG
)WC_STATIC
||
2763 (ULONG
)zClass
== (ULONG
)WC_TITLEBAR
||
2764 (ULONG
)zClass
== (ULONG
)WC_VALUESET
2771 // no standard controls
2772 if(wxString (wxT("wxFrameClass")) == wxString(zClass
) )
2774 pszClass
= WC_FRAME
;
2781 nControlId
= FID_CLIENT
;
2786 // We will either have a registered class via string name or a standard PM Class via a long
2788 m_hWnd
= (WXHWND
)::WinCreateWindow( (HWND
)hParent
2790 ,(PSZ
)zTitle
? zTitle
: wxT("")
2804 vError
= ::WinGetLastError(vHabmain
);
2805 sError
= wxPMErrorToStr(vError
);
2806 wxLogError("Can't create window of class %s!. Error: %s\n", zClass
, sError
);
2809 m_dwExStyle
= dwExStyle
;
2810 ::WinSetWindowULong(m_hWnd
, QWL_USER
, (ULONG
) this);
2814 wxNode
* pNode
= wxWinHandleList
->Member(this);
2818 HWND hWnd
= (HWND
)pNode
->GetKeyInteger();
2820 if (hWnd
!= (HWND
)m_hWnd
)
2823 wxLogError("A second HWND association is being added for the same window!");
2827 wxAssociateWinWithHandle((HWND
)m_hWnd
2831 // Now need to subclass window.
2835 wxAssociateWinWithHandle((HWND
)m_hWnd
,this);
2839 SubclassWin(GetHWND());
2842 } // end of wxWindowOS2::OS2Create
2844 // ===========================================================================
2845 // OS2 PM message handlers
2846 // ===========================================================================
2848 // ---------------------------------------------------------------------------
2849 // window creation/destruction
2850 // ---------------------------------------------------------------------------
2852 bool wxWindowOS2::HandleCreate(
2853 WXLPCREATESTRUCT vCs
2857 wxWindowCreateEvent
vEvent(this);
2859 (void)GetEventHandler()->ProcessEvent(vEvent
);
2860 *pbMayCreate
= TRUE
;
2862 } // end of wxWindowOS2::HandleCreate
2864 bool wxWindowOS2::HandleDestroy()
2866 wxWindowDestroyEvent
vEvent(this);
2868 (void)GetEventHandler()->ProcessEvent(vEvent
);
2871 // Delete our drop target if we've got one
2873 #if wxUSE_DRAG_AND_DROP
2874 if (m_dropTarget
!= NULL
)
2876 m_dropTarget
->Revoke(m_hWnd
);
2877 delete m_dropTarget
;
2878 m_dropTarget
= NULL
;
2880 #endif // wxUSE_DRAG_AND_DROP
2883 // WM_DESTROY handled
2886 } // end of wxWindowOS2::HandleDestroy
2888 // ---------------------------------------------------------------------------
2890 // ---------------------------------------------------------------------------
2891 void wxWindowOS2::OnSetFocus(
2892 wxFocusEvent
& rEvent
2896 // Panel wants to track the window which was the last to have focus in it,
2897 // so we want to set ourselves as the window which last had focus
2899 // Notice that it's also important to do it upwards the tree becaus
2900 // otherwise when the top level panel gets focus, it won't set it back to
2901 // us, but to some other sibling
2903 wxWindow
* pWin
= this;
2907 wxWindow
* pParent
= pWin
->GetParent();
2908 wxPanel
* pPanel
= wxDynamicCast( pParent
2913 pPanel
->SetLastFocus(pWin
);
2918 wxLogTrace(_T("focus"), _T("%s (0x%08x) gets focus"),
2919 GetClassInfo()->GetClassName(), GetHandle());
2922 } // end of wxWindowOS2::OnSetFocus
2924 bool wxWindowOS2::HandleActivate(
2926 , WXHWND
WXUNUSED(hActivate
)
2929 wxActivateEvent
vEvent( wxEVT_ACTIVATE
2933 vEvent
.SetEventObject(this);
2934 return GetEventHandler()->ProcessEvent(vEvent
);
2935 } // end of wxWindowOS2::HandleActivate
2937 bool wxWindowOS2::HandleSetFocus(
2938 WXHWND
WXUNUSED(hWnd
)
2947 m_caret
->OnSetFocus();
2949 #endif // wxUSE_CARET
2952 // Panel wants to track the window which was the last to have focus in it
2954 wxPanel
* pPanel
= wxDynamicCast( GetParent()
2959 pPanel
->SetLastFocus(this);
2962 wxFocusEvent
vEvent(wxEVT_SET_FOCUS
, m_windowId
);
2964 vEvent
.SetEventObject(this);
2965 return GetEventHandler()->ProcessEvent(vEvent
);
2966 } // end of wxWindowOS2::HandleSetFocus
2968 bool wxWindowOS2::HandleKillFocus(
2969 WXHWND
WXUNUSED(hWnd
)
2978 m_caret
->OnKillFocus();
2980 #endif // wxUSE_CARET
2982 wxFocusEvent
vEvent( wxEVT_KILL_FOCUS
2986 vEvent
.SetEventObject(this);
2987 return GetEventHandler()->ProcessEvent(vEvent
);
2988 } // end of wxWindowOS2::HandleKillFocus
2990 // ---------------------------------------------------------------------------
2992 // ---------------------------------------------------------------------------
2994 bool wxWindowOS2::HandleShow(
2999 wxShowEvent
vEvent( GetId()
3003 vEvent
.m_eventObject
= this;
3004 return GetEventHandler()->ProcessEvent(vEvent
);
3005 } // end of wxWindowOS2::HandleShow
3007 bool wxWindowOS2::HandleInitDialog(
3008 WXHWND
WXUNUSED(hWndFocus
)
3011 wxInitDialogEvent
vEvent(GetId());
3013 vEvent
.m_eventObject
= this;
3014 return GetEventHandler()->ProcessEvent(vEvent
);
3015 } // end of wxWindowOS2::HandleInitDialog
3017 bool wxWindowOS2::HandleEndDrag(WXWPARAM wParam
)
3019 // TODO: We'll handle drag and drop later
3023 bool wxWindowOS2::HandleSetCursor(
3029 // Under OS/2 PM this allows the pointer to be changed
3030 // as it passes over a control
3032 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)hPointer
);
3034 } // end of wxWindowOS2::HandleSetCursor
3036 // ---------------------------------------------------------------------------
3037 // owner drawn stuff
3038 // ---------------------------------------------------------------------------
3039 bool wxWindowOS2::OS2OnDrawItem(
3041 , WXDRAWITEMSTRUCT
* pItemStruct
3046 #if wxUSE_OWNER_DRAWN
3048 // Is it a menu item?
3054 POWNERITEM pMeasureStruct
= (POWNERITEM
)pItemStruct
;
3055 wxFrame
* pFrame
= (wxFrame
*)this;
3056 wxMenuItem
* pMenuItem
= pFrame
->GetMenuBar()->FindItem(pMeasureStruct
->idItem
, pMeasureStruct
->hItem
);
3057 HDC hDC
= ::GpiQueryDevice(pMeasureStruct
->hps
);
3058 wxRect
vRect( pMeasureStruct
->rclItem
.xLeft
3059 ,pMeasureStruct
->rclItem
.yBottom
3060 ,pMeasureStruct
->rclItem
.xRight
- pMeasureStruct
->rclItem
.xLeft
3061 ,pMeasureStruct
->rclItem
.yTop
- pMeasureStruct
->rclItem
.yBottom
3066 vDc
.SetHPS(pMeasureStruct
->hps
);
3068 // Load the wxWindows Pallete and set to RGB mode
3070 if (!::GpiCreateLogColorTable( pMeasureStruct
->hps
3074 ,(LONG
)wxTheColourDatabase
->m_nSize
3075 ,(PLONG
)wxTheColourDatabase
->m_palTable
3078 vError
= ::WinGetLastError(vHabmain
);
3079 sError
= wxPMErrorToStr(vError
);
3080 wxLogError("Unable to set current color table. Error: %s\n", sError
);
3083 // Set the color table to RGB mode
3085 if (!::GpiCreateLogColorTable( pMeasureStruct
->hps
3093 vError
= ::WinGetLastError(vHabmain
);
3094 sError
= wxPMErrorToStr(vError
);
3095 wxLogError("Unable to set current color table. Error: %s\n", sError
);
3098 wxCHECK( pMenuItem
->IsKindOf(CLASSINFO(wxMenuItem
)), FALSE
);
3104 if (pMeasureStruct
->fsAttribute
== pMeasureStruct
->fsAttributeOld
)
3107 // Entire Item needs to be redrawn (either it has reappeared from
3108 // behind another window or is being displayed for the first time
3110 eAction
= wxOwnerDrawn::wxODDrawAll
;
3112 if (pMeasureStruct
->fsAttribute
& MIA_HILITED
)
3115 // If it is currently selected we let the system handle it
3117 eStatus
|= wxOwnerDrawn::wxODSelected
;
3119 if (pMeasureStruct
->fsAttribute
& MIA_CHECKED
)
3122 // If it is currently checked we draw our own
3124 eStatus
|= wxOwnerDrawn::wxODChecked
;
3125 pMeasureStruct
->fsAttributeOld
= pMeasureStruct
->fsAttribute
&= ~MIA_CHECKED
;
3127 if (pMeasureStruct
->fsAttribute
& MIA_DISABLED
)
3130 // If it is currently disabled we let the system handle it
3132 eStatus
|= wxOwnerDrawn::wxODDisabled
;
3135 // Don't really care about framed (indicationg focus) or NoDismiss
3140 if (pMeasureStruct
->fsAttribute
& MIA_HILITED
)
3142 eAction
= wxOwnerDrawn::wxODDrawAll
;
3143 eStatus
|= wxOwnerDrawn::wxODSelected
;
3145 // Keep the system from trying to highlight with its bogus colors
3147 pMeasureStruct
->fsAttributeOld
= pMeasureStruct
->fsAttribute
&= ~MIA_HILITED
;
3149 else if (!(pMeasureStruct
->fsAttribute
& MIA_HILITED
))
3151 eAction
= wxOwnerDrawn::wxODDrawAll
;
3154 // Keep the system from trying to highlight with its bogus colors
3156 pMeasureStruct
->fsAttribute
= pMeasureStruct
->fsAttributeOld
&= ~MIA_HILITED
;
3161 // For now we don't care about anything else
3162 // just ignore the entire message!
3168 // Now redraw the item
3170 return(pMenuItem
->OnDrawItem( vDc
3172 ,(wxOwnerDrawn::wxODAction
)eAction
3173 ,(wxOwnerDrawn::wxODStatus
)eStatus
3176 // leave the fsAttribute and fsOldAttribute unchanged. If different,
3177 // the system will do the highlight or fraeming or disabling for us,
3178 // otherwise, we'd have to do it ourselves.
3182 wxWindow
* pItem
= FindItem(vId
);
3184 if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxControl
)))
3186 return ((wxControl
*)pItem
)->OS2OnDraw(pItemStruct
);
3190 } // end of wxWindowOS2::OS2OnDrawItem
3192 bool wxWindowOS2::OS2OnMeasureItem(
3194 , WXMEASUREITEMSTRUCT
* pItemStruct
3198 // Is it a menu item?
3200 if (lId
== 65536) // I really don't like this...has to be a better indicator
3202 if (IsKindOf(CLASSINFO(wxFrame
))) // we'll assume if Frame then a menu
3206 POWNERITEM pMeasureStruct
= (POWNERITEM
)pItemStruct
;
3207 wxFrame
* pFrame
= (wxFrame
*)this;
3208 wxMenuItem
* pMenuItem
= pFrame
->GetMenuBar()->FindItem(pMeasureStruct
->idItem
, pMeasureStruct
->hItem
);
3210 wxCHECK( pMenuItem
->IsKindOf(CLASSINFO(wxMenuItem
)), FALSE
);
3213 if (pMenuItem
->OnMeasureItem( &nWidth
3217 pMeasureStruct
->rclItem
.xRight
= nWidth
;
3218 pMeasureStruct
->rclItem
.xLeft
= 0L;
3219 pMeasureStruct
->rclItem
.yTop
= nHeight
;
3220 pMeasureStruct
->rclItem
.yBottom
= 0L;
3226 wxWindow
* pItem
= FindItem(lId
);
3228 if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxControl
)))
3230 return ((wxControl
*)pItem
)->OS2OnMeasure(pItemStruct
);
3235 // ---------------------------------------------------------------------------
3236 // colours and palettes
3237 // ---------------------------------------------------------------------------
3239 bool wxWindowOS2::HandleSysColorChange()
3241 wxSysColourChangedEvent vEvent
;
3243 vEvent
.SetEventObject(this);
3244 return GetEventHandler()->ProcessEvent(vEvent
);
3245 } // end of wxWindowOS2::HandleSysColorChange
3247 bool wxWindowOS2::HandleCtlColor(
3252 // Not much provided with message. So not sure I can do anything with it
3255 } // end of wxWindowOS2::HandleCtlColor
3257 bool wxWindowOS2::HandleWindowParams(
3258 PWNDPARAMS pWndParams
3262 // TODO: I'll do something here, just not sure what yet
3266 // Define for each class of dialog and control
3267 WXHBRUSH
wxWindowOS2::OnCtlColor(WXHDC hDC
,
3277 bool wxWindowOS2::HandlePaletteChanged()
3279 // need to set this to something first
3280 WXHWND hWndPalChange
= NULLHANDLE
;
3282 wxPaletteChangedEvent
vEvent(GetId());
3284 vEvent
.SetEventObject(this);
3285 vEvent
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
3287 return GetEventHandler()->ProcessEvent(vEvent
);
3288 } // end of wxWindowOS2::HandlePaletteChanged
3290 bool wxWindowOS2::HandlePresParamChanged(
3295 // TODO: Once again I'll do something here when I need it
3297 //wxQueryNewPaletteEvent event(GetId());
3298 //event.SetEventObject(this);
3299 // if the background is erased
3300 // bProcessed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
3302 return FALSE
; //GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized();
3306 // Responds to colour changes: passes event on to children.
3308 void wxWindowOS2::OnSysColourChanged(
3309 wxSysColourChangedEvent
& rEvent
3312 wxNode
* pNode
= GetChildren().First();
3317 // Only propagate to non-top-level windows
3319 wxWindow
* pWin
= (wxWindow
*)pNode
->Data();
3321 if (pWin
->GetParent())
3323 wxSysColourChangedEvent vEvent
;
3325 rEvent
.m_eventObject
= pWin
;
3326 pWin
->GetEventHandler()->ProcessEvent(vEvent
);
3328 pNode
= pNode
->Next();
3330 } // end of wxWindowOS2::OnSysColourChanged
3332 // ---------------------------------------------------------------------------
3334 // ---------------------------------------------------------------------------
3336 bool wxWindowOS2::HandlePaint()
3338 HRGN hRgn
= NULLHANDLE
;
3339 wxPaintEvent vEvent
;
3343 if (::WinQueryUpdateRegion(GetHwnd(), hRgn
) == RGN_NULL
)
3345 wxLogLastError("CreateRectRgn");
3349 m_updateRegion
= wxRegion(hRgn
);
3350 vEvent
.SetEventObject(this);
3351 if (!GetEventHandler()->ProcessEvent(vEvent
))
3355 hPS
= ::WinBeginPaint( GetHwnd()
3361 ::GpiCreateLogColorTable( hPS
3365 ,(LONG
)wxTheColourDatabase
->m_nSize
3366 ,(PLONG
)wxTheColourDatabase
->m_palTable
3368 ::GpiCreateLogColorTable( hPS
3376 ::WinFillRect(hPS
, &vRect
, GetBackgroundColour().GetPixel());
3380 LINEBUNDLE vLineBundle
;
3382 vLineBundle
.lColor
= 0x00000000; // Black
3383 vLineBundle
.usMixMode
= FM_OVERPAINT
;
3384 vLineBundle
.fxWidth
= 1;
3385 vLineBundle
.lGeomWidth
= 1;
3386 vLineBundle
.usType
= LINETYPE_SOLID
;
3387 vLineBundle
.usEnd
= 0;
3388 vLineBundle
.usJoin
= 0;
3391 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
3395 ::WinQueryWindowRect(GetHwnd(), &vRect
);
3404 return (GetEventHandler()->ProcessEvent(vEvent
));
3405 } // end of wxWindowOS2::HandlePaint
3407 bool wxWindowOS2::HandleEraseBkgnd(
3413 ::WinQueryWindowPos(GetHwnd(), &vSwp
);
3414 if (vSwp
.fl
& SWP_MINIMIZE
)
3419 vDC
.m_hPS
= (HPS
)hDC
; // this is really a PS
3420 vDC
.SetWindow(this);
3423 wxEraseEvent
vEvent(m_windowId
, &vDC
);
3425 vEvent
.SetEventObject(this);
3427 bool rc
= GetEventHandler()->ProcessEvent(vEvent
);
3430 vDC
.m_hPS
= NULLHANDLE
;
3432 } // end of wxWindowOS2::HandleEraseBkgnd
3434 void wxWindowOS2::OnEraseBackground(
3435 wxEraseEvent
& rEvent
3439 HPS hPS
= rEvent
.m_dc
->m_hPS
;
3441 ::WinQueryWindowRect(GetHwnd(), &vRect
);
3442 ::WinFillRect(hPS
, &vRect
, m_backgroundColour
.GetPixel());
3443 } // end of wxWindowOS2::OnEraseBackground
3445 // ---------------------------------------------------------------------------
3446 // moving and resizing
3447 // ---------------------------------------------------------------------------
3449 bool wxWindowOS2::HandleMinimize()
3451 wxIconizeEvent
vEvent(m_windowId
);
3453 vEvent
.SetEventObject(this);
3454 return GetEventHandler()->ProcessEvent(vEvent
);
3455 } // end of wxWindowOS2::HandleMinimize
3457 bool wxWindowOS2::HandleMaximize()
3459 wxMaximizeEvent
vEvent(m_windowId
);
3461 vEvent
.SetEventObject(this);
3462 return GetEventHandler()->ProcessEvent(vEvent
);
3463 } // end of wxWindowOS2::HandleMaximize
3465 bool wxWindowOS2::HandleMove(
3470 wxMoveEvent
vEvent( wxPoint( nX
3476 vEvent
.SetEventObject(this);
3477 return GetEventHandler()->ProcessEvent(vEvent
);
3478 } // end of wxWindowOS2::HandleMove
3480 bool wxWindowOS2::HandleSize(
3483 , WXUINT
WXUNUSED(nFlag
)
3486 wxSizeEvent
vEvent( wxSize( nWidth
3492 vEvent
.SetEventObject(this);
3493 return GetEventHandler()->ProcessEvent(vEvent
);
3494 } // end of wxWindowOS2::HandleSize
3496 bool wxWindowOS2::HandleGetMinMaxInfo(
3506 ::WinGetMaxPosition(GetHwnd(), pSwp
);
3507 m_maxWidth
= pSwp
->cx
;
3508 m_maxHeight
= pSwp
->cy
;
3512 ::WinGetMinPosition(GetHwnd(), pSwp
, &vPoint
);
3513 m_minWidth
= pSwp
->cx
;
3514 m_minHeight
= pSwp
->cy
;
3521 } // end of wxWindowOS2::HandleGetMinMaxInfo
3523 // ---------------------------------------------------------------------------
3525 // ---------------------------------------------------------------------------
3526 bool wxWindowOS2::HandleCommand(
3532 if (wxCurrentPopupMenu
)
3534 wxMenu
* pPopupMenu
= wxCurrentPopupMenu
;
3536 wxCurrentPopupMenu
= NULL
;
3537 return pPopupMenu
->OS2Command(wCmd
, wId
);
3540 wxWindow
* pWin
= FindItem(wId
);
3544 pWin
= wxFindWinFromHandle(hControl
);
3548 return pWin
->OS2Command( wCmd
3552 } // end of wxWindowOS2::HandleCommand
3554 bool wxWindowOS2::HandleSysCommand(
3560 // 4 bits are reserved
3562 switch (SHORT1FROMMP(wParam
))
3565 return HandleMaximize();
3568 return HandleMinimize();
3571 } // end of wxWindowOS2::HandleSysCommand
3573 // ---------------------------------------------------------------------------
3575 // ---------------------------------------------------------------------------
3577 void wxWindowOS2::InitMouseEvent(
3578 wxMouseEvent
& rEvent
3586 rEvent
.m_shiftDown
= ((uFlags
& VK_SHIFT
) != 0);
3587 rEvent
.m_controlDown
= ((uFlags
& VK_CTRL
) != 0);
3588 rEvent
.m_leftDown
= ((uFlags
& VK_BUTTON1
) != 0);
3589 rEvent
.m_middleDown
= ((uFlags
& VK_BUTTON3
) != 0);
3590 rEvent
.m_rightDown
= ((uFlags
& VK_BUTTON2
) != 0);
3591 rEvent
.SetTimestamp(s_currentMsg
.time
);
3592 rEvent
.m_eventObject
= this;
3594 #if wxUSE_MOUSEEVENT_HACK
3597 m_lastMouseEvent
= rEvent
.GetEventType();
3598 #endif // wxUSE_MOUSEEVENT_HACK
3599 } // end of wxWindowOS2::InitMouseEvent
3601 bool wxWindowOS2::HandleMouseEvent(
3609 // The mouse events take consecutive IDs from WM_MOUSEFIRST to
3610 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
3611 // from the message id and take the value in the table to get wxWin event
3614 static const wxEventType eventsMouse
[] =
3628 wxMouseEvent
vEvent(eventsMouse
[uMsg
- WM_MOUSEMOVE
]);
3630 InitMouseEvent( vEvent
3636 return GetEventHandler()->ProcessEvent(vEvent
);
3637 } // end of wxWindowOS2::HandleMouseEvent
3639 bool wxWindowOS2::HandleMouseMove(
3645 if (!m_bMouseInWindow
)
3648 // Generate an ENTER event
3650 m_bMouseInWindow
= TRUE
;
3652 wxMouseEvent
vEvent(wxEVT_ENTER_WINDOW
);
3654 InitMouseEvent( vEvent
3660 (void)GetEventHandler()->ProcessEvent(vEvent
);
3662 return HandleMouseEvent( WM_MOUSEMOVE
3667 } // end of wxWindowOS2::HandleMouseMove
3669 // ---------------------------------------------------------------------------
3670 // keyboard handling
3671 // ---------------------------------------------------------------------------
3674 // Create the key event of the given type for the given key - used by
3675 // HandleChar and HandleKeyDown/Up
3677 wxKeyEvent
wxWindowOS2::CreateKeyEvent(
3683 wxKeyEvent
vEvent(eType
);
3685 vEvent
.SetId(GetId());
3686 vEvent
.m_shiftDown
= IsShiftDown();
3687 vEvent
.m_controlDown
= IsCtrlDown();
3688 vEvent
.m_altDown
= (HIWORD(lParam
) & KC_ALT
) == KC_ALT
;
3690 vEvent
.m_eventObject
= (wxWindow
*)this; // const_cast
3691 vEvent
.m_keyCode
= nId
;
3692 vEvent
.SetTimestamp(s_currentMsg
.time
);
3695 // Translate the position to client coords
3700 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
3701 ::WinQueryWindowRect( GetHwnd()
3705 vPoint
.x
-= vRect
.xLeft
;
3706 vPoint
.y
-= vRect
.yBottom
;
3708 vEvent
.m_x
= vPoint
.x
;
3709 vEvent
.m_y
= vPoint
.y
;
3712 } // end of wxWindowOS2::CreateKeyEvent
3715 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
3718 bool wxWindowOS2::HandleChar(
3724 bool bCtrlDown
= FALSE
;
3730 // If 1 -> 26, translate to CTRL plus a letter.
3733 if ((vId
> 0) && (vId
< 27))
3755 else if ( (vId
= wxCharCodeOS2ToWX(wParam
)) == 0)
3758 // It's ASCII and will be processed here only when called from
3759 // WM_CHAR (i.e. when isASCII = TRUE), don't process it now
3766 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_CHAR
3773 vEvent
.m_controlDown
= TRUE
;
3776 if (GetEventHandler()->ProcessEvent(vEvent
))
3782 bool wxWindowOS2::HandleKeyDown(
3787 int nId
= wxCharCodeOS2ToWX(wParam
);
3792 // Normal ASCII char
3799 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_DOWN
3804 if (GetEventHandler()->ProcessEvent(vEvent
))
3810 } // end of wxWindowOS2::HandleKeyDown
3812 bool wxWindowOS2::HandleKeyUp(
3817 int nId
= wxCharCodeOS2ToWX(wParam
);
3822 // Normal ASCII char
3829 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_UP
3834 if (GetEventHandler()->ProcessEvent(vEvent
))
3838 } // end of wxWindowOS2::HandleKeyUp
3840 // ---------------------------------------------------------------------------
3842 // ---------------------------------------------------------------------------
3844 // ---------------------------------------------------------------------------
3846 // ---------------------------------------------------------------------------
3848 bool wxWindowOS2::OS2OnScroll(
3857 wxWindow
* pChild
= wxFindWinFromHandle(hControl
);
3860 return pChild
->OS2OnScroll( nOrientation
3867 wxScrollWinEvent vEvent
;
3869 vEvent
.SetPosition(wPos
);
3870 vEvent
.SetOrientation(nOrientation
);
3871 vEvent
.m_eventObject
= this;
3876 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEUP
;
3880 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEDOWN
;
3884 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEUP
;
3888 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEDOWN
;
3891 case SB_SLIDERPOSITION
:
3892 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBRELEASE
;
3895 case SB_SLIDERTRACK
:
3896 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBTRACK
;
3902 return GetEventHandler()->ProcessEvent(vEvent
);
3903 } // end of wxWindowOS2::OS2OnScroll
3905 // ===========================================================================
3907 // ===========================================================================
3916 // TODO: we'll do this later
3917 } // end of wxGetCharSize
3920 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
3921 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
3923 int wxCharCodeOS2ToWX(
3931 case VK_BACKTAB
: nId
= WXK_BACK
; break;
3932 case VK_TAB
: nId
= WXK_TAB
; break;
3933 case VK_CLEAR
: nId
= WXK_CLEAR
; break;
3934 case VK_ENTER
: nId
= WXK_RETURN
; break;
3935 case VK_SHIFT
: nId
= WXK_SHIFT
; break;
3936 case VK_CTRL
: nId
= WXK_CONTROL
; break;
3937 case VK_PAUSE
: nId
= WXK_PAUSE
; break;
3938 case VK_SPACE
: nId
= WXK_SPACE
; break;
3939 case VK_ESC
: nId
= WXK_ESCAPE
; break;
3940 case VK_END
: nId
= WXK_END
; break;
3941 case VK_HOME
: nId
= WXK_HOME
; break;
3942 case VK_LEFT
: nId
= WXK_LEFT
; break;
3943 case VK_UP
: nId
= WXK_UP
; break;
3944 case VK_RIGHT
: nId
= WXK_RIGHT
; break;
3945 case VK_DOWN
: nId
= WXK_DOWN
; break;
3946 case VK_PRINTSCRN
: nId
= WXK_PRINT
; break;
3947 case VK_INSERT
: nId
= WXK_INSERT
; break;
3948 case VK_DELETE
: nId
= WXK_DELETE
; break;
3949 case VK_F1
: nId
= WXK_F1
; break;
3950 case VK_F2
: nId
= WXK_F2
; break;
3951 case VK_F3
: nId
= WXK_F3
; break;
3952 case VK_F4
: nId
= WXK_F4
; break;
3953 case VK_F5
: nId
= WXK_F5
; break;
3954 case VK_F6
: nId
= WXK_F6
; break;
3955 case VK_F7
: nId
= WXK_F7
; break;
3956 case VK_F8
: nId
= WXK_F8
; break;
3957 case VK_F9
: nId
= WXK_F9
; break;
3958 case VK_F10
: nId
= WXK_F10
; break;
3959 case VK_F11
: nId
= WXK_F11
; break;
3960 case VK_F12
: nId
= WXK_F12
; break;
3961 case VK_F13
: nId
= WXK_F13
; break;
3962 case VK_F14
: nId
= WXK_F14
; break;
3963 case VK_F15
: nId
= WXK_F15
; break;
3964 case VK_F16
: nId
= WXK_F16
; break;
3965 case VK_F17
: nId
= WXK_F17
; break;
3966 case VK_F18
: nId
= WXK_F18
; break;
3967 case VK_F19
: nId
= WXK_F19
; break;
3968 case VK_F20
: nId
= WXK_F20
; break;
3969 case VK_F21
: nId
= WXK_F21
; break;
3970 case VK_F22
: nId
= WXK_F22
; break;
3971 case VK_F23
: nId
= WXK_F23
; break;
3972 case VK_F24
: nId
= WXK_F24
; break;
3973 case VK_NUMLOCK
: nId
= WXK_NUMLOCK
; break;
3974 case VK_SCRLLOCK
: nId
= WXK_SCROLL
; break;
3981 } // end of wxCharCodeOS2ToWX
3983 int wxCharCodeWXToOS2(
3993 case WXK_CLEAR
: nKeySym
= VK_CLEAR
; break;
3994 case WXK_SHIFT
: nKeySym
= VK_SHIFT
; break;
3995 case WXK_CONTROL
: nKeySym
= VK_CTRL
; break;
3996 case WXK_PAUSE
: nKeySym
= VK_PAUSE
; break;
3997 case WXK_END
: nKeySym
= VK_END
; break;
3998 case WXK_HOME
: nKeySym
= VK_HOME
; break;
3999 case WXK_LEFT
: nKeySym
= VK_LEFT
; break;
4000 case WXK_UP
: nKeySym
= VK_UP
; break;
4001 case WXK_RIGHT
: nKeySym
= VK_RIGHT
; break;
4002 case WXK_DOWN
: nKeySym
= VK_DOWN
; break;
4003 case WXK_PRINT
: nKeySym
= VK_PRINTSCRN
; break;
4004 case WXK_INSERT
: nKeySym
= VK_INSERT
; break;
4005 case WXK_DELETE
: nKeySym
= VK_DELETE
; break;
4006 case WXK_F1
: nKeySym
= VK_F1
; break;
4007 case WXK_F2
: nKeySym
= VK_F2
; break;
4008 case WXK_F3
: nKeySym
= VK_F3
; break;
4009 case WXK_F4
: nKeySym
= VK_F4
; break;
4010 case WXK_F5
: nKeySym
= VK_F5
; break;
4011 case WXK_F6
: nKeySym
= VK_F6
; break;
4012 case WXK_F7
: nKeySym
= VK_F7
; break;
4013 case WXK_F8
: nKeySym
= VK_F8
; break;
4014 case WXK_F9
: nKeySym
= VK_F9
; break;
4015 case WXK_F10
: nKeySym
= VK_F10
; break;
4016 case WXK_F11
: nKeySym
= VK_F11
; break;
4017 case WXK_F12
: nKeySym
= VK_F12
; break;
4018 case WXK_F13
: nKeySym
= VK_F13
; break;
4019 case WXK_F14
: nKeySym
= VK_F14
; break;
4020 case WXK_F15
: nKeySym
= VK_F15
; break;
4021 case WXK_F16
: nKeySym
= VK_F16
; break;
4022 case WXK_F17
: nKeySym
= VK_F17
; break;
4023 case WXK_F18
: nKeySym
= VK_F18
; break;
4024 case WXK_F19
: nKeySym
= VK_F19
; break;
4025 case WXK_F20
: nKeySym
= VK_F20
; break;
4026 case WXK_F21
: nKeySym
= VK_F21
; break;
4027 case WXK_F22
: nKeySym
= VK_F22
; break;
4028 case WXK_F23
: nKeySym
= VK_F23
; break;
4029 case WXK_F24
: nKeySym
= VK_F24
; break;
4030 case WXK_NUMLOCK
: nKeySym
= VK_NUMLOCK
; break;
4031 case WXK_SCROLL
: nKeySym
= VK_SCRLLOCK
; break;
4034 *bIsVirtual
= FALSE
;
4040 } // end of wxCharCodeWXToOS2
4042 wxWindow
* wxGetActiveWindow()
4044 HWND hWnd
= ::WinQueryActiveWindow(HWND_DESKTOP
);
4048 return wxFindWinFromHandle((WXHWND
)hWnd
);
4051 } // end of wxGetActiveWindow
4054 const char* wxGetMessageName(
4059 case 0x0000: return "WM_NULL";
4060 case 0x0001: return "WM_CREATE";
4061 case 0x0002: return "WM_DESTROY";
4062 case 0x0004: return "WM_ENABLE";
4063 case 0x0005: return "WM_SHOW";
4064 case 0x0006: return "WM_MOVE";
4065 case 0x0007: return "WM_SIZE";
4066 case 0x0008: return "WM_ADJUSTWINDOWPOS";
4067 case 0x0009: return "WM_CALCVALIDRECTS";
4068 case 0x000A: return "WM_SETWINDOWPARAMS";
4069 case 0x000B: return "WM_QUERYWINDOWPARAMS";
4070 case 0x000C: return "WM_HITTEST";
4071 case 0x000D: return "WM_ACTIVATE";
4072 case 0x000F: return "WM_SETFOCUS";
4073 case 0x0010: return "WM_SETSELECTION";
4074 case 0x0011: return "WM_PPAINT";
4075 case 0x0012: return "WM_PSETFOCUS";
4076 case 0x0013: return "WM_PSYSCOLORCHANGE";
4077 case 0x0014: return "WM_PSIZE";
4078 case 0x0015: return "WM_PACTIVATE";
4079 case 0x0016: return "WM_PCONTROL";
4080 case 0x0020: return "WM_COMMAND";
4081 case 0x0021: return "WM_SYSCOMMAND";
4082 case 0x0022: return "WM_HELP";
4083 case 0x0023: return "WM_PAINT";
4084 case 0x0024: return "WM_TIMER";
4085 case 0x0025: return "WM_SEM1";
4086 case 0x0026: return "WM_SEM2";
4087 case 0x0027: return "WM_SEM3";
4088 case 0x0028: return "WM_SEM4";
4089 case 0x0029: return "WM_CLOSE";
4090 case 0x002A: return "WM_QUIT";
4091 case 0x002B: return "WM_SYSCOLORCHANGE";
4092 case 0x002D: return "WM_SYSVALUECHANGE";
4093 case 0x002E: return "WM_APPTERMINATENOTIFY";
4094 case 0x002F: return "WM_PRESPARAMCHANGED";
4095 // Control notification messages
4096 case 0x0030: return "WM_CONTROL";
4097 case 0x0031: return "WM_VSCROLL";
4098 case 0x0032: return "WM_HSCROLL";
4099 case 0x0033: return "WM_INITMENU";
4100 case 0x0034: return "WM_MENUSELECT";
4101 case 0x0035: return "WM_MENUSEND";
4102 case 0x0036: return "WM_DRAWITEM";
4103 case 0x0037: return "WM_MEASUREITEM";
4104 case 0x0038: return "WM_CONTROLPOINTER";
4105 case 0x003A: return "WM_QUERYDLGCODE";
4106 case 0x003B: return "WM_INITDLG";
4107 case 0x003C: return "WM_SUBSTITUTESTRING";
4108 case 0x003D: return "WM_MATCHMNEMONIC";
4109 case 0x003E: return "WM_SAVEAPPLICATION";
4110 case 0x0129: return "WM_CTLCOLORCHANGE";
4111 case 0x0130: return "WM_QUERYCTLTYPE";
4113 case 0x0040: return "WM_FLASHWINDOW";
4114 case 0x0041: return "WM_FORMATFRAME";
4115 case 0x0042: return "WM_UPDATEFRAME";
4116 case 0x0043: return "WM_FOCUSCHANGE";
4117 case 0x0044: return "WM_SETBORDERSIZE";
4118 case 0x0045: return "WM_TRACKFRAME";
4119 case 0x0046: return "WM_MINMAXFRAME";
4120 case 0x0047: return "WM_SETICON";
4121 case 0x0048: return "WM_QUERYICON";
4122 case 0x0049: return "WM_SETACCELTABLE";
4123 case 0x004A: return "WM_QUERYACCELTABLE";
4124 case 0x004B: return "WM_TRANSLATEACCEL";
4125 case 0x004C: return "WM_QUERYTRACKINFO";
4126 case 0x004D: return "WM_QUERYBORDERSIZE";
4127 case 0x004E: return "WM_NEXTMENU";
4128 case 0x004F: return "WM_ERASEBACKGROUND";
4129 case 0x0050: return "WM_QUERYFRAMEINFO";
4130 case 0x0051: return "WM_QUERYFOCUSCHAIN";
4131 case 0x0052: return "WM_OWNERPOSCHANGE";
4132 case 0x0053: return "WM_CACLFRAMERECT";
4133 case 0x0055: return "WM_WINDOWPOSCHANGED";
4134 case 0x0056: return "WM_ADJUSTFRAMEPOS";
4135 case 0x0059: return "WM_QUERYFRAMECTLCOUNT";
4136 case 0x005B: return "WM_QUERYHELPINFO";
4137 case 0x005C: return "WM_SETHELPINFO";
4138 case 0x005D: return "WM_ERROR";
4139 case 0x005E: return "WM_REALIZEPALETTE";
4140 // Clipboard messages
4141 case 0x0060: return "WM_RENDERFMT";
4142 case 0x0061: return "WM_RENDERALLFMTS";
4143 case 0x0062: return "WM_DESTROYCLIPBOARD";
4144 case 0x0063: return "WM_PAINTCLIPBOARD";
4145 case 0x0064: return "WM_SIZECLIPBOARD";
4146 case 0x0065: return "WM_HSCROLLCLIPBOARD";
4147 case 0x0066: return "WM_VSCROLLCLIPBOARD";
4148 case 0x0067: return "WM_DRAWCLIPBOARD";
4150 case 0x0070: return "WM_MOUSEMOVE";
4151 case 0x0071: return "WM_BUTTON1DOWN";
4152 case 0x0072: return "WM_BUTTON1UP";
4153 case 0x0073: return "WM_BUTTON1DBLCLK";
4154 case 0x0074: return "WM_BUTTON2DOWN";
4155 case 0x0075: return "WM_BUTTON2UP";
4156 case 0x0076: return "WM_BUTTON2DBLCLK";
4157 case 0x0077: return "WM_BUTTON3DOWN";
4158 case 0x0078: return "WM_BUTTON3UP";
4159 case 0x0079: return "WM_BUTTON3DBLCLK";
4160 case 0x007D: return "WM_MOUSEMAP";
4161 case 0x007E: return "WM_VRNDISABLED";
4162 case 0x007F: return "WM_VRNENABLED";
4163 case 0x0410: return "WM_CHORD";
4164 case 0x0411: return "WM_BUTTON1MOTIONSTART";
4165 case 0x0412: return "WM_BUTTON1MOTIONEND";
4166 case 0x0413: return "WM_BUTTON1CLICK";
4167 case 0x0414: return "WM_BUTTON2MOTIONSTART";
4168 case 0x0415: return "WM_BUTTON2MOTIONEND";
4169 case 0x0416: return "WM_BUTTON2CLICK";
4170 case 0x0417: return "WM_BUTTON3MOTIONSTART";
4171 case 0x0418: return "WM_BUTTON3MOTIONEND";
4172 case 0x0419: return "WM_BUTTON3CLICK";
4173 case 0x0420: return "WM_BEGINDRAG";
4174 case 0x0421: return "WM_ENDDRAG";
4175 case 0x0422: return "WM_SINGLESELECT";
4176 case 0x0423: return "WM_OPEN";
4177 case 0x0424: return "WM_CONTEXTMENU";
4178 case 0x0425: return "WM_CONTEXTHELP";
4179 case 0x0426: return "WM_TEXTEDIT";
4180 case 0x0427: return "WM_BEGINSELECT";
4181 case 0x0228: return "WM_ENDSELECT";
4182 case 0x0429: return "WM_PICKUP";
4183 case 0x04C0: return "WM_PENFIRST";
4184 case 0x04FF: return "WM_PENLAST";
4185 case 0x0500: return "WM_MMPMFIRST";
4186 case 0x05FF: return "WM_MMPMLAST";
4187 case 0x0600: return "WM_STDDLGFIRST";
4188 case 0x06FF: return "WM_STDDLGLAST";
4189 case 0x0BD0: return "WM_BIDI_FIRST";
4190 case 0x0BFF: return "WM_BIDI_LAST";
4192 case 0x007A: return "WM_CHAR";
4193 case 0x007B: return "WM_VIOCHAR";
4195 case 0x00A0: return "WM_DDE_INITIATE";
4196 case 0x00A1: return "WM_DDE_REQUEST";
4197 case 0x00A2: return "WM_DDE_ACK";
4198 case 0x00A3: return "WM_DDE_DATA";
4199 case 0x00A4: return "WM_DDE_ADVISE";
4200 case 0x00A5: return "WM_DDE_UNADVISE";
4201 case 0x00A6: return "WM_DDE_POKE";
4202 case 0x00A7: return "WM_DDE_EXECUTE";
4203 case 0x00A8: return "WM_DDE_TERMINATE";
4204 case 0x00A9: return "WM_DDE_INITIATEACK";
4205 case 0x00AF: return "WM_DDE_LAST";
4207 case 0x0120: return "BM_CLICK";
4208 case 0x0121: return "BM_QUERYCHECKINDEX";
4209 case 0x0122: return "BM_QUERYHILITE";
4210 case 0x0123: return "BM_SETHILITE";
4211 case 0x0124: return "BM_QUERYCHECK";
4212 case 0x0125: return "BM_SETCHECK";
4213 case 0x0126: return "BM_SETDEFAULT";
4214 case 0x0128: return "BM_AUTOSIZE";
4216 case 0x029A: return "CBID_LIST";
4217 case 0x029B: return "CBID_EDIT";
4218 case 0x0170: return "CBM_SHOWLIST";
4219 case 0x0171: return "CBM_HILITE";
4220 case 0x0172: return "CBM_ISLISTSHOWING";
4222 case 0x0140: return "EM_QUERYCHANGED";
4223 case 0x0141: return "EM_QUERYSEL";
4224 case 0x0142: return "EM_SETSEL";
4225 case 0x0143: return "EM_SETTEXTLIMIT";
4226 case 0x0144: return "EM_CUT";
4227 case 0x0145: return "EM_COPY";
4228 case 0x0146: return "EM_CLEAR";
4229 case 0x0147: return "EM_PASTE";
4230 case 0x0148: return "EM_QUERYFIRSTCHAR";
4231 case 0x0149: return "EM_SETFIRSTCHAR";
4232 case 0x014A: return "EM_QUERYREADONLY";
4233 case 0x014B: return "EM_SETREADONLY";
4234 case 0x014C: return "EM_SETINSERTMODE";
4236 case 0x0160: return "LM_QUERYITEMCOUNT";
4237 case 0x0161: return "LM_INSERTITEM";
4238 case 0x0162: return "LM_SETOPENINDEX";
4239 case 0x0163: return "LM_DELETEITEM";
4240 case 0x0164: return "LM_SELECTITEM";
4241 case 0x0165: return "LM_QUERYSELECTION";
4242 case 0x0166: return "LM_SETITEMTEXT";
4243 case 0x0167: return "LM_QUERYITEMTEXTLENGTH";
4244 case 0x0168: return "LM_QUERYITEMTEXT";
4245 case 0x0169: return "LM_SETITEMHANDLE";
4246 case 0x016A: return "LM_QUERYITEMHANDLE";
4247 case 0x016B: return "LM_SEARCHSTRING";
4248 case 0x016C: return "LM_SETITEMHEIGHT";
4249 case 0x016D: return "LM_QUERYTOPINDEX";
4250 case 0x016E: return "LM_DELETEALL";
4251 case 0x016F: return "LM_INSERTMULITEMS";
4252 case 0x0660: return "LM_SETITEMWIDTH";
4254 case 0x0180: return "MM_INSERTITEM";
4255 case 0x0181: return "MM_DELETEITEM";
4256 case 0x0182: return "MM_QUERYITEM";
4257 case 0x0183: return "MM_SETITEM";
4258 case 0x0184: return "MM_QUERYITEMCOUNT";
4259 case 0x0185: return "MM_STARTMENUMODE";
4260 case 0x0186: return "MM_ENDMENUMODE";
4261 case 0x0188: return "MM_REMOVEITEM";
4262 case 0x0189: return "MM_SELECTITEM";
4263 case 0x018A: return "MM_QUERYSELITEMID";
4264 case 0x018B: return "MM_QUERYITEMTEXT";
4265 case 0x018C: return "MM_QUERYITEMTEXTLENGTH";
4266 case 0x018D: return "MM_SETITEMHANDLE";
4267 case 0x018E: return "MM_SETITEMTEXT";
4268 case 0x018F: return "MM_ITEMPOSITIONFROMID";
4269 case 0x0190: return "MM_ITEMIDFROMPOSITION";
4270 case 0x0191: return "MM_QUERYITEMATTR";
4271 case 0x0192: return "MM_SETITEMATTR";
4272 case 0x0193: return "MM_ISITEMVALID";
4273 case 0x0194: return "MM_QUERYITEMRECT";
4274 case 0x0431: return "MM_QUERYDEFAULTITEMID";
4275 case 0x0432: return "MM_SETDEFAULTITEMID";
4277 case 0x01A0: return "SBM_SETSCROLLBAR";
4278 case 0x01A1: return "SBM_SETPOS";
4279 case 0x01A2: return "SBM_QUERYPOS";
4280 case 0x01A3: return "SBM_QUERYRANGE";
4281 case 0x01A6: return "SBM_SETTHUMBSIZE";
4284 case 0x0F00: return "WM_HELPBASE";
4285 case 0x0FFF: return "WM_HELPTOP";
4286 // Beginning of user defined messages
4287 case 0x1000: return "WM_USER";
4289 // wxWindows user defined types
4292 // case 0x1000 + 0: return "LVM_GETBKCOLOR";
4293 case 0x1000 + 1: return "LVM_SETBKCOLOR";
4294 case 0x1000 + 2: return "LVM_GETIMAGELIST";
4295 case 0x1000 + 3: return "LVM_SETIMAGELIST";
4296 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
4297 case 0x1000 + 5: return "LVM_GETITEMA";
4298 case 0x1000 + 75: return "LVM_GETITEMW";
4299 case 0x1000 + 6: return "LVM_SETITEMA";
4300 case 0x1000 + 76: return "LVM_SETITEMW";
4301 case 0x1000 + 7: return "LVM_INSERTITEMA";
4302 case 0x1000 + 77: return "LVM_INSERTITEMW";
4303 case 0x1000 + 8: return "LVM_DELETEITEM";
4304 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
4305 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
4306 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
4307 case 0x1000 + 12: return "LVM_GETNEXTITEM";
4308 case 0x1000 + 13: return "LVM_FINDITEMA";
4309 case 0x1000 + 83: return "LVM_FINDITEMW";
4310 case 0x1000 + 14: return "LVM_GETITEMRECT";
4311 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
4312 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
4313 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
4314 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
4315 case 0x1000 + 18: return "LVM_HITTEST";
4316 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
4317 case 0x1000 + 20: return "LVM_SCROLL";
4318 case 0x1000 + 21: return "LVM_REDRAWITEMS";
4319 case 0x1000 + 22: return "LVM_ARRANGE";
4320 case 0x1000 + 23: return "LVM_EDITLABELA";
4321 case 0x1000 + 118: return "LVM_EDITLABELW";
4322 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
4323 case 0x1000 + 25: return "LVM_GETCOLUMNA";
4324 case 0x1000 + 95: return "LVM_GETCOLUMNW";
4325 case 0x1000 + 26: return "LVM_SETCOLUMNA";
4326 case 0x1000 + 96: return "LVM_SETCOLUMNW";
4327 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
4328 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
4329 case 0x1000 + 28: return "LVM_DELETECOLUMN";
4330 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
4331 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
4332 case 0x1000 + 31: return "LVM_GETHEADER";
4333 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
4334 case 0x1000 + 34: return "LVM_GETVIEWRECT";
4335 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
4336 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
4337 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
4338 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
4339 case 0x1000 + 39: return "LVM_GETTOPINDEX";
4340 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
4341 case 0x1000 + 41: return "LVM_GETORIGIN";
4342 case 0x1000 + 42: return "LVM_UPDATE";
4343 case 0x1000 + 43: return "LVM_SETITEMSTATE";
4344 case 0x1000 + 44: return "LVM_GETITEMSTATE";
4345 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
4346 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
4347 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
4348 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
4349 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
4350 case 0x1000 + 48: return "LVM_SORTITEMS";
4351 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
4352 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
4353 case 0x1000 + 51: return "LVM_GETITEMSPACING";
4354 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
4355 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
4356 case 0x1000 + 53: return "LVM_SETICONSPACING";
4357 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
4358 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
4359 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
4360 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
4361 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
4362 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
4363 case 0x1000 + 60: return "LVM_SETHOTITEM";
4364 case 0x1000 + 61: return "LVM_GETHOTITEM";
4365 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
4366 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
4367 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
4368 case 0x1000 + 65: return "LVM_SETWORKAREA";
4371 case 0x1100 + 0: return "TVM_INSERTITEMA";
4372 case 0x1100 + 50: return "TVM_INSERTITEMW";
4373 case 0x1100 + 1: return "TVM_DELETEITEM";
4374 case 0x1100 + 2: return "TVM_EXPAND";
4375 case 0x1100 + 4: return "TVM_GETITEMRECT";
4376 case 0x1100 + 5: return "TVM_GETCOUNT";
4377 case 0x1100 + 6: return "TVM_GETINDENT";
4378 case 0x1100 + 7: return "TVM_SETINDENT";
4379 case 0x1100 + 8: return "TVM_GETIMAGELIST";
4380 case 0x1100 + 9: return "TVM_SETIMAGELIST";
4381 case 0x1100 + 10: return "TVM_GETNEXTITEM";
4382 case 0x1100 + 11: return "TVM_SELECTITEM";
4383 case 0x1100 + 12: return "TVM_GETITEMA";
4384 case 0x1100 + 62: return "TVM_GETITEMW";
4385 case 0x1100 + 13: return "TVM_SETITEMA";
4386 case 0x1100 + 63: return "TVM_SETITEMW";
4387 case 0x1100 + 14: return "TVM_EDITLABELA";
4388 case 0x1100 + 65: return "TVM_EDITLABELW";
4389 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
4390 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
4391 case 0x1100 + 17: return "TVM_HITTEST";
4392 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
4393 case 0x1100 + 19: return "TVM_SORTCHILDREN";
4394 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
4395 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
4396 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
4397 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
4398 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
4399 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
4400 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
4403 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
4404 case 0x1200 + 1: return "HDM_INSERTITEMA";
4405 case 0x1200 + 10: return "HDM_INSERTITEMW";
4406 case 0x1200 + 2: return "HDM_DELETEITEM";
4407 case 0x1200 + 3: return "HDM_GETITEMA";
4408 case 0x1200 + 11: return "HDM_GETITEMW";
4409 case 0x1200 + 4: return "HDM_SETITEMA";
4410 case 0x1200 + 12: return "HDM_SETITEMW";
4411 case 0x1200 + 5: return "HDM_LAYOUT";
4412 case 0x1200 + 6: return "HDM_HITTEST";
4413 case 0x1200 + 7: return "HDM_GETITEMRECT";
4414 case 0x1200 + 8: return "HDM_SETIMAGELIST";
4415 case 0x1200 + 9: return "HDM_GETIMAGELIST";
4416 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
4417 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
4418 case 0x1200 + 17: return "HDM_GETORDERARRAY";
4419 case 0x1200 + 18: return "HDM_SETORDERARRAY";
4420 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
4423 case 0x1300 + 2: return "TCM_GETIMAGELIST";
4424 case 0x1300 + 3: return "TCM_SETIMAGELIST";
4425 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
4426 case 0x1300 + 5: return "TCM_GETITEMA";
4427 case 0x1300 + 60: return "TCM_GETITEMW";
4428 case 0x1300 + 6: return "TCM_SETITEMA";
4429 case 0x1300 + 61: return "TCM_SETITEMW";
4430 case 0x1300 + 7: return "TCM_INSERTITEMA";
4431 case 0x1300 + 62: return "TCM_INSERTITEMW";
4432 case 0x1300 + 8: return "TCM_DELETEITEM";
4433 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
4434 case 0x1300 + 10: return "TCM_GETITEMRECT";
4435 case 0x1300 + 11: return "TCM_GETCURSEL";
4436 case 0x1300 + 12: return "TCM_SETCURSEL";
4437 case 0x1300 + 13: return "TCM_HITTEST";
4438 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
4439 case 0x1300 + 40: return "TCM_ADJUSTRECT";
4440 case 0x1300 + 41: return "TCM_SETITEMSIZE";
4441 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
4442 case 0x1300 + 43: return "TCM_SETPADDING";
4443 case 0x1300 + 44: return "TCM_GETROWCOUNT";
4444 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
4445 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
4446 case 0x1300 + 47: return "TCM_GETCURFOCUS";
4447 case 0x1300 + 48: return "TCM_SETCURFOCUS";
4448 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
4449 case 0x1300 + 50: return "TCM_DESELECTALL";
4452 case WM_USER
+1000+1: return "TB_ENABLEBUTTON";
4453 case WM_USER
+1000+2: return "TB_CHECKBUTTON";
4454 case WM_USER
+1000+3: return "TB_PRESSBUTTON";
4455 case WM_USER
+1000+4: return "TB_HIDEBUTTON";
4456 case WM_USER
+1000+5: return "TB_INDETERMINATE";
4457 case WM_USER
+1000+9: return "TB_ISBUTTONENABLED";
4458 case WM_USER
+1000+10: return "TB_ISBUTTONCHECKED";
4459 case WM_USER
+1000+11: return "TB_ISBUTTONPRESSED";
4460 case WM_USER
+1000+12: return "TB_ISBUTTONHIDDEN";
4461 case WM_USER
+1000+13: return "TB_ISBUTTONINDETERMINATE";
4462 case WM_USER
+1000+17: return "TB_SETSTATE";
4463 case WM_USER
+1000+18: return "TB_GETSTATE";
4464 case WM_USER
+1000+19: return "TB_ADDBITMAP";
4465 case WM_USER
+1000+20: return "TB_ADDBUTTONS";
4466 case WM_USER
+1000+21: return "TB_INSERTBUTTON";
4467 case WM_USER
+1000+22: return "TB_DELETEBUTTON";
4468 case WM_USER
+1000+23: return "TB_GETBUTTON";
4469 case WM_USER
+1000+24: return "TB_BUTTONCOUNT";
4470 case WM_USER
+1000+25: return "TB_COMMANDTOINDEX";
4471 case WM_USER
+1000+26: return "TB_SAVERESTOREA";
4472 case WM_USER
+1000+76: return "TB_SAVERESTOREW";
4473 case WM_USER
+1000+27: return "TB_CUSTOMIZE";
4474 case WM_USER
+1000+28: return "TB_ADDSTRINGA";
4475 case WM_USER
+1000+77: return "TB_ADDSTRINGW";
4476 case WM_USER
+1000+29: return "TB_GETITEMRECT";
4477 case WM_USER
+1000+30: return "TB_BUTTONSTRUCTSIZE";
4478 case WM_USER
+1000+31: return "TB_SETBUTTONSIZE";
4479 case WM_USER
+1000+32: return "TB_SETBITMAPSIZE";
4480 case WM_USER
+1000+33: return "TB_AUTOSIZE";
4481 case WM_USER
+1000+35: return "TB_GETTOOLTIPS";
4482 case WM_USER
+1000+36: return "TB_SETTOOLTIPS";
4483 case WM_USER
+1000+37: return "TB_SETPARENT";
4484 case WM_USER
+1000+39: return "TB_SETROWS";
4485 case WM_USER
+1000+40: return "TB_GETROWS";
4486 case WM_USER
+1000+42: return "TB_SETCMDID";
4487 case WM_USER
+1000+43: return "TB_CHANGEBITMAP";
4488 case WM_USER
+1000+44: return "TB_GETBITMAP";
4489 case WM_USER
+1000+45: return "TB_GETBUTTONTEXTA";
4490 case WM_USER
+1000+75: return "TB_GETBUTTONTEXTW";
4491 case WM_USER
+1000+46: return "TB_REPLACEBITMAP";
4492 case WM_USER
+1000+47: return "TB_SETINDENT";
4493 case WM_USER
+1000+48: return "TB_SETIMAGELIST";
4494 case WM_USER
+1000+49: return "TB_GETIMAGELIST";
4495 case WM_USER
+1000+50: return "TB_LOADIMAGES";
4496 case WM_USER
+1000+51: return "TB_GETRECT";
4497 case WM_USER
+1000+52: return "TB_SETHOTIMAGELIST";
4498 case WM_USER
+1000+53: return "TB_GETHOTIMAGELIST";
4499 case WM_USER
+1000+54: return "TB_SETDISABLEDIMAGELIST";
4500 case WM_USER
+1000+55: return "TB_GETDISABLEDIMAGELIST";
4501 case WM_USER
+1000+56: return "TB_SETSTYLE";
4502 case WM_USER
+1000+57: return "TB_GETSTYLE";
4503 case WM_USER
+1000+58: return "TB_GETBUTTONSIZE";
4504 case WM_USER
+1000+59: return "TB_SETBUTTONWIDTH";
4505 case WM_USER
+1000+60: return "TB_SETMAXTEXTROWS";
4506 case WM_USER
+1000+61: return "TB_GETTEXTROWS";
4507 case WM_USER
+1000+41: return "TB_GETBITMAPFLAGS";
4510 static char s_szBuf
[128];
4511 sprintf(s_szBuf
, "<unknown message = %d>", nMessage
);
4515 } // end of wxGetMessageName
4517 #endif // __WXDEBUG__
4519 static void TranslateKbdEventToMouse(
4527 // Construct the key mask
4528 ULONG
& fwKeys
= *pFlags
;
4530 fwKeys
= VK_BUTTON2
;
4531 if ((::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x100) != 0)
4533 if ((::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x100) != 0)
4537 // Simulate right mouse button click
4541 ::WinQueryMsgPos(vHabmain
, &vPoint
);
4545 pWin
->ScreenToClient(pX
, pY
);
4546 } // end of TranslateKbdEventToMouse
4548 // Find the wxWindow at the current mouse position, returning the mouse
4550 wxWindow
* wxFindWindowAtPointer(
4554 return wxFindWindowAtPoint(wxGetMousePosition());
4557 wxWindow
* wxFindWindowAtPoint(
4566 HWND hWndHit
= ::WinWindowFromPoint(HWND_DESKTOP
, &vPt2
, FALSE
);
4567 wxWindow
* pWin
= wxFindWinFromHandle((WXHWND
)hWndHit
) ;
4568 HWND hWnd
= hWndHit
;
4571 // Try to find a window with a wxWindow associated with it
4573 while (!pWin
&& (hWnd
!= 0))
4575 hWnd
= ::WinQueryWindow(hWnd
, QW_PARENT
);
4576 pWin
= wxFindWinFromHandle((WXHWND
)hWnd
) ;
4581 // Get the current mouse position.
4582 wxPoint
wxGetMousePosition()
4586 ::WinQueryPointerPos(HWND_DESKTOP
, &vPt
);
4587 return wxPoint(vPt
.x
, vPt
.y
);