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"
40 #define DEBUG_PRINTF(NAME) { static int raz=0; \
41 printf( #NAME " %i\n",raz); fflush(stdout); \
46 #include "wx/ownerdrw.h"
49 #if wxUSE_DRAG_AND_DROP
53 #include "wx/menuitem.h"
56 #include "wx/os2/private.h"
59 #include "wx/tooltip.h"
70 #include "wx/textctrl.h"
75 // Place compiler, OS specific includes here
79 // Standard macros -- these are for OS/2 PM, but most GUI's have something similar
83 // SHORT1FROMMP -- LOWORD
85 #define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp))
87 // SHORT2FROMMP -- HIWORD
89 #define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16))
90 #endif // GET_X_LPARAM
93 # define CW_USEDEFAULT ((int)0x80000000)
96 // ---------------------------------------------------------------------------
98 // ---------------------------------------------------------------------------
101 // The last Windows message we got (MT-UNSAFE)
105 wxMenu
* wxCurrentPopupMenu
= NULL
;
106 extern wxList WXDLLEXPORT wxPendingDelete
;
107 #if !defined(__VISAGECPP__) || (__IBMCPP__ < 400)
108 extern wxChar wxCanvasClassName
[];
110 wxList
* wxWinHandleList
= NULL
;
112 // ---------------------------------------------------------------------------
114 // ---------------------------------------------------------------------------
117 // the window proc for all our windows; most gui's have something similar
119 MRESULT EXPENTRY
wxWndProc( HWND hWnd
126 const char *wxGetMessageName(int message
);
129 void wxRemoveHandleAssociation(wxWindow
* pWin
);
130 void wxAssociateWinWithHandle( HWND hWnd
133 wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
136 // This magical function is used to translate VK_APPS key presses to right
139 static void TranslateKbdEventToMouse( wxWindow
* pWin
146 // get the current state of SHIFT/CTRL keys
148 static inline bool IsShiftDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x8000) != 0; }
149 static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x8000) != 0; }
150 // ---------------------------------------------------------------------------
152 // ---------------------------------------------------------------------------
154 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxWindowBase
)
156 BEGIN_EVENT_TABLE(wxWindow
, wxWindowBase
)
157 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground
)
158 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged
)
159 EVT_INIT_DIALOG(wxWindow::OnInitDialog
)
160 EVT_IDLE(wxWindow::OnIdle
)
163 // ===========================================================================
165 // ===========================================================================
168 // Find an item given the PM Window id
170 wxWindow
* wxWindow::FindItem(
174 wxControl
* pItem
= wxDynamicCast( this
181 // I it we or one of our "internal" children?
183 if (pItem
->GetId() == lId
||
184 (pItem
->GetSubcontrols().Index(lId
) != wxNOT_FOUND
))
190 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
194 wxWindow
* pChildWin
= pCurrent
->GetData();
195 wxWindow
* pWnd
= pChildWin
->FindItem(lId
);
200 pCurrent
= pCurrent
->GetNext();
203 } // end of wxWindow::FindItem
206 // Find an item given the PM Window handle
208 wxWindow
* wxWindow::FindItemByHWND(
213 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
217 wxWindow
* pParent
= pCurrent
->GetData();
220 // Do a recursive search.
222 wxWindow
* pWnd
= pParent
->FindItemByHWND(hWnd
);
227 if (!bControlOnly
|| pParent
->IsKindOf(CLASSINFO(wxControl
)))
229 wxWindow
* pItem
= pCurrent
->GetData();
231 if (pItem
->GetHWND() == hWnd
)
235 if (pItem
->ContainsHWND(hWnd
))
239 pCurrent
= pCurrent
->GetNext();
242 } // end of wxWindow::FindItemByHWND
245 // Default command handler
247 bool wxWindow::OS2Command(
248 WXUINT
WXUNUSED(uParam
)
249 , WXWORD
WXUNUSED(uId
)
253 DEBUG_PRINTF(wxWindow::OS2Command
);
258 // ----------------------------------------------------------------------------
259 // constructors and such
260 // ----------------------------------------------------------------------------
262 void wxWindow::Init()
272 m_bDoubleClickAllowed
= 0;
273 m_bWinCaptured
= FALSE
;
275 m_isBeingDeleted
= FALSE
;
278 m_bMouseInWindow
= FALSE
;
287 // Pass WM_GETDLGCODE to DefWindowProc()
292 m_bBackgroundTransparent
= FALSE
;
295 // As all windows are created with WS_VISIBLE style...
299 #if wxUSE_MOUSEEVENT_HACK
302 m_nLastMouseEvent
= -1;
303 #endif // wxUSE_MOUSEEVENT_HACK
305 DEBUG_PRINTF(wxWindow::Init
-End
);
312 wxWindow::~wxWindow()
314 DEBUG_PRINTF(wxWindow::~wxWindow
-Start
);
315 m_isBeingDeleted
= TRUE
;
317 OS2DetachWindowMenu();
319 m_parent
->RemoveChild(this);
326 if(!::WinDestroyWindow(GetHWND()))
327 wxLogLastError(wxT("DestroyWindow"));
329 // remove hWnd <-> wxWindow association
331 wxRemoveHandleAssociation(this);
333 DEBUG_PRINTF(wxWindow::~wxWindow
-End
);
334 } // end of wxWindow::~wxWindow
336 bool wxWindow::Create(
339 , const wxPoint
& rPos
340 , const wxSize
& rSize
342 , const wxString
& rName
345 HWND hParent
= NULLHANDLE
;
347 wxCHECK_MSG(pParent
, FALSE
, wxT("can't create wxWindow without parent"));
349 if ( !CreateBase( pParent
361 pParent
->AddChild(this);
362 hParent
= GetWinHwnd(pParent
);
365 hParent
= HWND_DESKTOP
;
367 ULONG ulCreateFlags
= 0L;
371 // Most wxSTYLES are really PM Class specific styles and will be
372 // set in those class create procs. PM's basic windows styles are
375 if (lStyle
& wxCLIP_CHILDREN
)
376 ulCreateFlags
|= WS_CLIPCHILDREN
;
379 // Empty stuff for now since PM has no custome 3D effects
380 // Doesn't mean someone cannot make some up though
383 WXDWORD dwExStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &bWant3D
);
386 // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
387 // and no presentation parameters
390 ,(PSZ
)wxCanvasClassName
395 ,WidthDefault(rSize
.x
)
396 ,HeightDefault(rSize
.y
)
403 } // end of wxWindow::Create
405 // ---------------------------------------------------------------------------
407 // ---------------------------------------------------------------------------
409 void wxWindow::SetFocus()
411 HWND hWnd
= GetHwnd();
414 ::WinSetFocus(HWND_DESKTOP
, hWnd
);
415 } // end of wxWindow::SetFocus
417 wxWindow
* wxWindowBase::FindFocus()
419 HWND hWnd
= ::WinQueryFocus(HWND_DESKTOP
);
423 return wxFindWinFromHandle((WXHWND
)hWnd
);
426 } // wxWindowBase::FindFocus
428 bool wxWindow::Enable(
432 if (!wxWindowBase::Enable(bEnable
))
435 HWND hWnd
= GetHwnd();
438 ::WinEnableWindow(hWnd
, (BOOL
)bEnable
);
440 wxWindowList::Node
* pNode
= GetChildren().GetFirst();
444 wxWindow
* pChild
= pNode
->GetData();
446 pChild
->Enable(bEnable
);
447 pNode
= pNode
->GetNext();
450 } // end of wxWindow::Enable
456 if (!wxWindowBase::Show(bShow
))
459 HWND hWnd
= GetHwnd();
461 ::WinShowWindow(hWnd
, bShow
);
465 ::WinSetWindowPos(hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_ACTIVATE
| SWP_ZORDER
);
468 } // end of wxWindow::Show
470 void wxWindow::Raise()
472 ::WinSetWindowPos(GetHwnd(), HWND_TOP
, 0, 0, 0, 0, SWP_ZORDER
| SWP_ACTIVATE
);
473 } // end of wxWindow::Raise
475 void wxWindow::Lower()
477 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_ZORDER
| SWP_DEACTIVATE
);
478 } // end of wxWindow::Lower
480 void wxWindow::SetTitle(
481 const wxString
& rTitle
484 ::WinSetWindowText(GetHwnd(), rTitle
.c_str());
485 } // end of wxWindow::SetTitle
487 wxString
wxWindow::GetTitle() const
489 return wxGetWindowText(GetHWND());
490 } // end of wxWindow::GetTitle
492 void wxWindow::CaptureMouse()
494 HWND hWnd
= GetHwnd();
496 if (hWnd
&& !m_bWinCaptured
)
498 ::WinSetCapture(HWND_DESKTOP
, hWnd
);
499 m_bWinCaptured
= TRUE
;
501 } // end of wxWindow::GetTitle
503 void wxWindow::ReleaseMouse()
507 ::WinSetCapture(HWND_DESKTOP
, NULLHANDLE
);
508 m_bWinCaptured
= FALSE
;
510 } // end of wxWindow::ReleaseMouse
512 bool wxWindow::SetFont(
516 DEBUG_PRINTF(wxWindow::SetFont
);
517 if (!wxWindowBase::SetFont(rFont
))
523 HWND hWnd
= GetHwnd();
529 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), rFont
.GetFaceName().c_str());
530 return(::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
), (PVOID
)zFont
));
535 bool wxWindow::SetCursor(
536 const wxCursor
& rCursor
537 ) // check if base implementation is OK
539 if ( !wxWindowBase::SetCursor(rCursor
))
545 wxASSERT_MSG( m_cursor
.Ok(),
546 wxT("cursor must be valid after call to the base version"));
548 HWND hWnd
= GetHwnd();
554 hPS
= ::WinGetPS(hWnd
);
556 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
557 ::WinQueryWindowRect(hWnd
, &vRect
);
559 hRGN
= ::GpiCreateRegion(hPS
, 1L, &vRect
);
561 if ((::GpiPtInRegion(hPS
, hRGN
, &vPoint
) == PRGN_INSIDE
) && !wxIsBusy())
563 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)m_cursor
.GetHCURSOR());
566 } // end of wxWindow::SetCursor
568 void wxWindow::WarpPointer(
577 ::WinQueryWindowRect(GetHwnd(), &vRect
);
581 ::WinSetPointerPos(HWND_DESKTOP
, (LONG
)nX
, (LONG
)(nY
));
582 } // end of wxWindow::WarpPointer
584 #if WXWIN_COMPATIBILITY
585 void wxWindow::OS2DeviceToLogical (float *x
, float *y
) const
588 #endif // WXWIN_COMPATIBILITY
590 // ---------------------------------------------------------------------------
592 // ---------------------------------------------------------------------------
594 #if WXWIN_COMPATIBILITY
595 void wxWindow::SetScrollRange(
601 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, nRange
));
602 } // end of wxWindow::SetScrollRange
604 void wxWindow::SetScrollPage(
610 if ( orient
== wxHORIZONTAL
)
616 int wxWindow::OldGetScrollRange(
621 HWND hWnd
= GetHwnd();
625 mRc
= WinSendMsg(hWnd
, SBM_QUERYRANGE
, (MPARAM
)0L, (MPARAM
)0L);
626 return(SHORT2FROMMR(mRc
));
629 } // end of wxWindow::OldGetScrollRange
631 int wxWindow::GetScrollPage(
635 if (nOrient
== wxHORIZONTAL
)
636 return m_nXThumbSize
;
638 return m_nYThumbSize
;
639 } // end of wxWindow::GetScrollPage
640 #endif // WXWIN_COMPATIBILITY
642 int wxWindow::GetScrollPos(
646 return((int)::WinSendMsg(GetHwnd(), SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
647 } // end of wxWindow::GetScrollPos
649 int wxWindow::GetScrollRange(
655 mr
= ::WinSendMsg(GetHwnd(), SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
656 return((int)SHORT2FROMMR(mr
));
657 } // end of wxWindow::GetScrollRange
659 int wxWindow::GetScrollThumb(
663 WNDPARAMS vWndParams
;
666 ::WinSendMsg(GetHwnd(), WM_QUERYWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)NULL
);
667 pSbcd
= (PSBCDATA
)vWndParams
.pCtlData
;
668 return((int)pSbcd
->posThumb
);
669 } // end of wxWindow::GetScrollThumb
671 void wxWindow::SetScrollPos(
677 ::WinSendMsg(GetHwnd(), SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
678 } // end of wxWindow::SetScrollPos(
680 void wxWindow::SetScrollbar(
688 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, nRange
));
689 if (nOrient
== wxHORIZONTAL
)
691 m_nXThumbSize
= nThumbVisible
;
695 m_nYThumbSize
= nThumbVisible
;
697 } // end of wxWindow::SetScrollbar
699 void wxWindow::ScrollWindow(
702 , const wxRect
* pRect
709 vRect2
.xLeft
= pRect
->x
;
710 vRect2
.yTop
= pRect
->y
;
711 vRect2
.xRight
= pRect
->x
+ pRect
->width
;
712 vRect2
.yBottom
= pRect
->y
+ pRect
->height
;
716 ::WinScrollWindow(GetHwnd(), (LONG
)nDx
, (LONG
)nDy
, &vRect2
, NULL
, NULLHANDLE
, NULL
, 0L);
718 ::WinScrollWindow(GetHwnd(), nDx
, nDy
, NULL
, NULL
, NULLHANDLE
, NULL
, 0L);
719 } // end of wxWindow::ScrollWindow
721 // ---------------------------------------------------------------------------
723 // ---------------------------------------------------------------------------
725 void wxWindow::SubclassWin(
729 HWND hwnd
= (HWND
)hWnd
;
731 wxASSERT_MSG( !m_fnOldWndProc
, wxT("subclassing window twice?") );
733 wxCHECK_RET(::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in SubclassWin") );
735 // wxAssociateWinWithHandle(hwnd, this);
737 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(hwnd
, (PFNWP
)wxWndProc
);
738 // ::WinSetWindowULong(hwnd, QWL_USER, (ULONG)wxWndProc);
739 } // end of wxWindow::SubclassWin
741 void wxWindow::UnsubclassWin()
743 // wxRemoveHandleAssociation(this);
746 // Restore old Window proc
748 HWND hwnd
= GetHWND();
754 wxCHECK_RET( ::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in UnsubclassWin") );
756 PFNWP fnProc
= (PFNWP
)::WinQueryWindowPtr(hwnd
, QWP_PFNWP
);
757 if ( (m_fnOldWndProc
!= 0) && (fnProc
!= (PFNWP
) m_fnOldWndProc
))
759 WinSubclassWindow(hwnd
, (PFNWP
)m_fnOldWndProc
);
763 } // end of wxWindow::UnsubclassWin
766 // Make a Windows extended style from the given wxWindows window style
768 WXDWORD
wxWindow::MakeExtendedStyle(
770 , bool bEliminateBorders
774 // PM does not support extended style
778 } // end of wxWindow::MakeExtendedStyle
781 // Determines whether native 3D effects or CTL3D should be used,
782 // applying a default border style if required, and returning an extended
783 // style to pass to CreateWindowEx.
785 WXDWORD
wxWindow::Determine3DEffects(
786 WXDWORD dwDefaultBorderStyle
790 WXDWORD dwStyle
= 0L;
793 // Native PM does not have any specialize 3D effects like WIN32 does
797 } // end of wxWindow::Determine3DEffects
799 #if WXWIN_COMPATIBILITY
800 void wxWindow::OnCommand(
802 , wxCommandEvent
& rEvent
805 if (GetEventHandler()->ProcessEvent(rEvent
))
808 m_parent
->GetEventHandler()->OnCommand( rWin
811 } // end of wxWindow::OnCommand
813 wxObject
* wxWindow::GetChild(
818 // Return a pointer to the Nth object in the Panel
820 wxNode
* pNode
= GetChildren().First();
824 pNode
= pNode
->Next();
827 wxObject
* pObj
= (wxObject
*)pNode
->Data();
832 } // end of wxWindow::GetChild
834 #endif // WXWIN_COMPATIBILITY
837 // Setup background and foreground colours correctly
839 void wxWindow::SetupColours()
842 SetBackgroundColour(GetParent()->GetBackgroundColour());
843 } // end of wxWindow::SetupColours
845 void wxWindow::OnIdle(
850 // Check if we need to send a LEAVE event
852 if (m_bMouseInWindow
)
856 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
857 if (::WinWindowFromPoint(HWND_DESKTOP
, &vPoint
, FALSE
) != (HWND
)GetHwnd())
860 // Generate a LEAVE event
862 m_bMouseInWindow
= FALSE
;
865 // Unfortunately the mouse button and keyboard state may have changed
866 // by the time the OnIdle function is called, so 'state' may be
871 if (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) != 0)
873 if (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) != 0);
876 wxMouseEvent
rEvent(wxEVT_LEAVE_WINDOW
);
878 InitMouseEvent( rEvent
883 (void)GetEventHandler()->ProcessEvent(rEvent
);
887 } // end of wxWindow::OnIdle
890 // Set this window to be the child of 'parent'.
892 bool wxWindow::Reparent(
896 if (!wxWindowBase::Reparent(pParent
))
899 HWND hWndChild
= GetHwnd();
900 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
902 ::WinSetParent(hWndChild
, hWndParent
, TRUE
);
904 } // end of wxWindow::Reparent
906 void wxWindow::Clear()
908 wxClientDC
vDc(this);
909 wxBrush
vBrush( GetBackgroundColour()
913 vDc
.SetBackground(vBrush
);
915 } // end of wxWindow::Clear
917 void wxWindow::Refresh(
919 , const wxRect
* pRect
922 HWND hWnd
= GetHwnd();
930 vOs2Rect
.xLeft
= pRect
->x
;
931 vOs2Rect
.yTop
= pRect
->y
;
932 vOs2Rect
.xRight
= pRect
->x
+ pRect
->width
;
933 vOs2Rect
.yBottom
= pRect
->y
+ pRect
->height
;
935 ::WinInvalidateRect(hWnd
, &vOs2Rect
, bEraseBack
);
938 ::WinInvalidateRect(hWnd
, NULL
, bEraseBack
);
940 } // end of wxWindow::Refresh
942 // ---------------------------------------------------------------------------
944 // ---------------------------------------------------------------------------
946 #if wxUSE_DRAG_AND_DROP
947 void wxWindow::SetDropTarget(
948 wxDropTarget
* pDropTarget
951 if (m_dropTarget
!= 0)
953 m_dropTarget
->Revoke(m_hWnd
);
956 m_dropTarget
= pDropTarget
;
957 if (m_dropTarget
!= 0)
958 m_dropTarget
->Register(m_hWnd
);
959 } // end of wxWindow::SetDropTarget
963 // old style file-manager drag&drop support: we retain the old-style
964 // DragAcceptFiles in parallel with SetDropTarget.
966 void wxWindow::DragAcceptFiles(
970 HWND hWnd
= GetHwnd();
973 ::DrgAcceptDroppedFiles(hWnd
, NULL
, NULL
, DO_COPY
, 0L);
974 } // end of wxWindow::DragAcceptFiles
976 // ----------------------------------------------------------------------------
978 // ----------------------------------------------------------------------------
982 void wxWindow::DoSetToolTip(
986 wxWindowBase::DoSetToolTip(pTooltip
);
989 m_tooltip
->SetWindow(this);
990 } // end of wxWindow::DoSetToolTip
992 #endif // wxUSE_TOOLTIPS
994 // ---------------------------------------------------------------------------
995 // moving and resizing
996 // ---------------------------------------------------------------------------
999 void wxWindow::DoGetSize(
1004 HWND hWnd
= GetHwnd();
1007 ::WinQueryWindowRect(hWnd
, &vRect
);
1010 *pWidth
= vRect
.xRight
- vRect
.xLeft
;
1012 // OS/2 PM is backwards from windows
1013 *pHeight
= vRect
.yTop
- vRect
.yBottom
;
1014 } // end of wxWindow::DoGetSize
1016 void wxWindow::DoGetPosition(
1021 HWND hWnd
= GetHwnd();
1025 ::WinQueryWindowRect(hWnd
, &vRect
);
1027 vPoint
.x
= vRect
.xLeft
;
1028 vPoint
.y
= vRect
.yBottom
;
1031 // We do the adjustments with respect to the parent only for the "real"
1032 // children, not for the dialogs/frames
1036 HWND hParentWnd
= 0;
1037 wxWindow
* pParent
= GetParent();
1040 hParentWnd
= GetWinHwnd(pParent
);
1043 // Since we now have the absolute screen coords, if there's a parent we
1044 // must subtract its bottom left corner
1050 ::WinQueryWindowRect(hParentWnd
, &vRect2
);
1051 vPoint
.x
-= vRect
.xLeft
;
1052 vPoint
.y
-= vRect
.yBottom
;
1056 // We may be faking the client origin. So a window that's really at (0,
1057 // 30) may appear (to wxWin apps) to be at (0, 0).
1059 wxPoint
vPt(pParent
->GetClientAreaOrigin());
1069 } // end of wxWindow::DoGetPosition
1071 void wxWindow::DoScreenToClient(
1076 HWND hWnd
= GetHwnd();
1079 ::WinQueryWindowPos(hWnd
, &vSwp
);
1085 } // end of wxWindow::DoScreenToClient
1087 void wxWindow::DoClientToScreen(
1092 HWND hWnd
= GetHwnd();
1095 ::WinQueryWindowPos(hWnd
, &vSwp
);
1101 } // end of wxWindow::DoClientToScreen
1104 // Get size *available for subwindows* i.e. excluding menu bar etc.
1105 // Must be a frame type window
1107 void wxWindow::DoGetClientSize(
1112 HWND hWnd
= GetHwnd();
1116 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1117 ::WinQueryWindowRect(hWndClient
, &vRect
);
1120 *pWidth
= vRect
.xRight
;
1122 *pHeight
= vRect
.yTop
;
1123 } // end of wxWindow::DoGetClientSize
1125 void wxWindow::DoMoveWindow(
1132 if ( !::WinSetWindowPos( GetHwnd()
1138 ,SWP_SIZE
| SWP_MOVE
1141 wxLogLastError("MoveWindow");
1143 } // end of wxWindow::DoMoveWindow
1146 // Set the size of the window: if the dimensions are positive, just use them,
1147 // but if any of them is equal to -1, it means that we must find the value for
1148 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
1149 // which case -1 is a valid value for x and y)
1151 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
1152 // the width/height to best suit our contents, otherwise we reuse the current
1155 void wxWindow::DoSetSize(
1164 // Get the current size and position...
1170 wxSize
vSize(-1, -1);
1172 GetPosition( &nCurrentX
1175 GetSize( &nCurrentWidth
1180 // ... and don't do anything (avoiding flicker) if it's already ok
1182 if ( nX
== nCurrentX
&&
1184 nWidth
== nCurrentWidth
&&
1185 nHeight
== nCurrentHeight
1191 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1193 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1196 AdjustForParentClientOrigin( nX
1203 if (nSizeFlags
& wxSIZE_AUTO_WIDTH
)
1205 vSize
= DoGetBestSize();
1211 // Just take the current one
1213 nWidth
= nCurrentWidth
;
1219 if (nSizeFlags
& wxSIZE_AUTO_HEIGHT
)
1223 vSize
= DoGetBestSize();
1229 // just take the current one
1230 nHeight
= nCurrentHeight
;
1239 } // end of wxWindow::DoSetSize
1241 void wxWindow::DoSetClientSize(
1246 wxWindow
* pParent
= GetParent();
1247 HWND hWnd
= GetHwnd();
1248 HWND hParentWnd
= (HWND
)0;
1249 HWND hClientWnd
= (HWND
)0;
1254 hClientWnd
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1255 ::WinQueryWindowRect(hClientWnd
, &vRect2
);
1258 hParentWnd
= (HWND
) pParent
->GetHWND();
1260 ::WinQueryWindowRect(hWnd
, &vRect
);
1261 ::WinQueryWindowRect(hParentWnd
, &vRect3
);
1263 // Find the difference between the entire window (title bar and all)
1264 // and the client area; add this to the new client size to move the
1265 // window. OS/2 is backward from windows on height
1267 int nActualWidth
= vRect2
.xRight
- vRect2
.xLeft
- vRect
.xRight
+ nWidth
;
1268 int nActualHeight
= vRect2
.yTop
- vRect2
.yBottom
- vRect
.yTop
+ nHeight
;
1271 // If there's a parent, must subtract the parent's bottom left corner
1272 // since MoveWindow moves relative to the parent
1276 vPoint
.x
= vRect2
.xLeft
;
1277 vPoint
.y
= vRect2
.yBottom
;
1280 vPoint
.x
-= vRect3
.xLeft
;
1281 vPoint
.y
-= vRect3
.yBottom
;
1284 DoMoveWindow( vPoint
.x
1290 wxSizeEvent
vEvent( wxSize( nWidth
1296 vEvent
.SetEventObject(this);
1297 GetEventHandler()->ProcessEvent(vEvent
);
1298 } // end of wxWindow::DoSetClientSize
1300 wxPoint
wxWindow::GetClientAreaOrigin() const
1302 return wxPoint(0, 0);
1303 } // end of wxWindow::GetClientAreaOrigin
1305 void wxWindow::AdjustForParentClientOrigin(
1312 // Don't do it for the dialogs/frames - they float independently of their
1317 wxWindow
* pParent
= GetParent();
1319 if (!(nSizeFlags
& wxSIZE_NO_ADJUSTMENTS
) && pParent
)
1321 wxPoint
vPoint(pParent
->GetClientAreaOrigin());
1326 } // end of wxWindow::AdjustForParentClientOrigin
1328 // ---------------------------------------------------------------------------
1330 // ---------------------------------------------------------------------------
1332 int wxWindow::GetCharHeight() const
1335 FONTMETRICS vFontMetrics
;
1338 hPs
= ::WinGetPS(GetHwnd());
1340 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1343 return(vFontMetrics
.lMaxAscender
+ vFontMetrics
.lMaxDescender
);
1344 ::WinReleasePS(hPs
);
1345 } // end of wxWindow::GetCharHeight
1347 int wxWindow::GetCharWidth() const
1350 FONTMETRICS vFontMetrics
;
1352 hPs
= ::WinGetPS(GetHwnd());
1354 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1357 return(vFontMetrics
.lAveCharWidth
);
1358 ::WinReleasePS(hPs
);
1359 } // end of wxWindow::GetCharWidth
1361 void wxWindow::GetTextExtent(
1362 const wxString
& rString
1366 , int* pExternalLeading
1367 , const wxFont
* pTheFont
1370 const wxFont
* pFontToUse
= pTheFont
;
1373 hPs
= ::WinGetPS(GetHwnd());
1375 // TODO: Will have to play with fonts later
1378 pFontToUse = &m_font;
1381 HFONT hFfontOld = 0;
1383 if (pFontToUse && pFontToUse->Ok())
1386 hFnt = (HFONT)((wxFont *)pFontToUse)->GetResourceHandle(); // const_cast
1388 hFontOld = (HFONT)SelectObject(dc,fnt);
1393 GetTextExtentPoint(dc, string, (int)string.Length(), &sizeRect);
1394 GetTextMetrics(dc, &tm);
1396 if ( fontToUse && fnt && hfontOld )
1397 SelectObject(dc, hfontOld);
1399 ReleaseDC(hWnd, dc);
1406 *descent = tm.tmDescent;
1407 if ( externalLeading )
1408 *externalLeading = tm.tmExternalLeading;
1410 ::WinReleasePS(hPs
);
1413 #if wxUSE_CARET && WXWIN_COMPATIBILITY
1414 // ---------------------------------------------------------------------------
1415 // Caret manipulation
1416 // ---------------------------------------------------------------------------
1418 void wxWindow::CreateCaret(
1423 SetCaret(new wxCaret( this
1427 } // end of wxWindow::CreateCaret
1429 void wxWindow::CreateCaret(
1430 const wxBitmap
* pBitmap
1433 wxFAIL_MSG("not implemented");
1434 } // end of wxWindow::CreateCaret
1436 void wxWindow::ShowCaret(
1440 wxCHECK_RET( m_caret
, "no caret to show" );
1442 m_caret
->Show(bShow
);
1443 } // end of wxWindow::ShowCaret
1445 void wxWindow::DestroyCaret()
1448 } // end of wxWindow::DestroyCaret
1450 void wxWindow::SetCaretPos(
1454 wxCHECK_RET( m_caret
, "no caret to move" );
1459 } // end of wxWindow::SetCaretPos
1461 void wxWindow::GetCaretPos(
1466 wxCHECK_RET( m_caret
, "no caret to get position of" );
1468 m_caret
->GetPosition( pX
1471 } // end of wxWindow::GetCaretPos
1473 #endif //wxUSE_CARET
1475 // ---------------------------------------------------------------------------
1477 // ---------------------------------------------------------------------------
1479 bool wxWindow::DoPopupMenu(
1485 HWND hWnd
= GetHwnd();
1486 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
1487 HWND hMenu
= GetHmenuOf(pMenu
);
1489 pMenu
->SetInvokingWindow(this);
1492 DoClientToScreen( &nX
1495 wxCurrentPopupMenu
= pMenu
;
1497 ::WinPopupMenu( hWndParent
1503 ,PU_MOUSEBUTTON2DOWN
| PU_MOUSEBUTTON2
| PU_KEYBOARD
1506 wxCurrentPopupMenu
= NULL
;
1508 pMenu
->SetInvokingWindow(NULL
);
1510 } // end of wxWindow::DoPopupMenu
1512 // ===========================================================================
1513 // pre/post message processing
1514 // ===========================================================================
1516 MRESULT
wxWindow::OS2DefWindowProc(
1522 DEBUG_PRINTF(wxWindow::OS2DefWindowProc
);
1525 return (MRESULT
)m_fnOldWndProc(GetHWND(), (ULONG
)uMsg
, (MPARAM
)wParam
, (MPARAM
)lParam
);
1527 return ::WinDefWindowProc(GetHWND(), (ULONG
)uMsg
, (MPARAM
)wParam
, (MPARAM
)lParam
);
1528 } // end of wxWindow::OS2DefWindowProc
1530 bool wxWindow::OS2ProcessMessage(
1534 QMSG
* pQMsg
= (QMSG
*)pMsg
;
1536 DEBUG_PRINTF(OS2ProcessMessage
);
1538 if (m_hWnd
!= 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL
))
1541 // Intercept dialog navigation keys
1543 bool bProcess
= TRUE
;
1544 USHORT uKeyFlags
= SHORT1FROMMP(pQMsg
->mp1
);
1546 if (uKeyFlags
& KC_KEYUP
)
1549 if (uKeyFlags
& KC_ALT
)
1552 if (!(uKeyFlags
& KC_VIRTUALKEY
))
1557 bool bCtrlDown
= IsCtrlDown();
1558 bool bShiftDown
= IsShiftDown();
1561 // WM_QUERYDLGCODE: ask the control if it wants the key for itself,
1562 // don't process it if it's the case (except for Ctrl-Tab/Enter
1563 // combinations which are always processed)
1565 ULONG ulDlgCode
= 0;
1569 ulDlgCode
= (ULONG
)::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0);
1572 bool bForward
= TRUE
;
1573 bool bWindowChange
= FALSE
;
1575 switch (SHORT2FROMMP(pQMsg
->mp2
))
1578 // Going to make certain assumptions about specific types of controls
1579 // here, so we may have to alter some things later if they prove invalid
1583 // Shift tabl will always be a nav-key but tabs may be wanted
1592 // Entry Fields want tabs for themselve usually
1596 case DLGC_ENTRYFIELD
:
1606 // Ctrl-Tab cycles thru notebook pages
1608 bWindowChange
= bCtrlDown
;
1609 bForward
= !bShiftDown
;
1632 // ctrl-enter is not processed
1636 else if (ulDlgCode
& DLGC_BUTTON
)
1639 // buttons want process Enter themselevs
1645 wxPanel
* pPanel
= wxDynamicCast(this, wxPanel
);
1646 wxButton
* pBtn
= NULL
;
1651 // Panel may have a default button which should
1652 // be activated by Enter
1654 pBtn
= pPanel
->GetDefaultItem();
1657 if (pBtn
&& pBtn
->IsEnabled())
1660 // If we do have a default button, do press it
1662 pBtn
->OS2Command(BN_CLICKED
, 0 /* unused */);
1665 // else: but if it does not it makes sense to make
1666 // it work like a TAB - and that's what we do.
1667 // Note that Ctrl-Enter always works this way.
1678 wxNavigationKeyEvent vEvent
;
1680 vEvent
.SetDirection(bForward
);
1681 vEvent
.SetWindowChange(bWindowChange
);
1682 vEvent
.SetEventObject(this);
1684 if (GetEventHandler()->ProcessEvent(vEvent
))
1686 wxButton
* pBtn
= wxDynamicCast(FindFocus(), wxButton
);
1691 // The button which has focus should be default
1700 // Let Dialogs process
1702 if (::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0));
1709 // relay mouse move events to the tooltip control
1710 QMSG
* pQMsg
= (QMSG
*)pMsg
;
1712 if (pQMsg
->msg
== WM_MOUSEMOVE
)
1713 m_tooltip
->RelayEvent(pMsg
);
1715 #endif // wxUSE_TOOLTIPS
1718 } // end of wxWindow::OS2ProcessMessage
1720 bool wxWindow::OS2TranslateMessage(
1725 return m_acceleratorTable
.Translate(m_hWnd
, pMsg
);
1728 #endif //wxUSE_ACCEL
1729 } // end of wxWindow::OS2TranslateMessage
1731 // ---------------------------------------------------------------------------
1732 // message params unpackers
1733 // ---------------------------------------------------------------------------
1735 void wxWindow::UnpackCommand(
1744 *pId = LOWORD(wParam);
1745 *phWnd = (WXHWND)lParam;
1746 *pCmd = HIWORD(wParam);
1748 *pId
= LOWORD(wParam
);
1749 *phWnd
= NULL
; // or may be GetHWND() ?
1750 *pCmd
= LOWORD(lParam
);
1751 } // end of wxWindow::UnpackCommand
1753 void wxWindow::UnpackActivate(
1760 *pState
= LOWORD(wParam
);
1761 *phWnd
= (WXHWND
)lParam
;
1762 } // end of wxWindow::UnpackActivate
1764 void wxWindow::UnpackScroll(
1772 *pCode
= LOWORD(wParam
);
1773 *pPos
= HIWORD(wParam
);
1774 *phWnd
= (WXHWND
)lParam
;
1775 } // end of wxWindow::UnpackScroll
1777 void wxWindow::UnpackMenuSelect(
1785 *pItem
= (WXWORD
)LOWORD(wParam
);
1786 *pFlags
= HIWORD(wParam
);
1787 *phMenu
= (WXHMENU
)lParam
;
1788 } // end of wxWindow::UnpackMenuSelect
1790 // ---------------------------------------------------------------------------
1791 // Main wxWindows window proc and the window proc for wxWindow
1792 // ---------------------------------------------------------------------------
1795 // Hook for new window just as it's being created, when the window isn't yet
1796 // associated with the handle
1798 wxWindow
* wxWndHook
= NULL
;
1803 MRESULT EXPENTRY
wxWndProc(
1811 // Trace all ulMsgs - useful for the debugging
1814 DEBUG_PRINTF(__WXDEBUG__wxWndProc
);
1815 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
1816 wxGetMessageName(ulMsg
), wParam
, lParam
);
1817 #endif // __WXDEBUG__
1819 wxWindow
* pWnd
= wxFindWinFromHandle((WXHWND
)hWnd
);
1822 // When we get the first message for the HWND we just created, we associate
1823 // it with wxWindow stored in wxWndHook
1825 if (!pWnd
&& wxWndHook
)
1827 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
1830 pWnd
->SetHWND((WXHWND
)hWnd
);
1833 MRESULT rc
= (MRESULT
)0;
1837 // Stop right here if we don't have a valid handle in our wxWindow object.
1839 if (pWnd
&& !pWnd
->GetHWND())
1841 pWnd
->SetHWND((WXHWND
) hWnd
);
1842 rc
= pWnd
->OS2DefWindowProc(ulMsg
, wParam
, lParam
);
1848 rc
= pWnd
->OS2WindowProc(ulMsg
, wParam
, lParam
);
1850 rc
= ::WinDefWindowProc(hWnd
, ulMsg
, wParam
, lParam
);
1854 } // end of wxWndProc
1857 // We will add (or delete) messages we need to handle at this default
1860 MRESULT
wxWindow::OS2WindowProc(
1867 // Did we process the uMsg?
1869 bool bProcessed
= FALSE
;
1887 // For most messages we should return 0 when we do process the message
1889 mResult
= (MRESULT
)0;
1897 bProcessed
= HandleCreate( (WXLPCREATESTRUCT
)lParam
1903 // Return 0 to bAllow window creation
1905 mResult
= (MRESULT
)(bMayCreate
? 0 : -1);
1916 bProcessed
= HandleMove( LOWORD(lParam
)
1922 bProcessed
= HandleSize( LOWORD(lParam
)
1933 UnpackActivate( wParam
1939 bProcessed
= HandleActivate( wState
1947 if (SHORT1FROMMP((MPARAM
)lParam
) == TRUE
)
1948 bProcessed
= HandleSetFocus((WXHWND
)(HWND
)wParam
);
1950 bProcessed
= HandleKillFocus((WXHWND
)(HWND
)wParam
);
1954 DEBUG_PRINTF(WM_PAINT
)
1955 bProcessed
= HandlePaint();
1960 // Don't let the DefWindowProc() destroy our window - we'll do it
1961 // ourselves in ~wxWindow
1964 mResult
= (MRESULT
)TRUE
;
1965 DEBUG_PRINTF(WM_CLOSE
)
1969 DEBUG_PRINTF(WM_SHOW
)
1970 bProcessed
= HandleShow(wParam
!= 0, (int)lParam
);
1974 // Under OS2 PM Joysticks are treated just like mouse events
1975 // The "Motion" events will be prevelent in joysticks
1978 case WM_BUTTON1DOWN
:
1980 case WM_BUTTON1DBLCLK
:
1981 case WM_BUTTON1MOTIONEND
:
1982 case WM_BUTTON1MOTIONSTART
:
1983 case WM_BUTTON2DOWN
:
1985 case WM_BUTTON2DBLCLK
:
1986 case WM_BUTTON2MOTIONEND
:
1987 case WM_BUTTON2MOTIONSTART
:
1988 case WM_BUTTON3DOWN
:
1990 case WM_BUTTON3DBLCLK
:
1991 case WM_BUTTON3MOTIONEND
:
1992 case WM_BUTTON3MOTIONSTART
:
1994 short x
= LOWORD(lParam
);
1995 short y
= HIWORD(lParam
);
1997 bProcessed
= HandleMouseEvent(uMsg
, x
, y
, (WXUINT
)wParam
);
2001 bProcessed
= HandleSysCommand(wParam
, lParam
);
2008 DEBUG_PRINTF(WM_COMMAND
-in
)
2009 UnpackCommand(wParam
, lParam
, &id
, &hwnd
, &cmd
);
2011 bProcessed
= HandleCommand(id
, cmd
, hwnd
);
2012 DEBUG_PRINTF(WM_COMMAND
-out
)
2017 // For these messages we must return TRUE if process the message
2020 case WM_MEASUREITEM
:
2022 int idCtrl
= (UINT
)wParam
;
2023 if ( uMsg
== WM_DRAWITEM
)
2025 bProcessed
= OS2OnDrawItem(idCtrl
,
2026 (WXDRAWITEMSTRUCT
*)lParam
);
2030 bProcessed
= OS2OnMeasureItem(idCtrl
,
2031 (WXMEASUREITEMSTRUCT
*)lParam
);
2035 mResult
= (MRESULT
)TRUE
;
2039 case WM_QUERYDLGCODE
:
2042 mResult
= (MRESULT
)m_lDlgCode
;
2046 //else: get the dlg code from the DefWindowProc()
2051 // In OS/2 PM all keyboard events are of the WM_CHAR type. Virtual key and key-up
2052 // and key-down events are obtained from the WM_CHAR params.
2056 USHORT uKeyFlags
= SHORT1FROMMP((MPARAM
)wParam
);
2058 if (uKeyFlags
& KC_KEYUP
)
2060 bProcessed
= HandleKeyUp((WXDWORD
)wParam
, lParam
);
2063 else // keydown event
2066 // If this has been processed by an event handler,
2067 // return 0 now (we've handled it). DON't RETURN
2068 // we still need to process further
2070 HandleKeyDown((WXDWORD
)wParam
, lParam
);
2071 if (uKeyFlags
& KC_VIRTUALKEY
)
2073 USHORT uVk
= SHORT2FROMMP((MPARAM
)lParam
);
2076 // We consider these message "not interesting" to OnChar
2078 if (uVk
== VK_SHIFT
|| uVk
== VK_CTRL
)
2086 // Avoid duplicate messages to OnChar for these ASCII keys: they
2087 // will be translated by TranslateMessage() and received in WM_CHAR
2093 // But set processed to FALSE, not TRUE to still pass them to
2094 // the control's default window proc - otherwise built-in
2095 // keyboard handling won't work
2104 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
);
2108 else // WM_CHAR -- Always an ASCII character
2110 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
, TRUE
);
2122 UnpackScroll( wParam
2129 bProcessed
= OS2OnScroll( uMsg
== WM_HSCROLL
? wxHORIZONTAL
2138 #if defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
2139 case WM_CTLCOLORCHANGE
:
2141 bProcessed
= HandleCtlColor(&hBrush
);
2146 // Instead of CTLCOLOR messages PM sends QUERYWINDOWPARAMS to
2147 // things such as colors and fonts and such
2149 case WM_QUERYWINDOWPARAMS
:
2151 PWNDPARAMS pWndParams
= (PWNDPARAMS
)wParam
;
2153 bProcessed
= HandleWindowParams( pWndParams
2159 // the return value for this message is ignored
2160 case WM_SYSCOLORCHANGE
:
2161 bProcessed
= HandleSysColorChange();
2164 case WM_REALIZEPALETTE
:
2165 bProcessed
= HandlePaletteChanged();
2168 case WM_PRESPARAMCHANGED
:
2169 bProcessed
= HandlePresParamChanged(wParam
);
2172 // move this to wxFrame
2173 case WM_ERASEBACKGROUND
:
2174 bProcessed
= HandleEraseBkgnd((WXHDC
)(HDC
)wParam
);
2178 // We processed the message, i.e. erased the background
2180 mResult
= (MRESULT
)TRUE
;
2184 // move all drag and drops to wxDrg
2186 bProcessed
= HandleEndDrag(wParam
);
2190 bProcessed
= HandleInitDialog((WXHWND
)(HWND
)wParam
);
2194 // we never set focus from here
2199 // wxFrame specific message
2200 case WM_MINMAXFRAME
:
2201 bProcessed
= HandleGetMinMaxInfo((PSWP
)wParam
);
2204 case WM_SYSVALUECHANGED
:
2205 // TODO: do something
2206 mResult
= (MRESULT
)TRUE
;
2210 // Comparable to WM_SETPOINTER for windows, only for just controls
2212 case WM_CONTROLPOINTER
:
2213 bProcessed
= HandleSetCursor( SHORT1FROMMP(wParam
) // Control ID
2214 ,(HWND
)lParam
// Cursor Handle
2219 // Returning TRUE stops the DefWindowProc() from further
2220 // processing this message - exactly what we need because we've
2221 // just set the cursor.
2223 mResult
= (MRESULT
)TRUE
;
2231 wxLogTrace(wxTraceMessages
, wxT("Forwarding %s to DefWindowProc."),
2232 wxGetMessageName(uMsg
));
2233 #endif // __WXDEBUG__
2234 mResult
= OS2DefWindowProc(uMsg
, wParam
, lParam
);
2237 } // end of wxWindow::OS2WindowProc
2240 // Dialog window proc
2248 if (uMsg
== WM_INITDLG
)
2251 // For this message, returning TRUE tells system to set focus to the
2252 // first control in the dialog box
2254 return (MRESULT
)TRUE
;
2259 // For all the other ones, FALSE means that we didn't process the
2264 } // end of wxDlgProc
2266 wxWindow
* wxFindWinFromHandle(
2270 wxNode
* pNode
= wxWinHandleList
->Find((long)hWnd
);
2274 return (wxWindow
*)pNode
->Data();
2275 } // end of wxFindWinFromHandle
2277 void wxAssociateWinWithHandle(
2283 // Adding NULL hWnd is (first) surely a result of an error and
2284 // (secondly) breaks menu command processing
2286 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
2287 wxT("attempt to add a NULL hWnd to window list ignored") );
2290 wxWindow
* pOldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
2292 if (pOldWin
&& (pOldWin
!= pWin
))
2294 wxString
str(pWin
->GetClassInfo()->GetClassName());
2295 wxLogError( "Bug! Found existing HWND %X for new window of class %s"
2302 wxWinHandleList
->Append( (long)hWnd
2306 } // end of wxAssociateWinWithHandle
2308 void wxRemoveHandleAssociation(
2312 wxWinHandleList
->DeleteObject(pWin
);
2313 } // end of wxRemoveHandleAssociation
2316 // Default destroyer - override if you destroy it in some other way
2317 // (e.g. with MDI child windows)
2319 void wxWindow::OS2DestroyWindow()
2323 void wxWindow::OS2DetachWindowMenu()
2327 HMENU hMenu
= (HMENU
)m_hMenu
;
2329 int nN
= (int)::WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
2332 for (i
= 0; i
< nN
; i
++)
2335 int nChars
= (int)::WinSendMsg( hMenu
2337 ,MPFROM2SHORT(i
, nN
)
2342 wxLogLastError(wxT("GetMenuString"));
2346 if (wxStrcmp(zBuf
, wxT("&Window")) == 0)
2348 ::WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
2353 } // end of wxWindow::OS2DetachWindowMenu
2355 bool wxWindow::OS2Create(
2358 , const wxChar
* zTitle
2366 , unsigned long ulId
2376 long lHeight1
= 20L;
2380 // Find parent's size, if it exists, to set up a possible default
2381 // panel size the size of the parent window
2398 // check to see if the new window is a standard control
2400 if ((ULONG
)zClass
== (ULONG
)WC_BUTTON
||
2401 (ULONG
)zClass
== (ULONG
)WC_COMBOBOX
||
2402 (ULONG
)zClass
== (ULONG
)WC_CONTAINER
||
2403 (ULONG
)zClass
== (ULONG
)WC_ENTRYFIELD
||
2404 (ULONG
)zClass
== (ULONG
)WC_FRAME
||
2405 (ULONG
)zClass
== (ULONG
)WC_LISTBOX
||
2406 (ULONG
)zClass
== (ULONG
)WC_MENU
||
2407 (ULONG
)zClass
== (ULONG
)WC_NOTEBOOK
||
2408 (ULONG
)zClass
== (ULONG
)WC_SCROLLBAR
||
2409 (ULONG
)zClass
== (ULONG
)WC_SPINBUTTON
||
2410 (ULONG
)zClass
== (ULONG
)WC_STATIC
||
2411 (ULONG
)zClass
== (ULONG
)WC_TITLEBAR
||
2412 (ULONG
)zClass
== (ULONG
)WC_VALUESET
2419 // We will either have a registered class via string name or a standard PM Class via a long
2421 m_hWnd
= (WXHWND
)::WinCreateWindow( (HWND
)hParent
2423 ,(PSZ
)zTitle
? zTitle
: wxT("")
2437 vError
= ::WinGetLastError(vHabmain
);
2438 sError
= wxPMErrorToStr(vError
);
2439 wxLogError("Can't create window of class %s!. Error: %s\n", zClass
, sError
);
2442 ::WinSetWindowULong(m_hWnd
, QWL_USER
, (ULONG
) this);
2446 wxNode
* pNode
= wxWinHandleList
->Member(this);
2450 HWND hWnd
= (HWND
)pNode
->GetKeyInteger();
2452 if (hWnd
!= (HWND
)m_hWnd
)
2455 wxLogError("A second HWND association is being added for the same window!");
2459 wxAssociateWinWithHandle((HWND
)m_hWnd
2463 // Now need to subclass window.
2466 SubclassWin(GetHWND());
2469 } // end of wxWindow::OS2Create
2471 // ===========================================================================
2472 // OS2 PM message handlers
2473 // ===========================================================================
2475 // ---------------------------------------------------------------------------
2476 // window creation/destruction
2477 // ---------------------------------------------------------------------------
2479 bool wxWindow::HandleCreate(
2480 WXLPCREATESTRUCT vCs
2484 wxWindowCreateEvent
vEvent(this);
2486 (void)GetEventHandler()->ProcessEvent(vEvent
);
2487 *pbMayCreate
= TRUE
;
2489 } // end of wxWindow::HandleCreate
2491 bool wxWindow::HandleDestroy()
2493 wxWindowDestroyEvent
vEvent(this);
2495 (void)GetEventHandler()->ProcessEvent(vEvent
);
2498 // Delete our drop target if we've got one
2500 #if wxUSE_DRAG_AND_DROP
2501 if (m_dropTarget
!= NULL
)
2503 m_dropTarget
->Revoke(m_hWnd
);
2504 delete m_dropTarget
;
2505 m_dropTarget
= NULL
;
2507 #endif // wxUSE_DRAG_AND_DROP
2510 // WM_DESTROY handled
2513 } // end of wxWindow::HandleDestroy
2515 // ---------------------------------------------------------------------------
2517 // ---------------------------------------------------------------------------
2518 void wxWindow::OnSetFocus(
2519 wxFocusEvent
& rEvent
2523 // Panel wants to track the window which was the last to have focus in it,
2524 // so we want to set ourselves as the window which last had focus
2526 // Notice that it's also important to do it upwards the tree becaus
2527 // otherwise when the top level panel gets focus, it won't set it back to
2528 // us, but to some other sibling
2530 wxWindow
* pWin
= this;
2534 wxWindow
* pParent
= pWin
->GetParent();
2535 wxPanel
* pPanel
= wxDynamicCast( pParent
2540 pPanel
->SetLastFocus(pWin
);
2545 wxLogTrace(_T("focus"), _T("%s (0x%08x) gets focus"),
2546 GetClassInfo()->GetClassName(), GetHandle());
2549 } // end of wxWindow::OnSetFocus
2551 bool wxWindow::HandleActivate(
2553 , WXHWND
WXUNUSED(hActivate
)
2556 wxActivateEvent
vEvent( wxEVT_ACTIVATE
2560 vEvent
.SetEventObject(this);
2561 return GetEventHandler()->ProcessEvent(vEvent
);
2562 } // end of wxWindow::HandleActivate
2564 bool wxWindow::HandleSetFocus(
2565 WXHWND
WXUNUSED(hWnd
)
2574 m_caret
->OnSetFocus();
2576 #endif // wxUSE_CARET
2579 // Panel wants to track the window which was the last to have focus in it
2581 wxPanel
* pPanel
= wxDynamicCast( GetParent()
2586 pPanel
->SetLastFocus(this);
2589 wxFocusEvent
vEvent(wxEVT_SET_FOCUS
, m_windowId
);
2591 vEvent
.SetEventObject(this);
2592 return GetEventHandler()->ProcessEvent(vEvent
);
2593 } // end of wxWindow::HandleSetFocus
2595 bool wxWindow::HandleKillFocus(
2596 WXHWND
WXUNUSED(hWnd
)
2605 m_caret
->OnKillFocus();
2607 #endif // wxUSE_CARET
2609 wxFocusEvent
vEvent( wxEVT_KILL_FOCUS
2613 vEvent
.SetEventObject(this);
2614 return GetEventHandler()->ProcessEvent(vEvent
);
2615 } // end of wxWindow::HandleKillFocus
2617 // ---------------------------------------------------------------------------
2619 // ---------------------------------------------------------------------------
2621 bool wxWindow::HandleShow(
2626 wxShowEvent
vEvent( GetId()
2630 vEvent
.m_eventObject
= this;
2631 return GetEventHandler()->ProcessEvent(vEvent
);
2632 } // end of wxWindow::HandleShow
2634 bool wxWindow::HandleInitDialog(
2635 WXHWND
WXUNUSED(hWndFocus
)
2638 wxInitDialogEvent
vEvent(GetId());
2640 vEvent
.m_eventObject
= this;
2641 return GetEventHandler()->ProcessEvent(vEvent
);
2642 } // end of wxWindow::HandleInitDialog
2644 bool wxWindow::HandleEndDrag(WXWPARAM wParam
)
2646 // TODO: We'll handle drag and drop later
2650 bool wxWindow::HandleSetCursor(
2656 // Under OS/2 PM this allows the pointer to be changed
2657 // as it passes over a control
2659 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)hPointer
);
2661 } // end of wxWindow::HandleSetCursor
2663 // ---------------------------------------------------------------------------
2664 // owner drawn stuff
2665 // ---------------------------------------------------------------------------
2666 bool wxWindow::OS2OnDrawItem(
2668 , WXDRAWITEMSTRUCT
* pItemStruct
2672 // I'll get to owner drawn stuff later
2676 // is it a menu item or control?
2678 wxWindow
* pItem
= FindItem(vId
);
2680 #if wxUSE_OWNER_DRAWN
2681 if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxControl
)))
2683 return ((wxControl
*)pItem
)->OS2OnDraw(pItemStruct
);
2685 else if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxMenu
)))
2688 // TODO: draw a menu item
2690 POWNERITEM pDrawStruct = (OWNERITEM *)pItemStruct;
2691 wxMenuItem* pMenuItem = (wxMenuItem *)(pDrawStruct->pItemData);
2693 wxCHECK(pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE);
2696 // Prepare to call OnDrawItem()
2699 dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE);
2700 wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top,
2701 pDrawStruct->rcItem.right - pDrawStruct->rcItem.left,
2702 pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top);
2704 return pMenuItem->OnDrawItem
2707 (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction,
2708 (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
2717 } // end of wxWindow::OS2OnDrawItem
2719 bool wxWindow::OS2OnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*itemStruct
)
2721 // TODO: more owner drawn menu related stuff, get to it later
2723 #if wxUSE_OWNER_DRAWN
2724 // is it a menu item?
2727 MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
2728 wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
2730 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
2732 return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
2733 &pMeasureStruct->itemHeight);
2736 wxWindow *item = FindItem(id);
2737 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
2739 return ((wxControl *)item)->MSWOnMeasure(itemStruct);
2741 #endif // owner-drawn menus
2746 // ---------------------------------------------------------------------------
2747 // colours and palettes
2748 // ---------------------------------------------------------------------------
2750 bool wxWindow::HandleSysColorChange()
2752 wxSysColourChangedEvent vEvent
;
2754 vEvent
.SetEventObject(this);
2755 return GetEventHandler()->ProcessEvent(vEvent
);
2756 } // end of wxWindow::HandleSysColorChange
2758 bool wxWindow::HandleCtlColor(
2763 // Not much provided with message. So not sure I can do anything with it
2766 } // end of wxWindow::HandleCtlColor
2768 bool wxWindow::HandleWindowParams(
2769 PWNDPARAMS pWndParams
2773 // TODO: I'll do something here, just not sure what yet
2777 // Define for each class of dialog and control
2778 WXHBRUSH
wxWindow::OnCtlColor(WXHDC hDC
,
2788 bool wxWindow::HandlePaletteChanged()
2790 // need to set this to something first
2791 WXHWND hWndPalChange
= NULLHANDLE
;
2793 wxPaletteChangedEvent
vEvent(GetId());
2795 vEvent
.SetEventObject(this);
2796 vEvent
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
2798 return GetEventHandler()->ProcessEvent(vEvent
);
2799 } // end of wxWindow::HandlePaletteChanged
2801 bool wxWindow::HandlePresParamChanged(
2806 // TODO: Once again I'll do something here when I need it
2808 //wxQueryNewPaletteEvent event(GetId());
2809 //event.SetEventObject(this);
2810 // if the background is erased
2811 // bProcessed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
2813 return FALSE
; //GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized();
2817 // Responds to colour changes: passes event on to children.
2819 void wxWindow::OnSysColourChanged(
2820 wxSysColourChangedEvent
& rEvent
2823 wxNode
* pNode
= GetChildren().First();
2828 // Only propagate to non-top-level windows
2830 wxWindow
* pWin
= (wxWindow
*)pNode
->Data();
2832 if (pWin
->GetParent())
2834 wxSysColourChangedEvent vEvent
;
2836 rEvent
.m_eventObject
= pWin
;
2837 pWin
->GetEventHandler()->ProcessEvent(vEvent
);
2839 pNode
= pNode
->Next();
2841 } // end of wxWindow::OnSysColourChanged
2843 // ---------------------------------------------------------------------------
2845 // ---------------------------------------------------------------------------
2847 bool wxWindow::HandlePaint()
2849 HRGN hRgn
= NULLHANDLE
;
2850 wxPaintEvent vEvent
;
2854 if (::WinQueryUpdateRegion(GetHwnd(), hRgn
) == RGN_NULL
)
2856 wxLogLastError("CreateRectRgn");
2865 HWND hWnd0
= NULLHANDLE
;
2869 printf("HandlePaint hWnd=%x ",hWnd
);
2873 m_updateRegion
= wxRegion(hRgn
);
2874 vEvent
.SetEventObject(this);
2875 return (GetEventHandler()->ProcessEvent(vEvent
));
2876 } // end of wxWindow::HandlePaint
2878 bool wxWindow::HandleEraseBkgnd(WXHDC hdc
)
2880 // TODO: will have to worry about this later as part of
2881 // the handling of changed presentation parameters
2883 if ( ::IsIconic(GetHwnd()) )
2892 wxEraseEvent event(m_windowId, &dc);
2893 event.SetEventObject(this);
2894 bool rc = GetEventHandler()->ProcessEvent(event);
2897 dc.SelectOldObjects(hdc);
2898 dc.SetHDC((WXHDC) NULL);
2901 } // end of wxWindow::HandleEraseBkgnd
2903 void wxWindow::OnEraseBackground(
2904 wxEraseEvent
& rEvent
2908 } // end of wxWindow::OnEraseBackground
2910 // ---------------------------------------------------------------------------
2911 // moving and resizing
2912 // ---------------------------------------------------------------------------
2914 bool wxWindow::HandleMinimize()
2916 wxIconizeEvent
vEvent(m_windowId
);
2918 vEvent
.SetEventObject(this);
2919 return GetEventHandler()->ProcessEvent(vEvent
);
2920 } // end of wxWindow::HandleMinimize
2922 bool wxWindow::HandleMaximize()
2924 wxMaximizeEvent
vEvent(m_windowId
);
2926 vEvent
.SetEventObject(this);
2927 return GetEventHandler()->ProcessEvent(vEvent
);
2928 } // end of wxWindow::HandleMaximize
2930 bool wxWindow::HandleMove(
2935 wxMoveEvent
vEvent( wxPoint( nX
2941 vEvent
.SetEventObject(this);
2942 return GetEventHandler()->ProcessEvent(vEvent
);
2943 } // end of wxWindow::HandleMove
2945 bool wxWindow::HandleSize(
2948 , WXUINT
WXUNUSED(nFlag
)
2951 wxSizeEvent
vEvent( wxSize( nWidth
2957 vEvent
.SetEventObject(this);
2958 return GetEventHandler()->ProcessEvent(vEvent
);
2959 } // end of wxWindow::HandleSize
2961 bool wxWindow::HandleGetMinMaxInfo(
2971 ::WinGetMaxPosition(GetHwnd(), pSwp
);
2972 m_maxWidth
= pSwp
->cx
;
2973 m_maxHeight
= pSwp
->cy
;
2977 ::WinGetMinPosition(GetHwnd(), pSwp
, &vPoint
);
2978 m_minWidth
= pSwp
->cx
;
2979 m_minHeight
= pSwp
->cy
;
2986 } // end of wxWindow::HandleGetMinMaxInfo
2988 // ---------------------------------------------------------------------------
2990 // ---------------------------------------------------------------------------
2991 bool wxWindow::HandleCommand(
2997 if (wxCurrentPopupMenu
)
2999 wxMenu
* pPopupMenu
= wxCurrentPopupMenu
;
3001 wxCurrentPopupMenu
= NULL
;
3002 return pPopupMenu
->OS2Command(wCmd
, wId
);
3005 wxWindow
* pWin
= FindItem(wId
);
3009 pWin
= wxFindWinFromHandle(hControl
);
3013 return pWin
->OS2Command( wCmd
3017 } // end of wxWindow::HandleCommand
3019 bool wxWindow::HandleSysCommand(
3025 // 4 bits are reserved
3027 switch (SHORT1FROMMP(wParam
))
3030 return HandleMaximize();
3033 return HandleMinimize();
3036 } // end of wxWindow::HandleSysCommand
3038 // ---------------------------------------------------------------------------
3040 // ---------------------------------------------------------------------------
3042 void wxWindow::InitMouseEvent(
3043 wxMouseEvent
& rEvent
3051 rEvent
.m_shiftDown
= ((uFlags
& VK_SHIFT
) != 0);
3052 rEvent
.m_controlDown
= ((uFlags
& VK_CTRL
) != 0);
3053 rEvent
.m_leftDown
= ((uFlags
& VK_BUTTON1
) != 0);
3054 rEvent
.m_middleDown
= ((uFlags
& VK_BUTTON3
) != 0);
3055 rEvent
.m_rightDown
= ((uFlags
& VK_BUTTON2
) != 0);
3056 rEvent
.SetTimestamp(s_currentMsg
.time
);
3057 rEvent
.m_eventObject
= this;
3059 #if wxUSE_MOUSEEVENT_HACK
3062 m_lastMouseEvent
= rEvent
.GetEventType();
3063 #endif // wxUSE_MOUSEEVENT_HACK
3064 } // end of wxWindow::InitMouseEvent
3066 bool wxWindow::HandleMouseEvent(
3074 // The mouse events take consecutive IDs from WM_MOUSEFIRST to
3075 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
3076 // from the message id and take the value in the table to get wxWin event
3079 static const wxEventType eventsMouse
[] =
3093 wxMouseEvent
vEvent(eventsMouse
[uMsg
- WM_MOUSEMOVE
]);
3095 InitMouseEvent( vEvent
3101 return GetEventHandler()->ProcessEvent(vEvent
);
3102 } // end of wxWindow::HandleMouseEvent
3104 bool wxWindow::HandleMouseMove(
3110 if (!m_bMouseInWindow
)
3113 // Generate an ENTER event
3115 m_bMouseInWindow
= TRUE
;
3117 wxMouseEvent
vEvent(wxEVT_ENTER_WINDOW
);
3119 InitMouseEvent( vEvent
3125 (void)GetEventHandler()->ProcessEvent(vEvent
);
3127 return HandleMouseEvent( WM_MOUSEMOVE
3132 } // end of wxWindow::HandleMouseMove
3134 // ---------------------------------------------------------------------------
3135 // keyboard handling
3136 // ---------------------------------------------------------------------------
3139 // Create the key event of the given type for the given key - used by
3140 // HandleChar and HandleKeyDown/Up
3142 wxKeyEvent
wxWindow::CreateKeyEvent(
3148 wxKeyEvent
vEvent(eType
);
3150 vEvent
.SetId(GetId());
3151 vEvent
.m_shiftDown
= IsShiftDown();
3152 vEvent
.m_controlDown
= IsCtrlDown();
3153 vEvent
.m_altDown
= (HIWORD(lParam
) & KC_ALT
) == KC_ALT
;
3155 vEvent
.m_eventObject
= (wxWindow
*)this; // const_cast
3156 vEvent
.m_keyCode
= nId
;
3157 vEvent
.SetTimestamp(s_currentMsg
.time
);
3160 // Translate the position to client coords
3165 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
3166 ::WinQueryWindowRect( GetHwnd()
3170 vPoint
.x
-= vRect
.xLeft
;
3171 vPoint
.y
-= vRect
.yBottom
;
3173 vEvent
.m_x
= vPoint
.x
;
3174 vEvent
.m_y
= vPoint
.y
;
3177 } // end of wxWindow::CreateKeyEvent
3180 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
3183 bool wxWindow::HandleChar(
3189 bool bCtrlDown
= FALSE
;
3195 // If 1 -> 26, translate to CTRL plus a letter.
3198 if ((vId
> 0) && (vId
< 27))
3220 else if ( (vId
= wxCharCodeOS2ToWX(wParam
)) == 0)
3223 // It's ASCII and will be processed here only when called from
3224 // WM_CHAR (i.e. when isASCII = TRUE), don't process it now
3231 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_CHAR
3238 vEvent
.m_controlDown
= TRUE
;
3241 if (GetEventHandler()->ProcessEvent(vEvent
))
3247 bool wxWindow::HandleKeyDown(
3252 int nId
= wxCharCodeOS2ToWX(wParam
);
3257 // Normal ASCII char
3264 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_DOWN
3269 if (GetEventHandler()->ProcessEvent(vEvent
))
3275 } // end of wxWindow::HandleKeyDown
3277 bool wxWindow::HandleKeyUp(
3282 int nId
= wxCharCodeOS2ToWX(wParam
);
3287 // Normal ASCII char
3294 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_UP
3299 if (GetEventHandler()->ProcessEvent(vEvent
))
3303 } // end of wxWindow::HandleKeyUp
3305 // ---------------------------------------------------------------------------
3307 // ---------------------------------------------------------------------------
3309 // ---------------------------------------------------------------------------
3311 // ---------------------------------------------------------------------------
3313 bool wxWindow::OS2OnScroll(
3322 wxWindow
* pChild
= wxFindWinFromHandle(hControl
);
3325 return pChild
->OS2OnScroll( nOrientation
3332 wxScrollWinEvent vEvent
;
3334 vEvent
.SetPosition(wPos
);
3335 vEvent
.SetOrientation(nOrientation
);
3336 vEvent
.m_eventObject
= this;
3341 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEUP
;
3345 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEDOWN
;
3349 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEUP
;
3353 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEDOWN
;
3356 case SB_SLIDERPOSITION
:
3357 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBRELEASE
;
3360 case SB_SLIDERTRACK
:
3361 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBTRACK
;
3367 return GetEventHandler()->ProcessEvent(vEvent
);
3368 } // end of wxWindow::OS2OnScroll
3370 // ===========================================================================
3372 // ===========================================================================
3381 // TODO: we'll do this later
3382 } // end of wxGetCharSize
3385 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
3386 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
3388 int wxCharCodeOS2ToWX(
3396 case VK_BACKTAB
: nId
= WXK_BACK
; break;
3397 case VK_TAB
: nId
= WXK_TAB
; break;
3398 case VK_CLEAR
: nId
= WXK_CLEAR
; break;
3399 case VK_ENTER
: nId
= WXK_RETURN
; break;
3400 case VK_SHIFT
: nId
= WXK_SHIFT
; break;
3401 case VK_CTRL
: nId
= WXK_CONTROL
; break;
3402 case VK_PAUSE
: nId
= WXK_PAUSE
; break;
3403 case VK_SPACE
: nId
= WXK_SPACE
; break;
3404 case VK_ESC
: nId
= WXK_ESCAPE
; break;
3405 case VK_END
: nId
= WXK_END
; break;
3406 case VK_HOME
: nId
= WXK_HOME
; break;
3407 case VK_LEFT
: nId
= WXK_LEFT
; break;
3408 case VK_UP
: nId
= WXK_UP
; break;
3409 case VK_RIGHT
: nId
= WXK_RIGHT
; break;
3410 case VK_DOWN
: nId
= WXK_DOWN
; break;
3411 case VK_PRINTSCRN
: nId
= WXK_PRINT
; break;
3412 case VK_INSERT
: nId
= WXK_INSERT
; break;
3413 case VK_DELETE
: nId
= WXK_DELETE
; break;
3414 case VK_F1
: nId
= WXK_F1
; break;
3415 case VK_F2
: nId
= WXK_F2
; break;
3416 case VK_F3
: nId
= WXK_F3
; break;
3417 case VK_F4
: nId
= WXK_F4
; break;
3418 case VK_F5
: nId
= WXK_F5
; break;
3419 case VK_F6
: nId
= WXK_F6
; break;
3420 case VK_F7
: nId
= WXK_F7
; break;
3421 case VK_F8
: nId
= WXK_F8
; break;
3422 case VK_F9
: nId
= WXK_F9
; break;
3423 case VK_F10
: nId
= WXK_F10
; break;
3424 case VK_F11
: nId
= WXK_F11
; break;
3425 case VK_F12
: nId
= WXK_F12
; break;
3426 case VK_F13
: nId
= WXK_F13
; break;
3427 case VK_F14
: nId
= WXK_F14
; break;
3428 case VK_F15
: nId
= WXK_F15
; break;
3429 case VK_F16
: nId
= WXK_F16
; break;
3430 case VK_F17
: nId
= WXK_F17
; break;
3431 case VK_F18
: nId
= WXK_F18
; break;
3432 case VK_F19
: nId
= WXK_F19
; break;
3433 case VK_F20
: nId
= WXK_F20
; break;
3434 case VK_F21
: nId
= WXK_F21
; break;
3435 case VK_F22
: nId
= WXK_F22
; break;
3436 case VK_F23
: nId
= WXK_F23
; break;
3437 case VK_F24
: nId
= WXK_F24
; break;
3438 case VK_NUMLOCK
: nId
= WXK_NUMLOCK
; break;
3439 case VK_SCRLLOCK
: nId
= WXK_SCROLL
; break;
3446 } // end of wxCharCodeOS2ToWX
3448 int wxCharCodeWXToOS2(
3458 case WXK_CLEAR
: nKeySym
= VK_CLEAR
; break;
3459 case WXK_SHIFT
: nKeySym
= VK_SHIFT
; break;
3460 case WXK_CONTROL
: nKeySym
= VK_CTRL
; break;
3461 case WXK_PAUSE
: nKeySym
= VK_PAUSE
; break;
3462 case WXK_END
: nKeySym
= VK_END
; break;
3463 case WXK_HOME
: nKeySym
= VK_HOME
; break;
3464 case WXK_LEFT
: nKeySym
= VK_LEFT
; break;
3465 case WXK_UP
: nKeySym
= VK_UP
; break;
3466 case WXK_RIGHT
: nKeySym
= VK_RIGHT
; break;
3467 case WXK_DOWN
: nKeySym
= VK_DOWN
; break;
3468 case WXK_PRINT
: nKeySym
= VK_PRINTSCRN
; break;
3469 case WXK_INSERT
: nKeySym
= VK_INSERT
; break;
3470 case WXK_DELETE
: nKeySym
= VK_DELETE
; break;
3471 case WXK_F1
: nKeySym
= VK_F1
; break;
3472 case WXK_F2
: nKeySym
= VK_F2
; break;
3473 case WXK_F3
: nKeySym
= VK_F3
; break;
3474 case WXK_F4
: nKeySym
= VK_F4
; break;
3475 case WXK_F5
: nKeySym
= VK_F5
; break;
3476 case WXK_F6
: nKeySym
= VK_F6
; break;
3477 case WXK_F7
: nKeySym
= VK_F7
; break;
3478 case WXK_F8
: nKeySym
= VK_F8
; break;
3479 case WXK_F9
: nKeySym
= VK_F9
; break;
3480 case WXK_F10
: nKeySym
= VK_F10
; break;
3481 case WXK_F11
: nKeySym
= VK_F11
; break;
3482 case WXK_F12
: nKeySym
= VK_F12
; break;
3483 case WXK_F13
: nKeySym
= VK_F13
; break;
3484 case WXK_F14
: nKeySym
= VK_F14
; break;
3485 case WXK_F15
: nKeySym
= VK_F15
; break;
3486 case WXK_F16
: nKeySym
= VK_F16
; break;
3487 case WXK_F17
: nKeySym
= VK_F17
; break;
3488 case WXK_F18
: nKeySym
= VK_F18
; break;
3489 case WXK_F19
: nKeySym
= VK_F19
; break;
3490 case WXK_F20
: nKeySym
= VK_F20
; break;
3491 case WXK_F21
: nKeySym
= VK_F21
; break;
3492 case WXK_F22
: nKeySym
= VK_F22
; break;
3493 case WXK_F23
: nKeySym
= VK_F23
; break;
3494 case WXK_F24
: nKeySym
= VK_F24
; break;
3495 case WXK_NUMLOCK
: nKeySym
= VK_NUMLOCK
; break;
3496 case WXK_SCROLL
: nKeySym
= VK_SCRLLOCK
; break;
3499 *bIsVirtual
= FALSE
;
3505 } // end of wxCharCodeWXToOS2
3507 wxWindow
* wxGetActiveWindow()
3509 HWND hWnd
= ::WinQueryActiveWindow(HWND_DESKTOP
);
3513 return wxFindWinFromHandle((WXHWND
)hWnd
);
3516 } // end of wxGetActiveWindow
3519 const char* wxGetMessageName(
3524 case 0x0000: return "WM_NULL";
3525 case 0x0001: return "WM_CREATE";
3526 case 0x0002: return "WM_DESTROY";
3527 case 0x0004: return "WM_ENABLE";
3528 case 0x0005: return "WM_SHOW";
3529 case 0x0006: return "WM_MOVE";
3530 case 0x0007: return "WM_SIZE";
3531 case 0x0008: return "WM_ADJUSTWINDOWPOS";
3532 case 0x0009: return "WM_CALCVALIDRECTS";
3533 case 0x000A: return "WM_SETWINDOWPARAMS";
3534 case 0x000B: return "WM_QUERYWINDOWPARAMS";
3535 case 0x000C: return "WM_HITTEST";
3536 case 0x000D: return "WM_ACTIVATE";
3537 case 0x000F: return "WM_SETFOCUS";
3538 case 0x0010: return "WM_SETSELECTION";
3539 case 0x0011: return "WM_PPAINT";
3540 case 0x0012: return "WM_PSETFOCUS";
3541 case 0x0013: return "WM_PSYSCOLORCHANGE";
3542 case 0x0014: return "WM_PSIZE";
3543 case 0x0015: return "WM_PACTIVATE";
3544 case 0x0016: return "WM_PCONTROL";
3545 case 0x0020: return "WM_COMMAND";
3546 case 0x0021: return "WM_SYSCOMMAND";
3547 case 0x0022: return "WM_HELP";
3548 case 0x0023: return "WM_PAINT";
3549 case 0x0024: return "WM_TIMER";
3550 case 0x0025: return "WM_SEM1";
3551 case 0x0026: return "WM_SEM2";
3552 case 0x0027: return "WM_SEM3";
3553 case 0x0028: return "WM_SEM4";
3554 case 0x0029: return "WM_CLOSE";
3555 case 0x002A: return "WM_QUIT";
3556 case 0x002B: return "WM_SYSCOLORCHANGE";
3557 case 0x002D: return "WM_SYSVALUECHANGE";
3558 case 0x002E: return "WM_APPTERMINATENOTIFY";
3559 case 0x002F: return "WM_PRESPARAMCHANGED";
3560 // Control notification messages
3561 case 0x0030: return "WM_CONTROL";
3562 case 0x0031: return "WM_VSCROLL";
3563 case 0x0032: return "WM_HSCROLL";
3564 case 0x0033: return "WM_INITMENU";
3565 case 0x0034: return "WM_MENUSELECT";
3566 case 0x0035: return "WM_MENUSEND";
3567 case 0x0036: return "WM_DRAWITEM";
3568 case 0x0037: return "WM_MEASUREITEM";
3569 case 0x0038: return "WM_CONTROLPOINTER";
3570 case 0x003A: return "WM_QUERYDLGCODE";
3571 case 0x003B: return "WM_INITDLG";
3572 case 0x003C: return "WM_SUBSTITUTESTRING";
3573 case 0x003D: return "WM_MATCHMNEMONIC";
3574 case 0x003E: return "WM_SAVEAPPLICATION";
3575 case 0x0129: return "WM_CTLCOLORCHANGE";
3576 case 0x0130: return "WM_QUERYCTLTYPE";
3578 case 0x0040: return "WM_FLASHWINDOW";
3579 case 0x0041: return "WM_FORMATFRAME";
3580 case 0x0042: return "WM_UPDATEFRAME";
3581 case 0x0043: return "WM_FOCUSCHANGE";
3582 case 0x0044: return "WM_SETBORDERSIZE";
3583 case 0x0045: return "WM_TRACKFRAME";
3584 case 0x0046: return "WM_MINMAXFRAME";
3585 case 0x0047: return "WM_SETICON";
3586 case 0x0048: return "WM_QUERYICON";
3587 case 0x0049: return "WM_SETACCELTABLE";
3588 case 0x004A: return "WM_QUERYACCELTABLE";
3589 case 0x004B: return "WM_TRANSLATEACCEL";
3590 case 0x004C: return "WM_QUERYTRACKINFO";
3591 case 0x004D: return "WM_QUERYBORDERSIZE";
3592 case 0x004E: return "WM_NEXTMENU";
3593 case 0x004F: return "WM_ERASEBACKGROUND";
3594 case 0x0050: return "WM_QUERYFRAMEINFO";
3595 case 0x0051: return "WM_QUERYFOCUSCHAIN";
3596 case 0x0052: return "WM_OWNERPOSCHANGE";
3597 case 0x0053: return "WM_CACLFRAMERECT";
3598 case 0x0055: return "WM_WINDOWPOSCHANGED";
3599 case 0x0056: return "WM_ADJUSTFRAMEPOS";
3600 case 0x0059: return "WM_QUERYFRAMECTLCOUNT";
3601 case 0x005B: return "WM_QUERYHELPINFO";
3602 case 0x005C: return "WM_SETHELPINFO";
3603 case 0x005D: return "WM_ERROR";
3604 case 0x005E: return "WM_REALIZEPALETTE";
3605 // Clipboard messages
3606 case 0x0060: return "WM_RENDERFMT";
3607 case 0x0061: return "WM_RENDERALLFMTS";
3608 case 0x0062: return "WM_DESTROYCLIPBOARD";
3609 case 0x0063: return "WM_PAINTCLIPBOARD";
3610 case 0x0064: return "WM_SIZECLIPBOARD";
3611 case 0x0065: return "WM_HSCROLLCLIPBOARD";
3612 case 0x0066: return "WM_VSCROLLCLIPBOARD";
3613 case 0x0067: return "WM_DRAWCLIPBOARD";
3615 case 0x0070: return "WM_MOUSEMOVE";
3616 case 0x0071: return "WM_BUTTON1DOWN";
3617 case 0x0072: return "WM_BUTTON1UP";
3618 case 0x0073: return "WM_BUTTON1DBLCLK";
3619 case 0x0074: return "WM_BUTTON2DOWN";
3620 case 0x0075: return "WM_BUTTON2UP";
3621 case 0x0076: return "WM_BUTTON2DBLCLK";
3622 case 0x0077: return "WM_BUTTON3DOWN";
3623 case 0x0078: return "WM_BUTTON3UP";
3624 case 0x0079: return "WM_BUTTON3DBLCLK";
3625 case 0x007D: return "WM_MOUSEMAP";
3626 case 0x007E: return "WM_VRNDISABLED";
3627 case 0x007F: return "WM_VRNENABLED";
3628 case 0x0410: return "WM_CHORD";
3629 case 0x0411: return "WM_BUTTON1MOTIONSTART";
3630 case 0x0412: return "WM_BUTTON1MOTIONEND";
3631 case 0x0413: return "WM_BUTTON1CLICK";
3632 case 0x0414: return "WM_BUTTON2MOTIONSTART";
3633 case 0x0415: return "WM_BUTTON2MOTIONEND";
3634 case 0x0416: return "WM_BUTTON2CLICK";
3635 case 0x0417: return "WM_BUTTON3MOTIONSTART";
3636 case 0x0418: return "WM_BUTTON3MOTIONEND";
3637 case 0x0419: return "WM_BUTTON3CLICK";
3638 case 0x0420: return "WM_BEGINDRAG";
3639 case 0x0421: return "WM_ENDDRAG";
3640 case 0x0422: return "WM_SINGLESELECT";
3641 case 0x0423: return "WM_OPEN";
3642 case 0x0424: return "WM_CONTEXTMENU";
3643 case 0x0425: return "WM_CONTEXTHELP";
3644 case 0x0426: return "WM_TEXTEDIT";
3645 case 0x0427: return "WM_BEGINSELECT";
3646 case 0x0228: return "WM_ENDSELECT";
3647 case 0x0429: return "WM_PICKUP";
3648 case 0x04C0: return "WM_PENFIRST";
3649 case 0x04FF: return "WM_PENLAST";
3650 case 0x0500: return "WM_MMPMFIRST";
3651 case 0x05FF: return "WM_MMPMLAST";
3652 case 0x0600: return "WM_STDDLGFIRST";
3653 case 0x06FF: return "WM_STDDLGLAST";
3654 case 0x0BD0: return "WM_BIDI_FIRST";
3655 case 0x0BFF: return "WM_BIDI_LAST";
3657 case 0x007A: return "WM_CHAR";
3658 case 0x007B: return "WM_VIOCHAR";
3660 case 0x00A0: return "WM_DDE_INITIATE";
3661 case 0x00A1: return "WM_DDE_REQUEST";
3662 case 0x00A2: return "WM_DDE_ACK";
3663 case 0x00A3: return "WM_DDE_DATA";
3664 case 0x00A4: return "WM_DDE_ADVISE";
3665 case 0x00A5: return "WM_DDE_UNADVISE";
3666 case 0x00A6: return "WM_DDE_POKE";
3667 case 0x00A7: return "WM_DDE_EXECUTE";
3668 case 0x00A8: return "WM_DDE_TERMINATE";
3669 case 0x00A9: return "WM_DDE_INITIATEACK";
3670 case 0x00AF: return "WM_DDE_LAST";
3672 case 0x0120: return "BM_CLICK";
3673 case 0x0121: return "BM_QUERYCHECKINDEX";
3674 case 0x0122: return "BM_QUERYHILITE";
3675 case 0x0123: return "BM_SETHILITE";
3676 case 0x0124: return "BM_QUERYCHECK";
3677 case 0x0125: return "BM_SETCHECK";
3678 case 0x0126: return "BM_SETDEFAULT";
3679 case 0x0128: return "BM_AUTOSIZE";
3681 case 0x029A: return "CBID_LIST";
3682 case 0x029B: return "CBID_EDIT";
3683 case 0x0170: return "CBM_SHOWLIST";
3684 case 0x0171: return "CBM_HILITE";
3685 case 0x0172: return "CBM_ISLISTSHOWING";
3687 case 0x0140: return "EM_QUERYCHANGED";
3688 case 0x0141: return "EM_QUERYSEL";
3689 case 0x0142: return "EM_SETSEL";
3690 case 0x0143: return "EM_SETTEXTLIMIT";
3691 case 0x0144: return "EM_CUT";
3692 case 0x0145: return "EM_COPY";
3693 case 0x0146: return "EM_CLEAR";
3694 case 0x0147: return "EM_PASTE";
3695 case 0x0148: return "EM_QUERYFIRSTCHAR";
3696 case 0x0149: return "EM_SETFIRSTCHAR";
3697 case 0x014A: return "EM_QUERYREADONLY";
3698 case 0x014B: return "EM_SETREADONLY";
3699 case 0x014C: return "EM_SETINSERTMODE";
3701 case 0x0160: return "LM_QUERYITEMCOUNT";
3702 case 0x0161: return "LM_INSERTITEM";
3703 case 0x0162: return "LM_SETOPENINDEX";
3704 case 0x0163: return "LM_DELETEITEM";
3705 case 0x0164: return "LM_SELECTITEM";
3706 case 0x0165: return "LM_QUERYSELECTION";
3707 case 0x0166: return "LM_SETITEMTEXT";
3708 case 0x0167: return "LM_QUERYITEMTEXTLENGTH";
3709 case 0x0168: return "LM_QUERYITEMTEXT";
3710 case 0x0169: return "LM_SETITEMHANDLE";
3711 case 0x016A: return "LM_QUERYITEMHANDLE";
3712 case 0x016B: return "LM_SEARCHSTRING";
3713 case 0x016C: return "LM_SETITEMHEIGHT";
3714 case 0x016D: return "LM_QUERYTOPINDEX";
3715 case 0x016E: return "LM_DELETEALL";
3716 case 0x016F: return "LM_INSERTMULITEMS";
3717 case 0x0660: return "LM_SETITEMWIDTH";
3719 case 0x0180: return "MM_INSERTITEM";
3720 case 0x0181: return "MM_DELETEITEM";
3721 case 0x0182: return "MM_QUERYITEM";
3722 case 0x0183: return "MM_SETITEM";
3723 case 0x0184: return "MM_QUERYITEMCOUNT";
3724 case 0x0185: return "MM_STARTMENUMODE";
3725 case 0x0186: return "MM_ENDMENUMODE";
3726 case 0x0188: return "MM_REMOVEITEM";
3727 case 0x0189: return "MM_SELECTITEM";
3728 case 0x018A: return "MM_QUERYSELITEMID";
3729 case 0x018B: return "MM_QUERYITEMTEXT";
3730 case 0x018C: return "MM_QUERYITEMTEXTLENGTH";
3731 case 0x018D: return "MM_SETITEMHANDLE";
3732 case 0x018E: return "MM_SETITEMTEXT";
3733 case 0x018F: return "MM_ITEMPOSITIONFROMID";
3734 case 0x0190: return "MM_ITEMIDFROMPOSITION";
3735 case 0x0191: return "MM_QUERYITEMATTR";
3736 case 0x0192: return "MM_SETITEMATTR";
3737 case 0x0193: return "MM_ISITEMVALID";
3738 case 0x0194: return "MM_QUERYITEMRECT";
3739 case 0x0431: return "MM_QUERYDEFAULTITEMID";
3740 case 0x0432: return "MM_SETDEFAULTITEMID";
3742 case 0x01A0: return "SBM_SETSCROLLBAR";
3743 case 0x01A1: return "SBM_SETPOS";
3744 case 0x01A2: return "SBM_QUERYPOS";
3745 case 0x01A3: return "SBM_QUERYRANGE";
3746 case 0x01A6: return "SBM_SETTHUMBSIZE";
3749 case 0x0F00: return "WM_HELPBASE";
3750 case 0x0FFF: return "WM_HELPTOP";
3751 // Beginning of user defined messages
3752 case 0x1000: return "WM_USER";
3754 // wxWindows user defined types
3757 // case 0x1000 + 0: return "LVM_GETBKCOLOR";
3758 case 0x1000 + 1: return "LVM_SETBKCOLOR";
3759 case 0x1000 + 2: return "LVM_GETIMAGELIST";
3760 case 0x1000 + 3: return "LVM_SETIMAGELIST";
3761 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
3762 case 0x1000 + 5: return "LVM_GETITEMA";
3763 case 0x1000 + 75: return "LVM_GETITEMW";
3764 case 0x1000 + 6: return "LVM_SETITEMA";
3765 case 0x1000 + 76: return "LVM_SETITEMW";
3766 case 0x1000 + 7: return "LVM_INSERTITEMA";
3767 case 0x1000 + 77: return "LVM_INSERTITEMW";
3768 case 0x1000 + 8: return "LVM_DELETEITEM";
3769 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
3770 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
3771 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
3772 case 0x1000 + 12: return "LVM_GETNEXTITEM";
3773 case 0x1000 + 13: return "LVM_FINDITEMA";
3774 case 0x1000 + 83: return "LVM_FINDITEMW";
3775 case 0x1000 + 14: return "LVM_GETITEMRECT";
3776 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
3777 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
3778 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
3779 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
3780 case 0x1000 + 18: return "LVM_HITTEST";
3781 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
3782 case 0x1000 + 20: return "LVM_SCROLL";
3783 case 0x1000 + 21: return "LVM_REDRAWITEMS";
3784 case 0x1000 + 22: return "LVM_ARRANGE";
3785 case 0x1000 + 23: return "LVM_EDITLABELA";
3786 case 0x1000 + 118: return "LVM_EDITLABELW";
3787 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
3788 case 0x1000 + 25: return "LVM_GETCOLUMNA";
3789 case 0x1000 + 95: return "LVM_GETCOLUMNW";
3790 case 0x1000 + 26: return "LVM_SETCOLUMNA";
3791 case 0x1000 + 96: return "LVM_SETCOLUMNW";
3792 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
3793 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
3794 case 0x1000 + 28: return "LVM_DELETECOLUMN";
3795 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
3796 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
3797 case 0x1000 + 31: return "LVM_GETHEADER";
3798 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
3799 case 0x1000 + 34: return "LVM_GETVIEWRECT";
3800 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
3801 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
3802 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
3803 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
3804 case 0x1000 + 39: return "LVM_GETTOPINDEX";
3805 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
3806 case 0x1000 + 41: return "LVM_GETORIGIN";
3807 case 0x1000 + 42: return "LVM_UPDATE";
3808 case 0x1000 + 43: return "LVM_SETITEMSTATE";
3809 case 0x1000 + 44: return "LVM_GETITEMSTATE";
3810 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
3811 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
3812 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
3813 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
3814 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
3815 case 0x1000 + 48: return "LVM_SORTITEMS";
3816 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
3817 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
3818 case 0x1000 + 51: return "LVM_GETITEMSPACING";
3819 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
3820 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
3821 case 0x1000 + 53: return "LVM_SETICONSPACING";
3822 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
3823 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
3824 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
3825 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
3826 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
3827 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
3828 case 0x1000 + 60: return "LVM_SETHOTITEM";
3829 case 0x1000 + 61: return "LVM_GETHOTITEM";
3830 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
3831 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
3832 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
3833 case 0x1000 + 65: return "LVM_SETWORKAREA";
3836 case 0x1100 + 0: return "TVM_INSERTITEMA";
3837 case 0x1100 + 50: return "TVM_INSERTITEMW";
3838 case 0x1100 + 1: return "TVM_DELETEITEM";
3839 case 0x1100 + 2: return "TVM_EXPAND";
3840 case 0x1100 + 4: return "TVM_GETITEMRECT";
3841 case 0x1100 + 5: return "TVM_GETCOUNT";
3842 case 0x1100 + 6: return "TVM_GETINDENT";
3843 case 0x1100 + 7: return "TVM_SETINDENT";
3844 case 0x1100 + 8: return "TVM_GETIMAGELIST";
3845 case 0x1100 + 9: return "TVM_SETIMAGELIST";
3846 case 0x1100 + 10: return "TVM_GETNEXTITEM";
3847 case 0x1100 + 11: return "TVM_SELECTITEM";
3848 case 0x1100 + 12: return "TVM_GETITEMA";
3849 case 0x1100 + 62: return "TVM_GETITEMW";
3850 case 0x1100 + 13: return "TVM_SETITEMA";
3851 case 0x1100 + 63: return "TVM_SETITEMW";
3852 case 0x1100 + 14: return "TVM_EDITLABELA";
3853 case 0x1100 + 65: return "TVM_EDITLABELW";
3854 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
3855 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
3856 case 0x1100 + 17: return "TVM_HITTEST";
3857 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
3858 case 0x1100 + 19: return "TVM_SORTCHILDREN";
3859 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
3860 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
3861 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
3862 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
3863 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
3864 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
3865 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
3868 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
3869 case 0x1200 + 1: return "HDM_INSERTITEMA";
3870 case 0x1200 + 10: return "HDM_INSERTITEMW";
3871 case 0x1200 + 2: return "HDM_DELETEITEM";
3872 case 0x1200 + 3: return "HDM_GETITEMA";
3873 case 0x1200 + 11: return "HDM_GETITEMW";
3874 case 0x1200 + 4: return "HDM_SETITEMA";
3875 case 0x1200 + 12: return "HDM_SETITEMW";
3876 case 0x1200 + 5: return "HDM_LAYOUT";
3877 case 0x1200 + 6: return "HDM_HITTEST";
3878 case 0x1200 + 7: return "HDM_GETITEMRECT";
3879 case 0x1200 + 8: return "HDM_SETIMAGELIST";
3880 case 0x1200 + 9: return "HDM_GETIMAGELIST";
3881 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
3882 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
3883 case 0x1200 + 17: return "HDM_GETORDERARRAY";
3884 case 0x1200 + 18: return "HDM_SETORDERARRAY";
3885 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
3888 case 0x1300 + 2: return "TCM_GETIMAGELIST";
3889 case 0x1300 + 3: return "TCM_SETIMAGELIST";
3890 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
3891 case 0x1300 + 5: return "TCM_GETITEMA";
3892 case 0x1300 + 60: return "TCM_GETITEMW";
3893 case 0x1300 + 6: return "TCM_SETITEMA";
3894 case 0x1300 + 61: return "TCM_SETITEMW";
3895 case 0x1300 + 7: return "TCM_INSERTITEMA";
3896 case 0x1300 + 62: return "TCM_INSERTITEMW";
3897 case 0x1300 + 8: return "TCM_DELETEITEM";
3898 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
3899 case 0x1300 + 10: return "TCM_GETITEMRECT";
3900 case 0x1300 + 11: return "TCM_GETCURSEL";
3901 case 0x1300 + 12: return "TCM_SETCURSEL";
3902 case 0x1300 + 13: return "TCM_HITTEST";
3903 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
3904 case 0x1300 + 40: return "TCM_ADJUSTRECT";
3905 case 0x1300 + 41: return "TCM_SETITEMSIZE";
3906 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
3907 case 0x1300 + 43: return "TCM_SETPADDING";
3908 case 0x1300 + 44: return "TCM_GETROWCOUNT";
3909 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
3910 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
3911 case 0x1300 + 47: return "TCM_GETCURFOCUS";
3912 case 0x1300 + 48: return "TCM_SETCURFOCUS";
3913 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
3914 case 0x1300 + 50: return "TCM_DESELECTALL";
3917 case WM_USER
+1000+1: return "TB_ENABLEBUTTON";
3918 case WM_USER
+1000+2: return "TB_CHECKBUTTON";
3919 case WM_USER
+1000+3: return "TB_PRESSBUTTON";
3920 case WM_USER
+1000+4: return "TB_HIDEBUTTON";
3921 case WM_USER
+1000+5: return "TB_INDETERMINATE";
3922 case WM_USER
+1000+9: return "TB_ISBUTTONENABLED";
3923 case WM_USER
+1000+10: return "TB_ISBUTTONCHECKED";
3924 case WM_USER
+1000+11: return "TB_ISBUTTONPRESSED";
3925 case WM_USER
+1000+12: return "TB_ISBUTTONHIDDEN";
3926 case WM_USER
+1000+13: return "TB_ISBUTTONINDETERMINATE";
3927 case WM_USER
+1000+17: return "TB_SETSTATE";
3928 case WM_USER
+1000+18: return "TB_GETSTATE";
3929 case WM_USER
+1000+19: return "TB_ADDBITMAP";
3930 case WM_USER
+1000+20: return "TB_ADDBUTTONS";
3931 case WM_USER
+1000+21: return "TB_INSERTBUTTON";
3932 case WM_USER
+1000+22: return "TB_DELETEBUTTON";
3933 case WM_USER
+1000+23: return "TB_GETBUTTON";
3934 case WM_USER
+1000+24: return "TB_BUTTONCOUNT";
3935 case WM_USER
+1000+25: return "TB_COMMANDTOINDEX";
3936 case WM_USER
+1000+26: return "TB_SAVERESTOREA";
3937 case WM_USER
+1000+76: return "TB_SAVERESTOREW";
3938 case WM_USER
+1000+27: return "TB_CUSTOMIZE";
3939 case WM_USER
+1000+28: return "TB_ADDSTRINGA";
3940 case WM_USER
+1000+77: return "TB_ADDSTRINGW";
3941 case WM_USER
+1000+29: return "TB_GETITEMRECT";
3942 case WM_USER
+1000+30: return "TB_BUTTONSTRUCTSIZE";
3943 case WM_USER
+1000+31: return "TB_SETBUTTONSIZE";
3944 case WM_USER
+1000+32: return "TB_SETBITMAPSIZE";
3945 case WM_USER
+1000+33: return "TB_AUTOSIZE";
3946 case WM_USER
+1000+35: return "TB_GETTOOLTIPS";
3947 case WM_USER
+1000+36: return "TB_SETTOOLTIPS";
3948 case WM_USER
+1000+37: return "TB_SETPARENT";
3949 case WM_USER
+1000+39: return "TB_SETROWS";
3950 case WM_USER
+1000+40: return "TB_GETROWS";
3951 case WM_USER
+1000+42: return "TB_SETCMDID";
3952 case WM_USER
+1000+43: return "TB_CHANGEBITMAP";
3953 case WM_USER
+1000+44: return "TB_GETBITMAP";
3954 case WM_USER
+1000+45: return "TB_GETBUTTONTEXTA";
3955 case WM_USER
+1000+75: return "TB_GETBUTTONTEXTW";
3956 case WM_USER
+1000+46: return "TB_REPLACEBITMAP";
3957 case WM_USER
+1000+47: return "TB_SETINDENT";
3958 case WM_USER
+1000+48: return "TB_SETIMAGELIST";
3959 case WM_USER
+1000+49: return "TB_GETIMAGELIST";
3960 case WM_USER
+1000+50: return "TB_LOADIMAGES";
3961 case WM_USER
+1000+51: return "TB_GETRECT";
3962 case WM_USER
+1000+52: return "TB_SETHOTIMAGELIST";
3963 case WM_USER
+1000+53: return "TB_GETHOTIMAGELIST";
3964 case WM_USER
+1000+54: return "TB_SETDISABLEDIMAGELIST";
3965 case WM_USER
+1000+55: return "TB_GETDISABLEDIMAGELIST";
3966 case WM_USER
+1000+56: return "TB_SETSTYLE";
3967 case WM_USER
+1000+57: return "TB_GETSTYLE";
3968 case WM_USER
+1000+58: return "TB_GETBUTTONSIZE";
3969 case WM_USER
+1000+59: return "TB_SETBUTTONWIDTH";
3970 case WM_USER
+1000+60: return "TB_SETMAXTEXTROWS";
3971 case WM_USER
+1000+61: return "TB_GETTEXTROWS";
3972 case WM_USER
+1000+41: return "TB_GETBITMAPFLAGS";
3975 static char s_szBuf
[128];
3976 sprintf(s_szBuf
, "<unknown message = %d>", nMessage
);
3980 } // end of wxGetMessageName
3982 #endif // __WXDEBUG__
3984 static void TranslateKbdEventToMouse(
3992 // Construct the key mask
3993 ULONG
& fwKeys
= *pFlags
;
3995 fwKeys
= VK_BUTTON2
;
3996 if ((::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x100) != 0)
3998 if ((::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x100) != 0)
4002 // Simulate right mouse button click
4006 ::WinQueryMsgPos(vHabmain
, &vPoint
);
4010 pWin
->ScreenToClient(pX
, pY
);
4011 } // end of TranslateKbdEventToMouse
4013 // Find the wxWindow at the current mouse position, returning the mouse
4015 wxWindow
* wxFindWindowAtPointer(
4019 return wxFindWindowAtPoint(wxGetMousePosition());
4022 wxWindow
* wxFindWindowAtPoint(
4031 HWND hWndHit
= ::WinWindowFromPoint(HWND_DESKTOP
, &vPt2
, FALSE
);
4032 wxWindow
* pWin
= wxFindWinFromHandle((WXHWND
)hWndHit
) ;
4033 HWND hWnd
= hWndHit
;
4036 // Try to find a window with a wxWindow associated with it
4038 while (!pWin
&& (hWnd
!= 0))
4040 hWnd
= ::WinQueryWindow(hWnd
, QW_PARENT
);
4041 pWin
= wxFindWinFromHandle((WXHWND
)hWnd
) ;
4046 // Get the current mouse position.
4047 wxPoint
wxGetMousePosition()
4051 ::WinQueryPointerPos(HWND_DESKTOP
, &vPt
);
4052 return wxPoint(vPt
.x
, vPt
.y
);