1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
21 #include "wx/window.h"
26 #include "wx/dcclient.h"
30 #include "wx/layout.h"
31 #include "wx/dialog.h"
33 #include "wx/listbox.h"
34 #include "wx/button.h"
35 #include "wx/msgdlg.h"
41 #include "wx/ownerdrw.h"
44 #if wxUSE_DRAG_AND_DROP
48 #include "wx/menuitem.h"
51 #include "wx/os2/private.h"
54 #include "wx/tooltip.h"
65 #include "wx/textctrl.h"
70 // Place compiler, OS specific includes here
74 // Standard macros -- these are for OS/2 PM, but most GUI's have something similar
78 // SHORT1FROMMP -- LOWORD
80 #define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp))
82 // SHORT2FROMMP -- HIWORD
84 #define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16))
85 #endif // GET_X_LPARAM
88 # define CW_USEDEFAULT ((int)0x80000000)
91 // ---------------------------------------------------------------------------
93 // ---------------------------------------------------------------------------
96 // The last Windows message we got (MT-UNSAFE)
100 wxMenu
* wxCurrentPopupMenu
= NULL
;
101 extern wxList WXDLLEXPORT wxPendingDelete
;
102 #if !defined(__VISAGECPP__) || (__IBMCPP__ < 400)
103 extern wxChar wxCanvasClassName
[];
105 wxList
* wxWinHandleList
= NULL
;
107 // ---------------------------------------------------------------------------
109 // ---------------------------------------------------------------------------
112 // the window proc for all our windows; most gui's have something similar
114 MRESULT EXPENTRY
wxWndProc( HWND hWnd
121 const char *wxGetMessageName(int message
);
124 void wxRemoveHandleAssociation(wxWindow
* pWin
);
125 void wxAssociateWinWithHandle( HWND hWnd
128 wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
131 // This magical function is used to translate VK_APPS key presses to right
134 static void TranslateKbdEventToMouse( wxWindow
* pWin
141 // get the current state of SHIFT/CTRL keys
143 static inline bool IsShiftDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x8000) != 0; }
144 static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x8000) != 0; }
145 // ---------------------------------------------------------------------------
147 // ---------------------------------------------------------------------------
149 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxWindowBase
)
151 BEGIN_EVENT_TABLE(wxWindow
, wxWindowBase
)
152 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground
)
153 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged
)
154 EVT_INIT_DIALOG(wxWindow::OnInitDialog
)
155 EVT_IDLE(wxWindow::OnIdle
)
158 // ===========================================================================
160 // ===========================================================================
163 // Find an item given the PM Window id
165 wxWindow
* wxWindow::FindItem(
169 wxControl
* pItem
= wxDynamicCast( this
176 // I it we or one of our "internal" children?
178 if (pItem
->GetId() == lId
||
179 (pItem
->GetSubcontrols().Index(lId
) != wxNOT_FOUND
))
185 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
189 wxWindow
* pChildWin
= pCurrent
->GetData();
190 wxWindow
* pWnd
= pChildWin
->FindItem(lId
);
195 pCurrent
= pCurrent
->GetNext();
198 } // end of wxWindow::FindItem
201 // Find an item given the PM Window handle
203 wxWindow
* wxWindow::FindItemByHWND(
208 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
212 wxWindow
* pParent
= pCurrent
->GetData();
215 // Do a recursive search.
217 wxWindow
* pWnd
= pParent
->FindItemByHWND(hWnd
);
222 if (!bControlOnly
|| pParent
->IsKindOf(CLASSINFO(wxControl
)))
224 wxWindow
* pItem
= pCurrent
->GetData();
226 if (pItem
->GetHWND() == hWnd
)
230 if (pItem
->ContainsHWND(hWnd
))
234 pCurrent
= pCurrent
->GetNext();
237 } // end of wxWindow::FindItemByHWND
240 // Default command handler
242 bool wxWindow::OS2Command(
243 WXUINT
WXUNUSED(uParam
)
244 , WXWORD
WXUNUSED(uId
)
250 // ----------------------------------------------------------------------------
251 // constructors and such
252 // ----------------------------------------------------------------------------
254 void wxWindow::Init()
264 m_bDoubleClickAllowed
= 0;
265 m_bWinCaptured
= FALSE
;
267 m_isBeingDeleted
= FALSE
;
270 m_bMouseInWindow
= FALSE
;
279 // Pass WM_GETDLGCODE to DefWindowProc()
284 m_bBackgroundTransparent
= FALSE
;
287 // As all windows are created with WS_VISIBLE style...
291 #if wxUSE_MOUSEEVENT_HACK
294 m_nLastMouseEvent
= -1;
295 #endif // wxUSE_MOUSEEVENT_HACK
301 wxWindow::~wxWindow()
303 m_isBeingDeleted
= TRUE
;
305 OS2DetachWindowMenu();
307 m_parent
->RemoveChild(this);
311 if(!::WinDestroyWindow(GetHWND()))
312 wxLogLastError(wxT("DestroyWindow"));
314 // remove hWnd <-> wxWindow association
316 wxRemoveHandleAssociation(this);
318 } // end of wxWindow::~wxWindow
320 bool wxWindow::Create(
323 , const wxPoint
& rPos
324 , const wxSize
& rSize
326 , const wxString
& rName
329 HWND hParent
= NULLHANDLE
;
331 wxCHECK_MSG(pParent
, FALSE
, wxT("can't create wxWindow without parent"));
333 if ( !CreateBase( pParent
345 pParent
->AddChild(this);
346 hParent
= GetWinHwnd(pParent
);
349 hParent
= HWND_DESKTOP
;
351 ULONG ulCreateFlags
= 0L;
355 // Most wxSTYLES are really PM Class specific styles and will be
356 // set in those class create procs. PM's basic windows styles are
359 if (lStyle
& wxCLIP_CHILDREN
)
360 ulCreateFlags
|= WS_CLIPCHILDREN
;
363 // Empty stuff for now since PM has no custome 3D effects
364 // Doesn't mean someone cannot make some up though
367 WXDWORD dwExStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &bWant3D
);
370 // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
371 // and no presentation parameters
374 ,(PSZ
)wxCanvasClassName
379 ,WidthDefault(rSize
.x
)
380 ,HeightDefault(rSize
.y
)
386 } // end of wxWindow::Create
388 // ---------------------------------------------------------------------------
390 // ---------------------------------------------------------------------------
392 void wxWindow::SetFocus()
394 HWND hWnd
= GetHwnd();
397 ::WinSetFocus(HWND_DESKTOP
, hWnd
);
398 } // end of wxWindow::SetFocus
400 wxWindow
* wxWindowBase::FindFocus()
402 HWND hWnd
= ::WinQueryFocus(HWND_DESKTOP
);
406 return wxFindWinFromHandle((WXHWND
)hWnd
);
409 } // wxWindowBase::FindFocus
411 bool wxWindow::Enable(
415 if (!wxWindowBase::Enable(bEnable
))
418 HWND hWnd
= GetHwnd();
421 ::WinEnableWindow(hWnd
, (BOOL
)bEnable
);
423 wxWindowList::Node
* pNode
= GetChildren().GetFirst();
427 wxWindow
* pChild
= pNode
->GetData();
429 pChild
->Enable(bEnable
);
430 pNode
= pNode
->GetNext();
433 } // end of wxWindow::Enable
439 if (!wxWindowBase::Show(bShow
))
442 HWND hWnd
= GetHwnd();
444 ::WinShowWindow(hWnd
, bShow
);
448 ::WinSetWindowPos(hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_ACTIVATE
| SWP_ZORDER
);
451 } // end of wxWindow::Show
453 void wxWindow::Raise()
455 ::WinSetWindowPos(GetHwnd(), HWND_TOP
, 0, 0, 0, 0, SWP_ZORDER
| SWP_ACTIVATE
);
456 } // end of wxWindow::Raise
458 void wxWindow::Lower()
460 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_ZORDER
| SWP_DEACTIVATE
);
461 } // end of wxWindow::Lower
463 void wxWindow::SetTitle(
464 const wxString
& rTitle
467 ::WinSetWindowText(GetHwnd(), rTitle
.c_str());
468 } // end of wxWindow::SetTitle
470 wxString
wxWindow::GetTitle() const
472 return wxGetWindowText(GetHWND());
473 } // end of wxWindow::GetTitle
475 void wxWindow::CaptureMouse()
477 HWND hWnd
= GetHwnd();
479 if (hWnd
&& !m_bWinCaptured
)
481 ::WinSetCapture(HWND_DESKTOP
, hWnd
);
482 m_bWinCaptured
= TRUE
;
484 } // end of wxWindow::GetTitle
486 void wxWindow::ReleaseMouse()
490 ::WinSetCapture(HWND_DESKTOP
, NULLHANDLE
);
491 m_bWinCaptured
= FALSE
;
493 } // end of wxWindow::ReleaseMouse
495 bool wxWindow::SetFont(
499 if (!wxWindowBase::SetFont(rFont
))
505 HWND hWnd
= GetHwnd();
511 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), rFont
.GetFaceName().c_str());
512 return(::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
), (PVOID
)zFont
));
517 bool wxWindow::SetCursor(
518 const wxCursor
& rCursor
519 ) // check if base implementation is OK
521 if ( !wxWindowBase::SetCursor(rCursor
))
527 wxASSERT_MSG( m_cursor
.Ok(),
528 wxT("cursor must be valid after call to the base version"));
530 HWND hWnd
= GetHwnd();
536 hPS
= ::WinGetPS(hWnd
);
538 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
539 ::WinQueryWindowRect(hWnd
, &vRect
);
541 hRGN
= ::GpiCreateRegion(hPS
, 1L, &vRect
);
543 if ((::GpiPtInRegion(hPS
, hRGN
, &vPoint
) == PRGN_INSIDE
) && !wxIsBusy())
545 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)m_cursor
.GetHCURSOR());
548 } // end of wxWindow::SetCursor
550 void wxWindow::WarpPointer(
559 ::WinQueryWindowRect(GetHwnd(), &vRect
);
563 ::WinSetPointerPos(HWND_DESKTOP
, (LONG
)nX
, (LONG
)(nY
));
564 } // end of wxWindow::WarpPointer
566 #if WXWIN_COMPATIBILITY
567 void wxWindow::OS2DeviceToLogical (float *x
, float *y
) const
570 #endif // WXWIN_COMPATIBILITY
572 // ---------------------------------------------------------------------------
574 // ---------------------------------------------------------------------------
576 #if WXWIN_COMPATIBILITY
577 void wxWindow::SetScrollRange(
583 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, nRange
));
584 } // end of wxWindow::SetScrollRange
586 void wxWindow::SetScrollPage(
592 if ( orient
== wxHORIZONTAL
)
598 int wxWindow::OldGetScrollRange(
603 HWND hWnd
= GetHwnd();
607 mRc
= WinSendMsg(hWnd
, SBM_QUERYRANGE
, (MPARAM
)0L, (MPARAM
)0L);
608 return(SHORT2FROMMR(mRc
));
611 } // end of wxWindow::OldGetScrollRange
613 int wxWindow::GetScrollPage(
617 if (nOrient
== wxHORIZONTAL
)
618 return m_nXThumbSize
;
620 return m_nYThumbSize
;
621 } // end of wxWindow::GetScrollPage
622 #endif // WXWIN_COMPATIBILITY
624 int wxWindow::GetScrollPos(
628 return((int)::WinSendMsg(GetHwnd(), SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
629 } // end of wxWindow::GetScrollPos
631 int wxWindow::GetScrollRange(
637 mr
= ::WinSendMsg(GetHwnd(), SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
638 return((int)SHORT2FROMMR(mr
));
639 } // end of wxWindow::GetScrollRange
641 int wxWindow::GetScrollThumb(
645 WNDPARAMS vWndParams
;
648 ::WinSendMsg(GetHwnd(), WM_QUERYWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)NULL
);
649 pSbcd
= (PSBCDATA
)vWndParams
.pCtlData
;
650 return((int)pSbcd
->posThumb
);
651 } // end of wxWindow::GetScrollThumb
653 void wxWindow::SetScrollPos(
659 ::WinSendMsg(GetHwnd(), SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
660 } // end of wxWindow::SetScrollPos(
662 void wxWindow::SetScrollbar(
670 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, nRange
));
671 if (nOrient
== wxHORIZONTAL
)
673 m_nXThumbSize
= nThumbVisible
;
677 m_nYThumbSize
= nThumbVisible
;
679 } // end of wxWindow::SetScrollbar
681 void wxWindow::ScrollWindow(
684 , const wxRect
* pRect
691 vRect2
.xLeft
= pRect
->x
;
692 vRect2
.yTop
= pRect
->y
;
693 vRect2
.xRight
= pRect
->x
+ pRect
->width
;
694 vRect2
.yBottom
= pRect
->y
+ pRect
->height
;
698 ::WinScrollWindow(GetHwnd(), (LONG
)nDx
, (LONG
)nDy
, &vRect2
, NULL
, NULLHANDLE
, NULL
, 0L);
700 ::WinScrollWindow(GetHwnd(), nDx
, nDy
, NULL
, NULL
, NULLHANDLE
, NULL
, 0L);
701 } // end of wxWindow::ScrollWindow
703 // ---------------------------------------------------------------------------
705 // ---------------------------------------------------------------------------
707 void wxWindow::SubclassWin(
711 HWND hwnd
= (HWND
)hWnd
;
713 wxASSERT_MSG( !m_fnOldWndProc
, wxT("subclassing window twice?") );
715 wxCHECK_RET(::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in SubclassWin") );
717 wxAssociateWinWithHandle(hwnd
, this);
719 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(hwnd
, (PFNWP
)wxWndProc
);
720 ::WinSetWindowULong(hwnd
, QWS_USER
, (ULONG
)wxWndProc
);
721 } // end of wxWindow::SubclassWin
723 void wxWindow::UnsubclassWin()
725 wxRemoveHandleAssociation(this);
728 // Restore old Window proc
730 HWND hwnd
= GetHwnd();
736 wxCHECK_RET( ::WinIsWindow(vHabmain
, hwnd
), wxT("invalid HWND in UnsubclassWin") );
738 PFNWP fnProc
= (PFNWP
)::WinQueryWindowULong(hwnd
, QWS_USER
);
739 if ( (m_fnOldWndProc
!= 0) && (fnProc
!= (PFNWP
) m_fnOldWndProc
))
741 WinSubclassWindow(hwnd
, (PFNWP
)m_fnOldWndProc
);
745 } // end of wxWindow::UnsubclassWin
748 // Make a Windows extended style from the given wxWindows window style
750 WXDWORD
wxWindow::MakeExtendedStyle(
752 , bool bEliminateBorders
756 // PM does not support extended style
760 } // end of wxWindow::MakeExtendedStyle
763 // Determines whether native 3D effects or CTL3D should be used,
764 // applying a default border style if required, and returning an extended
765 // style to pass to CreateWindowEx.
767 WXDWORD
wxWindow::Determine3DEffects(
768 WXDWORD dwDefaultBorderStyle
772 WXDWORD dwStyle
= 0L;
775 // Native PM does not have any specialize 3D effects like WIN32 does
779 } // end of wxWindow::Determine3DEffects
781 #if WXWIN_COMPATIBILITY
782 void wxWindow::OnCommand(
784 , wxCommandEvent
& rEvent
787 if (GetEventHandler()->ProcessEvent(rEvent
))
790 m_parent
->GetEventHandler()->OnCommand( rWin
793 } // end of wxWindow::OnCommand
795 wxObject
* wxWindow::GetChild(
800 // Return a pointer to the Nth object in the Panel
802 wxNode
* pNode
= GetChildren().First();
806 pNode
= pNode
->Next();
809 wxObject
* pObj
= (wxObject
*)pNode
->Data();
814 } // end of wxWindow::GetChild
816 #endif // WXWIN_COMPATIBILITY
819 // Setup background and foreground colours correctly
821 void wxWindow::SetupColours()
824 SetBackgroundColour(GetParent()->GetBackgroundColour());
825 } // end of wxWindow::SetupColours
827 void wxWindow::OnIdle(
832 // Check if we need to send a LEAVE event
834 if (m_bMouseInWindow
)
838 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
839 if (::WinWindowFromPoint(HWND_DESKTOP
, &vPoint
, FALSE
) != (HWND
)GetHwnd())
842 // Generate a LEAVE event
844 m_bMouseInWindow
= FALSE
;
847 // Unfortunately the mouse button and keyboard state may have changed
848 // by the time the OnIdle function is called, so 'state' may be
853 if (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) != 0)
855 if (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) != 0);
858 wxMouseEvent
rEvent(wxEVT_LEAVE_WINDOW
);
860 InitMouseEvent( rEvent
865 (void)GetEventHandler()->ProcessEvent(rEvent
);
869 } // end of wxWindow::OnIdle
872 // Set this window to be the child of 'parent'.
874 bool wxWindow::Reparent(
878 if (!wxWindowBase::Reparent(pParent
))
881 HWND hWndChild
= GetHwnd();
882 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
884 ::WinSetParent(hWndChild
, hWndParent
, TRUE
);
886 } // end of wxWindow::Reparent
888 void wxWindow::Clear()
890 wxClientDC
vDc(this);
891 wxBrush
vBrush( GetBackgroundColour()
895 vDc
.SetBackground(vBrush
);
897 } // end of wxWindow::Clear
899 void wxWindow::Refresh(
901 , const wxRect
* pRect
904 HWND hWnd
= GetHwnd();
912 vOs2Rect
.xLeft
= pRect
->x
;
913 vOs2Rect
.yTop
= pRect
->y
;
914 vOs2Rect
.xRight
= pRect
->x
+ pRect
->width
;
915 vOs2Rect
.yBottom
= pRect
->y
+ pRect
->height
;
917 ::WinInvalidateRect(hWnd
, &vOs2Rect
, bEraseBack
);
920 ::WinInvalidateRect(hWnd
, NULL
, bEraseBack
);
922 } // end of wxWindow::Refresh
924 // ---------------------------------------------------------------------------
926 // ---------------------------------------------------------------------------
928 #if wxUSE_DRAG_AND_DROP
929 void wxWindow::SetDropTarget(
930 wxDropTarget
* pDropTarget
933 if (m_dropTarget
!= 0)
935 m_dropTarget
->Revoke(m_hWnd
);
938 m_dropTarget
= pDropTarget
;
939 if (m_dropTarget
!= 0)
940 m_dropTarget
->Register(m_hWnd
);
941 } // end of wxWindow::SetDropTarget
945 // old style file-manager drag&drop support: we retain the old-style
946 // DragAcceptFiles in parallel with SetDropTarget.
948 void wxWindow::DragAcceptFiles(
952 HWND hWnd
= GetHwnd();
955 ::DrgAcceptDroppedFiles(hWnd
, NULL
, NULL
, DO_COPY
, 0L);
956 } // end of wxWindow::DragAcceptFiles
958 // ----------------------------------------------------------------------------
960 // ----------------------------------------------------------------------------
964 void wxWindow::DoSetToolTip(
968 wxWindowBase::DoSetToolTip(pTooltip
);
971 m_tooltip
->SetWindow(this);
972 } // end of wxWindow::DoSetToolTip
974 #endif // wxUSE_TOOLTIPS
976 // ---------------------------------------------------------------------------
977 // moving and resizing
978 // ---------------------------------------------------------------------------
981 void wxWindow::DoGetSize(
986 HWND hWnd
= GetHwnd();
989 ::WinQueryWindowRect(hWnd
, &vRect
);
992 *pWidth
= vRect
.xRight
- vRect
.xLeft
;
994 // OS/2 PM is backwards from windows
995 *pHeight
= vRect
.yTop
- vRect
.yBottom
;
996 } // end of wxWindow::DoGetSize
998 void wxWindow::DoGetPosition(
1003 HWND hWnd
= GetHwnd();
1007 ::WinQueryWindowRect(hWnd
, &vRect
);
1009 vPoint
.x
= vRect
.xLeft
;
1010 vPoint
.y
= vRect
.yBottom
;
1013 // We do the adjustments with respect to the parent only for the "real"
1014 // children, not for the dialogs/frames
1018 HWND hParentWnd
= 0;
1019 wxWindow
* pParent
= GetParent();
1022 hParentWnd
= GetWinHwnd(pParent
);
1025 // Since we now have the absolute screen coords, if there's a parent we
1026 // must subtract its bottom left corner
1032 ::WinQueryWindowRect(hParentWnd
, &vRect2
);
1033 vPoint
.x
-= vRect
.xLeft
;
1034 vPoint
.y
-= vRect
.yBottom
;
1038 // We may be faking the client origin. So a window that's really at (0,
1039 // 30) may appear (to wxWin apps) to be at (0, 0).
1041 wxPoint
vPt(pParent
->GetClientAreaOrigin());
1051 } // end of wxWindow::DoGetPosition
1053 void wxWindow::DoScreenToClient(
1058 HWND hWnd
= GetHwnd();
1061 ::WinQueryWindowPos(hWnd
, &vSwp
);
1067 } // end of wxWindow::DoScreenToClient
1069 void wxWindow::DoClientToScreen(
1074 HWND hWnd
= GetHwnd();
1077 ::WinQueryWindowPos(hWnd
, &vSwp
);
1083 } // end of wxWindow::DoClientToScreen
1086 // Get size *available for subwindows* i.e. excluding menu bar etc.
1087 // Must be a frame type window
1089 void wxWindow::DoGetClientSize(
1094 HWND hWnd
= GetHwnd();
1098 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1099 ::WinQueryWindowRect(hWndClient
, &vRect
);
1102 *pWidth
= vRect
.xRight
;
1104 *pHeight
= vRect
.yTop
;
1105 } // end of wxWindow::DoGetClientSize
1107 void wxWindow::DoMoveWindow(
1114 if ( !::WinSetWindowPos( GetHwnd()
1120 ,SWP_SIZE
| SWP_MOVE
1123 wxLogLastError("MoveWindow");
1125 } // end of wxWindow::DoMoveWindow
1128 // Set the size of the window: if the dimensions are positive, just use them,
1129 // but if any of them is equal to -1, it means that we must find the value for
1130 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
1131 // which case -1 is a valid value for x and y)
1133 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
1134 // the width/height to best suit our contents, otherwise we reuse the current
1137 void wxWindow::DoSetSize(
1146 // Get the current size and position...
1152 wxSize
vSize(-1, -1);
1154 GetPosition( &nCurrentX
1157 GetSize( &nCurrentWidth
1162 // ... and don't do anything (avoiding flicker) if it's already ok
1164 if ( nX
== nCurrentX
&&
1166 nWidth
== nCurrentWidth
&&
1167 nHeight
== nCurrentHeight
1173 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1175 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1178 AdjustForParentClientOrigin( nX
1185 if (nSizeFlags
& wxSIZE_AUTO_WIDTH
)
1187 vSize
= DoGetBestSize();
1193 // Just take the current one
1195 nWidth
= nCurrentWidth
;
1201 if (nSizeFlags
& wxSIZE_AUTO_HEIGHT
)
1205 vSize
= DoGetBestSize();
1211 // just take the current one
1212 nHeight
= nCurrentHeight
;
1221 } // end of wxWindow::DoSetSize
1223 void wxWindow::DoSetClientSize(
1228 wxWindow
* pParent
= GetParent();
1229 HWND hWnd
= GetHwnd();
1230 HWND hParentWnd
= (HWND
)0;
1231 HWND hClientWnd
= (HWND
)0;
1236 hClientWnd
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1237 ::WinQueryWindowRect(hClientWnd
, &vRect2
);
1240 hParentWnd
= (HWND
) pParent
->GetHWND();
1242 ::WinQueryWindowRect(hWnd
, &vRect
);
1243 ::WinQueryWindowRect(hParentWnd
, &vRect3
);
1245 // Find the difference between the entire window (title bar and all)
1246 // and the client area; add this to the new client size to move the
1247 // window. OS/2 is backward from windows on height
1249 int nActualWidth
= vRect2
.xRight
- vRect2
.xLeft
- vRect
.xRight
+ nWidth
;
1250 int nActualHeight
= vRect2
.yTop
- vRect2
.yBottom
- vRect
.yTop
+ nHeight
;
1253 // If there's a parent, must subtract the parent's bottom left corner
1254 // since MoveWindow moves relative to the parent
1258 vPoint
.x
= vRect2
.xLeft
;
1259 vPoint
.y
= vRect2
.yBottom
;
1262 vPoint
.x
-= vRect3
.xLeft
;
1263 vPoint
.y
-= vRect3
.yBottom
;
1266 DoMoveWindow( vPoint
.x
1272 wxSizeEvent
vEvent( wxSize( nWidth
1278 vEvent
.SetEventObject(this);
1279 GetEventHandler()->ProcessEvent(vEvent
);
1280 } // end of wxWindow::DoSetClientSize
1282 wxPoint
wxWindow::GetClientAreaOrigin() const
1284 return wxPoint(0, 0);
1285 } // end of wxWindow::GetClientAreaOrigin
1287 void wxWindow::AdjustForParentClientOrigin(
1294 // Don't do it for the dialogs/frames - they float independently of their
1299 wxWindow
* pParent
= GetParent();
1301 if (!(nSizeFlags
& wxSIZE_NO_ADJUSTMENTS
) && pParent
)
1303 wxPoint
vPoint(pParent
->GetClientAreaOrigin());
1308 } // end of wxWindow::AdjustForParentClientOrigin
1310 // ---------------------------------------------------------------------------
1312 // ---------------------------------------------------------------------------
1314 int wxWindow::GetCharHeight() const
1317 FONTMETRICS vFontMetrics
;
1320 hPs
= ::WinGetPS(GetHwnd());
1322 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1325 return(vFontMetrics
.lMaxAscender
+ vFontMetrics
.lMaxDescender
);
1326 ::WinReleasePS(hPs
);
1327 } // end of wxWindow::GetCharHeight
1329 int wxWindow::GetCharWidth() const
1332 FONTMETRICS vFontMetrics
;
1334 hPs
= ::WinGetPS(GetHwnd());
1336 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1339 return(vFontMetrics
.lAveCharWidth
);
1340 ::WinReleasePS(hPs
);
1341 } // end of wxWindow::GetCharWidth
1343 void wxWindow::GetTextExtent(
1344 const wxString
& rString
1348 , int* pExternalLeading
1349 , const wxFont
* pTheFont
1352 const wxFont
* pFontToUse
= pTheFont
;
1355 hPs
= ::WinGetPS(GetHwnd());
1357 // TODO: Will have to play with fonts later
1360 pFontToUse = &m_font;
1363 HFONT hFfontOld = 0;
1365 if (pFontToUse && pFontToUse->Ok())
1368 hFnt = (HFONT)((wxFont *)pFontToUse)->GetResourceHandle(); // const_cast
1370 hFontOld = (HFONT)SelectObject(dc,fnt);
1375 GetTextExtentPoint(dc, string, (int)string.Length(), &sizeRect);
1376 GetTextMetrics(dc, &tm);
1378 if ( fontToUse && fnt && hfontOld )
1379 SelectObject(dc, hfontOld);
1381 ReleaseDC(hWnd, dc);
1388 *descent = tm.tmDescent;
1389 if ( externalLeading )
1390 *externalLeading = tm.tmExternalLeading;
1392 ::WinReleasePS(hPs
);
1395 #if wxUSE_CARET && WXWIN_COMPATIBILITY
1396 // ---------------------------------------------------------------------------
1397 // Caret manipulation
1398 // ---------------------------------------------------------------------------
1400 void wxWindow::CreateCaret(
1405 SetCaret(new wxCaret( this
1409 } // end of wxWindow::CreateCaret
1411 void wxWindow::CreateCaret(
1412 const wxBitmap
* pBitmap
1415 wxFAIL_MSG("not implemented");
1416 } // end of wxWindow::CreateCaret
1418 void wxWindow::ShowCaret(
1422 wxCHECK_RET( m_caret
, "no caret to show" );
1424 m_caret
->Show(bShow
);
1425 } // end of wxWindow::ShowCaret
1427 void wxWindow::DestroyCaret()
1430 } // end of wxWindow::DestroyCaret
1432 void wxWindow::SetCaretPos(
1436 wxCHECK_RET( m_caret
, "no caret to move" );
1441 } // end of wxWindow::SetCaretPos
1443 void wxWindow::GetCaretPos(
1448 wxCHECK_RET( m_caret
, "no caret to get position of" );
1450 m_caret
->GetPosition( pX
1453 } // end of wxWindow::GetCaretPos
1455 #endif //wxUSE_CARET
1457 // ---------------------------------------------------------------------------
1459 // ---------------------------------------------------------------------------
1461 bool wxWindow::DoPopupMenu(
1467 HWND hWnd
= GetHwnd();
1468 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
1469 HWND hMenu
= GetHmenuOf(pMenu
);
1471 pMenu
->SetInvokingWindow(this);
1474 DoClientToScreen( &nX
1477 wxCurrentPopupMenu
= pMenu
;
1479 ::WinPopupMenu( hWndParent
1485 ,PU_MOUSEBUTTON2DOWN
| PU_MOUSEBUTTON2
| PU_KEYBOARD
1488 wxCurrentPopupMenu
= NULL
;
1490 pMenu
->SetInvokingWindow(NULL
);
1492 } // end of wxWindow::DoPopupMenu
1494 // ===========================================================================
1495 // pre/post message processing
1496 // ===========================================================================
1498 MRESULT
wxWindow::OS2DefWindowProc(
1505 return ((MRESULT
)m_fnOldWndProc());
1507 return (::WinDefWindowProc(GetHwnd(), (ULONG
)uMsg
, (MPARAM
)wParam
, (MPARAM
)lParam
));
1508 } // end of wxWindow::OS2DefWindowProc
1510 bool wxWindow::OS2ProcessMessage(
1514 QMSG
* pQMsg
= (QMSG
*)pMsg
;
1516 if (m_hWnd
!= 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL
))
1519 // Intercept dialog navigation keys
1521 bool bProcess
= TRUE
;
1522 USHORT uKeyFlags
= SHORT1FROMMP(pQMsg
->mp1
);
1524 if (uKeyFlags
& KC_KEYUP
)
1527 if (uKeyFlags
& KC_ALT
)
1530 if (!(uKeyFlags
& KC_VIRTUALKEY
))
1535 bool bCtrlDown
= IsCtrlDown();
1536 bool bShiftDown
= IsShiftDown();
1539 // WM_QUERYDLGCODE: ask the control if it wants the key for itself,
1540 // don't process it if it's the case (except for Ctrl-Tab/Enter
1541 // combinations which are always processed)
1543 ULONG ulDlgCode
= 0;
1547 ulDlgCode
= (ULONG
)::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0);
1550 bool bForward
= TRUE
;
1551 bool bWindowChange
= FALSE
;
1553 switch (SHORT2FROMMP(pQMsg
->mp2
))
1556 // Going to make certain assumptions about specific types of controls
1557 // here, so we may have to alter some things later if they prove invalid
1561 // Shift tabl will always be a nav-key but tabs may be wanted
1570 // Entry Fields want tabs for themselve usually
1574 case DLGC_ENTRYFIELD
:
1584 // Ctrl-Tab cycles thru notebook pages
1586 bWindowChange
= bCtrlDown
;
1587 bForward
= !bShiftDown
;
1610 // ctrl-enter is not processed
1614 else if (ulDlgCode
& DLGC_BUTTON
)
1617 // buttons want process Enter themselevs
1623 wxPanel
* pPanel
= wxDynamicCast(this, wxPanel
);
1624 wxButton
* pBtn
= NULL
;
1629 // Panel may have a default button which should
1630 // be activated by Enter
1632 pBtn
= pPanel
->GetDefaultItem();
1635 if (pBtn
&& pBtn
->IsEnabled())
1638 // If we do have a default button, do press it
1640 pBtn
->OS2Command(BN_CLICKED
, 0 /* unused */);
1643 // else: but if it does not it makes sense to make
1644 // it work like a TAB - and that's what we do.
1645 // Note that Ctrl-Enter always works this way.
1656 wxNavigationKeyEvent vEvent
;
1658 vEvent
.SetDirection(bForward
);
1659 vEvent
.SetWindowChange(bWindowChange
);
1660 vEvent
.SetEventObject(this);
1662 if (GetEventHandler()->ProcessEvent(vEvent
))
1664 wxButton
* pBtn
= wxDynamicCast(FindFocus(), wxButton
);
1669 // The button which has focus should be default
1678 // Let Dialogs process
1680 if (::WinSendMsg(pQMsg
->hwnd
, WM_QUERYDLGCODE
, pQMsg
, 0));
1687 // relay mouse move events to the tooltip control
1688 QMSG
* pQMsg
= (QMSG
*)pMsg
;
1690 if (pQMsg
->msg
== WM_MOUSEMOVE
)
1691 m_tooltip
->RelayEvent(pMsg
);
1693 #endif // wxUSE_TOOLTIPS
1696 } // end of wxWindow::OS2ProcessMessage
1698 bool wxWindow::OS2TranslateMessage(
1702 return m_acceleratorTable
.Translate(m_hWnd
, pMsg
);
1703 } // end of wxWindow::OS2TranslateMessage
1705 // ---------------------------------------------------------------------------
1706 // message params unpackers
1707 // ---------------------------------------------------------------------------
1709 void wxWindow::UnpackCommand(
1717 *pId
= LOWORD(wParam
);
1718 *phWnd
= (WXHWND
)lParam
;
1719 *pCmd
= HIWORD(wParam
);
1720 } // end of wxWindow::UnpackCommand
1722 void wxWindow::UnpackActivate(
1729 *pState
= LOWORD(wParam
);
1730 *phWnd
= (WXHWND
)lParam
;
1731 } // end of wxWindow::UnpackActivate
1733 void wxWindow::UnpackScroll(
1741 *pCode
= LOWORD(wParam
);
1742 *pPos
= HIWORD(wParam
);
1743 *phWnd
= (WXHWND
)lParam
;
1744 } // end of wxWindow::UnpackScroll
1746 void wxWindow::UnpackMenuSelect(
1754 *pItem
= (WXWORD
)LOWORD(wParam
);
1755 *pFlags
= HIWORD(wParam
);
1756 *phMenu
= (WXHMENU
)lParam
;
1757 } // end of wxWindow::UnpackMenuSelect
1759 // ---------------------------------------------------------------------------
1760 // Main wxWindows window proc and the window proc for wxWindow
1761 // ---------------------------------------------------------------------------
1764 // Hook for new window just as it's being created, when the window isn't yet
1765 // associated with the handle
1767 wxWindow
* wxWndHook
= NULL
;
1772 MRESULT EXPENTRY
wxWndProc(
1780 // Trace all ulMsgs - useful for the debugging
1783 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
1784 wxGetMessageName(ulMsg
), wParam
, lParam
);
1785 #endif // __WXDEBUG__
1787 wxWindow
* pWnd
= wxFindWinFromHandle((WXHWND
)hWnd
);
1790 // When we get the first message for the HWND we just created, we associate
1791 // it with wxWindow stored in wxWndHook
1793 if (!pWnd
&& wxWndHook
)
1795 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
1798 pWnd
->SetHWND((WXHWND
)hWnd
);
1804 // Stop right here if we don't have a valid handle in our wxWindow object.
1806 if (pWnd
&& !pWnd
->GetHWND())
1808 pWnd
->SetHWND((WXHWND
) hWnd
);
1809 rc
= pWnd
->OS2DefWindowProc(ulMsg
, wParam
, lParam
);
1815 rc
= pWnd
->OS2WindowProc(ulMsg
, wParam
, lParam
);
1817 rc
= ::WinDefWindowProc(hWnd
, ulMsg
, wParam
, lParam
);
1820 } // end of wxWndProc
1823 // We will add (or delete) messages we need to handle at this default
1826 MRESULT
wxWindow::OS2WindowProc(
1833 // Did we process the uMsg?
1835 bool bProcessed
= FALSE
;
1849 // For most messages we should return 0 when we do process the message
1851 vRc
.mResult
= (MRESULT
)0;
1859 bProcessed
= HandleCreate( (WXLPCREATESTRUCT
)lParam
1865 // Return 0 to bAllow window creation
1867 vRc
.mResult
= (MRESULT
)(bMayCreate
? 0 : -1);
1873 bProcessed
= HandleDestroy();
1877 bProcessed
= HandleMove( LOWORD(lParam
)
1883 bProcessed
= HandleSize( LOWORD(lParam
)
1894 UnpackActivate( wParam
1900 bProcessed
= HandleActivate( wState
1907 if (SHORT1FROMMP((MPARAM
)lParam
) == TRUE
)
1908 bProcessed
= HandleSetFocus((WXHWND
)(HWND
)wParam
);
1910 bProcessed
= HandleKillFocus((WXHWND
)(HWND
)wParam
);
1914 bProcessed
= HandlePaint();
1919 // Don't let the DefWindowProc() destroy our window - we'll do it
1920 // ourselves in ~wxWindow
1923 vRc
.mResult
= (MRESULT
)TRUE
;
1927 bProcessed
= HandleShow(wParam
!= 0, (int)lParam
);
1931 // Under OS2 PM Joysticks are treated just like mouse events
1932 // The "Motion" events will be prevelent in joysticks
1935 case WM_BUTTON1DOWN
:
1937 case WM_BUTTON1DBLCLK
:
1938 case WM_BUTTON1MOTIONEND
:
1939 case WM_BUTTON1MOTIONSTART
:
1940 case WM_BUTTON2DOWN
:
1942 case WM_BUTTON2DBLCLK
:
1943 case WM_BUTTON2MOTIONEND
:
1944 case WM_BUTTON2MOTIONSTART
:
1945 case WM_BUTTON3DOWN
:
1947 case WM_BUTTON3DBLCLK
:
1948 case WM_BUTTON3MOTIONEND
:
1949 case WM_BUTTON3MOTIONSTART
:
1951 short x
= LOWORD(lParam
);
1952 short y
= HIWORD(lParam
);
1954 bProcessed
= HandleMouseEvent(uMsg
, x
, y
, (WXUINT
)wParam
);
1958 bProcessed
= HandleSysCommand(wParam
, lParam
);
1965 UnpackCommand(wParam
, lParam
, &id
, &hwnd
, &cmd
);
1967 bProcessed
= HandleCommand(id
, cmd
, hwnd
);
1972 // For these messages we must return TRUE if process the message
1975 case WM_MEASUREITEM
:
1977 int idCtrl
= (UINT
)wParam
;
1978 if ( uMsg
== WM_DRAWITEM
)
1980 bProcessed
= OS2OnDrawItem(idCtrl
,
1981 (WXDRAWITEMSTRUCT
*)lParam
);
1985 bProcessed
= OS2OnMeasureItem(idCtrl
,
1986 (WXMEASUREITEMSTRUCT
*)lParam
);
1990 vRc
.mResult
= (MRESULT
)TRUE
;
1994 case WM_QUERYDLGCODE
:
1997 vRc
.mResult
= (MRESULT
)m_lDlgCode
;
2001 //else: get the dlg code from the DefWindowProc()
2006 // In OS/2 PM all keyboard events are of the WM_CHAR type. Virtual key and key-up
2007 // and key-down events are obtained from the WM_CHAR params.
2011 USHORT uKeyFlags
= SHORT1FROMMP((MPARAM
)wParam
);
2013 if (uKeyFlags
& KC_KEYUP
)
2015 bProcessed
= HandleKeyUp((WXDWORD
)wParam
, lParam
);
2018 else // keydown event
2021 // If this has been processed by an event handler,
2022 // return 0 now (we've handled it). DON't RETURN
2023 // we still need to process further
2025 HandleKeyDown((WXDWORD
)wParam
, lParam
);
2026 if (uKeyFlags
& KC_VIRTUALKEY
)
2028 USHORT uVk
= SHORT2FROMMP((MPARAM
)lParam
);
2031 // We consider these message "not interesting" to OnChar
2033 if (uVk
== VK_SHIFT
|| uVk
== VK_CTRL
)
2041 // Avoid duplicate messages to OnChar for these ASCII keys: they
2042 // will be translated by TranslateMessage() and received in WM_CHAR
2048 // But set processed to FALSE, not TRUE to still pass them to
2049 // the control's default window proc - otherwise built-in
2050 // keyboard handling won't work
2059 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
);
2063 else // WM_CHAR -- Always an ASCII character
2065 bProcessed
= HandleChar((WXDWORD
)wParam
, lParam
, TRUE
);
2077 UnpackScroll( wParam
2084 bProcessed
= OS2OnScroll( uMsg
== WM_HSCROLL
? wxHORIZONTAL
2093 #if defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
2094 case WM_CTLCOLORCHANGE
:
2096 bProcessed
= HandleCtlColor(&vRc
.hBrush
);
2101 // Instead of CTLCOLOR messages PM sends QUERYWINDOWPARAMS to
2102 // things such as colors and fonts and such
2104 case WM_QUERYWINDOWPARAMS
:
2106 PWNDPARAMS pWndParams
= (PWNDPARAMS
)wParam
;
2108 bProcessed
= HandleWindowParams( pWndParams
2114 // the return value for this message is ignored
2115 case WM_SYSCOLORCHANGE
:
2116 bProcessed
= HandleSysColorChange();
2119 case WM_REALIZEPALETTE
:
2120 bProcessed
= HandlePaletteChanged();
2123 case WM_PRESPARAMCHANGED
:
2124 bProcessed
= HandlePresParamChanged(wParam
);
2127 // move this to wxFrame
2128 case WM_ERASEBACKGROUND
:
2129 bProcessed
= HandleEraseBkgnd((WXHDC
)(HDC
)wParam
);
2133 // We processed the message, i.e. erased the background
2135 vRc
.mResult
= (MRESULT
)TRUE
;
2139 // move all drag and drops to wxDrg
2141 bProcessed
= HandleEndDrag(wParam
);
2145 bProcessed
= HandleInitDialog((WXHWND
)(HWND
)wParam
);
2149 // we never set focus from here
2150 vRc
.mResult
= FALSE
;
2154 // wxFrame specific message
2155 case WM_MINMAXFRAME
:
2156 bProcessed
= HandleGetMinMaxInfo((PSWP
)wParam
);
2159 case WM_SYSVALUECHANGED
:
2160 // TODO: do something
2161 vRc
.mResult
= (MRESULT
)TRUE
;
2165 // Comparable to WM_SETPOINTER for windows, only for just controls
2167 case WM_CONTROLPOINTER
:
2168 bProcessed
= HandleSetCursor( SHORT1FROMMP(wParam
) // Control ID
2169 ,(HWND
)lParam
// Cursor Handle
2174 // Returning TRUE stops the DefWindowProc() from further
2175 // processing this message - exactly what we need because we've
2176 // just set the cursor.
2178 vRc
.mResult
= (MRESULT
)TRUE
;
2186 wxLogTrace(wxTraceMessages
, wxT("Forwarding %s to DefWindowProc."),
2187 wxGetMessageName(uMsg
));
2188 #endif // __WXDEBUG__
2189 vRc
.mResult
= OS2DefWindowProc(uMsg
, wParam
, lParam
);
2192 } // end of wxWindow::OS2WindowProc
2195 // Dialog window proc
2203 if (uMsg
== WM_INITDLG
)
2206 // For this message, returning TRUE tells system to set focus to the
2207 // first control in the dialog box
2209 return (MRESULT
)TRUE
;
2214 // For all the other ones, FALSE means that we didn't process the
2219 } // end of wxDlgProc
2221 wxWindow
* wxFindWinFromHandle(
2225 wxNode
* pNode
= wxWinHandleList
->Find((long)hWnd
);
2229 return (wxWindow
*)pNode
->Data();
2230 } // end of wxFindWinFromHandle
2232 void wxAssociateWinWithHandle(
2238 // Adding NULL hWnd is (first) surely a result of an error and
2239 // (secondly) breaks menu command processing
2241 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
2242 wxT("attempt to add a NULL hWnd to window list ignored") );
2245 wxWindow
* pOldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
2247 if (pOldWin
&& (pOldWin
!= pWin
))
2249 wxString
str(pWin
->GetClassInfo()->GetClassName());
2250 wxLogError( "Bug! Found existing HWND %X for new window of class %s"
2257 wxWinHandleList
->Append( (long)hWnd
2261 } // end of wxAssociateWinWithHandle
2263 void wxRemoveHandleAssociation(
2267 wxWinHandleList
->DeleteObject(pWin
);
2268 } // end of wxRemoveHandleAssociation
2271 // Default destroyer - override if you destroy it in some other way
2272 // (e.g. with MDI child windows)
2274 void wxWindow::OS2DestroyWindow()
2278 void wxWindow::OS2DetachWindowMenu()
2282 HMENU hMenu
= (HMENU
)m_hMenu
;
2284 int nN
= (int)::WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
2287 for (i
= 0; i
< nN
; i
++)
2290 int nChars
= (int)::WinSendMsg( hMenu
2292 ,MPFROM2SHORT(i
, nN
)
2297 wxLogLastError(wxT("GetMenuString"));
2301 if (wxStrcmp(zBuf
, wxT("&Window")) == 0)
2303 ::WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
2308 } // end of wxWindow::OS2DetachWindowMenu
2310 bool wxWindow::OS2Create(
2313 , const wxChar
* zTitle
2321 , unsigned long ulId
2328 long lX1
= (long)CW_USEDEFAULT
;
2330 long lWidth1
= (long)CW_USEDEFAULT
;
2331 long lHeight1
= 100L;
2335 // Find parent's size, if it exists, to set up a possible default
2336 // panel size the size of the parent window
2353 // check to see if the new window is a standard control
2355 if ((ULONG
)zClass
== (ULONG
)WC_BUTTON
||
2356 (ULONG
)zClass
== (ULONG
)WC_COMBOBOX
||
2357 (ULONG
)zClass
== (ULONG
)WC_CONTAINER
||
2358 (ULONG
)zClass
== (ULONG
)WC_ENTRYFIELD
||
2359 (ULONG
)zClass
== (ULONG
)WC_FRAME
||
2360 (ULONG
)zClass
== (ULONG
)WC_LISTBOX
||
2361 (ULONG
)zClass
== (ULONG
)WC_MENU
||
2362 (ULONG
)zClass
== (ULONG
)WC_NOTEBOOK
||
2363 (ULONG
)zClass
== (ULONG
)WC_SCROLLBAR
||
2364 (ULONG
)zClass
== (ULONG
)WC_SPINBUTTON
||
2365 (ULONG
)zClass
== (ULONG
)WC_STATIC
||
2366 (ULONG
)zClass
== (ULONG
)WC_TITLEBAR
||
2367 (ULONG
)zClass
== (ULONG
)WC_VALUESET
2374 // We will either have a registered class via string name or a standard PM Class via a long
2376 m_hWnd
= (WXHWND
)::WinCreateWindow( (HWND
)hParent
2378 ,(PSZ
)zTitle
? zTitle
: wxT("")
2392 vError
= ::WinGetLastError(vHabmain
);
2393 sError
= wxPMErrorToStr(vError
);
2394 wxLogError("Can't create window of class %s!. Error: %s\n", zClass
, sError
);
2397 ::WinSetWindowULong(m_hWnd
, QWL_USER
, (ULONG
) this);
2401 wxNode
* pNode
= wxWinHandleList
->Member(this);
2405 HWND hWnd
= (HWND
)pNode
->GetKeyInteger();
2407 if (hWnd
!= (HWND
)m_hWnd
)
2410 wxLogError("A second HWND association is being added for the same window!");
2414 wxAssociateWinWithHandle((HWND
)m_hWnd
2418 } // end of wxWindow::OS2Create
2420 // ===========================================================================
2421 // OS2 PM message handlers
2422 // ===========================================================================
2424 // ---------------------------------------------------------------------------
2425 // window creation/destruction
2426 // ---------------------------------------------------------------------------
2428 bool wxWindow::HandleCreate(
2429 WXLPCREATESTRUCT vCs
2433 wxWindowCreateEvent
vEvent(this);
2435 (void)GetEventHandler()->ProcessEvent(vEvent
);
2436 *pbMayCreate
= TRUE
;
2438 } // end of wxWindow::HandleCreate
2440 bool wxWindow::HandleDestroy()
2442 wxWindowDestroyEvent
vEvent(this);
2444 (void)GetEventHandler()->ProcessEvent(vEvent
);
2447 // Delete our drop target if we've got one
2449 #if wxUSE_DRAG_AND_DROP
2450 if (m_dropTarget
!= NULL
)
2452 m_dropTarget
->Revoke(m_hWnd
);
2453 delete m_dropTarget
;
2454 m_dropTarget
= NULL
;
2456 #endif // wxUSE_DRAG_AND_DROP
2459 // WM_DESTROY handled
2462 } // end of wxWindow::HandleDestroy
2464 // ---------------------------------------------------------------------------
2466 // ---------------------------------------------------------------------------
2467 void wxWindow::OnSetFocus(
2468 wxFocusEvent
& rEvent
2472 // Panel wants to track the window which was the last to have focus in it,
2473 // so we want to set ourselves as the window which last had focus
2475 // Notice that it's also important to do it upwards the tree becaus
2476 // otherwise when the top level panel gets focus, it won't set it back to
2477 // us, but to some other sibling
2479 wxWindow
* pWin
= this;
2483 wxWindow
* pParent
= pWin
->GetParent();
2484 wxPanel
* pPanel
= wxDynamicCast( pParent
2489 pPanel
->SetLastFocus(pWin
);
2494 wxLogTrace(_T("focus"), _T("%s (0x%08x) gets focus"),
2495 GetClassInfo()->GetClassName(), GetHandle());
2498 } // end of wxWindow::OnSetFocus
2500 bool wxWindow::HandleActivate(
2502 , WXHWND
WXUNUSED(hActivate
)
2505 wxActivateEvent
vEvent( wxEVT_ACTIVATE
2509 vEvent
.SetEventObject(this);
2510 return GetEventHandler()->ProcessEvent(vEvent
);
2511 } // end of wxWindow::HandleActivate
2513 bool wxWindow::HandleSetFocus(
2514 WXHWND
WXUNUSED(hWnd
)
2523 m_caret
->OnSetFocus();
2525 #endif // wxUSE_CARET
2528 // Panel wants to track the window which was the last to have focus in it
2530 wxPanel
* pPanel
= wxDynamicCast( GetParent()
2535 pPanel
->SetLastFocus(this);
2538 wxFocusEvent
vEvent(wxEVT_SET_FOCUS
, m_windowId
);
2540 vEvent
.SetEventObject(this);
2541 return GetEventHandler()->ProcessEvent(vEvent
);
2542 } // end of wxWindow::HandleSetFocus
2544 bool wxWindow::HandleKillFocus(
2545 WXHWND
WXUNUSED(hWnd
)
2554 m_caret
->OnKillFocus();
2556 #endif // wxUSE_CARET
2558 wxFocusEvent
vEvent( wxEVT_KILL_FOCUS
2562 vEvent
.SetEventObject(this);
2563 return GetEventHandler()->ProcessEvent(vEvent
);
2564 } // end of wxWindow::HandleKillFocus
2566 // ---------------------------------------------------------------------------
2568 // ---------------------------------------------------------------------------
2570 bool wxWindow::HandleShow(
2575 wxShowEvent
vEvent( GetId()
2579 vEvent
.m_eventObject
= this;
2580 return GetEventHandler()->ProcessEvent(vEvent
);
2581 } // end of wxWindow::HandleShow
2583 bool wxWindow::HandleInitDialog(
2584 WXHWND
WXUNUSED(hWndFocus
)
2587 wxInitDialogEvent
vEvent(GetId());
2589 vEvent
.m_eventObject
= this;
2590 return GetEventHandler()->ProcessEvent(vEvent
);
2591 } // end of wxWindow::HandleInitDialog
2593 bool wxWindow::HandleEndDrag(WXWPARAM wParam
)
2595 // TODO: We'll handle drag and drop later
2599 bool wxWindow::HandleSetCursor(
2605 // Under OS/2 PM this allows the pointer to be changed
2606 // as it passes over a control
2608 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)hPointer
);
2610 } // end of wxWindow::HandleSetCursor
2612 // ---------------------------------------------------------------------------
2613 // owner drawn stuff
2614 // ---------------------------------------------------------------------------
2615 bool wxWindow::OS2OnDrawItem(
2617 , WXDRAWITEMSTRUCT
* pItemStruct
2621 // I'll get to owner drawn stuff later
2625 // is it a menu item or control?
2627 wxWindow
* pItem
= FindItem(vId
);
2629 #if wxUSE_OWNER_DRAWN
2630 if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxControl
)))
2632 return ((wxControl
*)pItem
)->OS2OnDraw(pItemStruct
);
2634 else if (pItem
&& pItem
->IsKindOf(CLASSINFO(wxMenu
)))
2637 // TODO: draw a menu item
2639 POWNERITEM pDrawStruct = (OWNERITEM *)pItemStruct;
2640 wxMenuItem* pMenuItem = (wxMenuItem *)(pDrawStruct->pItemData);
2642 wxCHECK(pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE);
2645 // Prepare to call OnDrawItem()
2648 dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE);
2649 wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top,
2650 pDrawStruct->rcItem.right - pDrawStruct->rcItem.left,
2651 pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top);
2653 return pMenuItem->OnDrawItem
2656 (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction,
2657 (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
2666 } // end of wxWindow::OS2OnDrawItem
2668 bool wxWindow::OS2OnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*itemStruct
)
2670 // TODO: more owner drawn menu related stuff, get to it later
2672 #if wxUSE_OWNER_DRAWN
2673 // is it a menu item?
2676 MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
2677 wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
2679 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
2681 return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
2682 &pMeasureStruct->itemHeight);
2685 wxWindow *item = FindItem(id);
2686 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
2688 return ((wxControl *)item)->MSWOnMeasure(itemStruct);
2690 #endif // owner-drawn menus
2695 // ---------------------------------------------------------------------------
2696 // colours and palettes
2697 // ---------------------------------------------------------------------------
2699 bool wxWindow::HandleSysColorChange()
2701 wxSysColourChangedEvent vEvent
;
2703 vEvent
.SetEventObject(this);
2704 return GetEventHandler()->ProcessEvent(vEvent
);
2705 } // end of wxWindow::HandleSysColorChange
2707 bool wxWindow::HandleCtlColor(
2712 // Not much provided with message. So not sure I can do anything with it
2715 } // end of wxWindow::HandleCtlColor
2717 bool wxWindow::HandleWindowParams(
2718 PWNDPARAMS pWndParams
2722 // TODO: I'll do something here, just not sure what yet
2726 // Define for each class of dialog and control
2727 WXHBRUSH
wxWindow::OnCtlColor(WXHDC hDC
,
2737 bool wxWindow::HandlePaletteChanged()
2739 // need to set this to something first
2740 WXHWND hWndPalChange
= NULLHANDLE
;
2742 wxPaletteChangedEvent
vEvent(GetId());
2744 vEvent
.SetEventObject(this);
2745 vEvent
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
2747 return GetEventHandler()->ProcessEvent(vEvent
);
2748 } // end of wxWindow::HandlePaletteChanged
2750 bool wxWindow::HandlePresParamChanged(
2755 // TODO: Once again I'll do something here when I need it
2757 //wxQueryNewPaletteEvent event(GetId());
2758 //event.SetEventObject(this);
2759 // if the background is erased
2760 // bProcessed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
2762 return FALSE
; //GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized();
2766 // Responds to colour changes: passes event on to children.
2768 void wxWindow::OnSysColourChanged(
2769 wxSysColourChangedEvent
& rEvent
2772 wxNode
* pNode
= GetChildren().First();
2777 // Only propagate to non-top-level windows
2779 wxWindow
* pWin
= (wxWindow
*)pNode
->Data();
2781 if (pWin
->GetParent())
2783 wxSysColourChangedEvent vEvent
;
2785 rEvent
.m_eventObject
= pWin
;
2786 pWin
->GetEventHandler()->ProcessEvent(vEvent
);
2788 pNode
= pNode
->Next();
2790 } // end of wxWindow::OnSysColourChanged
2792 // ---------------------------------------------------------------------------
2794 // ---------------------------------------------------------------------------
2796 bool wxWindow::HandlePaint()
2798 HRGN hRgn
= NULLHANDLE
;
2799 wxPaintEvent vEvent
;
2803 if (::WinQueryUpdateRegion(GetHwnd(), hRgn
) == RGN_NULL
)
2805 wxLogLastError("CreateRectRgn");
2808 m_updateRegion
= wxRegion(hRgn
);
2810 hPS
= WinBeginPaint(GetHwnd(), 0L, &vRect
);
2811 WinFillRect(hPS
, &vRect
, SYSCLR_WINDOW
);
2814 vEvent
.SetEventObject(this);
2815 return (GetEventHandler()->ProcessEvent(vEvent
));
2816 } // end of wxWindow::HandlePaint
2818 bool wxWindow::HandleEraseBkgnd(WXHDC hdc
)
2820 // TODO: will have to worry about this later as part of
2821 // the handling of changed presentation parameters
2823 if ( ::IsIconic(GetHwnd()) )
2832 wxEraseEvent event(m_windowId, &dc);
2833 event.SetEventObject(this);
2834 bool rc = GetEventHandler()->ProcessEvent(event);
2837 dc.SelectOldObjects(hdc);
2838 dc.SetHDC((WXHDC) NULL);
2841 } // end of wxWindow::HandleEraseBkgnd
2843 void wxWindow::OnEraseBackground(
2844 wxEraseEvent
& rEvent
2848 } // end of wxWindow::OnEraseBackground
2850 // ---------------------------------------------------------------------------
2851 // moving and resizing
2852 // ---------------------------------------------------------------------------
2854 bool wxWindow::HandleMinimize()
2856 wxIconizeEvent
vEvent(m_windowId
);
2858 vEvent
.SetEventObject(this);
2859 return GetEventHandler()->ProcessEvent(vEvent
);
2860 } // end of wxWindow::HandleMinimize
2862 bool wxWindow::HandleMaximize()
2864 wxMaximizeEvent
vEvent(m_windowId
);
2866 vEvent
.SetEventObject(this);
2867 return GetEventHandler()->ProcessEvent(vEvent
);
2868 } // end of wxWindow::HandleMaximize
2870 bool wxWindow::HandleMove(
2875 wxMoveEvent
vEvent( wxPoint( nX
2881 vEvent
.SetEventObject(this);
2882 return GetEventHandler()->ProcessEvent(vEvent
);
2883 } // end of wxWindow::HandleMove
2885 bool wxWindow::HandleSize(
2888 , WXUINT
WXUNUSED(nFlag
)
2891 wxSizeEvent
vEvent( wxSize( nWidth
2897 vEvent
.SetEventObject(this);
2898 return GetEventHandler()->ProcessEvent(vEvent
);
2899 } // end of wxWindow::HandleSize
2901 bool wxWindow::HandleGetMinMaxInfo(
2911 ::WinGetMaxPosition(GetHwnd(), pSwp
);
2912 m_maxWidth
= pSwp
->cx
;
2913 m_maxHeight
= pSwp
->cy
;
2917 ::WinGetMinPosition(GetHwnd(), pSwp
, &vPoint
);
2918 m_minWidth
= pSwp
->cx
;
2919 m_minHeight
= pSwp
->cy
;
2926 } // end of wxWindow::HandleGetMinMaxInfo
2928 // ---------------------------------------------------------------------------
2930 // ---------------------------------------------------------------------------
2931 bool wxWindow::HandleCommand(
2937 if (wxCurrentPopupMenu
)
2939 wxMenu
* pPopupMenu
= wxCurrentPopupMenu
;
2941 wxCurrentPopupMenu
= NULL
;
2942 return pPopupMenu
->OS2Command(wCmd
, wId
);
2945 wxWindow
* pWin
= FindItem(wId
);
2949 pWin
= wxFindWinFromHandle(hControl
);
2953 return pWin
->OS2Command( wCmd
2957 } // end of wxWindow::HandleCommand
2959 bool wxWindow::HandleSysCommand(
2965 // 4 bits are reserved
2967 switch (SHORT1FROMMP(wParam
))
2970 return HandleMaximize();
2973 return HandleMinimize();
2976 } // end of wxWindow::HandleSysCommand
2978 // ---------------------------------------------------------------------------
2980 // ---------------------------------------------------------------------------
2982 void wxWindow::InitMouseEvent(
2983 wxMouseEvent
& rEvent
2991 rEvent
.m_shiftDown
= ((uFlags
& VK_SHIFT
) != 0);
2992 rEvent
.m_controlDown
= ((uFlags
& VK_CTRL
) != 0);
2993 rEvent
.m_leftDown
= ((uFlags
& VK_BUTTON1
) != 0);
2994 rEvent
.m_middleDown
= ((uFlags
& VK_BUTTON3
) != 0);
2995 rEvent
.m_rightDown
= ((uFlags
& VK_BUTTON2
) != 0);
2996 rEvent
.SetTimestamp(s_currentMsg
.time
);
2997 rEvent
.m_eventObject
= this;
2999 #if wxUSE_MOUSEEVENT_HACK
3002 m_lastMouseEvent
= rEvent
.GetEventType();
3003 #endif // wxUSE_MOUSEEVENT_HACK
3004 } // end of wxWindow::InitMouseEvent
3006 bool wxWindow::HandleMouseEvent(
3014 // The mouse events take consecutive IDs from WM_MOUSEFIRST to
3015 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
3016 // from the message id and take the value in the table to get wxWin event
3019 static const wxEventType eventsMouse
[] =
3033 wxMouseEvent
vEvent(eventsMouse
[uMsg
- WM_MOUSEMOVE
]);
3035 InitMouseEvent( vEvent
3041 return GetEventHandler()->ProcessEvent(vEvent
);
3042 } // end of wxWindow::HandleMouseEvent
3044 bool wxWindow::HandleMouseMove(
3050 if (!m_bMouseInWindow
)
3053 // Generate an ENTER event
3055 m_bMouseInWindow
= TRUE
;
3057 wxMouseEvent
vEvent(wxEVT_ENTER_WINDOW
);
3059 InitMouseEvent( vEvent
3065 (void)GetEventHandler()->ProcessEvent(vEvent
);
3067 return HandleMouseEvent( WM_MOUSEMOVE
3072 } // end of wxWindow::HandleMouseMove
3074 // ---------------------------------------------------------------------------
3075 // keyboard handling
3076 // ---------------------------------------------------------------------------
3079 // Create the key event of the given type for the given key - used by
3080 // HandleChar and HandleKeyDown/Up
3082 wxKeyEvent
wxWindow::CreateKeyEvent(
3088 wxKeyEvent
vEvent(eType
);
3090 vEvent
.SetId(GetId());
3091 vEvent
.m_shiftDown
= IsShiftDown();
3092 vEvent
.m_controlDown
= IsCtrlDown();
3093 vEvent
.m_altDown
= (HIWORD(lParam
) & KC_ALT
) == KC_ALT
;
3095 vEvent
.m_eventObject
= (wxWindow
*)this; // const_cast
3096 vEvent
.m_keyCode
= nId
;
3097 vEvent
.SetTimestamp(s_currentMsg
.time
);
3100 // Translate the position to client coords
3105 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
3106 ::WinQueryWindowRect( GetHwnd()
3110 vPoint
.x
-= vRect
.xLeft
;
3111 vPoint
.y
-= vRect
.yBottom
;
3113 vEvent
.m_x
= vPoint
.x
;
3114 vEvent
.m_y
= vPoint
.y
;
3117 } // end of wxWindow::CreateKeyEvent
3120 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
3123 bool wxWindow::HandleChar(
3129 bool bCtrlDown
= FALSE
;
3135 // If 1 -> 26, translate to CTRL plus a letter.
3138 if ((vId
> 0) && (vId
< 27))
3160 else if ( (vId
= wxCharCodeOS2ToWX(wParam
)) == 0)
3163 // It's ASCII and will be processed here only when called from
3164 // WM_CHAR (i.e. when isASCII = TRUE), don't process it now
3171 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_CHAR
3178 vEvent
.m_controlDown
= TRUE
;
3181 if (GetEventHandler()->ProcessEvent(vEvent
))
3187 bool wxWindow::HandleKeyDown(
3192 int nId
= wxCharCodeOS2ToWX(wParam
);
3197 // Normal ASCII char
3204 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_DOWN
3209 if (GetEventHandler()->ProcessEvent(vEvent
))
3215 } // end of wxWindow::HandleKeyDown
3217 bool wxWindow::HandleKeyUp(
3222 int nId
= wxCharCodeOS2ToWX(wParam
);
3227 // Normal ASCII char
3234 wxKeyEvent
vEvent(CreateKeyEvent( wxEVT_KEY_UP
3239 if (GetEventHandler()->ProcessEvent(vEvent
))
3243 } // end of wxWindow::HandleKeyUp
3245 // ---------------------------------------------------------------------------
3247 // ---------------------------------------------------------------------------
3249 // ---------------------------------------------------------------------------
3251 // ---------------------------------------------------------------------------
3253 bool wxWindow::OS2OnScroll(
3262 wxWindow
* pChild
= wxFindWinFromHandle(hControl
);
3265 return pChild
->OS2OnScroll( nOrientation
3272 wxScrollWinEvent vEvent
;
3274 vEvent
.SetPosition(wPos
);
3275 vEvent
.SetOrientation(nOrientation
);
3276 vEvent
.m_eventObject
= this;
3281 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEUP
;
3285 vEvent
.m_eventType
= wxEVT_SCROLLWIN_LINEDOWN
;
3289 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEUP
;
3293 vEvent
.m_eventType
= wxEVT_SCROLLWIN_PAGEDOWN
;
3296 case SB_SLIDERPOSITION
:
3297 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBRELEASE
;
3300 case SB_SLIDERTRACK
:
3301 vEvent
.m_eventType
= wxEVT_SCROLLWIN_THUMBTRACK
;
3307 return GetEventHandler()->ProcessEvent(vEvent
);
3308 } // end of wxWindow::OS2OnScroll
3310 // ===========================================================================
3312 // ===========================================================================
3321 // TODO: we'll do this later
3322 } // end of wxGetCharSize
3325 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
3326 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
3328 int wxCharCodeOS2ToWX(
3336 case VK_BACKTAB
: nId
= WXK_BACK
; break;
3337 case VK_TAB
: nId
= WXK_TAB
; break;
3338 case VK_CLEAR
: nId
= WXK_CLEAR
; break;
3339 case VK_ENTER
: nId
= WXK_RETURN
; break;
3340 case VK_SHIFT
: nId
= WXK_SHIFT
; break;
3341 case VK_CTRL
: nId
= WXK_CONTROL
; break;
3342 case VK_PAUSE
: nId
= WXK_PAUSE
; break;
3343 case VK_SPACE
: nId
= WXK_SPACE
; break;
3344 case VK_ESC
: nId
= WXK_ESCAPE
; break;
3345 case VK_END
: nId
= WXK_END
; break;
3346 case VK_HOME
: nId
= WXK_HOME
; break;
3347 case VK_LEFT
: nId
= WXK_LEFT
; break;
3348 case VK_UP
: nId
= WXK_UP
; break;
3349 case VK_RIGHT
: nId
= WXK_RIGHT
; break;
3350 case VK_DOWN
: nId
= WXK_DOWN
; break;
3351 case VK_PRINTSCRN
: nId
= WXK_PRINT
; break;
3352 case VK_INSERT
: nId
= WXK_INSERT
; break;
3353 case VK_DELETE
: nId
= WXK_DELETE
; break;
3354 case VK_F1
: nId
= WXK_F1
; break;
3355 case VK_F2
: nId
= WXK_F2
; break;
3356 case VK_F3
: nId
= WXK_F3
; break;
3357 case VK_F4
: nId
= WXK_F4
; break;
3358 case VK_F5
: nId
= WXK_F5
; break;
3359 case VK_F6
: nId
= WXK_F6
; break;
3360 case VK_F7
: nId
= WXK_F7
; break;
3361 case VK_F8
: nId
= WXK_F8
; break;
3362 case VK_F9
: nId
= WXK_F9
; break;
3363 case VK_F10
: nId
= WXK_F10
; break;
3364 case VK_F11
: nId
= WXK_F11
; break;
3365 case VK_F12
: nId
= WXK_F12
; break;
3366 case VK_F13
: nId
= WXK_F13
; break;
3367 case VK_F14
: nId
= WXK_F14
; break;
3368 case VK_F15
: nId
= WXK_F15
; break;
3369 case VK_F16
: nId
= WXK_F16
; break;
3370 case VK_F17
: nId
= WXK_F17
; break;
3371 case VK_F18
: nId
= WXK_F18
; break;
3372 case VK_F19
: nId
= WXK_F19
; break;
3373 case VK_F20
: nId
= WXK_F20
; break;
3374 case VK_F21
: nId
= WXK_F21
; break;
3375 case VK_F22
: nId
= WXK_F22
; break;
3376 case VK_F23
: nId
= WXK_F23
; break;
3377 case VK_F24
: nId
= WXK_F24
; break;
3378 case VK_NUMLOCK
: nId
= WXK_NUMLOCK
; break;
3379 case VK_SCRLLOCK
: nId
= WXK_SCROLL
; break;
3386 } // end of wxCharCodeOS2ToWX
3388 int wxCharCodeWXToOS2(
3398 case WXK_CLEAR
: nKeySym
= VK_CLEAR
; break;
3399 case WXK_SHIFT
: nKeySym
= VK_SHIFT
; break;
3400 case WXK_CONTROL
: nKeySym
= VK_CTRL
; break;
3401 case WXK_PAUSE
: nKeySym
= VK_PAUSE
; break;
3402 case WXK_END
: nKeySym
= VK_END
; break;
3403 case WXK_HOME
: nKeySym
= VK_HOME
; break;
3404 case WXK_LEFT
: nKeySym
= VK_LEFT
; break;
3405 case WXK_UP
: nKeySym
= VK_UP
; break;
3406 case WXK_RIGHT
: nKeySym
= VK_RIGHT
; break;
3407 case WXK_DOWN
: nKeySym
= VK_DOWN
; break;
3408 case WXK_PRINT
: nKeySym
= VK_PRINTSCRN
; break;
3409 case WXK_INSERT
: nKeySym
= VK_INSERT
; break;
3410 case WXK_DELETE
: nKeySym
= VK_DELETE
; break;
3411 case WXK_F1
: nKeySym
= VK_F1
; break;
3412 case WXK_F2
: nKeySym
= VK_F2
; break;
3413 case WXK_F3
: nKeySym
= VK_F3
; break;
3414 case WXK_F4
: nKeySym
= VK_F4
; break;
3415 case WXK_F5
: nKeySym
= VK_F5
; break;
3416 case WXK_F6
: nKeySym
= VK_F6
; break;
3417 case WXK_F7
: nKeySym
= VK_F7
; break;
3418 case WXK_F8
: nKeySym
= VK_F8
; break;
3419 case WXK_F9
: nKeySym
= VK_F9
; break;
3420 case WXK_F10
: nKeySym
= VK_F10
; break;
3421 case WXK_F11
: nKeySym
= VK_F11
; break;
3422 case WXK_F12
: nKeySym
= VK_F12
; break;
3423 case WXK_F13
: nKeySym
= VK_F13
; break;
3424 case WXK_F14
: nKeySym
= VK_F14
; break;
3425 case WXK_F15
: nKeySym
= VK_F15
; break;
3426 case WXK_F16
: nKeySym
= VK_F16
; break;
3427 case WXK_F17
: nKeySym
= VK_F17
; break;
3428 case WXK_F18
: nKeySym
= VK_F18
; break;
3429 case WXK_F19
: nKeySym
= VK_F19
; break;
3430 case WXK_F20
: nKeySym
= VK_F20
; break;
3431 case WXK_F21
: nKeySym
= VK_F21
; break;
3432 case WXK_F22
: nKeySym
= VK_F22
; break;
3433 case WXK_F23
: nKeySym
= VK_F23
; break;
3434 case WXK_F24
: nKeySym
= VK_F24
; break;
3435 case WXK_NUMLOCK
: nKeySym
= VK_NUMLOCK
; break;
3436 case WXK_SCROLL
: nKeySym
= VK_SCRLLOCK
; break;
3439 *bIsVirtual
= FALSE
;
3445 } // end of wxCharCodeWXToOS2
3447 wxWindow
* wxGetActiveWindow()
3449 HWND hWnd
= ::WinQueryActiveWindow(HWND_DESKTOP
);
3453 return wxFindWinFromHandle((WXHWND
)hWnd
);
3456 } // end of wxGetActiveWindow
3459 const char* wxGetMessageName(
3464 case 0x0000: return "WM_NULL";
3465 case 0x0001: return "WM_CREATE";
3466 case 0x0002: return "WM_DESTROY";
3467 case 0x0004: return "WM_ENABLE";
3468 case 0x0005: return "WM_SHOW";
3469 case 0x0006: return "WM_MOVE";
3470 case 0x0007: return "WM_SIZE";
3471 case 0x0008: return "WM_ADJUSTWINDOWPOS";
3472 case 0x0009: return "WM_CALCVALIDRECTS";
3473 case 0x000A: return "WM_SETWINDOWPARAMS";
3474 case 0x000B: return "WM_QUERYWINDOWPARAMS";
3475 case 0x000C: return "WM_HITTEST";
3476 case 0x000D: return "WM_ACTIVATE";
3477 case 0x000F: return "WM_SETFOCUS";
3478 case 0x0010: return "WM_SETSELECTION";
3479 case 0x0011: return "WM_PPAINT";
3480 case 0x0012: return "WM_PSETFOCUS";
3481 case 0x0013: return "WM_PSYSCOLORCHANGE";
3482 case 0x0014: return "WM_PSIZE";
3483 case 0x0015: return "WM_PACTIVATE";
3484 case 0x0016: return "WM_PCONTROL";
3485 case 0x0020: return "WM_COMMAND";
3486 case 0x0021: return "WM_SYSCOMMAND";
3487 case 0x0022: return "WM_HELP";
3488 case 0x0023: return "WM_PAINT";
3489 case 0x0024: return "WM_TIMER";
3490 case 0x0025: return "WM_SEM1";
3491 case 0x0026: return "WM_SEM2";
3492 case 0x0027: return "WM_SEM3";
3493 case 0x0028: return "WM_SEM4";
3494 case 0x0029: return "WM_CLOSE";
3495 case 0x002A: return "WM_QUIT";
3496 case 0x002B: return "WM_SYSCOLORCHANGE";
3497 case 0x002D: return "WM_SYSVALUECHANGE";
3498 case 0x002E: return "WM_APPTERMINATENOTIFY";
3499 case 0x002F: return "WM_PRESPARAMCHANGED";
3500 // Control notification messages
3501 case 0x0030: return "WM_CONTROL";
3502 case 0x0031: return "WM_VSCROLL";
3503 case 0x0032: return "WM_HSCROLL";
3504 case 0x0033: return "WM_INITMENU";
3505 case 0x0034: return "WM_MENUSELECT";
3506 case 0x0035: return "WM_MENUSEND";
3507 case 0x0036: return "WM_DRAWITEM";
3508 case 0x0037: return "WM_MEASUREITEM";
3509 case 0x0038: return "WM_CONTROLPOINTER";
3510 case 0x003A: return "WM_QUERYDLGCODE";
3511 case 0x003B: return "WM_INITDLG";
3512 case 0x003C: return "WM_SUBSTITUTESTRING";
3513 case 0x003D: return "WM_MATCHMNEMONIC";
3514 case 0x003E: return "WM_SAVEAPPLICATION";
3515 case 0x0129: return "WM_CTLCOLORCHANGE";
3516 case 0x0130: return "WM_QUERYCTLTYPE";
3518 case 0x0040: return "WM_FLASHWINDOW";
3519 case 0x0041: return "WM_FORMATFRAME";
3520 case 0x0042: return "WM_UPDATEFRAME";
3521 case 0x0043: return "WM_FOCUSCHANGE";
3522 case 0x0044: return "WM_SETBORDERSIZE";
3523 case 0x0045: return "WM_TRACKFRAME";
3524 case 0x0046: return "WM_MINMAXFRAME";
3525 case 0x0047: return "WM_SETICON";
3526 case 0x0048: return "WM_QUERYICON";
3527 case 0x0049: return "WM_SETACCELTABLE";
3528 case 0x004A: return "WM_QUERYACCELTABLE";
3529 case 0x004B: return "WM_TRANSLATEACCEL";
3530 case 0x004C: return "WM_QUERYTRACKINFO";
3531 case 0x004D: return "WM_QUERYBORDERSIZE";
3532 case 0x004E: return "WM_NEXTMENU";
3533 case 0x004F: return "WM_ERASEBACKGROUND";
3534 case 0x0050: return "WM_QUERYFRAMEINFO";
3535 case 0x0051: return "WM_QUERYFOCUSCHAIN";
3536 case 0x0052: return "WM_OWNERPOSCHANGE";
3537 case 0x0053: return "WM_CACLFRAMERECT";
3538 case 0x0055: return "WM_WINDOWPOSCHANGED";
3539 case 0x0056: return "WM_ADJUSTFRAMEPOS";
3540 case 0x0059: return "WM_QUERYFRAMECTLCOUNT";
3541 case 0x005B: return "WM_QUERYHELPINFO";
3542 case 0x005C: return "WM_SETHELPINFO";
3543 case 0x005D: return "WM_ERROR";
3544 case 0x005E: return "WM_REALIZEPALETTE";
3545 // Clipboard messages
3546 case 0x0060: return "WM_RENDERFMT";
3547 case 0x0061: return "WM_RENDERALLFMTS";
3548 case 0x0062: return "WM_DESTROYCLIPBOARD";
3549 case 0x0063: return "WM_PAINTCLIPBOARD";
3550 case 0x0064: return "WM_SIZECLIPBOARD";
3551 case 0x0065: return "WM_HSCROLLCLIPBOARD";
3552 case 0x0066: return "WM_VSCROLLCLIPBOARD";
3553 case 0x0067: return "WM_DRAWCLIPBOARD";
3555 case 0x0070: return "WM_MOUSEMOVE";
3556 case 0x0071: return "WM_BUTTON1DOWN";
3557 case 0x0072: return "WM_BUTTON1UP";
3558 case 0x0073: return "WM_BUTTON1DBLCLK";
3559 case 0x0074: return "WM_BUTTON2DOWN";
3560 case 0x0075: return "WM_BUTTON2UP";
3561 case 0x0076: return "WM_BUTTON2DBLCLK";
3562 case 0x0077: return "WM_BUTTON3DOWN";
3563 case 0x0078: return "WM_BUTTON3UP";
3564 case 0x0079: return "WM_BUTTON3DBLCLK";
3565 case 0x007D: return "WM_MOUSEMAP";
3566 case 0x007E: return "WM_VRNDISABLED";
3567 case 0x007F: return "WM_VRNENABLED";
3568 case 0x0410: return "WM_CHORD";
3569 case 0x0411: return "WM_BUTTON1MOTIONSTART";
3570 case 0x0412: return "WM_BUTTON1MOTIONEND";
3571 case 0x0413: return "WM_BUTTON1CLICK";
3572 case 0x0414: return "WM_BUTTON2MOTIONSTART";
3573 case 0x0415: return "WM_BUTTON2MOTIONEND";
3574 case 0x0416: return "WM_BUTTON2CLICK";
3575 case 0x0417: return "WM_BUTTON3MOTIONSTART";
3576 case 0x0418: return "WM_BUTTON3MOTIONEND";
3577 case 0x0419: return "WM_BUTTON3CLICK";
3578 case 0x0420: return "WM_BEGINDRAG";
3579 case 0x0421: return "WM_ENDDRAG";
3580 case 0x0422: return "WM_SINGLESELECT";
3581 case 0x0423: return "WM_OPEN";
3582 case 0x0424: return "WM_CONTEXTMENU";
3583 case 0x0425: return "WM_CONTEXTHELP";
3584 case 0x0426: return "WM_TEXTEDIT";
3585 case 0x0427: return "WM_BEGINSELECT";
3586 case 0x0228: return "WM_ENDSELECT";
3587 case 0x0429: return "WM_PICKUP";
3588 case 0x04C0: return "WM_PENFIRST";
3589 case 0x04FF: return "WM_PENLAST";
3590 case 0x0500: return "WM_MMPMFIRST";
3591 case 0x05FF: return "WM_MMPMLAST";
3592 case 0x0600: return "WM_STDDLGFIRST";
3593 case 0x06FF: return "WM_STDDLGLAST";
3594 case 0x0BD0: return "WM_BIDI_FIRST";
3595 case 0x0BFF: return "WM_BIDI_LAST";
3597 case 0x007A: return "WM_CHAR";
3598 case 0x007B: return "WM_VIOCHAR";
3600 case 0x00A0: return "WM_DDE_INITIATE";
3601 case 0x00A1: return "WM_DDE_REQUEST";
3602 case 0x00A2: return "WM_DDE_ACK";
3603 case 0x00A3: return "WM_DDE_DATA";
3604 case 0x00A4: return "WM_DDE_ADVISE";
3605 case 0x00A5: return "WM_DDE_UNADVISE";
3606 case 0x00A6: return "WM_DDE_POKE";
3607 case 0x00A7: return "WM_DDE_EXECUTE";
3608 case 0x00A8: return "WM_DDE_TERMINATE";
3609 case 0x00A9: return "WM_DDE_INITIATEACK";
3610 case 0x00AF: return "WM_DDE_LAST";
3612 case 0x0120: return "BM_CLICK";
3613 case 0x0121: return "BM_QUERYCHECKINDEX";
3614 case 0x0122: return "BM_QUERYHILITE";
3615 case 0x0123: return "BM_SETHILITE";
3616 case 0x0124: return "BM_QUERYCHECK";
3617 case 0x0125: return "BM_SETCHECK";
3618 case 0x0126: return "BM_SETDEFAULT";
3619 case 0x0128: return "BM_AUTOSIZE";
3621 case 0x029A: return "CBID_LIST";
3622 case 0x029B: return "CBID_EDIT";
3623 case 0x0170: return "CBM_SHOWLIST";
3624 case 0x0171: return "CBM_HILITE";
3625 case 0x0172: return "CBM_ISLISTSHOWING";
3627 case 0x0140: return "EM_QUERYCHANGED";
3628 case 0x0141: return "EM_QUERYSEL";
3629 case 0x0142: return "EM_SETSEL";
3630 case 0x0143: return "EM_SETTEXTLIMIT";
3631 case 0x0144: return "EM_CUT";
3632 case 0x0145: return "EM_COPY";
3633 case 0x0146: return "EM_CLEAR";
3634 case 0x0147: return "EM_PASTE";
3635 case 0x0148: return "EM_QUERYFIRSTCHAR";
3636 case 0x0149: return "EM_SETFIRSTCHAR";
3637 case 0x014A: return "EM_QUERYREADONLY";
3638 case 0x014B: return "EM_SETREADONLY";
3639 case 0x014C: return "EM_SETINSERTMODE";
3641 case 0x0160: return "LM_QUERYITEMCOUNT";
3642 case 0x0161: return "LM_INSERTITEM";
3643 case 0x0162: return "LM_SETOPENINDEX";
3644 case 0x0163: return "LM_DELETEITEM";
3645 case 0x0164: return "LM_SELECTITEM";
3646 case 0x0165: return "LM_QUERYSELECTION";
3647 case 0x0166: return "LM_SETITEMTEXT";
3648 case 0x0167: return "LM_QUERYITEMTEXTLENGTH";
3649 case 0x0168: return "LM_QUERYITEMTEXT";
3650 case 0x0169: return "LM_SETITEMHANDLE";
3651 case 0x016A: return "LM_QUERYITEMHANDLE";
3652 case 0x016B: return "LM_SEARCHSTRING";
3653 case 0x016C: return "LM_SETITEMHEIGHT";
3654 case 0x016D: return "LM_QUERYTOPINDEX";
3655 case 0x016E: return "LM_DELETEALL";
3656 case 0x016F: return "LM_INSERTMULITEMS";
3657 case 0x0660: return "LM_SETITEMWIDTH";
3659 case 0x0180: return "MM_INSERTITEM";
3660 case 0x0181: return "MM_DELETEITEM";
3661 case 0x0182: return "MM_QUERYITEM";
3662 case 0x0183: return "MM_SETITEM";
3663 case 0x0184: return "MM_QUERYITEMCOUNT";
3664 case 0x0185: return "MM_STARTMENUMODE";
3665 case 0x0186: return "MM_ENDMENUMODE";
3666 case 0x0188: return "MM_REMOVEITEM";
3667 case 0x0189: return "MM_SELECTITEM";
3668 case 0x018A: return "MM_QUERYSELITEMID";
3669 case 0x018B: return "MM_QUERYITEMTEXT";
3670 case 0x018C: return "MM_QUERYITEMTEXTLENGTH";
3671 case 0x018D: return "MM_SETITEMHANDLE";
3672 case 0x018E: return "MM_SETITEMTEXT";
3673 case 0x018F: return "MM_ITEMPOSITIONFROMID";
3674 case 0x0190: return "MM_ITEMIDFROMPOSITION";
3675 case 0x0191: return "MM_QUERYITEMATTR";
3676 case 0x0192: return "MM_SETITEMATTR";
3677 case 0x0193: return "MM_ISITEMVALID";
3678 case 0x0194: return "MM_QUERYITEMRECT";
3679 case 0x0431: return "MM_QUERYDEFAULTITEMID";
3680 case 0x0432: return "MM_SETDEFAULTITEMID";
3682 case 0x01A0: return "SBM_SETSCROLLBAR";
3683 case 0x01A1: return "SBM_SETPOS";
3684 case 0x01A2: return "SBM_QUERYPOS";
3685 case 0x01A3: return "SBM_QUERYRANGE";
3686 case 0x01A6: return "SBM_SETTHUMBSIZE";
3689 case 0x0F00: return "WM_HELPBASE";
3690 case 0x0FFF: return "WM_HELPTOP";
3691 // Beginning of user defined messages
3692 case 0x1000: return "WM_USER";
3694 // wxWindows user defined types
3697 // case 0x1000 + 0: return "LVM_GETBKCOLOR";
3698 case 0x1000 + 1: return "LVM_SETBKCOLOR";
3699 case 0x1000 + 2: return "LVM_GETIMAGELIST";
3700 case 0x1000 + 3: return "LVM_SETIMAGELIST";
3701 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
3702 case 0x1000 + 5: return "LVM_GETITEMA";
3703 case 0x1000 + 75: return "LVM_GETITEMW";
3704 case 0x1000 + 6: return "LVM_SETITEMA";
3705 case 0x1000 + 76: return "LVM_SETITEMW";
3706 case 0x1000 + 7: return "LVM_INSERTITEMA";
3707 case 0x1000 + 77: return "LVM_INSERTITEMW";
3708 case 0x1000 + 8: return "LVM_DELETEITEM";
3709 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
3710 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
3711 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
3712 case 0x1000 + 12: return "LVM_GETNEXTITEM";
3713 case 0x1000 + 13: return "LVM_FINDITEMA";
3714 case 0x1000 + 83: return "LVM_FINDITEMW";
3715 case 0x1000 + 14: return "LVM_GETITEMRECT";
3716 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
3717 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
3718 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
3719 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
3720 case 0x1000 + 18: return "LVM_HITTEST";
3721 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
3722 case 0x1000 + 20: return "LVM_SCROLL";
3723 case 0x1000 + 21: return "LVM_REDRAWITEMS";
3724 case 0x1000 + 22: return "LVM_ARRANGE";
3725 case 0x1000 + 23: return "LVM_EDITLABELA";
3726 case 0x1000 + 118: return "LVM_EDITLABELW";
3727 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
3728 case 0x1000 + 25: return "LVM_GETCOLUMNA";
3729 case 0x1000 + 95: return "LVM_GETCOLUMNW";
3730 case 0x1000 + 26: return "LVM_SETCOLUMNA";
3731 case 0x1000 + 96: return "LVM_SETCOLUMNW";
3732 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
3733 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
3734 case 0x1000 + 28: return "LVM_DELETECOLUMN";
3735 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
3736 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
3737 case 0x1000 + 31: return "LVM_GETHEADER";
3738 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
3739 case 0x1000 + 34: return "LVM_GETVIEWRECT";
3740 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
3741 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
3742 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
3743 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
3744 case 0x1000 + 39: return "LVM_GETTOPINDEX";
3745 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
3746 case 0x1000 + 41: return "LVM_GETORIGIN";
3747 case 0x1000 + 42: return "LVM_UPDATE";
3748 case 0x1000 + 43: return "LVM_SETITEMSTATE";
3749 case 0x1000 + 44: return "LVM_GETITEMSTATE";
3750 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
3751 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
3752 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
3753 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
3754 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
3755 case 0x1000 + 48: return "LVM_SORTITEMS";
3756 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
3757 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
3758 case 0x1000 + 51: return "LVM_GETITEMSPACING";
3759 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
3760 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
3761 case 0x1000 + 53: return "LVM_SETICONSPACING";
3762 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
3763 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
3764 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
3765 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
3766 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
3767 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
3768 case 0x1000 + 60: return "LVM_SETHOTITEM";
3769 case 0x1000 + 61: return "LVM_GETHOTITEM";
3770 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
3771 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
3772 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
3773 case 0x1000 + 65: return "LVM_SETWORKAREA";
3776 case 0x1100 + 0: return "TVM_INSERTITEMA";
3777 case 0x1100 + 50: return "TVM_INSERTITEMW";
3778 case 0x1100 + 1: return "TVM_DELETEITEM";
3779 case 0x1100 + 2: return "TVM_EXPAND";
3780 case 0x1100 + 4: return "TVM_GETITEMRECT";
3781 case 0x1100 + 5: return "TVM_GETCOUNT";
3782 case 0x1100 + 6: return "TVM_GETINDENT";
3783 case 0x1100 + 7: return "TVM_SETINDENT";
3784 case 0x1100 + 8: return "TVM_GETIMAGELIST";
3785 case 0x1100 + 9: return "TVM_SETIMAGELIST";
3786 case 0x1100 + 10: return "TVM_GETNEXTITEM";
3787 case 0x1100 + 11: return "TVM_SELECTITEM";
3788 case 0x1100 + 12: return "TVM_GETITEMA";
3789 case 0x1100 + 62: return "TVM_GETITEMW";
3790 case 0x1100 + 13: return "TVM_SETITEMA";
3791 case 0x1100 + 63: return "TVM_SETITEMW";
3792 case 0x1100 + 14: return "TVM_EDITLABELA";
3793 case 0x1100 + 65: return "TVM_EDITLABELW";
3794 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
3795 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
3796 case 0x1100 + 17: return "TVM_HITTEST";
3797 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
3798 case 0x1100 + 19: return "TVM_SORTCHILDREN";
3799 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
3800 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
3801 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
3802 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
3803 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
3804 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
3805 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
3808 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
3809 case 0x1200 + 1: return "HDM_INSERTITEMA";
3810 case 0x1200 + 10: return "HDM_INSERTITEMW";
3811 case 0x1200 + 2: return "HDM_DELETEITEM";
3812 case 0x1200 + 3: return "HDM_GETITEMA";
3813 case 0x1200 + 11: return "HDM_GETITEMW";
3814 case 0x1200 + 4: return "HDM_SETITEMA";
3815 case 0x1200 + 12: return "HDM_SETITEMW";
3816 case 0x1200 + 5: return "HDM_LAYOUT";
3817 case 0x1200 + 6: return "HDM_HITTEST";
3818 case 0x1200 + 7: return "HDM_GETITEMRECT";
3819 case 0x1200 + 8: return "HDM_SETIMAGELIST";
3820 case 0x1200 + 9: return "HDM_GETIMAGELIST";
3821 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
3822 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
3823 case 0x1200 + 17: return "HDM_GETORDERARRAY";
3824 case 0x1200 + 18: return "HDM_SETORDERARRAY";
3825 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
3828 case 0x1300 + 2: return "TCM_GETIMAGELIST";
3829 case 0x1300 + 3: return "TCM_SETIMAGELIST";
3830 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
3831 case 0x1300 + 5: return "TCM_GETITEMA";
3832 case 0x1300 + 60: return "TCM_GETITEMW";
3833 case 0x1300 + 6: return "TCM_SETITEMA";
3834 case 0x1300 + 61: return "TCM_SETITEMW";
3835 case 0x1300 + 7: return "TCM_INSERTITEMA";
3836 case 0x1300 + 62: return "TCM_INSERTITEMW";
3837 case 0x1300 + 8: return "TCM_DELETEITEM";
3838 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
3839 case 0x1300 + 10: return "TCM_GETITEMRECT";
3840 case 0x1300 + 11: return "TCM_GETCURSEL";
3841 case 0x1300 + 12: return "TCM_SETCURSEL";
3842 case 0x1300 + 13: return "TCM_HITTEST";
3843 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
3844 case 0x1300 + 40: return "TCM_ADJUSTRECT";
3845 case 0x1300 + 41: return "TCM_SETITEMSIZE";
3846 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
3847 case 0x1300 + 43: return "TCM_SETPADDING";
3848 case 0x1300 + 44: return "TCM_GETROWCOUNT";
3849 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
3850 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
3851 case 0x1300 + 47: return "TCM_GETCURFOCUS";
3852 case 0x1300 + 48: return "TCM_SETCURFOCUS";
3853 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
3854 case 0x1300 + 50: return "TCM_DESELECTALL";
3857 case WM_USER
+1000+1: return "TB_ENABLEBUTTON";
3858 case WM_USER
+1000+2: return "TB_CHECKBUTTON";
3859 case WM_USER
+1000+3: return "TB_PRESSBUTTON";
3860 case WM_USER
+1000+4: return "TB_HIDEBUTTON";
3861 case WM_USER
+1000+5: return "TB_INDETERMINATE";
3862 case WM_USER
+1000+9: return "TB_ISBUTTONENABLED";
3863 case WM_USER
+1000+10: return "TB_ISBUTTONCHECKED";
3864 case WM_USER
+1000+11: return "TB_ISBUTTONPRESSED";
3865 case WM_USER
+1000+12: return "TB_ISBUTTONHIDDEN";
3866 case WM_USER
+1000+13: return "TB_ISBUTTONINDETERMINATE";
3867 case WM_USER
+1000+17: return "TB_SETSTATE";
3868 case WM_USER
+1000+18: return "TB_GETSTATE";
3869 case WM_USER
+1000+19: return "TB_ADDBITMAP";
3870 case WM_USER
+1000+20: return "TB_ADDBUTTONS";
3871 case WM_USER
+1000+21: return "TB_INSERTBUTTON";
3872 case WM_USER
+1000+22: return "TB_DELETEBUTTON";
3873 case WM_USER
+1000+23: return "TB_GETBUTTON";
3874 case WM_USER
+1000+24: return "TB_BUTTONCOUNT";
3875 case WM_USER
+1000+25: return "TB_COMMANDTOINDEX";
3876 case WM_USER
+1000+26: return "TB_SAVERESTOREA";
3877 case WM_USER
+1000+76: return "TB_SAVERESTOREW";
3878 case WM_USER
+1000+27: return "TB_CUSTOMIZE";
3879 case WM_USER
+1000+28: return "TB_ADDSTRINGA";
3880 case WM_USER
+1000+77: return "TB_ADDSTRINGW";
3881 case WM_USER
+1000+29: return "TB_GETITEMRECT";
3882 case WM_USER
+1000+30: return "TB_BUTTONSTRUCTSIZE";
3883 case WM_USER
+1000+31: return "TB_SETBUTTONSIZE";
3884 case WM_USER
+1000+32: return "TB_SETBITMAPSIZE";
3885 case WM_USER
+1000+33: return "TB_AUTOSIZE";
3886 case WM_USER
+1000+35: return "TB_GETTOOLTIPS";
3887 case WM_USER
+1000+36: return "TB_SETTOOLTIPS";
3888 case WM_USER
+1000+37: return "TB_SETPARENT";
3889 case WM_USER
+1000+39: return "TB_SETROWS";
3890 case WM_USER
+1000+40: return "TB_GETROWS";
3891 case WM_USER
+1000+42: return "TB_SETCMDID";
3892 case WM_USER
+1000+43: return "TB_CHANGEBITMAP";
3893 case WM_USER
+1000+44: return "TB_GETBITMAP";
3894 case WM_USER
+1000+45: return "TB_GETBUTTONTEXTA";
3895 case WM_USER
+1000+75: return "TB_GETBUTTONTEXTW";
3896 case WM_USER
+1000+46: return "TB_REPLACEBITMAP";
3897 case WM_USER
+1000+47: return "TB_SETINDENT";
3898 case WM_USER
+1000+48: return "TB_SETIMAGELIST";
3899 case WM_USER
+1000+49: return "TB_GETIMAGELIST";
3900 case WM_USER
+1000+50: return "TB_LOADIMAGES";
3901 case WM_USER
+1000+51: return "TB_GETRECT";
3902 case WM_USER
+1000+52: return "TB_SETHOTIMAGELIST";
3903 case WM_USER
+1000+53: return "TB_GETHOTIMAGELIST";
3904 case WM_USER
+1000+54: return "TB_SETDISABLEDIMAGELIST";
3905 case WM_USER
+1000+55: return "TB_GETDISABLEDIMAGELIST";
3906 case WM_USER
+1000+56: return "TB_SETSTYLE";
3907 case WM_USER
+1000+57: return "TB_GETSTYLE";
3908 case WM_USER
+1000+58: return "TB_GETBUTTONSIZE";
3909 case WM_USER
+1000+59: return "TB_SETBUTTONWIDTH";
3910 case WM_USER
+1000+60: return "TB_SETMAXTEXTROWS";
3911 case WM_USER
+1000+61: return "TB_GETTEXTROWS";
3912 case WM_USER
+1000+41: return "TB_GETBITMAPFLAGS";
3915 static char s_szBuf
[128];
3916 sprintf(s_szBuf
, "<unknown message = %d>", nMessage
);
3920 } // end of wxGetMessageName
3922 #endif // __WXDEBUG__
3924 static void TranslateKbdEventToMouse(
3932 // Construct the key mask
3933 ULONG
& fwKeys
= *pFlags
;
3935 fwKeys
= VK_BUTTON2
;
3936 if ((::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x100) != 0)
3938 if ((::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x100) != 0)
3942 // Simulate right mouse button click
3946 ::WinQueryMsgPos(vHabmain
, &vPoint
);
3950 pWin
->ScreenToClient(pX
, pY
);
3951 } // end of TranslateKbdEventToMouse