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
)
161 EVT_SET_FOCUS(wxWindow::OnSetFocus
)
164 // ===========================================================================
166 // ===========================================================================
169 // Find an item given the PM Window id
171 wxWindow
* wxWindow::FindItem(
175 wxControl
* pItem
= wxDynamicCast( this
182 // I it we or one of our "internal" children?
184 if (pItem
->GetId() == lId
||
185 (pItem
->GetSubcontrols().Index(lId
) != wxNOT_FOUND
))
191 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
195 wxWindow
* pChildWin
= pCurrent
->GetData();
196 wxWindow
* pWnd
= pChildWin
->FindItem(lId
);
201 pCurrent
= pCurrent
->GetNext();
204 } // end of wxWindow::FindItem
207 // Find an item given the PM Window handle
209 wxWindow
* wxWindow::FindItemByHWND(
214 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
218 wxWindow
* pParent
= pCurrent
->GetData();
221 // Do a recursive search.
223 wxWindow
* pWnd
= pParent
->FindItemByHWND(hWnd
);
228 if (!bControlOnly
|| pParent
->IsKindOf(CLASSINFO(wxControl
)))
230 wxWindow
* pItem
= pCurrent
->GetData();
232 if (pItem
->GetHWND() == hWnd
)
236 if (pItem
->ContainsHWND(hWnd
))
240 pCurrent
= pCurrent
->GetNext();
243 } // end of wxWindow::FindItemByHWND
246 // Default command handler
248 bool wxWindow::OS2Command(
249 WXUINT
WXUNUSED(uParam
)
250 , WXWORD
WXUNUSED(uId
)
254 DEBUG_PRINTF(wxWindow::OS2Command
);
259 // ----------------------------------------------------------------------------
260 // constructors and such
261 // ----------------------------------------------------------------------------
263 void wxWindow::Init()
273 m_bDoubleClickAllowed
= 0;
274 m_bWinCaptured
= FALSE
;
276 m_isBeingDeleted
= FALSE
;
279 m_bMouseInWindow
= FALSE
;
288 // Pass WM_GETDLGCODE to DefWindowProc()
293 m_bBackgroundTransparent
= FALSE
;
296 // As all windows are created with WS_VISIBLE style...
300 #if wxUSE_MOUSEEVENT_HACK
303 m_nLastMouseEvent
= -1;
304 #endif // wxUSE_MOUSEEVENT_HACK
306 DEBUG_PRINTF(wxWindow::Init
-End
);
313 wxWindow::~wxWindow()
315 DEBUG_PRINTF(wxWindow::~wxWindow
-Start
);
316 m_isBeingDeleted
= TRUE
;
318 OS2DetachWindowMenu();
320 m_parent
->RemoveChild(this);
325 if(!::WinDestroyWindow(GetHWND()))
326 wxLogLastError(wxT("DestroyWindow"));
328 // remove hWnd <-> wxWindow association
330 wxRemoveHandleAssociation(this);
332 DEBUG_PRINTF(wxWindow::~wxWindow
-End
);
333 } // end of wxWindow::~wxWindow
335 bool wxWindow::Create(
338 , const wxPoint
& rPos
339 , const wxSize
& rSize
341 , const wxString
& rName
344 HWND hParent
= NULLHANDLE
;
346 wxCHECK_MSG(pParent
, FALSE
, wxT("can't create wxWindow without parent"));
348 if ( !CreateBase( pParent
360 pParent
->AddChild(this);
361 hParent
= GetWinHwnd(pParent
);
364 hParent
= HWND_DESKTOP
;
366 ULONG ulCreateFlags
= 0L;
370 // Most wxSTYLES are really PM Class specific styles and will be
371 // set in those class create procs. PM's basic windows styles are
374 ulCreateFlags
|= WS_VISIBLE
;
377 if ( lStyle
& wxCLIP_SIBLINGS
)
378 ulCreateFlags
|= WS_CLIPSIBLINGS
;
380 if (lStyle
& wxCLIP_CHILDREN
)
381 ulCreateFlags
|= WS_CLIPCHILDREN
;
384 // Empty stuff for now since PM has no custome 3D effects
385 // Doesn't mean someone cannot make some up though
388 WXDWORD dwExStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &bWant3D
);
391 // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
392 // and no presentation parameters
395 ,(PSZ
)wxCanvasClassName
400 ,WidthDefault(rSize
.x
)
401 ,HeightDefault(rSize
.y
)
408 } // end of wxWindow::Create
410 // ---------------------------------------------------------------------------
412 // ---------------------------------------------------------------------------
414 void wxWindow::SetFocus()
416 HWND hWnd
= GetHwnd();
419 ::WinSetFocus(HWND_DESKTOP
, hWnd
);
420 } // end of wxWindow::SetFocus
422 wxWindow
* wxWindowBase::FindFocus()
424 HWND hWnd
= ::WinQueryFocus(HWND_DESKTOP
);
428 return wxFindWinFromHandle((WXHWND
)hWnd
);
431 } // wxWindowBase::FindFocus
433 bool wxWindow::Enable(
437 if (!wxWindowBase::Enable(bEnable
))
440 HWND hWnd
= GetHwnd();
443 ::WinEnableWindow(hWnd
, (BOOL
)bEnable
);
445 wxWindowList::Node
* pNode
= GetChildren().GetFirst();
449 wxWindow
* pChild
= pNode
->GetData();
451 pChild
->Enable(bEnable
);
452 pNode
= pNode
->GetNext();
455 } // end of wxWindow::Enable
461 if (!wxWindowBase::Show(bShow
))
464 HWND hWnd
= GetHwnd();
466 ::WinShowWindow(hWnd
, bShow
);
470 ::WinSetWindowPos(hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_ACTIVATE
| SWP_ZORDER
);
473 } // end of wxWindow::Show
475 void wxWindow::Raise()
477 ::WinSetWindowPos(GetHwnd(), HWND_TOP
, 0, 0, 0, 0, SWP_ZORDER
| SWP_ACTIVATE
);
478 } // end of wxWindow::Raise
480 void wxWindow::Lower()
482 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_ZORDER
| SWP_DEACTIVATE
);
483 } // end of wxWindow::Lower
485 void wxWindow::SetTitle(
486 const wxString
& rTitle
489 ::WinSetWindowText(GetHwnd(), rTitle
.c_str());
490 } // end of wxWindow::SetTitle
492 wxString
wxWindow::GetTitle() const
494 return wxGetWindowText(GetHWND());
495 } // end of wxWindow::GetTitle
497 void wxWindow::CaptureMouse()
499 HWND hWnd
= GetHwnd();
501 if (hWnd
&& !m_bWinCaptured
)
503 ::WinSetCapture(HWND_DESKTOP
, hWnd
);
504 m_bWinCaptured
= TRUE
;
506 } // end of wxWindow::GetTitle
508 void wxWindow::ReleaseMouse()
512 ::WinSetCapture(HWND_DESKTOP
, NULLHANDLE
);
513 m_bWinCaptured
= FALSE
;
515 } // end of wxWindow::ReleaseMouse
517 bool wxWindow::SetFont(
521 DEBUG_PRINTF(wxWindow::SetFont
);
522 if (!wxWindowBase::SetFont(rFont
))
528 HWND hWnd
= GetHwnd();
534 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), rFont
.GetFaceName().c_str());
535 return(::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
), (PVOID
)zFont
));
540 bool wxWindow::SetCursor(
541 const wxCursor
& rCursor
542 ) // check if base implementation is OK
544 if ( !wxWindowBase::SetCursor(rCursor
))
550 wxASSERT_MSG( m_cursor
.Ok(),
551 wxT("cursor must be valid after call to the base version"));
553 HWND hWnd
= GetHwnd();
559 hPS
= ::WinGetPS(hWnd
);
561 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
562 ::WinQueryWindowRect(hWnd
, &vRect
);
564 hRGN
= ::GpiCreateRegion(hPS
, 1L, &vRect
);
566 if ((::GpiPtInRegion(hPS
, hRGN
, &vPoint
) == PRGN_INSIDE
) && !wxIsBusy())
568 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)m_cursor
.GetHCURSOR());
571 } // end of wxWindow::SetCursor
573 void wxWindow::WarpPointer(
582 ::WinQueryWindowRect(GetHwnd(), &vRect
);
586 ::WinSetPointerPos(HWND_DESKTOP
, (LONG
)nX
, (LONG
)(nY
));
587 } // end of wxWindow::WarpPointer
589 #if WXWIN_COMPATIBILITY
590 void wxWindow::OS2DeviceToLogical (float *x
, float *y
) const
593 #endif // WXWIN_COMPATIBILITY
595 // ---------------------------------------------------------------------------
597 // ---------------------------------------------------------------------------
599 #if WXWIN_COMPATIBILITY
600 void wxWindow::SetScrollRange(
606 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, nRange
));
607 } // end of wxWindow::SetScrollRange
609 void wxWindow::SetScrollPage(
615 if ( orient
== wxHORIZONTAL
)
621 int wxWindow::OldGetScrollRange(
626 HWND hWnd
= GetHwnd();
630 mRc
= WinSendMsg(hWnd
, SBM_QUERYRANGE
, (MPARAM
)0L, (MPARAM
)0L);
631 return(SHORT2FROMMR(mRc
));
634 } // end of wxWindow::OldGetScrollRange
636 int wxWindow::GetScrollPage(
640 if (nOrient
== wxHORIZONTAL
)
641 return m_nXThumbSize
;
643 return m_nYThumbSize
;
644 } // end of wxWindow::GetScrollPage
645 #endif // WXWIN_COMPATIBILITY
647 int wxWindow::GetScrollPos(
651 return((int)::WinSendMsg(GetHwnd(), SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
652 } // end of wxWindow::GetScrollPos
654 int wxWindow::GetScrollRange(
660 mr
= ::WinSendMsg(GetHwnd(), SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
661 return((int)SHORT2FROMMR(mr
));
662 } // end of wxWindow::GetScrollRange
664 int wxWindow::GetScrollThumb(
668 WNDPARAMS vWndParams
;
671 ::WinSendMsg(GetHwnd(), WM_QUERYWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)NULL
);
672 pSbcd
= (PSBCDATA
)vWndParams
.pCtlData
;
673 return((int)pSbcd
->posThumb
);
674 } // end of wxWindow::GetScrollThumb
676 void wxWindow::SetScrollPos(
682 ::WinSendMsg(GetHwnd(), SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
683 } // end of wxWindow::SetScrollPos(
685 void wxWindow::SetScrollbar(
693 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, nRange
));
694 if (nOrient
== wxHORIZONTAL
)
696 m_nXThumbSize
= nThumbVisible
;
700 m_nYThumbSize
= nThumbVisible
;
702 } // end of wxWindow::SetScrollbar
704 void wxWindow::ScrollWindow(
707 , const wxRect
* pRect
714 vRect2
.xLeft
= pRect
->x
;
715 vRect2
.yTop
= pRect
->y
;
716 vRect2
.xRight
= pRect
->x
+ pRect
->width
;
717 vRect2
.yBottom
= pRect
->y
+ pRect
->height
;
721 ::WinScrollWindow(GetHwnd(), (LONG
)nDx
, (LONG
)nDy
, &vRect2
, NULL
, NULLHANDLE
, NULL
, 0L);
723 ::WinScrollWindow(GetHwnd(), nDx
, nDy
, NULL
, NULL
, NULLHANDLE
, NULL
, 0L);
724 } // end of wxWindow::ScrollWindow
726 // ---------------------------------------------------------------------------
728 // ---------------------------------------------------------------------------
730 void wxWindow::SubclassWin(
734 HWND hwnd
= (HWND
)hWnd
;
736 wxASSERT_MSG( !m_fnOldWndProc
, wxT("subclassing window twice?") );
737 wxCHECK_RET(::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in SubclassWin") );
738 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(hwnd
, (PFNWP
)wxWndProc
);
739 } // end of wxWindow::SubclassWin
741 void wxWindow::UnsubclassWin()
744 // Restore old Window proc
746 HWND hwnd
= GetHWND();
750 wxCHECK_RET( ::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in UnsubclassWin") );
752 PFNWP fnProc
= (PFNWP
)::WinQueryWindowPtr(hwnd
, QWP_PFNWP
);
754 if ( (m_fnOldWndProc
!= 0) && (fnProc
!= (PFNWP
) m_fnOldWndProc
))
756 WinSubclassWindow(hwnd
, (PFNWP
)m_fnOldWndProc
);
760 } // end of wxWindow::UnsubclassWin
763 // Make a Windows extended style from the given wxWindows window style
765 WXDWORD
wxWindow::MakeExtendedStyle(
767 , bool bEliminateBorders
771 // PM does not support extended style
775 } // end of wxWindow::MakeExtendedStyle
778 // Determines whether native 3D effects or CTL3D should be used,
779 // applying a default border style if required, and returning an extended
780 // style to pass to CreateWindowEx.
782 WXDWORD
wxWindow::Determine3DEffects(
783 WXDWORD dwDefaultBorderStyle
787 WXDWORD dwStyle
= 0L;
790 // Native PM does not have any specialize 3D effects like WIN32 does
794 } // end of wxWindow::Determine3DEffects
796 #if WXWIN_COMPATIBILITY
797 void wxWindow::OnCommand(
799 , wxCommandEvent
& rEvent
802 if (GetEventHandler()->ProcessEvent(rEvent
))
805 m_parent
->GetEventHandler()->OnCommand( rWin
808 } // end of wxWindow::OnCommand
810 wxObject
* wxWindow::GetChild(
815 // Return a pointer to the Nth object in the Panel
817 wxNode
* pNode
= GetChildren().First();
821 pNode
= pNode
->Next();
824 wxObject
* pObj
= (wxObject
*)pNode
->Data();
829 } // end of wxWindow::GetChild
831 #endif // WXWIN_COMPATIBILITY
834 // Setup background and foreground colours correctly
836 void wxWindow::SetupColours()
839 SetBackgroundColour(GetParent()->GetBackgroundColour());
840 } // end of wxWindow::SetupColours
842 void wxWindow::OnIdle(
847 // Check if we need to send a LEAVE event
849 if (m_bMouseInWindow
)
853 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
854 if (::WinWindowFromPoint(HWND_DESKTOP
, &vPoint
, FALSE
) != (HWND
)GetHwnd())
857 // Generate a LEAVE event
859 m_bMouseInWindow
= FALSE
;
862 // Unfortunately the mouse button and keyboard state may have changed
863 // by the time the OnIdle function is called, so 'state' may be
868 if (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) != 0)
870 if (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) != 0);
873 wxMouseEvent
rEvent(wxEVT_LEAVE_WINDOW
);
875 InitMouseEvent( rEvent
880 (void)GetEventHandler()->ProcessEvent(rEvent
);
884 } // end of wxWindow::OnIdle
887 // Set this window to be the child of 'parent'.
889 bool wxWindow::Reparent(
893 if (!wxWindowBase::Reparent(pParent
))
896 HWND hWndChild
= GetHwnd();
897 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
899 ::WinSetParent(hWndChild
, hWndParent
, TRUE
);
901 } // end of wxWindow::Reparent
903 void wxWindow::Clear()
905 wxClientDC
vDc(this);
906 wxBrush
vBrush( GetBackgroundColour()
910 vDc
.SetBackground(vBrush
);
912 } // end of wxWindow::Clear
914 void wxWindow::Refresh(
916 , const wxRect
* pRect
919 HWND hWnd
= GetHwnd();
927 vOs2Rect
.xLeft
= pRect
->x
;
928 vOs2Rect
.yTop
= pRect
->y
;
929 vOs2Rect
.xRight
= pRect
->x
+ pRect
->width
;
930 vOs2Rect
.yBottom
= pRect
->y
+ pRect
->height
;
932 ::WinInvalidateRect(hWnd
, &vOs2Rect
, bEraseBack
);
935 ::WinInvalidateRect(hWnd
, NULL
, bEraseBack
);
937 } // end of wxWindow::Refresh
939 // ---------------------------------------------------------------------------
941 // ---------------------------------------------------------------------------
943 #if wxUSE_DRAG_AND_DROP
944 void wxWindow::SetDropTarget(
945 wxDropTarget
* pDropTarget
948 if (m_dropTarget
!= 0)
950 m_dropTarget
->Revoke(m_hWnd
);
953 m_dropTarget
= pDropTarget
;
954 if (m_dropTarget
!= 0)
955 m_dropTarget
->Register(m_hWnd
);
956 } // end of wxWindow::SetDropTarget
960 // old style file-manager drag&drop support: we retain the old-style
961 // DragAcceptFiles in parallel with SetDropTarget.
963 void wxWindow::DragAcceptFiles(
967 HWND hWnd
= GetHwnd();
970 ::DrgAcceptDroppedFiles(hWnd
, NULL
, NULL
, DO_COPY
, 0L);
971 } // end of wxWindow::DragAcceptFiles
973 // ----------------------------------------------------------------------------
975 // ----------------------------------------------------------------------------
979 void wxWindow::DoSetToolTip(
983 wxWindowBase::DoSetToolTip(pTooltip
);
986 m_tooltip
->SetWindow(this);
987 } // end of wxWindow::DoSetToolTip
989 #endif // wxUSE_TOOLTIPS
991 // ---------------------------------------------------------------------------
992 // moving and resizing
993 // ---------------------------------------------------------------------------
996 void wxWindow::DoGetSize(
1001 HWND hWnd
= GetHwnd();
1004 ::WinQueryWindowRect(hWnd
, &vRect
);
1007 *pWidth
= vRect
.xRight
- vRect
.xLeft
;
1009 // OS/2 PM is backwards from windows
1010 *pHeight
= vRect
.yTop
- vRect
.yBottom
;
1011 } // end of wxWindow::DoGetSize
1013 void wxWindow::DoGetPosition(
1018 HWND hWnd
= GetHwnd();
1022 ::WinQueryWindowRect(hWnd
, &vRect
);
1024 vPoint
.x
= vRect
.xLeft
;
1025 vPoint
.y
= vRect
.yBottom
;
1028 // We do the adjustments with respect to the parent only for the "real"
1029 // children, not for the dialogs/frames
1033 HWND hParentWnd
= 0;
1034 wxWindow
* pParent
= GetParent();
1037 hParentWnd
= GetWinHwnd(pParent
);
1040 // Since we now have the absolute screen coords, if there's a parent we
1041 // must subtract its bottom left corner
1047 ::WinQueryWindowRect(hParentWnd
, &vRect2
);
1048 vPoint
.x
-= vRect
.xLeft
;
1049 vPoint
.y
-= vRect
.yBottom
;
1053 // We may be faking the client origin. So a window that's really at (0,
1054 // 30) may appear (to wxWin apps) to be at (0, 0).
1056 wxPoint
vPt(pParent
->GetClientAreaOrigin());
1066 } // end of wxWindow::DoGetPosition
1068 void wxWindow::DoScreenToClient(
1073 HWND hWnd
= GetHwnd();
1076 ::WinQueryWindowPos(hWnd
, &vSwp
);
1082 } // end of wxWindow::DoScreenToClient
1084 void wxWindow::DoClientToScreen(
1089 HWND hWnd
= GetHwnd();
1092 ::WinQueryWindowPos(hWnd
, &vSwp
);
1098 } // end of wxWindow::DoClientToScreen
1101 // Get size *available for subwindows* i.e. excluding menu bar etc.
1102 // Must be a frame type window
1104 void wxWindow::DoGetClientSize(
1109 HWND hWnd
= GetHwnd();
1113 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1114 if( hWndClient
== NULLHANDLE
)
1115 ::WinQueryWindowRect(GetHwnd(), &vRect
);
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 if (m_hWnd
!= 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL
))
1539 // Intercept dialog navigation keys
1541 bool bProcess
= TRUE
;
1542 USHORT uKeyFlags
= SHORT1FROMMP(pQMsg
->mp1
);
1544 if (uKeyFlags
& KC_KEYUP
)
1547 if (uKeyFlags
& KC_ALT
)
1550 if (!(uKeyFlags
& KC_VIRTUALKEY
))
1555 bool bCtrlDown
= IsCtrlDown();
1556 bool bShiftDown
= IsShiftDown();
1559 // WM_QUERYDLGCODE: ask the control if it wants the key for itself,
1560 // don't process it if it's the case (except for Ctrl-Tab/Enter
1561 // combinations which are always processed)
1563 ULONG ulDlgCode
= 0;
1567 ulDlgCode
= (ULONG
)::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0);
1570 bool bForward
= TRUE
;
1571 bool bWindowChange
= FALSE
;
1573 switch (SHORT2FROMMP(pQMsg
->mp2
))
1576 // Going to make certain assumptions about specific types of controls
1577 // here, so we may have to alter some things later if they prove invalid
1581 // Shift tabl will always be a nav-key but tabs may be wanted
1590 // Entry Fields want tabs for themselve usually
1594 case DLGC_ENTRYFIELD
:
1604 // Ctrl-Tab cycles thru notebook pages
1606 bWindowChange
= bCtrlDown
;
1607 bForward
= !bShiftDown
;
1630 // ctrl-enter is not processed
1634 else if (ulDlgCode
& DLGC_BUTTON
)
1637 // buttons want process Enter themselevs
1643 wxPanel
* pPanel
= wxDynamicCast(this, wxPanel
);
1644 wxButton
* pBtn
= NULL
;
1649 // Panel may have a default button which should
1650 // be activated by Enter
1652 pBtn
= pPanel
->GetDefaultItem();
1655 if (pBtn
&& pBtn
->IsEnabled())
1658 // If we do have a default button, do press it
1660 pBtn
->OS2Command(BN_CLICKED
, 0 /* unused */);
1663 // else: but if it does not it makes sense to make
1664 // it work like a TAB - and that's what we do.
1665 // Note that Ctrl-Enter always works this way.
1676 wxNavigationKeyEvent vEvent
;
1678 vEvent
.SetDirection(bForward
);
1679 vEvent
.SetWindowChange(bWindowChange
);
1680 vEvent
.SetEventObject(this);
1682 if (GetEventHandler()->ProcessEvent(vEvent
))
1684 wxButton
* pBtn
= wxDynamicCast(FindFocus(), wxButton
);
1689 // The button which has focus should be default
1698 // Let Dialogs process
1700 if (::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0));
1707 // relay mouse move events to the tooltip control
1708 QMSG
* pQMsg
= (QMSG
*)pMsg
;
1710 if (pQMsg
->msg
== WM_MOUSEMOVE
)
1711 m_tooltip
->RelayEvent(pMsg
);
1713 #endif // wxUSE_TOOLTIPS
1716 } // end of wxWindow::OS2ProcessMessage
1718 bool wxWindow::OS2TranslateMessage(
1723 return m_acceleratorTable
.Translate(m_hWnd
, pMsg
);
1726 #endif //wxUSE_ACCEL
1727 } // end of wxWindow::OS2TranslateMessage
1729 // ---------------------------------------------------------------------------
1730 // message params unpackers
1731 // ---------------------------------------------------------------------------
1733 void wxWindow::UnpackCommand(
1741 *pId
= LOWORD(wParam
);
1742 *phWnd
= NULL
; // or may be GetHWND() ?
1743 *pCmd
= LOWORD(lParam
);
1744 } // end of wxWindow::UnpackCommand
1746 void wxWindow::UnpackActivate(
1753 *pState
= LOWORD(wParam
);
1754 *phWnd
= (WXHWND
)lParam
;
1755 } // end of wxWindow::UnpackActivate
1757 void wxWindow::UnpackScroll(
1765 *pCode
= LOWORD(wParam
);
1766 *pPos
= HIWORD(wParam
);
1767 *phWnd
= (WXHWND
)lParam
;
1768 } // end of wxWindow::UnpackScroll
1770 void wxWindow::UnpackMenuSelect(
1778 *pItem
= (WXWORD
)LOWORD(wParam
);
1779 *pFlags
= HIWORD(wParam
);
1780 *phMenu
= (WXHMENU
)lParam
;
1781 } // end of wxWindow::UnpackMenuSelect
1783 // ---------------------------------------------------------------------------
1784 // Main wxWindows window proc and the window proc for wxWindow
1785 // ---------------------------------------------------------------------------
1788 // Hook for new window just as it's being created, when the window isn't yet
1789 // associated with the handle
1791 wxWindow
* wxWndHook
= NULL
;
1796 MRESULT EXPENTRY
wxWndProc(
1804 // Trace all ulMsgs - useful for the debugging
1807 DEBUG_PRINTF(__WXDEBUG__wxWndProc
);
1808 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
1809 wxGetMessageName(ulMsg
), wParam
, lParam
);
1810 #endif // __WXDEBUG__
1812 wxWindow
* pWnd
= wxFindWinFromHandle((WXHWND
)hWnd
);
1815 // When we get the first message for the HWND we just created, we associate
1816 // it with wxWindow stored in wxWndHook
1818 if (!pWnd
&& wxWndHook
)
1820 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
1823 pWnd
->SetHWND((WXHWND
)hWnd
);
1826 MRESULT rc
= (MRESULT
)0;
1830 // Stop right here if we don't have a valid handle in our wxWindow object.
1832 if (pWnd
&& !pWnd
->GetHWND())
1834 pWnd
->SetHWND((WXHWND
) hWnd
);
1835 rc
= pWnd
->OS2DefWindowProc(ulMsg
, wParam
, lParam
);
1841 rc
= pWnd
->OS2WindowProc(ulMsg
, wParam
, lParam
);
1843 rc
= ::WinDefWindowProc(hWnd
, ulMsg
, wParam
, lParam
);
1847 } // end of wxWndProc
1850 // We will add (or delete) messages we need to handle at this default
1853 MRESULT
wxWindow::OS2WindowProc(
1860 // Did we process the uMsg?
1862 bool bProcessed
= FALSE
;
1869 // For most messages we should return 0 when we do process the message
1871 mResult
= (MRESULT
)0;
1879 bProcessed
= HandleCreate( (WXLPCREATESTRUCT
)lParam
1885 // Return 0 to bAllow window creation
1887 mResult
= (MRESULT
)(bMayCreate
? 0 : -1);
1898 bProcessed
= HandleMove( LOWORD(lParam
)
1904 bProcessed
= HandleSize( LOWORD(lParam
)
1915 UnpackActivate( wParam
1921 bProcessed
= HandleActivate( wState
1929 if (SHORT1FROMMP((MPARAM
)lParam
) == TRUE
)
1930 bProcessed
= HandleSetFocus((WXHWND
)(HWND
)wParam
);
1932 bProcessed
= HandleKillFocus((WXHWND
)(HWND
)wParam
);
1936 DEBUG_PRINTF(WM_PAINT
)
1937 bProcessed
= HandlePaint();
1942 // Don't let the DefWindowProc() destroy our window - we'll do it
1943 // ourselves in ~wxWindow
1946 mResult
= (MRESULT
)TRUE
;
1947 DEBUG_PRINTF(WM_CLOSE
)
1951 DEBUG_PRINTF(WM_SHOW
)
1952 bProcessed
= HandleShow(wParam
!= 0, (int)lParam
);
1956 // Under OS2 PM Joysticks are treated just like mouse events
1957 // The "Motion" events will be prevelent in joysticks
1960 case WM_BUTTON1DOWN
:
1962 case WM_BUTTON1DBLCLK
:
1963 case WM_BUTTON1MOTIONEND
:
1964 case WM_BUTTON1MOTIONSTART
:
1965 case WM_BUTTON2DOWN
:
1967 case WM_BUTTON2DBLCLK
:
1968 case WM_BUTTON2MOTIONEND
:
1969 case WM_BUTTON2MOTIONSTART
:
1970 case WM_BUTTON3DOWN
:
1972 case WM_BUTTON3DBLCLK
:
1973 case WM_BUTTON3MOTIONEND
:
1974 case WM_BUTTON3MOTIONSTART
:
1976 short x
= LOWORD(lParam
);
1977 short y
= HIWORD(lParam
);
1979 bProcessed
= HandleMouseEvent(uMsg
, x
, y
, (WXUINT
)wParam
);
1983 bProcessed
= HandleSysCommand(wParam
, lParam
);
1990 DEBUG_PRINTF(WM_COMMAND
-in
)
1991 UnpackCommand(wParam
, lParam
, &id
, &hwnd
, &cmd
);
1993 bProcessed
= HandleCommand(id
, cmd
, hwnd
);
1994 DEBUG_PRINTF(WM_COMMAND
-out
)
1999 // For these messages we must return TRUE if process the message
2002 case WM_MEASUREITEM
:
2004 int idCtrl
= (UINT
)wParam
;
2005 if ( uMsg
== WM_DRAWITEM
)
2007 bProcessed
= OS2OnDrawItem(idCtrl
,
2008 (WXDRAWITEMSTRUCT
*)lParam
);
2012 bProcessed
= OS2OnMeasureItem(idCtrl
,
2013 (WXMEASUREITEMSTRUCT
*)lParam
);
2017 mResult
= (MRESULT
)TRUE
;
2021 case WM_QUERYDLGCODE
:
2024 mResult
= (MRESULT
)m_lDlgCode
;
2028 //else: get the dlg code from the DefWindowProc()
2033 // In OS/2 PM all keyboard events are of the WM_CHAR type. Virtual key and key-up
2034 // and key-down events are obtained from the WM_CHAR params.
2038 USHORT uKeyFlags
= SHORT1FROMMP((MPARAM
)wParam
);
2040 if (uKeyFlags
& KC_KEYUP
)
2042 bProcessed
= HandleKeyUp((WXDWORD
)wParam
, lParam
);
2045 else // keydown event
2048 // If this has been processed by an event handler,
2049 // return 0 now (we've handled it). DON't RETURN
2050 // we still need to process further
2052 HandleKeyDown((WXDWORD
)wParam
, lParam
);
2053 if (uKeyFlags
& KC_VIRTUALKEY
)
2055 USHORT uVk
= SHORT2FROMMP((MPARAM
)lParam
);
2058 // We consider these message "not interesting" to OnChar
2060 if (uVk
== VK_SHIFT
|| uVk
== VK_CTRL
)
2068 // Avoid duplicate messages to OnChar for these ASCII keys: they
2069 // will be translated by TranslateMessage() and received in WM_CHAR
2075 // But set processed to FALSE, not TRUE to still pass them to
2076 // the control's default window proc - otherwise built-in
2077 // keyboard handling won't work
2086 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
);
2090 else // WM_CHAR -- Always an ASCII character
2092 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
, TRUE
);
2104 UnpackScroll( wParam
2111 bProcessed
= OS2OnScroll( uMsg
== WM_HSCROLL
? wxHORIZONTAL
2120 #if defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
2121 case WM_CTLCOLORCHANGE
:
2123 bProcessed
= HandleCtlColor(&hBrush
);
2128 // Instead of CTLCOLOR messages PM sends QUERYWINDOWPARAMS to
2129 // things such as colors and fonts and such
2131 case WM_QUERYWINDOWPARAMS
:
2133 PWNDPARAMS pWndParams
= (PWNDPARAMS
)wParam
;
2135 bProcessed
= HandleWindowParams( pWndParams
2141 // the return value for this message is ignored
2142 case WM_SYSCOLORCHANGE
:
2143 bProcessed
= HandleSysColorChange();
2146 case WM_REALIZEPALETTE
:
2147 bProcessed
= HandlePaletteChanged();
2150 case WM_PRESPARAMCHANGED
:
2151 bProcessed
= HandlePresParamChanged(wParam
);
2154 // move this to wxFrame
2155 case WM_ERASEBACKGROUND
:
2156 bProcessed
= HandleEraseBkgnd((WXHDC
)(HDC
)wParam
);
2160 // We processed the message, i.e. erased the background
2162 mResult
= (MRESULT
)TRUE
;
2166 // move all drag and drops to wxDrg
2168 bProcessed
= HandleEndDrag(wParam
);
2172 bProcessed
= HandleInitDialog((WXHWND
)(HWND
)wParam
);
2176 // we never set focus from here
2181 // wxFrame specific message
2182 case WM_MINMAXFRAME
:
2183 bProcessed
= HandleGetMinMaxInfo((PSWP
)wParam
);
2186 case WM_SYSVALUECHANGED
:
2187 // TODO: do something
2188 mResult
= (MRESULT
)TRUE
;
2192 // Comparable to WM_SETPOINTER for windows, only for just controls
2194 case WM_CONTROLPOINTER
:
2195 bProcessed
= HandleSetCursor( SHORT1FROMMP(wParam
) // Control ID
2196 ,(HWND
)lParam
// Cursor Handle
2201 // Returning TRUE stops the DefWindowProc() from further
2202 // processing this message - exactly what we need because we've
2203 // just set the cursor.
2205 mResult
= (MRESULT
)TRUE
;
2212 wxLogTrace(wxTraceMessages
, wxT("Forwarding %s to DefWindowProc."),
2213 wxGetMessageName(uMsg
));
2214 #endif // __WXDEBUG__
2215 if (IsKindOf(CLASSINFO(wxFrame
)))
2216 mResult
= ::WinDefWindowProc(m_hWnd
, uMsg
, wParam
, lParam
);
2218 mResult
= OS2DefWindowProc(uMsg
, wParam
, lParam
);
2221 } // end of wxWindow::OS2WindowProc
2224 // Dialog window proc
2232 if (uMsg
== WM_INITDLG
)
2235 // For this message, returning TRUE tells system to set focus to the
2236 // first control in the dialog box
2238 return (MRESULT
)TRUE
;
2243 // For all the other ones, FALSE means that we didn't process the
2248 } // end of wxDlgProc
2250 wxWindow
* wxFindWinFromHandle(
2254 wxNode
* pNode
= wxWinHandleList
->Find((long)hWnd
);
2258 return (wxWindow
*)pNode
->Data();
2259 } // end of wxFindWinFromHandle
2261 void wxAssociateWinWithHandle(
2267 // Adding NULL hWnd is (first) surely a result of an error and
2268 // (secondly) breaks menu command processing
2270 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
2271 wxT("attempt to add a NULL hWnd to window list ignored") );
2274 wxWindow
* pOldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
2276 if (pOldWin
&& (pOldWin
!= pWin
))
2278 wxString
str(pWin
->GetClassInfo()->GetClassName());
2279 wxLogError( "Bug! Found existing HWND %X for new window of class %s"
2286 wxWinHandleList
->Append( (long)hWnd
2290 } // end of wxAssociateWinWithHandle
2292 void wxRemoveHandleAssociation(
2296 wxWinHandleList
->DeleteObject(pWin
);
2297 } // end of wxRemoveHandleAssociation
2300 // Default destroyer - override if you destroy it in some other way
2301 // (e.g. with MDI child windows)
2303 void wxWindow::OS2DestroyWindow()
2307 void wxWindow::OS2DetachWindowMenu()
2311 HMENU hMenu
= (HMENU
)m_hMenu
;
2313 int nN
= (int)::WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
2316 for (i
= 0; i
< nN
; i
++)
2319 int nChars
= (int)::WinSendMsg( hMenu
2321 ,MPFROM2SHORT(i
, nN
)
2326 wxLogLastError(wxT("GetMenuString"));
2330 if (wxStrcmp(zBuf
, wxT("&Window")) == 0)
2332 ::WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
2337 } // end of wxWindow::OS2DetachWindowMenu
2339 bool wxWindow::OS2Create(
2342 , const wxChar
* zTitle
2350 , unsigned long ulId
2360 long lHeight1
= 20L;
2362 int nNeedsubclass
= 0;
2363 PCSZ pszClass
= zClass
;
2366 // Find parent's size, if it exists, to set up a possible default
2367 // panel size the size of the parent window
2384 // check to see if the new window is a standard control
2386 if ((ULONG
)zClass
== (ULONG
)WC_BUTTON
||
2387 (ULONG
)zClass
== (ULONG
)WC_COMBOBOX
||
2388 (ULONG
)zClass
== (ULONG
)WC_CONTAINER
||
2389 (ULONG
)zClass
== (ULONG
)WC_ENTRYFIELD
||
2390 (ULONG
)zClass
== (ULONG
)WC_FRAME
||
2391 (ULONG
)zClass
== (ULONG
)WC_LISTBOX
||
2392 (ULONG
)zClass
== (ULONG
)WC_MENU
||
2393 (ULONG
)zClass
== (ULONG
)WC_NOTEBOOK
||
2394 (ULONG
)zClass
== (ULONG
)WC_SCROLLBAR
||
2395 (ULONG
)zClass
== (ULONG
)WC_SPINBUTTON
||
2396 (ULONG
)zClass
== (ULONG
)WC_STATIC
||
2397 (ULONG
)zClass
== (ULONG
)WC_TITLEBAR
||
2398 (ULONG
)zClass
== (ULONG
)WC_VALUESET
2405 // no standard controls
2406 if(wxString (wxT("wxFrameClass")) == wxString(zClass
) )
2408 pszClass
= WC_FRAME
;
2415 nControlId
= FID_CLIENT
;
2420 // We will either have a registered class via string name or a standard PM Class via a long
2422 m_hWnd
= (WXHWND
)::WinCreateWindow( (HWND
)hParent
2424 ,(PSZ
)zTitle
? zTitle
: wxT("")
2438 vError
= ::WinGetLastError(vHabmain
);
2439 sError
= wxPMErrorToStr(vError
);
2440 wxLogError("Can't create window of class %s!. Error: %s\n", zClass
, sError
);
2443 ::WinSetWindowULong(m_hWnd
, QWL_USER
, (ULONG
) this);
2447 wxNode
* pNode
= wxWinHandleList
->Member(this);
2451 HWND hWnd
= (HWND
)pNode
->GetKeyInteger();
2453 if (hWnd
!= (HWND
)m_hWnd
)
2456 wxLogError("A second HWND association is being added for the same window!");
2460 wxAssociateWinWithHandle((HWND
)m_hWnd
2464 // Now need to subclass window.
2468 wxAssociateWinWithHandle((HWND
)m_hWnd
,this);
2472 SubclassWin(GetHWND());
2475 } // end of wxWindow::OS2Create
2477 // ===========================================================================
2478 // OS2 PM message handlers
2479 // ===========================================================================
2481 // ---------------------------------------------------------------------------
2482 // window creation/destruction
2483 // ---------------------------------------------------------------------------
2485 bool wxWindow::HandleCreate(
2486 WXLPCREATESTRUCT vCs
2490 wxWindowCreateEvent
vEvent(this);
2492 (void)GetEventHandler()->ProcessEvent(vEvent
);
2493 *pbMayCreate
= TRUE
;
2495 } // end of wxWindow::HandleCreate
2497 bool wxWindow::HandleDestroy()
2499 wxWindowDestroyEvent
vEvent(this);
2501 (void)GetEventHandler()->ProcessEvent(vEvent
);
2504 // Delete our drop target if we've got one
2506 #if wxUSE_DRAG_AND_DROP
2507 if (m_dropTarget
!= NULL
)
2509 m_dropTarget
->Revoke(m_hWnd
);
2510 delete m_dropTarget
;
2511 m_dropTarget
= NULL
;
2513 #endif // wxUSE_DRAG_AND_DROP
2516 // WM_DESTROY handled
2519 } // end of wxWindow::HandleDestroy
2521 // ---------------------------------------------------------------------------
2523 // ---------------------------------------------------------------------------
2524 void wxWindow::OnSetFocus(
2525 wxFocusEvent
& rEvent
2529 // Panel wants to track the window which was the last to have focus in it,
2530 // so we want to set ourselves as the window which last had focus
2532 // Notice that it's also important to do it upwards the tree becaus
2533 // otherwise when the top level panel gets focus, it won't set it back to
2534 // us, but to some other sibling
2536 wxWindow
* pWin
= this;
2540 wxWindow
* pParent
= pWin
->GetParent();
2541 wxPanel
* pPanel
= wxDynamicCast( pParent
2546 pPanel
->SetLastFocus(pWin
);
2551 wxLogTrace(_T("focus"), _T("%s (0x%08x) gets focus"),
2552 GetClassInfo()->GetClassName(), GetHandle());
2555 } // end of wxWindow::OnSetFocus
2557 bool wxWindow::HandleActivate(
2559 , WXHWND
WXUNUSED(hActivate
)
2562 wxActivateEvent
vEvent( wxEVT_ACTIVATE
2566 vEvent
.SetEventObject(this);
2567 return GetEventHandler()->ProcessEvent(vEvent
);
2568 } // end of wxWindow::HandleActivate
2570 bool wxWindow::HandleSetFocus(
2571 WXHWND
WXUNUSED(hWnd
)
2580 m_caret
->OnSetFocus();
2582 #endif // wxUSE_CARET
2585 // Panel wants to track the window which was the last to have focus in it
2587 wxPanel
* pPanel
= wxDynamicCast( GetParent()
2592 pPanel
->SetLastFocus(this);
2595 wxFocusEvent
vEvent(wxEVT_SET_FOCUS
, m_windowId
);
2597 vEvent
.SetEventObject(this);
2598 return GetEventHandler()->ProcessEvent(vEvent
);
2599 } // end of wxWindow::HandleSetFocus
2601 bool wxWindow::HandleKillFocus(
2602 WXHWND
WXUNUSED(hWnd
)
2611 m_caret
->OnKillFocus();
2613 #endif // wxUSE_CARET
2615 wxFocusEvent
vEvent( wxEVT_KILL_FOCUS
2619 vEvent
.SetEventObject(this);
2620 return GetEventHandler()->ProcessEvent(vEvent
);
2621 } // end of wxWindow::HandleKillFocus
2623 // ---------------------------------------------------------------------------
2625 // ---------------------------------------------------------------------------
2627 bool wxWindow::HandleShow(
2632 wxShowEvent
vEvent( GetId()
2636 vEvent
.m_eventObject
= this;
2637 return GetEventHandler()->ProcessEvent(vEvent
);
2638 } // end of wxWindow::HandleShow
2640 bool wxWindow::HandleInitDialog(
2641 WXHWND
WXUNUSED(hWndFocus
)
2644 wxInitDialogEvent
vEvent(GetId());
2646 vEvent
.m_eventObject
= this;
2647 return GetEventHandler()->ProcessEvent(vEvent
);
2648 } // end of wxWindow::HandleInitDialog
2650 bool wxWindow::HandleEndDrag(WXWPARAM wParam
)
2652 // TODO: We'll handle drag and drop later
2656 bool wxWindow::HandleSetCursor(
2662 // Under OS/2 PM this allows the pointer to be changed
2663 // as it passes over a control
2665 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)hPointer
);
2667 } // end of wxWindow::HandleSetCursor
2669 // ---------------------------------------------------------------------------
2670 // owner drawn stuff
2671 // ---------------------------------------------------------------------------
2672 bool wxWindow::OS2OnDrawItem(
2674 , WXDRAWITEMSTRUCT
* pItemStruct
2678 // I'll get to owner drawn stuff later
2682 // is it a menu item or control?
2684 wxWindow
* pItem
= FindItem(vId
);
2686 #if wxUSE_OWNER_DRAWN
2687 if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxControl
)))
2689 return ((wxControl
*)pItem
)->OS2OnDraw(pItemStruct
);
2691 else if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxMenu
)))
2694 // TODO: draw a menu item
2696 POWNERITEM pDrawStruct = (OWNERITEM *)pItemStruct;
2697 wxMenuItem* pMenuItem = (wxMenuItem *)(pDrawStruct->pItemData);
2699 wxCHECK(pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE);
2702 // Prepare to call OnDrawItem()
2705 dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE);
2706 wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top,
2707 pDrawStruct->rcItem.right - pDrawStruct->rcItem.left,
2708 pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top);
2710 return pMenuItem->OnDrawItem
2713 (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction,
2714 (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
2723 } // end of wxWindow::OS2OnDrawItem
2725 bool wxWindow::OS2OnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*itemStruct
)
2727 // TODO: more owner drawn menu related stuff, get to it later
2729 #if wxUSE_OWNER_DRAWN
2730 // is it a menu item?
2733 MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
2734 wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
2736 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
2738 return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
2739 &pMeasureStruct->itemHeight);
2742 wxWindow *item = FindItem(id);
2743 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
2745 return ((wxControl *)item)->MSWOnMeasure(itemStruct);
2747 #endif // owner-drawn menus
2752 // ---------------------------------------------------------------------------
2753 // colours and palettes
2754 // ---------------------------------------------------------------------------
2756 bool wxWindow::HandleSysColorChange()
2758 wxSysColourChangedEvent vEvent
;
2760 vEvent
.SetEventObject(this);
2761 return GetEventHandler()->ProcessEvent(vEvent
);
2762 } // end of wxWindow::HandleSysColorChange
2764 bool wxWindow::HandleCtlColor(
2769 // Not much provided with message. So not sure I can do anything with it
2772 } // end of wxWindow::HandleCtlColor
2774 bool wxWindow::HandleWindowParams(
2775 PWNDPARAMS pWndParams
2779 // TODO: I'll do something here, just not sure what yet
2783 // Define for each class of dialog and control
2784 WXHBRUSH
wxWindow::OnCtlColor(WXHDC hDC
,
2794 bool wxWindow::HandlePaletteChanged()
2796 // need to set this to something first
2797 WXHWND hWndPalChange
= NULLHANDLE
;
2799 wxPaletteChangedEvent
vEvent(GetId());
2801 vEvent
.SetEventObject(this);
2802 vEvent
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
2804 return GetEventHandler()->ProcessEvent(vEvent
);
2805 } // end of wxWindow::HandlePaletteChanged
2807 bool wxWindow::HandlePresParamChanged(
2812 // TODO: Once again I'll do something here when I need it
2814 //wxQueryNewPaletteEvent event(GetId());
2815 //event.SetEventObject(this);
2816 // if the background is erased
2817 // bProcessed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
2819 return FALSE
; //GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized();
2823 // Responds to colour changes: passes event on to children.
2825 void wxWindow::OnSysColourChanged(
2826 wxSysColourChangedEvent
& rEvent
2829 wxNode
* pNode
= GetChildren().First();
2834 // Only propagate to non-top-level windows
2836 wxWindow
* pWin
= (wxWindow
*)pNode
->Data();
2838 if (pWin
->GetParent())
2840 wxSysColourChangedEvent vEvent
;
2842 rEvent
.m_eventObject
= pWin
;
2843 pWin
->GetEventHandler()->ProcessEvent(vEvent
);
2845 pNode
= pNode
->Next();
2847 } // end of wxWindow::OnSysColourChanged
2849 // ---------------------------------------------------------------------------
2851 // ---------------------------------------------------------------------------
2853 bool wxWindow::HandlePaint()
2855 HRGN hRgn
= NULLHANDLE
;
2856 wxPaintEvent vEvent
;
2860 if (::WinQueryUpdateRegion(GetHwnd(), hRgn
) == RGN_NULL
)
2862 wxLogLastError("CreateRectRgn");
2871 HWND hWnd0
= NULLHANDLE
;
2875 printf("HandlePaint hWnd=%x ",hWnd
);
2879 m_updateRegion
= wxRegion(hRgn
);
2880 vEvent
.SetEventObject(this);
2881 return (GetEventHandler()->ProcessEvent(vEvent
));
2882 } // end of wxWindow::HandlePaint
2884 bool wxWindow::HandleEraseBkgnd(WXHDC hdc
)
2886 // TODO: will have to worry about this later as part of
2887 // the handling of changed presentation parameters
2889 if ( ::IsIconic(GetHwnd()) )
2898 wxEraseEvent event(m_windowId, &dc);
2899 event.SetEventObject(this);
2900 bool rc = GetEventHandler()->ProcessEvent(event);
2903 dc.SelectOldObjects(hdc);
2904 dc.SetHDC((WXHDC) NULL);
2907 } // end of wxWindow::HandleEraseBkgnd
2909 void wxWindow::OnEraseBackground(
2910 wxEraseEvent
& rEvent
2914 } // end of wxWindow::OnEraseBackground
2916 // ---------------------------------------------------------------------------
2917 // moving and resizing
2918 // ---------------------------------------------------------------------------
2920 bool wxWindow::HandleMinimize()
2922 wxIconizeEvent
vEvent(m_windowId
);
2924 vEvent
.SetEventObject(this);
2925 return GetEventHandler()->ProcessEvent(vEvent
);
2926 } // end of wxWindow::HandleMinimize
2928 bool wxWindow::HandleMaximize()
2930 wxMaximizeEvent
vEvent(m_windowId
);
2932 vEvent
.SetEventObject(this);
2933 return GetEventHandler()->ProcessEvent(vEvent
);
2934 } // end of wxWindow::HandleMaximize
2936 bool wxWindow::HandleMove(
2941 wxMoveEvent
vEvent( wxPoint( nX
2947 vEvent
.SetEventObject(this);
2948 return GetEventHandler()->ProcessEvent(vEvent
);
2949 } // end of wxWindow::HandleMove
2951 bool wxWindow::HandleSize(
2954 , WXUINT
WXUNUSED(nFlag
)
2957 wxSizeEvent
vEvent( wxSize( nWidth
2963 vEvent
.SetEventObject(this);
2964 return GetEventHandler()->ProcessEvent(vEvent
);
2965 } // end of wxWindow::HandleSize
2967 bool wxWindow::HandleGetMinMaxInfo(
2977 ::WinGetMaxPosition(GetHwnd(), pSwp
);
2978 m_maxWidth
= pSwp
->cx
;
2979 m_maxHeight
= pSwp
->cy
;
2983 ::WinGetMinPosition(GetHwnd(), pSwp
, &vPoint
);
2984 m_minWidth
= pSwp
->cx
;
2985 m_minHeight
= pSwp
->cy
;
2992 } // end of wxWindow::HandleGetMinMaxInfo
2994 // ---------------------------------------------------------------------------
2996 // ---------------------------------------------------------------------------
2997 bool wxWindow::HandleCommand(
3003 if (wxCurrentPopupMenu
)
3005 wxMenu
* pPopupMenu
= wxCurrentPopupMenu
;
3007 wxCurrentPopupMenu
= NULL
;
3008 return pPopupMenu
->OS2Command(wCmd
, wId
);
3011 wxWindow
* pWin
= FindItem(wId
);
3015 pWin
= wxFindWinFromHandle(hControl
);
3019 return pWin
->OS2Command( wCmd
3023 } // end of wxWindow::HandleCommand
3025 bool wxWindow::HandleSysCommand(
3031 // 4 bits are reserved
3033 switch (SHORT1FROMMP(wParam
))
3036 return HandleMaximize();
3039 return HandleMinimize();
3042 } // end of wxWindow::HandleSysCommand
3044 // ---------------------------------------------------------------------------
3046 // ---------------------------------------------------------------------------
3048 void wxWindow::InitMouseEvent(
3049 wxMouseEvent
& rEvent
3057 rEvent
.m_shiftDown
= ((uFlags
& VK_SHIFT
) != 0);
3058 rEvent
.m_controlDown
= ((uFlags
& VK_CTRL
) != 0);
3059 rEvent
.m_leftDown
= ((uFlags
& VK_BUTTON1
) != 0);
3060 rEvent
.m_middleDown
= ((uFlags
& VK_BUTTON3
) != 0);
3061 rEvent
.m_rightDown
= ((uFlags
& VK_BUTTON2
) != 0);
3062 rEvent
.SetTimestamp(s_currentMsg
.time
);
3063 rEvent
.m_eventObject
= this;
3065 #if wxUSE_MOUSEEVENT_HACK
3068 m_lastMouseEvent
= rEvent
.GetEventType();
3069 #endif // wxUSE_MOUSEEVENT_HACK
3070 } // end of wxWindow::InitMouseEvent
3072 bool wxWindow::HandleMouseEvent(
3080 // The mouse events take consecutive IDs from WM_MOUSEFIRST to
3081 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
3082 // from the message id and take the value in the table to get wxWin event
3085 static const wxEventType eventsMouse
[] =
3099 wxMouseEvent
vEvent(eventsMouse
[uMsg
- WM_MOUSEMOVE
]);
3101 InitMouseEvent( vEvent
3107 return GetEventHandler()->ProcessEvent(vEvent
);
3108 } // end of wxWindow::HandleMouseEvent
3110 bool wxWindow::HandleMouseMove(
3116 if (!m_bMouseInWindow
)
3119 // Generate an ENTER event
3121 m_bMouseInWindow
= TRUE
;
3123 wxMouseEvent
vEvent(wxEVT_ENTER_WINDOW
);
3125 InitMouseEvent( vEvent
3131 (void)GetEventHandler()->ProcessEvent(vEvent
);
3133 return HandleMouseEvent( WM_MOUSEMOVE
3138 } // end of wxWindow::HandleMouseMove
3140 // ---------------------------------------------------------------------------
3141 // keyboard handling
3142 // ---------------------------------------------------------------------------
3145 // Create the key event of the given type for the given key - used by
3146 // HandleChar and HandleKeyDown/Up
3148 wxKeyEvent
wxWindow::CreateKeyEvent(
3154 wxKeyEvent
vEvent(eType
);
3156 vEvent
.SetId(GetId());
3157 vEvent
.m_shiftDown
= IsShiftDown();
3158 vEvent
.m_controlDown
= IsCtrlDown();
3159 vEvent
.m_altDown
= (HIWORD(lParam
) & KC_ALT
) == KC_ALT
;
3161 vEvent
.m_eventObject
= (wxWindow
*)this; // const_cast
3162 vEvent
.m_keyCode
= nId
;
3163 vEvent
.SetTimestamp(s_currentMsg
.time
);
3166 // Translate the position to client coords
3171 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
3172 ::WinQueryWindowRect( GetHwnd()
3176 vPoint
.x
-= vRect
.xLeft
;
3177 vPoint
.y
-= vRect
.yBottom
;
3179 vEvent
.m_x
= vPoint
.x
;
3180 vEvent
.m_y
= vPoint
.y
;
3183 } // end of wxWindow::CreateKeyEvent
3186 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
3189 bool wxWindow::HandleChar(
3195 bool bCtrlDown
= FALSE
;
3201 // If 1 -> 26, translate to CTRL plus a letter.
3204 if ((vId
> 0) && (vId
< 27))
3226 else if ( (vId
= wxCharCodeOS2ToWX(wParam
)) == 0)
3229 // It's ASCII and will be processed here only when called from
3230 // WM_CHAR (i.e. when isASCII = TRUE), don't process it now
3237 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_CHAR
3244 vEvent
.m_controlDown
= TRUE
;
3247 if (GetEventHandler()->ProcessEvent(vEvent
))
3253 bool wxWindow::HandleKeyDown(
3258 int nId
= wxCharCodeOS2ToWX(wParam
);
3263 // Normal ASCII char
3270 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_DOWN
3275 if (GetEventHandler()->ProcessEvent(vEvent
))
3281 } // end of wxWindow::HandleKeyDown
3283 bool wxWindow::HandleKeyUp(
3288 int nId
= wxCharCodeOS2ToWX(wParam
);
3293 // Normal ASCII char
3300 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_UP
3305 if (GetEventHandler()->ProcessEvent(vEvent
))
3309 } // end of wxWindow::HandleKeyUp
3311 // ---------------------------------------------------------------------------
3313 // ---------------------------------------------------------------------------
3315 // ---------------------------------------------------------------------------
3317 // ---------------------------------------------------------------------------
3319 bool wxWindow::OS2OnScroll(
3328 wxWindow
* pChild
= wxFindWinFromHandle(hControl
);
3331 return pChild
->OS2OnScroll( nOrientation
3338 wxScrollWinEvent vEvent
;
3340 vEvent
.SetPosition(wPos
);
3341 vEvent
.SetOrientation(nOrientation
);
3342 vEvent
.m_eventObject
= this;
3347 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEUP
;
3351 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEDOWN
;
3355 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEUP
;
3359 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEDOWN
;
3362 case SB_SLIDERPOSITION
:
3363 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBRELEASE
;
3366 case SB_SLIDERTRACK
:
3367 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBTRACK
;
3373 return GetEventHandler()->ProcessEvent(vEvent
);
3374 } // end of wxWindow::OS2OnScroll
3376 // ===========================================================================
3378 // ===========================================================================
3387 // TODO: we'll do this later
3388 } // end of wxGetCharSize
3391 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
3392 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
3394 int wxCharCodeOS2ToWX(
3402 case VK_BACKTAB
: nId
= WXK_BACK
; break;
3403 case VK_TAB
: nId
= WXK_TAB
; break;
3404 case VK_CLEAR
: nId
= WXK_CLEAR
; break;
3405 case VK_ENTER
: nId
= WXK_RETURN
; break;
3406 case VK_SHIFT
: nId
= WXK_SHIFT
; break;
3407 case VK_CTRL
: nId
= WXK_CONTROL
; break;
3408 case VK_PAUSE
: nId
= WXK_PAUSE
; break;
3409 case VK_SPACE
: nId
= WXK_SPACE
; break;
3410 case VK_ESC
: nId
= WXK_ESCAPE
; break;
3411 case VK_END
: nId
= WXK_END
; break;
3412 case VK_HOME
: nId
= WXK_HOME
; break;
3413 case VK_LEFT
: nId
= WXK_LEFT
; break;
3414 case VK_UP
: nId
= WXK_UP
; break;
3415 case VK_RIGHT
: nId
= WXK_RIGHT
; break;
3416 case VK_DOWN
: nId
= WXK_DOWN
; break;
3417 case VK_PRINTSCRN
: nId
= WXK_PRINT
; break;
3418 case VK_INSERT
: nId
= WXK_INSERT
; break;
3419 case VK_DELETE
: nId
= WXK_DELETE
; break;
3420 case VK_F1
: nId
= WXK_F1
; break;
3421 case VK_F2
: nId
= WXK_F2
; break;
3422 case VK_F3
: nId
= WXK_F3
; break;
3423 case VK_F4
: nId
= WXK_F4
; break;
3424 case VK_F5
: nId
= WXK_F5
; break;
3425 case VK_F6
: nId
= WXK_F6
; break;
3426 case VK_F7
: nId
= WXK_F7
; break;
3427 case VK_F8
: nId
= WXK_F8
; break;
3428 case VK_F9
: nId
= WXK_F9
; break;
3429 case VK_F10
: nId
= WXK_F10
; break;
3430 case VK_F11
: nId
= WXK_F11
; break;
3431 case VK_F12
: nId
= WXK_F12
; break;
3432 case VK_F13
: nId
= WXK_F13
; break;
3433 case VK_F14
: nId
= WXK_F14
; break;
3434 case VK_F15
: nId
= WXK_F15
; break;
3435 case VK_F16
: nId
= WXK_F16
; break;
3436 case VK_F17
: nId
= WXK_F17
; break;
3437 case VK_F18
: nId
= WXK_F18
; break;
3438 case VK_F19
: nId
= WXK_F19
; break;
3439 case VK_F20
: nId
= WXK_F20
; break;
3440 case VK_F21
: nId
= WXK_F21
; break;
3441 case VK_F22
: nId
= WXK_F22
; break;
3442 case VK_F23
: nId
= WXK_F23
; break;
3443 case VK_F24
: nId
= WXK_F24
; break;
3444 case VK_NUMLOCK
: nId
= WXK_NUMLOCK
; break;
3445 case VK_SCRLLOCK
: nId
= WXK_SCROLL
; break;
3452 } // end of wxCharCodeOS2ToWX
3454 int wxCharCodeWXToOS2(
3464 case WXK_CLEAR
: nKeySym
= VK_CLEAR
; break;
3465 case WXK_SHIFT
: nKeySym
= VK_SHIFT
; break;
3466 case WXK_CONTROL
: nKeySym
= VK_CTRL
; break;
3467 case WXK_PAUSE
: nKeySym
= VK_PAUSE
; break;
3468 case WXK_END
: nKeySym
= VK_END
; break;
3469 case WXK_HOME
: nKeySym
= VK_HOME
; break;
3470 case WXK_LEFT
: nKeySym
= VK_LEFT
; break;
3471 case WXK_UP
: nKeySym
= VK_UP
; break;
3472 case WXK_RIGHT
: nKeySym
= VK_RIGHT
; break;
3473 case WXK_DOWN
: nKeySym
= VK_DOWN
; break;
3474 case WXK_PRINT
: nKeySym
= VK_PRINTSCRN
; break;
3475 case WXK_INSERT
: nKeySym
= VK_INSERT
; break;
3476 case WXK_DELETE
: nKeySym
= VK_DELETE
; break;
3477 case WXK_F1
: nKeySym
= VK_F1
; break;
3478 case WXK_F2
: nKeySym
= VK_F2
; break;
3479 case WXK_F3
: nKeySym
= VK_F3
; break;
3480 case WXK_F4
: nKeySym
= VK_F4
; break;
3481 case WXK_F5
: nKeySym
= VK_F5
; break;
3482 case WXK_F6
: nKeySym
= VK_F6
; break;
3483 case WXK_F7
: nKeySym
= VK_F7
; break;
3484 case WXK_F8
: nKeySym
= VK_F8
; break;
3485 case WXK_F9
: nKeySym
= VK_F9
; break;
3486 case WXK_F10
: nKeySym
= VK_F10
; break;
3487 case WXK_F11
: nKeySym
= VK_F11
; break;
3488 case WXK_F12
: nKeySym
= VK_F12
; break;
3489 case WXK_F13
: nKeySym
= VK_F13
; break;
3490 case WXK_F14
: nKeySym
= VK_F14
; break;
3491 case WXK_F15
: nKeySym
= VK_F15
; break;
3492 case WXK_F16
: nKeySym
= VK_F16
; break;
3493 case WXK_F17
: nKeySym
= VK_F17
; break;
3494 case WXK_F18
: nKeySym
= VK_F18
; break;
3495 case WXK_F19
: nKeySym
= VK_F19
; break;
3496 case WXK_F20
: nKeySym
= VK_F20
; break;
3497 case WXK_F21
: nKeySym
= VK_F21
; break;
3498 case WXK_F22
: nKeySym
= VK_F22
; break;
3499 case WXK_F23
: nKeySym
= VK_F23
; break;
3500 case WXK_F24
: nKeySym
= VK_F24
; break;
3501 case WXK_NUMLOCK
: nKeySym
= VK_NUMLOCK
; break;
3502 case WXK_SCROLL
: nKeySym
= VK_SCRLLOCK
; break;
3505 *bIsVirtual
= FALSE
;
3511 } // end of wxCharCodeWXToOS2
3513 wxWindow
* wxGetActiveWindow()
3515 HWND hWnd
= ::WinQueryActiveWindow(HWND_DESKTOP
);
3519 return wxFindWinFromHandle((WXHWND
)hWnd
);
3522 } // end of wxGetActiveWindow
3525 const char* wxGetMessageName(
3530 case 0x0000: return "WM_NULL";
3531 case 0x0001: return "WM_CREATE";
3532 case 0x0002: return "WM_DESTROY";
3533 case 0x0004: return "WM_ENABLE";
3534 case 0x0005: return "WM_SHOW";
3535 case 0x0006: return "WM_MOVE";
3536 case 0x0007: return "WM_SIZE";
3537 case 0x0008: return "WM_ADJUSTWINDOWPOS";
3538 case 0x0009: return "WM_CALCVALIDRECTS";
3539 case 0x000A: return "WM_SETWINDOWPARAMS";
3540 case 0x000B: return "WM_QUERYWINDOWPARAMS";
3541 case 0x000C: return "WM_HITTEST";
3542 case 0x000D: return "WM_ACTIVATE";
3543 case 0x000F: return "WM_SETFOCUS";
3544 case 0x0010: return "WM_SETSELECTION";
3545 case 0x0011: return "WM_PPAINT";
3546 case 0x0012: return "WM_PSETFOCUS";
3547 case 0x0013: return "WM_PSYSCOLORCHANGE";
3548 case 0x0014: return "WM_PSIZE";
3549 case 0x0015: return "WM_PACTIVATE";
3550 case 0x0016: return "WM_PCONTROL";
3551 case 0x0020: return "WM_COMMAND";
3552 case 0x0021: return "WM_SYSCOMMAND";
3553 case 0x0022: return "WM_HELP";
3554 case 0x0023: return "WM_PAINT";
3555 case 0x0024: return "WM_TIMER";
3556 case 0x0025: return "WM_SEM1";
3557 case 0x0026: return "WM_SEM2";
3558 case 0x0027: return "WM_SEM3";
3559 case 0x0028: return "WM_SEM4";
3560 case 0x0029: return "WM_CLOSE";
3561 case 0x002A: return "WM_QUIT";
3562 case 0x002B: return "WM_SYSCOLORCHANGE";
3563 case 0x002D: return "WM_SYSVALUECHANGE";
3564 case 0x002E: return "WM_APPTERMINATENOTIFY";
3565 case 0x002F: return "WM_PRESPARAMCHANGED";
3566 // Control notification messages
3567 case 0x0030: return "WM_CONTROL";
3568 case 0x0031: return "WM_VSCROLL";
3569 case 0x0032: return "WM_HSCROLL";
3570 case 0x0033: return "WM_INITMENU";
3571 case 0x0034: return "WM_MENUSELECT";
3572 case 0x0035: return "WM_MENUSEND";
3573 case 0x0036: return "WM_DRAWITEM";
3574 case 0x0037: return "WM_MEASUREITEM";
3575 case 0x0038: return "WM_CONTROLPOINTER";
3576 case 0x003A: return "WM_QUERYDLGCODE";
3577 case 0x003B: return "WM_INITDLG";
3578 case 0x003C: return "WM_SUBSTITUTESTRING";
3579 case 0x003D: return "WM_MATCHMNEMONIC";
3580 case 0x003E: return "WM_SAVEAPPLICATION";
3581 case 0x0129: return "WM_CTLCOLORCHANGE";
3582 case 0x0130: return "WM_QUERYCTLTYPE";
3584 case 0x0040: return "WM_FLASHWINDOW";
3585 case 0x0041: return "WM_FORMATFRAME";
3586 case 0x0042: return "WM_UPDATEFRAME";
3587 case 0x0043: return "WM_FOCUSCHANGE";
3588 case 0x0044: return "WM_SETBORDERSIZE";
3589 case 0x0045: return "WM_TRACKFRAME";
3590 case 0x0046: return "WM_MINMAXFRAME";
3591 case 0x0047: return "WM_SETICON";
3592 case 0x0048: return "WM_QUERYICON";
3593 case 0x0049: return "WM_SETACCELTABLE";
3594 case 0x004A: return "WM_QUERYACCELTABLE";
3595 case 0x004B: return "WM_TRANSLATEACCEL";
3596 case 0x004C: return "WM_QUERYTRACKINFO";
3597 case 0x004D: return "WM_QUERYBORDERSIZE";
3598 case 0x004E: return "WM_NEXTMENU";
3599 case 0x004F: return "WM_ERASEBACKGROUND";
3600 case 0x0050: return "WM_QUERYFRAMEINFO";
3601 case 0x0051: return "WM_QUERYFOCUSCHAIN";
3602 case 0x0052: return "WM_OWNERPOSCHANGE";
3603 case 0x0053: return "WM_CACLFRAMERECT";
3604 case 0x0055: return "WM_WINDOWPOSCHANGED";
3605 case 0x0056: return "WM_ADJUSTFRAMEPOS";
3606 case 0x0059: return "WM_QUERYFRAMECTLCOUNT";
3607 case 0x005B: return "WM_QUERYHELPINFO";
3608 case 0x005C: return "WM_SETHELPINFO";
3609 case 0x005D: return "WM_ERROR";
3610 case 0x005E: return "WM_REALIZEPALETTE";
3611 // Clipboard messages
3612 case 0x0060: return "WM_RENDERFMT";
3613 case 0x0061: return "WM_RENDERALLFMTS";
3614 case 0x0062: return "WM_DESTROYCLIPBOARD";
3615 case 0x0063: return "WM_PAINTCLIPBOARD";
3616 case 0x0064: return "WM_SIZECLIPBOARD";
3617 case 0x0065: return "WM_HSCROLLCLIPBOARD";
3618 case 0x0066: return "WM_VSCROLLCLIPBOARD";
3619 case 0x0067: return "WM_DRAWCLIPBOARD";
3621 case 0x0070: return "WM_MOUSEMOVE";
3622 case 0x0071: return "WM_BUTTON1DOWN";
3623 case 0x0072: return "WM_BUTTON1UP";
3624 case 0x0073: return "WM_BUTTON1DBLCLK";
3625 case 0x0074: return "WM_BUTTON2DOWN";
3626 case 0x0075: return "WM_BUTTON2UP";
3627 case 0x0076: return "WM_BUTTON2DBLCLK";
3628 case 0x0077: return "WM_BUTTON3DOWN";
3629 case 0x0078: return "WM_BUTTON3UP";
3630 case 0x0079: return "WM_BUTTON3DBLCLK";
3631 case 0x007D: return "WM_MOUSEMAP";
3632 case 0x007E: return "WM_VRNDISABLED";
3633 case 0x007F: return "WM_VRNENABLED";
3634 case 0x0410: return "WM_CHORD";
3635 case 0x0411: return "WM_BUTTON1MOTIONSTART";
3636 case 0x0412: return "WM_BUTTON1MOTIONEND";
3637 case 0x0413: return "WM_BUTTON1CLICK";
3638 case 0x0414: return "WM_BUTTON2MOTIONSTART";
3639 case 0x0415: return "WM_BUTTON2MOTIONEND";
3640 case 0x0416: return "WM_BUTTON2CLICK";
3641 case 0x0417: return "WM_BUTTON3MOTIONSTART";
3642 case 0x0418: return "WM_BUTTON3MOTIONEND";
3643 case 0x0419: return "WM_BUTTON3CLICK";
3644 case 0x0420: return "WM_BEGINDRAG";
3645 case 0x0421: return "WM_ENDDRAG";
3646 case 0x0422: return "WM_SINGLESELECT";
3647 case 0x0423: return "WM_OPEN";
3648 case 0x0424: return "WM_CONTEXTMENU";
3649 case 0x0425: return "WM_CONTEXTHELP";
3650 case 0x0426: return "WM_TEXTEDIT";
3651 case 0x0427: return "WM_BEGINSELECT";
3652 case 0x0228: return "WM_ENDSELECT";
3653 case 0x0429: return "WM_PICKUP";
3654 case 0x04C0: return "WM_PENFIRST";
3655 case 0x04FF: return "WM_PENLAST";
3656 case 0x0500: return "WM_MMPMFIRST";
3657 case 0x05FF: return "WM_MMPMLAST";
3658 case 0x0600: return "WM_STDDLGFIRST";
3659 case 0x06FF: return "WM_STDDLGLAST";
3660 case 0x0BD0: return "WM_BIDI_FIRST";
3661 case 0x0BFF: return "WM_BIDI_LAST";
3663 case 0x007A: return "WM_CHAR";
3664 case 0x007B: return "WM_VIOCHAR";
3666 case 0x00A0: return "WM_DDE_INITIATE";
3667 case 0x00A1: return "WM_DDE_REQUEST";
3668 case 0x00A2: return "WM_DDE_ACK";
3669 case 0x00A3: return "WM_DDE_DATA";
3670 case 0x00A4: return "WM_DDE_ADVISE";
3671 case 0x00A5: return "WM_DDE_UNADVISE";
3672 case 0x00A6: return "WM_DDE_POKE";
3673 case 0x00A7: return "WM_DDE_EXECUTE";
3674 case 0x00A8: return "WM_DDE_TERMINATE";
3675 case 0x00A9: return "WM_DDE_INITIATEACK";
3676 case 0x00AF: return "WM_DDE_LAST";
3678 case 0x0120: return "BM_CLICK";
3679 case 0x0121: return "BM_QUERYCHECKINDEX";
3680 case 0x0122: return "BM_QUERYHILITE";
3681 case 0x0123: return "BM_SETHILITE";
3682 case 0x0124: return "BM_QUERYCHECK";
3683 case 0x0125: return "BM_SETCHECK";
3684 case 0x0126: return "BM_SETDEFAULT";
3685 case 0x0128: return "BM_AUTOSIZE";
3687 case 0x029A: return "CBID_LIST";
3688 case 0x029B: return "CBID_EDIT";
3689 case 0x0170: return "CBM_SHOWLIST";
3690 case 0x0171: return "CBM_HILITE";
3691 case 0x0172: return "CBM_ISLISTSHOWING";
3693 case 0x0140: return "EM_QUERYCHANGED";
3694 case 0x0141: return "EM_QUERYSEL";
3695 case 0x0142: return "EM_SETSEL";
3696 case 0x0143: return "EM_SETTEXTLIMIT";
3697 case 0x0144: return "EM_CUT";
3698 case 0x0145: return "EM_COPY";
3699 case 0x0146: return "EM_CLEAR";
3700 case 0x0147: return "EM_PASTE";
3701 case 0x0148: return "EM_QUERYFIRSTCHAR";
3702 case 0x0149: return "EM_SETFIRSTCHAR";
3703 case 0x014A: return "EM_QUERYREADONLY";
3704 case 0x014B: return "EM_SETREADONLY";
3705 case 0x014C: return "EM_SETINSERTMODE";
3707 case 0x0160: return "LM_QUERYITEMCOUNT";
3708 case 0x0161: return "LM_INSERTITEM";
3709 case 0x0162: return "LM_SETOPENINDEX";
3710 case 0x0163: return "LM_DELETEITEM";
3711 case 0x0164: return "LM_SELECTITEM";
3712 case 0x0165: return "LM_QUERYSELECTION";
3713 case 0x0166: return "LM_SETITEMTEXT";
3714 case 0x0167: return "LM_QUERYITEMTEXTLENGTH";
3715 case 0x0168: return "LM_QUERYITEMTEXT";
3716 case 0x0169: return "LM_SETITEMHANDLE";
3717 case 0x016A: return "LM_QUERYITEMHANDLE";
3718 case 0x016B: return "LM_SEARCHSTRING";
3719 case 0x016C: return "LM_SETITEMHEIGHT";
3720 case 0x016D: return "LM_QUERYTOPINDEX";
3721 case 0x016E: return "LM_DELETEALL";
3722 case 0x016F: return "LM_INSERTMULITEMS";
3723 case 0x0660: return "LM_SETITEMWIDTH";
3725 case 0x0180: return "MM_INSERTITEM";
3726 case 0x0181: return "MM_DELETEITEM";
3727 case 0x0182: return "MM_QUERYITEM";
3728 case 0x0183: return "MM_SETITEM";
3729 case 0x0184: return "MM_QUERYITEMCOUNT";
3730 case 0x0185: return "MM_STARTMENUMODE";
3731 case 0x0186: return "MM_ENDMENUMODE";
3732 case 0x0188: return "MM_REMOVEITEM";
3733 case 0x0189: return "MM_SELECTITEM";
3734 case 0x018A: return "MM_QUERYSELITEMID";
3735 case 0x018B: return "MM_QUERYITEMTEXT";
3736 case 0x018C: return "MM_QUERYITEMTEXTLENGTH";
3737 case 0x018D: return "MM_SETITEMHANDLE";
3738 case 0x018E: return "MM_SETITEMTEXT";
3739 case 0x018F: return "MM_ITEMPOSITIONFROMID";
3740 case 0x0190: return "MM_ITEMIDFROMPOSITION";
3741 case 0x0191: return "MM_QUERYITEMATTR";
3742 case 0x0192: return "MM_SETITEMATTR";
3743 case 0x0193: return "MM_ISITEMVALID";
3744 case 0x0194: return "MM_QUERYITEMRECT";
3745 case 0x0431: return "MM_QUERYDEFAULTITEMID";
3746 case 0x0432: return "MM_SETDEFAULTITEMID";
3748 case 0x01A0: return "SBM_SETSCROLLBAR";
3749 case 0x01A1: return "SBM_SETPOS";
3750 case 0x01A2: return "SBM_QUERYPOS";
3751 case 0x01A3: return "SBM_QUERYRANGE";
3752 case 0x01A6: return "SBM_SETTHUMBSIZE";
3755 case 0x0F00: return "WM_HELPBASE";
3756 case 0x0FFF: return "WM_HELPTOP";
3757 // Beginning of user defined messages
3758 case 0x1000: return "WM_USER";
3760 // wxWindows user defined types
3763 // case 0x1000 + 0: return "LVM_GETBKCOLOR";
3764 case 0x1000 + 1: return "LVM_SETBKCOLOR";
3765 case 0x1000 + 2: return "LVM_GETIMAGELIST";
3766 case 0x1000 + 3: return "LVM_SETIMAGELIST";
3767 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
3768 case 0x1000 + 5: return "LVM_GETITEMA";
3769 case 0x1000 + 75: return "LVM_GETITEMW";
3770 case 0x1000 + 6: return "LVM_SETITEMA";
3771 case 0x1000 + 76: return "LVM_SETITEMW";
3772 case 0x1000 + 7: return "LVM_INSERTITEMA";
3773 case 0x1000 + 77: return "LVM_INSERTITEMW";
3774 case 0x1000 + 8: return "LVM_DELETEITEM";
3775 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
3776 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
3777 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
3778 case 0x1000 + 12: return "LVM_GETNEXTITEM";
3779 case 0x1000 + 13: return "LVM_FINDITEMA";
3780 case 0x1000 + 83: return "LVM_FINDITEMW";
3781 case 0x1000 + 14: return "LVM_GETITEMRECT";
3782 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
3783 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
3784 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
3785 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
3786 case 0x1000 + 18: return "LVM_HITTEST";
3787 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
3788 case 0x1000 + 20: return "LVM_SCROLL";
3789 case 0x1000 + 21: return "LVM_REDRAWITEMS";
3790 case 0x1000 + 22: return "LVM_ARRANGE";
3791 case 0x1000 + 23: return "LVM_EDITLABELA";
3792 case 0x1000 + 118: return "LVM_EDITLABELW";
3793 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
3794 case 0x1000 + 25: return "LVM_GETCOLUMNA";
3795 case 0x1000 + 95: return "LVM_GETCOLUMNW";
3796 case 0x1000 + 26: return "LVM_SETCOLUMNA";
3797 case 0x1000 + 96: return "LVM_SETCOLUMNW";
3798 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
3799 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
3800 case 0x1000 + 28: return "LVM_DELETECOLUMN";
3801 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
3802 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
3803 case 0x1000 + 31: return "LVM_GETHEADER";
3804 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
3805 case 0x1000 + 34: return "LVM_GETVIEWRECT";
3806 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
3807 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
3808 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
3809 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
3810 case 0x1000 + 39: return "LVM_GETTOPINDEX";
3811 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
3812 case 0x1000 + 41: return "LVM_GETORIGIN";
3813 case 0x1000 + 42: return "LVM_UPDATE";
3814 case 0x1000 + 43: return "LVM_SETITEMSTATE";
3815 case 0x1000 + 44: return "LVM_GETITEMSTATE";
3816 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
3817 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
3818 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
3819 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
3820 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
3821 case 0x1000 + 48: return "LVM_SORTITEMS";
3822 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
3823 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
3824 case 0x1000 + 51: return "LVM_GETITEMSPACING";
3825 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
3826 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
3827 case 0x1000 + 53: return "LVM_SETICONSPACING";
3828 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
3829 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
3830 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
3831 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
3832 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
3833 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
3834 case 0x1000 + 60: return "LVM_SETHOTITEM";
3835 case 0x1000 + 61: return "LVM_GETHOTITEM";
3836 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
3837 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
3838 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
3839 case 0x1000 + 65: return "LVM_SETWORKAREA";
3842 case 0x1100 + 0: return "TVM_INSERTITEMA";
3843 case 0x1100 + 50: return "TVM_INSERTITEMW";
3844 case 0x1100 + 1: return "TVM_DELETEITEM";
3845 case 0x1100 + 2: return "TVM_EXPAND";
3846 case 0x1100 + 4: return "TVM_GETITEMRECT";
3847 case 0x1100 + 5: return "TVM_GETCOUNT";
3848 case 0x1100 + 6: return "TVM_GETINDENT";
3849 case 0x1100 + 7: return "TVM_SETINDENT";
3850 case 0x1100 + 8: return "TVM_GETIMAGELIST";
3851 case 0x1100 + 9: return "TVM_SETIMAGELIST";
3852 case 0x1100 + 10: return "TVM_GETNEXTITEM";
3853 case 0x1100 + 11: return "TVM_SELECTITEM";
3854 case 0x1100 + 12: return "TVM_GETITEMA";
3855 case 0x1100 + 62: return "TVM_GETITEMW";
3856 case 0x1100 + 13: return "TVM_SETITEMA";
3857 case 0x1100 + 63: return "TVM_SETITEMW";
3858 case 0x1100 + 14: return "TVM_EDITLABELA";
3859 case 0x1100 + 65: return "TVM_EDITLABELW";
3860 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
3861 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
3862 case 0x1100 + 17: return "TVM_HITTEST";
3863 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
3864 case 0x1100 + 19: return "TVM_SORTCHILDREN";
3865 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
3866 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
3867 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
3868 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
3869 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
3870 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
3871 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
3874 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
3875 case 0x1200 + 1: return "HDM_INSERTITEMA";
3876 case 0x1200 + 10: return "HDM_INSERTITEMW";
3877 case 0x1200 + 2: return "HDM_DELETEITEM";
3878 case 0x1200 + 3: return "HDM_GETITEMA";
3879 case 0x1200 + 11: return "HDM_GETITEMW";
3880 case 0x1200 + 4: return "HDM_SETITEMA";
3881 case 0x1200 + 12: return "HDM_SETITEMW";
3882 case 0x1200 + 5: return "HDM_LAYOUT";
3883 case 0x1200 + 6: return "HDM_HITTEST";
3884 case 0x1200 + 7: return "HDM_GETITEMRECT";
3885 case 0x1200 + 8: return "HDM_SETIMAGELIST";
3886 case 0x1200 + 9: return "HDM_GETIMAGELIST";
3887 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
3888 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
3889 case 0x1200 + 17: return "HDM_GETORDERARRAY";
3890 case 0x1200 + 18: return "HDM_SETORDERARRAY";
3891 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
3894 case 0x1300 + 2: return "TCM_GETIMAGELIST";
3895 case 0x1300 + 3: return "TCM_SETIMAGELIST";
3896 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
3897 case 0x1300 + 5: return "TCM_GETITEMA";
3898 case 0x1300 + 60: return "TCM_GETITEMW";
3899 case 0x1300 + 6: return "TCM_SETITEMA";
3900 case 0x1300 + 61: return "TCM_SETITEMW";
3901 case 0x1300 + 7: return "TCM_INSERTITEMA";
3902 case 0x1300 + 62: return "TCM_INSERTITEMW";
3903 case 0x1300 + 8: return "TCM_DELETEITEM";
3904 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
3905 case 0x1300 + 10: return "TCM_GETITEMRECT";
3906 case 0x1300 + 11: return "TCM_GETCURSEL";
3907 case 0x1300 + 12: return "TCM_SETCURSEL";
3908 case 0x1300 + 13: return "TCM_HITTEST";
3909 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
3910 case 0x1300 + 40: return "TCM_ADJUSTRECT";
3911 case 0x1300 + 41: return "TCM_SETITEMSIZE";
3912 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
3913 case 0x1300 + 43: return "TCM_SETPADDING";
3914 case 0x1300 + 44: return "TCM_GETROWCOUNT";
3915 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
3916 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
3917 case 0x1300 + 47: return "TCM_GETCURFOCUS";
3918 case 0x1300 + 48: return "TCM_SETCURFOCUS";
3919 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
3920 case 0x1300 + 50: return "TCM_DESELECTALL";
3923 case WM_USER
+1000+1: return "TB_ENABLEBUTTON";
3924 case WM_USER
+1000+2: return "TB_CHECKBUTTON";
3925 case WM_USER
+1000+3: return "TB_PRESSBUTTON";
3926 case WM_USER
+1000+4: return "TB_HIDEBUTTON";
3927 case WM_USER
+1000+5: return "TB_INDETERMINATE";
3928 case WM_USER
+1000+9: return "TB_ISBUTTONENABLED";
3929 case WM_USER
+1000+10: return "TB_ISBUTTONCHECKED";
3930 case WM_USER
+1000+11: return "TB_ISBUTTONPRESSED";
3931 case WM_USER
+1000+12: return "TB_ISBUTTONHIDDEN";
3932 case WM_USER
+1000+13: return "TB_ISBUTTONINDETERMINATE";
3933 case WM_USER
+1000+17: return "TB_SETSTATE";
3934 case WM_USER
+1000+18: return "TB_GETSTATE";
3935 case WM_USER
+1000+19: return "TB_ADDBITMAP";
3936 case WM_USER
+1000+20: return "TB_ADDBUTTONS";
3937 case WM_USER
+1000+21: return "TB_INSERTBUTTON";
3938 case WM_USER
+1000+22: return "TB_DELETEBUTTON";
3939 case WM_USER
+1000+23: return "TB_GETBUTTON";
3940 case WM_USER
+1000+24: return "TB_BUTTONCOUNT";
3941 case WM_USER
+1000+25: return "TB_COMMANDTOINDEX";
3942 case WM_USER
+1000+26: return "TB_SAVERESTOREA";
3943 case WM_USER
+1000+76: return "TB_SAVERESTOREW";
3944 case WM_USER
+1000+27: return "TB_CUSTOMIZE";
3945 case WM_USER
+1000+28: return "TB_ADDSTRINGA";
3946 case WM_USER
+1000+77: return "TB_ADDSTRINGW";
3947 case WM_USER
+1000+29: return "TB_GETITEMRECT";
3948 case WM_USER
+1000+30: return "TB_BUTTONSTRUCTSIZE";
3949 case WM_USER
+1000+31: return "TB_SETBUTTONSIZE";
3950 case WM_USER
+1000+32: return "TB_SETBITMAPSIZE";
3951 case WM_USER
+1000+33: return "TB_AUTOSIZE";
3952 case WM_USER
+1000+35: return "TB_GETTOOLTIPS";
3953 case WM_USER
+1000+36: return "TB_SETTOOLTIPS";
3954 case WM_USER
+1000+37: return "TB_SETPARENT";
3955 case WM_USER
+1000+39: return "TB_SETROWS";
3956 case WM_USER
+1000+40: return "TB_GETROWS";
3957 case WM_USER
+1000+42: return "TB_SETCMDID";
3958 case WM_USER
+1000+43: return "TB_CHANGEBITMAP";
3959 case WM_USER
+1000+44: return "TB_GETBITMAP";
3960 case WM_USER
+1000+45: return "TB_GETBUTTONTEXTA";
3961 case WM_USER
+1000+75: return "TB_GETBUTTONTEXTW";
3962 case WM_USER
+1000+46: return "TB_REPLACEBITMAP";
3963 case WM_USER
+1000+47: return "TB_SETINDENT";
3964 case WM_USER
+1000+48: return "TB_SETIMAGELIST";
3965 case WM_USER
+1000+49: return "TB_GETIMAGELIST";
3966 case WM_USER
+1000+50: return "TB_LOADIMAGES";
3967 case WM_USER
+1000+51: return "TB_GETRECT";
3968 case WM_USER
+1000+52: return "TB_SETHOTIMAGELIST";
3969 case WM_USER
+1000+53: return "TB_GETHOTIMAGELIST";
3970 case WM_USER
+1000+54: return "TB_SETDISABLEDIMAGELIST";
3971 case WM_USER
+1000+55: return "TB_GETDISABLEDIMAGELIST";
3972 case WM_USER
+1000+56: return "TB_SETSTYLE";
3973 case WM_USER
+1000+57: return "TB_GETSTYLE";
3974 case WM_USER
+1000+58: return "TB_GETBUTTONSIZE";
3975 case WM_USER
+1000+59: return "TB_SETBUTTONWIDTH";
3976 case WM_USER
+1000+60: return "TB_SETMAXTEXTROWS";
3977 case WM_USER
+1000+61: return "TB_GETTEXTROWS";
3978 case WM_USER
+1000+41: return "TB_GETBITMAPFLAGS";
3981 static char s_szBuf
[128];
3982 sprintf(s_szBuf
, "<unknown message = %d>", nMessage
);
3986 } // end of wxGetMessageName
3988 #endif // __WXDEBUG__
3990 static void TranslateKbdEventToMouse(
3998 // Construct the key mask
3999 ULONG
& fwKeys
= *pFlags
;
4001 fwKeys
= VK_BUTTON2
;
4002 if ((::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x100) != 0)
4004 if ((::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x100) != 0)
4008 // Simulate right mouse button click
4012 ::WinQueryMsgPos(vHabmain
, &vPoint
);
4016 pWin
->ScreenToClient(pX
, pY
);
4017 } // end of TranslateKbdEventToMouse
4019 // Find the wxWindow at the current mouse position, returning the mouse
4021 wxWindow
* wxFindWindowAtPointer(
4025 return wxFindWindowAtPoint(wxGetMousePosition());
4028 wxWindow
* wxFindWindowAtPoint(
4037 HWND hWndHit
= ::WinWindowFromPoint(HWND_DESKTOP
, &vPt2
, FALSE
);
4038 wxWindow
* pWin
= wxFindWinFromHandle((WXHWND
)hWndHit
) ;
4039 HWND hWnd
= hWndHit
;
4042 // Try to find a window with a wxWindow associated with it
4044 while (!pWin
&& (hWnd
!= 0))
4046 hWnd
= ::WinQueryWindow(hWnd
, QW_PARENT
);
4047 pWin
= wxFindWinFromHandle((WXHWND
)hWnd
) ;
4052 // Get the current mouse position.
4053 wxPoint
wxGetMousePosition()
4057 ::WinQueryPointerPos(HWND_DESKTOP
, &vPt
);
4058 return wxPoint(vPt
.x
, vPt
.y
);