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
87 // ---------------------------------------------------------------------------
89 // ---------------------------------------------------------------------------
92 // The last Windows message we got (MT-UNSAFE)
94 extern WXMSGID s_currentMsg
;
96 wxMenu
* wxCurrentPopupMenu
= NULL
;
97 extern wxList WXDLLEXPORT wxPendingDelete
;
98 extern wxChar
* wxCanvasClassName
;
99 wxList
* wxWinHandleList
= NULL
;
101 // ---------------------------------------------------------------------------
103 // ---------------------------------------------------------------------------
106 // the window proc for all our windows; most gui's have something similar
108 MRESULT
wxWndProc( HWND hWnd
115 const char *wxGetMessageName(int message
);
118 void wxRemoveHandleAssociation(wxWindow
* pWin
);
119 void wxAssociateWinWithHandle( HWND hWnd
122 wxWindow
* wxFindWinFromHandle(WXHWND hWnd
);
125 // This magical function is used to translate VK_APPS key presses to right
128 static void TranslateKbdEventToMouse( wxWindow
* pWin
135 // get the current state of SHIFT/CTRL keys
137 static inline bool IsShiftDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) & 0x8000) != 0; }
138 static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) & 0x8000) != 0; }
139 // ---------------------------------------------------------------------------
141 // ---------------------------------------------------------------------------
143 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxWindowBase
)
145 BEGIN_EVENT_TABLE(wxWindow
, wxWindowBase
)
146 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground
)
147 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged
)
148 EVT_INIT_DIALOG(wxWindow::OnInitDialog
)
149 EVT_IDLE(wxWindow::OnIdle
)
152 // ===========================================================================
154 // ===========================================================================
157 // Find an item given the PM Window id
159 wxWindow
* wxWindow::FindItem(
163 wxControl
* pItem
= wxDynamicCast( this
170 // I it we or one of our "internal" children?
172 if (pItem
->GetId() == lId
||
173 (pItem
->GetSubcontrols().Index(lId
) != wxNOT_FOUND
))
179 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
183 wxWindow
* pChildWin
= pCurrent
->GetData();
184 wxWindow
* pWnd
= pChildWin
->FindItem(lId
);
189 pCurrent
= pCurrent
->GetNext();
192 } // end of wxWindow::FindItem
195 // Find an item given the PM Window handle
197 wxWindow
* wxWindow::FindItemByHWND(
202 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
206 wxWindow
* pParent
= pCurrent
->GetData();
209 // Do a recursive search.
211 wxWindow
* pWnd
= pParent
->FindItemByHWND(hWnd
);
216 if (!bControlOnly
|| pParent
->IsKindOf(CLASSINFO(wxControl
)))
218 wxWindow
* pItem
= pCurrent
->GetData();
220 if (pItem
->GetHWND() == hWnd
)
224 if (pItem
->ContainsHWND(hWnd
))
228 pCurrent
= pCurrent
->GetNext();
231 } // end of wxWindow::FindItemByHWND
234 // Default command handler
236 bool wxWindow::OS2Command(
237 WXUINT
WXUNUSED(uParam
)
238 , WXWORD
WXUNUSED(uId
)
244 // ----------------------------------------------------------------------------
245 // constructors and such
246 // ----------------------------------------------------------------------------
248 void wxWindow::Init()
258 m_bDoubleClickAllowed
= 0;
259 m_bWinCaptured
= FALSE
;
261 m_isBeingDeleted
= FALSE
;
264 m_bMouseInWindow
= FALSE
;
273 // Pass WM_GETDLGCODE to DefWindowProc()
278 m_bBackgroundTransparent
= FALSE
;
281 // As all windows are created with WS_VISIBLE style...
285 #if wxUSE_MOUSEEVENT_HACK
288 m_nLastMouseEvent
= -1;
289 #endif // wxUSE_MOUSEEVENT_HACK
295 wxWindow::~wxWindow()
297 m_isBeingDeleted
= TRUE
;
299 OS2DetachWindowMenu();
301 m_parent
->RemoveChild(this);
305 if(!::WinDestroyWindow(GetHWND()))
306 wxLogLastError(wxT("DestroyWindow"));
308 // remove hWnd <-> wxWindow association
310 wxRemoveHandleAssociation(this);
312 } // end of wxWindow::~wxWindow
314 bool wxWindow::Create(
317 , const wxPoint
& rPos
318 , const wxSize
& rSize
320 , const wxString
& rName
323 wxCHECK_MSG(pParent
, FALSE
, wxT("can't create wxWindow without parent"));
325 if ( !CreateBase( pParent
335 pParent
->AddChild(this);
340 // Frame windows and their derivatives only
342 if (lStyle
& wxBORDER
)
343 ulFlags
|= FCF_BORDER
;
344 if (lStyle
& wxTHICK_FRAME
)
345 ulFlags
|= FCF_SIZEBORDER
;
348 // Some generic window styles
350 ulFlags
|= WS_VISIBLE
;
351 if (lStyle
& wxCLIP_CHILDREN
)
352 ulFlags
|= WS_CLIPCHILDREN
;
355 WXDWORD dwExStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &bWant3D
);
358 // OS/2 PM doesn't have "extended" styles but if the library specifies
359 // them and we are creating a frame window then at least give it a border
362 (m_windowStyle
& wxSIMPLE_BORDER
) ||
363 (m_windowStyle
& wxRAISED_BORDER
) ||
364 (m_windowStyle
& wxSUNKEN_BORDER
) ||
365 (m_windowStyle
& wxDOUBLE_BORDER
)
368 ulFlags
|= FCF_BORDER
;
370 OS2Create( m_windowId
377 ,WidthDefault(rSize
.x
)
378 ,HeightDefault(rSize
.y
)
384 } // end of wxWindow::Create
386 // ---------------------------------------------------------------------------
388 // ---------------------------------------------------------------------------
390 void wxWindow::SetFocus()
392 HWND hWnd
= GetHwnd();
395 ::WinSetFocus(HWND_DESKTOP
, hWnd
);
396 } // end of wxWindow::SetFocus
398 wxWindow
* wxWindowBase::FindFocus()
400 HWND hWnd
= ::WinQueryFocus(HWND_DESKTOP
);
404 return wxFindWinFromHandle((WXHWND
)hWnd
);
407 } // wxWindowBase::FindFocus
409 bool wxWindow::Enable(
413 if (!wxWindowBase::Enable(bEnable
))
416 HWND hWnd
= GetHwnd();
419 ::WinEnableWindow(hWnd
, (BOOL
)bEnable
);
421 wxWindowList::Node
* pNode
= GetChildren().GetFirst();
425 wxWindow
* pChild
= pNode
->GetData();
427 pChild
->Enable(bEnable
);
428 pNode
= pNode
->GetNext();
431 } // end of wxWindow::Enable
437 if (!wxWindowBase::Show(bShow
))
440 HWND hWnd
= GetHwnd();
442 ::WinShowWindow(hWnd
, bShow
);
446 ::WinSetWindowPos(hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_ACTIVATE
| SWP_ZORDER
);
449 } // end of wxWindow::Show
451 void wxWindow::Raise()
453 ::WinSetWindowPos(GetHwnd(), HWND_TOP
, 0, 0, 0, 0, SWP_ZORDER
| SWP_ACTIVATE
);
454 } // end of wxWindow::Raise
456 void wxWindow::Lower()
458 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_ZORDER
| SWP_DEACTIVATE
);
459 } // end of wxWindow::Lower
461 void wxWindow::SetTitle(
462 const wxString
& rTitle
465 ::WinSetWindowText(GetHwnd(), rTitle
.c_str());
466 } // end of wxWindow::SetTitle
468 wxString
wxWindow::GetTitle() const
470 return wxGetWindowText(GetHWND());
471 } // end of wxWindow::GetTitle
473 void wxWindow::CaptureMouse()
475 HWND hWnd
= GetHwnd();
477 if (hWnd
&& !m_bWinCaptured
)
479 ::WinSetCapture(HWND_DESKTOP
, hWnd
);
480 m_bWinCaptured
= TRUE
;
482 } // end of wxWindow::GetTitle
484 void wxWindow::ReleaseMouse()
488 ::WinSetCapture(HWND_DESKTOP
, NULLHANDLE
);
489 m_bWinCaptured
= FALSE
;
491 } // end of wxWindow::ReleaseMouse
493 bool wxWindow::SetFont(
497 if (!wxWindowBase::SetFont(rFont
))
503 HWND hWnd
= GetHwnd();
509 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), rFont
.GetFaceName().c_str());
510 return(::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
), (PVOID
)zFont
));
515 bool wxWindow::SetCursor(
516 const wxCursor
& rCursor
517 ) // check if base implementation is OK
519 if ( !wxWindowBase::SetCursor(rCursor
))
525 wxASSERT_MSG( m_cursor
.Ok(),
526 wxT("cursor must be valid after call to the base version"));
528 HWND hWnd
= GetHwnd();
534 hPS
= ::WinGetPS(hWnd
);
536 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
537 ::WinQueryWindowRect(hWnd
, &vRect
);
539 hRGN
= ::GpiCreateRegion(hPS
, 1L, &vRect
);
541 if ((::GpiPtInRegion(hPS
, hRGN
, &vPoint
) == PRGN_INSIDE
) && !wxIsBusy())
543 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)m_cursor
.GetHCURSOR());
546 } // end of wxWindow::SetCursor
548 void wxWindow::WarpPointer(
557 ::WinQueryWindowRect(GetHwnd(), &vRect
);
561 ::WinSetPointerPos(HWND_DESKTOP
, (LONG
)nX
, (LONG
)(nY
));
562 } // end of wxWindow::WarpPointer
564 #if WXWIN_COMPATIBILITY
565 void wxWindow::OS2DeviceToLogical (float *x
, float *y
) const
568 #endif // WXWIN_COMPATIBILITY
570 // ---------------------------------------------------------------------------
572 // ---------------------------------------------------------------------------
574 #if WXWIN_COMPATIBILITY
575 void wxWindow::SetScrollRange(
581 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)0, MPFROM2SHORT(0, nRange
));
582 } // end of wxWindow::SetScrollRange
584 void wxWindow::SetScrollPage(
590 if ( orient
== wxHORIZONTAL
)
596 int wxWindow::OldGetScrollRange(
601 HWND hWnd
= GetHwnd();
605 mRc
= WinSendMsg(hWnd
, SBM_QUERYRANGE
, (MPARAM
)0L, (MPARAM
)0L);
606 return(SHORT2FROMMR(mRc
));
609 } // end of wxWindow::OldGetScrollRange
611 int wxWindow::GetScrollPage(
615 if (nOrient
== wxHORIZONTAL
)
616 return m_nXThumbSize
;
618 return m_nYThumbSize
;
619 } // end of wxWindow::GetScrollPage
620 #endif // WXWIN_COMPATIBILITY
622 int wxWindow::GetScrollPos(
626 return((int)::WinSendMsg(GetHwnd(), SBM_QUERYPOS
, (MPARAM
)NULL
, (MPARAM
)NULL
));
627 } // end of wxWindow::GetScrollPos
629 int wxWindow::GetScrollRange(
635 mr
= ::WinSendMsg(GetHwnd(), SBM_QUERYRANGE
, (MPARAM
)NULL
, (MPARAM
)NULL
);
636 return((int)SHORT2FROMMR(mr
));
637 } // end of wxWindow::GetScrollRange
639 int wxWindow::GetScrollThumb(
643 WNDPARAMS vWndParams
;
646 ::WinSendMsg(GetHwnd(), WM_QUERYWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)NULL
);
647 pSbcd
= (PSBCDATA
)vWndParams
.pCtlData
;
648 return((int)pSbcd
->posThumb
);
649 } // end of wxWindow::GetScrollThumb
651 void wxWindow::SetScrollPos(
657 ::WinSendMsg(GetHwnd(), SBM_SETPOS
, (MPARAM
)nPos
, (MPARAM
)NULL
);
658 } // end of wxWindow::SetScrollPos(
660 void wxWindow::SetScrollbar(
668 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR
, (MPARAM
)nPos
, MPFROM2SHORT(0, nRange
));
669 if (nOrient
== wxHORIZONTAL
)
671 m_nXThumbSize
= nThumbVisible
;
675 m_nYThumbSize
= nThumbVisible
;
677 } // end of wxWindow::SetScrollbar
679 void wxWindow::ScrollWindow(
682 , const wxRect
* pRect
689 vRect2
.xLeft
= pRect
->x
;
690 vRect2
.yTop
= pRect
->y
;
691 vRect2
.xRight
= pRect
->x
+ pRect
->width
;
692 vRect2
.yBottom
= pRect
->y
+ pRect
->height
;
696 ::WinScrollWindow(GetHwnd(), (LONG
)nDx
, (LONG
)nDy
, &vRect2
, NULL
, NULLHANDLE
, NULL
, 0L);
698 ::WinScrollWindow(GetHwnd(), nDx
, nDy
, NULL
, NULL
, NULLHANDLE
, NULL
, 0L);
699 } // end of wxWindow::ScrollWindow
701 // ---------------------------------------------------------------------------
703 // ---------------------------------------------------------------------------
705 void wxWindow::SubclassWin(
710 HWND hwnd
= (HWND
)hWnd
;
712 wxASSERT_MSG( !m_fnOldWndProc
, wxT("subclassing window twice?") );
714 wxCHECK_RET(::WinIsWindow(hab
, hwnd
), wxT("invalid HWND in SubclassWin") );
716 wxAssociateWinWithHandle(hwnd
, this);
718 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(hwnd
, (PFNWP
)wxWndProc
);
719 ::WinSetWindowULong(hwnd
, QWS_USER
, (ULONG
)wxWndProc
);
720 } // end of wxWindow::SubclassWin
722 void wxWindow::UnsubclassWin()
726 wxRemoveHandleAssociation(this);
729 // Restore old Window proc
731 HWND hwnd
= GetHwnd();
737 wxCHECK_RET( ::WinIsWindow(hab
, hwnd
), wxT("invalid HWND in UnsubclassWin") );
739 PFNWP fnProc
= (PFNWP
)::WinQueryWindowULong(hwnd
, QWS_USER
);
740 if ( (m_fnOldWndProc
!= 0) && (fnProc
!= (PFNWP
) m_fnOldWndProc
))
742 WinSubclassWindow(hwnd
, (PFNWP
)m_fnOldWndProc
);
746 } // end of wxWindow::UnsubclassWin
749 // Make a Windows extended style from the given wxWindows window style
751 WXDWORD
wxWindow::MakeExtendedStyle(
753 , bool bEliminateBorders
757 // PM does not support extended style
761 } // end of wxWindow::MakeExtendedStyle
764 // Determines whether native 3D effects or CTL3D should be used,
765 // applying a default border style if required, and returning an extended
766 // style to pass to CreateWindowEx.
768 WXDWORD
wxWindow::Determine3DEffects(
769 WXDWORD dwDefaultBorderStyle
773 WXDWORD dwStyle
= 0L;
776 // Native PM does not have any specialize 3D effects like WIN32 does
780 } // end of wxWindow::Determine3DEffects
782 #if WXWIN_COMPATIBILITY
783 void wxWindow::OnCommand(
785 , wxCommandEvent
& rEvent
788 if (GetEventHandler()->ProcessEvent(rEvent
))
791 m_parent
->GetEventHandler()->OnCommand( rWin
794 } // end of wxWindow::OnCommand
796 wxObject
* wxWindow::GetChild(
801 // Return a pointer to the Nth object in the Panel
803 wxNode
* pNode
= GetChildren().First();
807 pNode
= pNode
->Next();
810 wxObject
* pObj
= (wxObject
*)pNode
->Data();
815 } // end of wxWindow::GetChild
817 #endif // WXWIN_COMPATIBILITY
820 // Setup background and foreground colours correctly
822 void wxWindow::SetupColours()
825 SetBackgroundColour(GetParent()->GetBackgroundColour());
826 } // end of wxWindow::SetupColours
828 void wxWindow::OnIdle(
833 // Check if we need to send a LEAVE event
835 if (m_bMouseInWindow
)
839 ::WinQueryPointerPos(HWND_DESKTOP
, &vPoint
);
840 if (::WinWindowFromPoint(HWND_DESKTOP
, &vPoint
, FALSE
) != (HWND
)GetHwnd())
843 // Generate a LEAVE event
845 m_bMouseInWindow
= FALSE
;
848 // Unfortunately the mouse button and keyboard state may have changed
849 // by the time the OnIdle function is called, so 'state' may be
854 if (::WinGetKeyState(HWND_DESKTOP
, VK_SHIFT
) != 0)
856 if (::WinGetKeyState(HWND_DESKTOP
, VK_CTRL
) != 0);
859 wxMouseEvent
rEvent(wxEVT_LEAVE_WINDOW
);
861 InitMouseEvent( rEvent
866 (void)GetEventHandler()->ProcessEvent(rEvent
);
870 } // end of wxWindow::OnIdle
873 // Set this window to be the child of 'parent'.
875 bool wxWindow::Reparent(
879 if (!wxWindowBase::Reparent(pParent
))
882 HWND hWndChild
= GetHwnd();
883 HWND hWndParent
= GetParent() ? GetWinHwnd(GetParent()) : (HWND
)0;
885 ::WinSetParent(hWndChild
, hWndParent
, TRUE
);
887 } // end of wxWindow::Reparent
889 void wxWindow::Clear()
891 wxClientDC
vDc(this);
892 wxBrush
vBrush( GetBackgroundColour()
896 vDc
.SetBackground(vBrush
);
898 } // end of wxWindow::Clear
900 void wxWindow::Refresh(
902 , const wxRect
* pRect
905 HWND hWnd
= GetHwnd();
913 vOs2Rect
.xLeft
= pRect
->x
;
914 vOs2Rect
.yTop
= pRect
->y
;
915 vOs2Rect
.xRight
= pRect
->x
+ pRect
->width
;
916 vOs2Rect
.yBottom
= pRect
->y
+ pRect
->height
;
918 ::WinInvalidateRect(hWnd
, &vOs2Rect
, bEraseBack
);
921 ::WinInvalidateRect(hWnd
, NULL
, bEraseBack
);
923 } // end of wxWindow::Refresh
925 // ---------------------------------------------------------------------------
927 // ---------------------------------------------------------------------------
929 #if wxUSE_DRAG_AND_DROP
930 void wxWindow::SetDropTarget(
931 wxDropTarget
* pDropTarget
934 if (m_dropTarget
!= 0)
936 m_dropTarget
->Revoke(m_hWnd
);
939 m_dropTarget
= pDropTarget
;
940 if (m_dropTarget
!= 0)
941 m_dropTarget
->Register(m_hWnd
);
942 } // end of wxWindow::SetDropTarget
946 // old style file-manager drag&drop support: we retain the old-style
947 // DragAcceptFiles in parallel with SetDropTarget.
949 void wxWindow::DragAcceptFiles(
953 HWND hWnd
= GetHwnd();
956 ::DrgAcceptDroppedFiles(hWnd
, NULL
, NULL
, DO_COPY
, 0L);
957 } // end of wxWindow::DragAcceptFiles
959 // ----------------------------------------------------------------------------
961 // ----------------------------------------------------------------------------
965 void wxWindow::DoSetToolTip(
969 wxWindowBase::DoSetToolTip(pTooltip
);
972 m_tooltip
->SetWindow(this);
973 } // end of wxWindow::DoSetToolTip
975 #endif // wxUSE_TOOLTIPS
977 // ---------------------------------------------------------------------------
978 // moving and resizing
979 // ---------------------------------------------------------------------------
982 void wxWindow::DoGetSize(
987 HWND hWnd
= GetHwnd();
990 ::WinQueryWindowRect(hWnd
, &vRect
);
993 *pWidth
= vRect
.xRight
- vRect
.xLeft
;
995 // OS/2 PM is backwards from windows
996 *pHeight
= vRect
.yTop
- vRect
.yBottom
;
997 } // end of wxWindow::DoGetSize
999 void wxWindow::DoGetPosition(
1004 HWND hWnd
= GetHwnd();
1008 ::WinQueryWindowRect(hWnd
, &vRect
);
1010 vPoint
.x
= vRect
.xLeft
;
1011 vPoint
.y
= vRect
.yBottom
;
1014 // We do the adjustments with respect to the parent only for the "real"
1015 // children, not for the dialogs/frames
1019 HWND hParentWnd
= 0;
1020 wxWindow
* pParent
= GetParent();
1023 hParentWnd
= GetWinHwnd(pParent
);
1026 // Since we now have the absolute screen coords, if there's a parent we
1027 // must subtract its bottom left corner
1033 ::WinQueryWindowRect(hParentWnd
, &vRect2
);
1034 vPoint
.x
-= vRect
.xLeft
;
1035 vPoint
.y
-= vRect
.yBottom
;
1039 // We may be faking the client origin. So a window that's really at (0,
1040 // 30) may appear (to wxWin apps) to be at (0, 0).
1042 wxPoint
vPt(pParent
->GetClientAreaOrigin());
1052 } // end of wxWindow::DoGetPosition
1054 void wxWindow::DoScreenToClient(
1059 HWND hWnd
= GetHwnd();
1062 ::WinQueryWindowPos(hWnd
, &vSwp
);
1068 } // end of wxWindow::DoScreenToClient
1070 void wxWindow::DoClientToScreen(
1075 HWND hWnd
= GetHwnd();
1078 ::WinQueryWindowPos(hWnd
, &vSwp
);
1084 } // end of wxWindow::DoClientToScreen
1087 // Get size *available for subwindows* i.e. excluding menu bar etc.
1088 // Must be a frame type window
1090 void wxWindow::DoGetClientSize(
1095 HWND hWnd
= GetHwnd();
1099 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1100 ::WinQueryWindowRect(hWndClient
, &vRect
);
1103 *pWidth
= vRect
.xRight
;
1105 *pHeight
= vRect
.yTop
;
1106 } // end of wxWindow::DoGetClientSize
1108 void wxWindow::DoMoveWindow(
1115 if ( !::WinSetWindowPos( GetHwnd()
1121 ,SWP_SIZE
| SWP_MOVE
1124 wxLogLastError("MoveWindow");
1126 } // end of wxWindow::DoMoveWindow
1129 // Set the size of the window: if the dimensions are positive, just use them,
1130 // but if any of them is equal to -1, it means that we must find the value for
1131 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
1132 // which case -1 is a valid value for x and y)
1134 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
1135 // the width/height to best suit our contents, otherwise we reuse the current
1138 void wxWindow::DoSetSize(
1147 // Get the current size and position...
1153 wxSize
vSize(-1, -1);
1155 GetPosition( &nCurrentX
1158 GetSize( &nCurrentWidth
1163 // ... and don't do anything (avoiding flicker) if it's already ok
1165 if ( nX
== nCurrentX
&&
1167 nWidth
== nCurrentWidth
&&
1168 nHeight
== nCurrentHeight
1174 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1176 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
1179 AdjustForParentClientOrigin( nX
1186 if (nSizeFlags
& wxSIZE_AUTO_WIDTH
)
1188 vSize
= DoGetBestSize();
1194 // Just take the current one
1196 nWidth
= nCurrentWidth
;
1202 if (nSizeFlags
& wxSIZE_AUTO_HEIGHT
)
1206 vSize
= DoGetBestSize();
1212 // just take the current one
1213 nHeight
= nCurrentHeight
;
1222 } // end of wxWindow::DoSetSize
1224 void wxWindow::DoSetClientSize(
1229 wxWindow
* pParent
= GetParent();
1230 HWND hWnd
= GetHwnd();
1231 HWND hParentWnd
= (HWND
)0;
1232 HWND hClientWnd
= (HWND
)0;
1237 hClientWnd
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1238 ::WinQueryWindowRect(hClientWnd
, &vRect2
);
1241 hParentWnd
= (HWND
) pParent
->GetHWND();
1243 ::WinQueryWindowRect(hWnd
, &vRect
);
1244 ::WinQueryWindowRect(hParentWnd
, &vRect3
);
1246 // Find the difference between the entire window (title bar and all)
1247 // and the client area; add this to the new client size to move the
1248 // window. OS/2 is backward from windows on height
1250 int nActualWidth
= vRect2
.xRight
- vRect2
.xLeft
- vRect
.xRight
+ nWidth
;
1251 int nActualHeight
= vRect2
.yTop
- vRect2
.yBottom
- vRect
.yTop
+ nHeight
;
1254 // If there's a parent, must subtract the parent's bottom left corner
1255 // since MoveWindow moves relative to the parent
1259 vPoint
.x
= vRect2
.xLeft
;
1260 vPoint
.y
= vRect2
.yBottom
;
1263 vPoint
.x
-= vRect3
.xLeft
;
1264 vPoint
.y
-= vRect3
.yBottom
;
1267 DoMoveWindow( vPoint
.x
1273 wxSizeEvent
vEvent( wxSize( nWidth
1279 vEvent
.SetEventObject(this);
1280 GetEventHandler()->ProcessEvent(vEvent
);
1281 } // end of wxWindow::DoSetClientSize
1283 wxPoint
wxWindow::GetClientAreaOrigin() const
1285 return wxPoint(0, 0);
1286 } // end of wxWindow::GetClientAreaOrigin
1288 void wxWindow::AdjustForParentClientOrigin(
1295 // Don't do it for the dialogs/frames - they float independently of their
1300 wxWindow
* pParent
= GetParent();
1302 if (!(nSizeFlags
& wxSIZE_NO_ADJUSTMENTS
) && pParent
)
1304 wxPoint
vPoint(pParent
->GetClientAreaOrigin());
1309 } // end of wxWindow::AdjustForParentClientOrigin
1311 // ---------------------------------------------------------------------------
1313 // ---------------------------------------------------------------------------
1315 int wxWindow::GetCharHeight() const
1318 FONTMETRICS vFontMetrics
;
1321 hPs
= ::WinGetPS(GetHwnd());
1323 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1326 return(vFontMetrics
.lMaxAscender
+ vFontMetrics
.lMaxDescender
);
1327 ::WinReleasePS(hPs
);
1328 } // end of wxWindow::GetCharHeight
1330 int wxWindow::GetCharWidth() const
1333 FONTMETRICS vFontMetrics
;
1335 hPs
= ::WinGetPS(GetHwnd());
1337 if(!GpiQueryFontMetrics(hPs
, sizeof(FONTMETRICS
), &vFontMetrics
))
1340 return(vFontMetrics
.lAveCharWidth
);
1341 ::WinReleasePS(hPs
);
1342 } // end of wxWindow::GetCharWidth
1344 void wxWindow::GetTextExtent(
1345 const wxString
& rString
1349 , int* pExternalLeading
1350 , const wxFont
* pTheFont
1353 const wxFont
* pFontToUse
= pTheFont
;
1356 hPs
= ::WinGetPS(GetHwnd());
1358 // TODO: Will have to play with fonts later
1361 pFontToUse = &m_font;
1364 HFONT hFfontOld = 0;
1366 if (pFontToUse && pFontToUse->Ok())
1369 hFnt = (HFONT)((wxFont *)pFontToUse)->GetResourceHandle(); // const_cast
1371 hFontOld = (HFONT)SelectObject(dc,fnt);
1376 GetTextExtentPoint(dc, string, (int)string.Length(), &sizeRect);
1377 GetTextMetrics(dc, &tm);
1379 if ( fontToUse && fnt && hfontOld )
1380 SelectObject(dc, hfontOld);
1382 ReleaseDC(hWnd, dc);
1389 *descent = tm.tmDescent;
1390 if ( externalLeading )
1391 *externalLeading = tm.tmExternalLeading;
1393 ::WinReleasePS(hPs
);
1396 #if wxUSE_CARET && WXWIN_COMPATIBILITY
1397 // ---------------------------------------------------------------------------
1398 // Caret manipulation
1399 // ---------------------------------------------------------------------------
1401 void wxWindow::CreateCaret(
1406 SetCaret(new wxCaret( this
1410 } // end of wxWindow::CreateCaret
1412 void wxWindow::CreateCaret(
1413 const wxBitmap
* pBitmap
1416 wxFAIL_MSG("not implemented");
1417 } // end of wxWindow::CreateCaret
1419 void wxWindow::ShowCaret(
1423 wxCHECK_RET( m_caret
, "no caret to show" );
1425 m_caret
->Show(bShow
);
1426 } // end of wxWindow::ShowCaret
1428 void wxWindow::DestroyCaret()
1431 } // end of wxWindow::DestroyCaret
1433 void wxWindow::SetCaretPos(
1437 wxCHECK_RET( m_caret
, "no caret to move" );
1442 } // end of wxWindow::SetCaretPos
1444 void wxWindow::GetCaretPos(
1449 wxCHECK_RET( m_caret
, "no caret to get position of" );
1451 m_caret
->GetPosition( pX
1454 } // end of wxWindow::GetCaretPos
1456 #endif //wxUSE_CARET
1458 // ---------------------------------------------------------------------------
1460 // ---------------------------------------------------------------------------
1462 bool wxWindow::DoPopupMenu( wxMenu
*menu
, int x
, int y
)
1468 // ===========================================================================
1469 // pre/post message processing
1470 // ===========================================================================
1472 MRESULT
wxWindow::OS2DefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
1478 bool wxWindow::OS2ProcessMessage(WXMSG
* pMsg
)
1484 bool wxWindow::OS2TranslateMessage(WXMSG
* pMsg
)
1486 return m_acceleratorTable
.Translate(this, pMsg
);
1489 // ---------------------------------------------------------------------------
1490 // message params unpackers (different for Win16 and Win32)
1491 // ---------------------------------------------------------------------------
1493 void wxWindow::UnpackCommand(WXWPARAM wParam
, WXLPARAM lParam
,
1494 WORD
*id
, WXHWND
*hwnd
, WORD
*cmd
)
1496 *id
= LOWORD(wParam
);
1497 *hwnd
= (WXHWND
)lParam
;
1498 *cmd
= HIWORD(wParam
);
1501 void wxWindow::UnpackActivate(WXWPARAM wParam
, WXLPARAM lParam
,
1502 WXWORD
*state
, WXWORD
*minimized
, WXHWND
*hwnd
)
1504 *state
= LOWORD(wParam
);
1505 *minimized
= HIWORD(wParam
);
1506 *hwnd
= (WXHWND
)lParam
;
1509 void wxWindow::UnpackScroll(WXWPARAM wParam
, WXLPARAM lParam
,
1510 WXWORD
*code
, WXWORD
*pos
, WXHWND
*hwnd
)
1512 *code
= LOWORD(wParam
);
1513 *pos
= HIWORD(wParam
);
1514 *hwnd
= (WXHWND
)lParam
;
1517 void wxWindow::UnpackCtlColor(WXWPARAM wParam
, WXLPARAM lParam
,
1518 WXWORD
*nCtlColor
, WXHDC
*hdc
, WXHWND
*hwnd
)
1520 *nCtlColor
= 0; // TODO: CTLCOLOR_BTN;
1521 *hwnd
= (WXHWND
)lParam
;
1522 *hdc
= (WXHDC
)wParam
;
1525 void wxWindow::UnpackMenuSelect(WXWPARAM wParam
, WXLPARAM lParam
,
1526 WXWORD
*item
, WXWORD
*flags
, WXHMENU
*hmenu
)
1528 *item
= (WXWORD
)LOWORD(wParam
);
1529 *flags
= HIWORD(wParam
);
1530 *hmenu
= (WXHMENU
)lParam
;
1533 // ---------------------------------------------------------------------------
1534 // Main wxWindows window proc and the window proc for wxWindow
1535 // ---------------------------------------------------------------------------
1537 // Hook for new window just as it's being created, when the window isn't yet
1538 // associated with the handle
1539 wxWindow
*wxWndHook
= NULL
;
1542 MRESULT
wxWndProc(HWND hWnd
, ULONG message
, MPARAM wParam
, MPARAM lParam
)
1544 // trace all messages - useful for the debugging
1546 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
1547 wxGetMessageName(message
), wParam
, lParam
);
1548 #endif // __WXDEBUG__
1550 wxWindow
*wnd
= wxFindWinFromHandle((WXHWND
) hWnd
);
1552 // when we get the first message for the HWND we just created, we associate
1553 // it with wxWindow stored in wxWndHook
1554 if ( !wnd
&& wxWndHook
)
1556 #if 0 // def __WXDEBUG__
1558 ::GetClassNameA((HWND
) hWnd
, buf
, 512);
1559 wxString
className(buf
);
1562 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
1565 wnd
->SetHWND((WXHWND
)hWnd
);
1570 // Stop right here if we don't have a valid handle in our wxWindow object.
1571 if ( wnd
&& !wnd
->GetHWND() )
1573 // FIXME: why do we do this?
1574 wnd
->SetHWND((WXHWND
) hWnd
);
1575 rc
= wnd
->OS2DefWindowProc(message
, wParam
, lParam
);
1581 rc
= wnd
->OS2WindowProc(message
, wParam
, lParam
);
1583 rc
= 0; //TODO: DefWindowProc( hWnd, message, wParam, lParam );
1589 MRESULT
wxWindow::OS2WindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
1591 // did we process the message?
1592 bool processed
= FALSE
;
1603 // for most messages we should return 0 when we do process the message
1612 processed = HandleCreate((WXLPCREATESTRUCT)lParam, &mayCreate);
1615 // return 0 to allow window creation
1616 rc.result = mayCreate ? 0 : -1;
1622 processed = HandleDestroy();
1626 processed = HandleMove(LOWORD(lParam), HIWORD(lParam));
1630 processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
1635 WXWORD state, minimized;
1637 UnpackActivate(wParam, lParam, &state, &minimized, &hwnd);
1639 processed = HandleActivate(state, minimized != 0, (WXHWND)hwnd);
1644 processed = HandleSetFocus((WXHWND)(HWND)wParam);
1648 processed = HandleKillFocus((WXHWND)(HWND)wParam);
1652 processed = HandlePaint();
1656 // don't let the DefWindowProc() destroy our window - we'll do it
1657 // ourselves in ~wxWindow
1663 processed = HandleShow(wParam != 0, (int)lParam);
1667 case WM_LBUTTONDOWN:
1669 case WM_LBUTTONDBLCLK:
1670 case WM_RBUTTONDOWN:
1672 case WM_RBUTTONDBLCLK:
1673 case WM_MBUTTONDOWN:
1675 case WM_MBUTTONDBLCLK:
1677 short x = LOWORD(lParam);
1678 short y = HIWORD(lParam);
1680 processed = HandleMouseEvent(message, x, y, wParam);
1688 case MM_JOY1BUTTONDOWN:
1689 case MM_JOY2BUTTONDOWN:
1690 case MM_JOY1BUTTONUP:
1691 case MM_JOY2BUTTONUP:
1693 int x = LOWORD(lParam);
1694 int y = HIWORD(lParam);
1696 processed = HandleJoystickEvent(message, x, y, wParam);
1701 processed = HandleSysCommand(wParam, lParam);
1708 UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);
1710 processed = HandleCommand(id, cmd, hwnd);
1716 processed = HandleNotify((int)wParam, lParam, &rc.result);
1720 // for these messages we must return TRUE if process the message
1722 case WM_MEASUREITEM:
1724 int idCtrl = (UINT)wParam;
1725 if ( message == WM_DRAWITEM )
1727 processed = MSWOnDrawItem(idCtrl,
1728 (WXDRAWITEMSTRUCT *)lParam);
1732 processed = MSWOnMeasureItem(idCtrl,
1733 (WXMEASUREITEMSTRUCT *)lParam);
1744 rc.result = m_lDlgCode;
1747 //else: get the dlg code from the DefWindowProc()
1751 // If this has been processed by an event handler,
1752 // return 0 now (we've handled it).
1753 if ( HandleKeyDown((WORD) wParam, lParam) )
1760 // we consider these message "not interesting" to OnChar
1761 if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
1770 // avoid duplicate messages to OnChar for these ASCII keys: they
1771 // will be translated by TranslateMessage() and received in WM_CHAR
1777 // but set processed to FALSE, not TRUE to still pass them to
1778 // the control's default window proc - otherwise built-in
1779 // keyboard handling won't work
1785 // special case of VK_APPS: treat it the same as right mouse
1786 // click because both usually pop up a context menu
1789 // construct the key mask
1790 WPARAM fwKeys = MK_RBUTTON;
1791 if ( (::GetKeyState(VK_CONTROL) & 0x100) != 0 )
1792 fwKeys |= MK_CONTROL;
1793 if ( (::GetKeyState(VK_SHIFT) & 0x100) != 0 )
1796 // simulate right mouse button click
1797 DWORD dwPos = ::GetMessagePos();
1798 int x = GET_X_LPARAM(dwPos),
1799 y = GET_Y_LPARAM(dwPos);
1801 ScreenToClient(&x, &y);
1802 processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, fwKeys);
1812 processed = HandleChar((WORD)wParam, lParam);
1817 processed = HandleKeyUp((WORD) wParam, lParam);
1820 case WM_CHAR: // Always an ASCII character
1821 processed = HandleChar((WORD)wParam, lParam, TRUE);
1829 UnpackScroll(wParam, lParam, &code, &pos, &hwnd);
1831 processed = MSWOnScroll(message == WM_HSCROLL ? wxHORIZONTAL
1837 // CTLCOLOR messages are sent by children to query the parent for their
1840 case WM_CTLCOLORMSGBOX:
1841 case WM_CTLCOLOREDIT:
1842 case WM_CTLCOLORLISTBOX:
1843 case WM_CTLCOLORBTN:
1844 case WM_CTLCOLORDLG:
1845 case WM_CTLCOLORSCROLLBAR:
1846 case WM_CTLCOLORSTATIC:
1854 UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd);
1856 processed = HandleCtlColor(&rc.hBrush,
1866 // the return value for this message is ignored
1867 case WM_SYSCOLORCHANGE:
1868 processed = HandleSysColorChange();
1871 case WM_PALETTECHANGED:
1872 processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
1875 case WM_QUERYNEWPALETTE:
1876 processed = HandleQueryNewPalette();
1880 processed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
1883 // we processed the message, i.e. erased the background
1889 processed = HandleDropFiles(wParam);
1893 processed = HandleInitDialog((WXHWND)(HWND)wParam);
1897 // we never set focus from here
1902 case WM_QUERYENDSESSION:
1903 processed = HandleQueryEndSession(lParam, &rc.allow);
1907 processed = HandleEndSession(wParam != 0, lParam);
1910 case WM_GETMINMAXINFO:
1911 processed = HandleGetMinMaxInfo((MINMAXINFO*)lParam);
1915 processed = HandleSetCursor((WXHWND)(HWND)wParam,
1916 LOWORD(lParam), // hit test
1917 HIWORD(lParam)); // mouse msg
1921 // returning TRUE stops the DefWindowProc() from further
1922 // processing this message - exactly what we need because we've
1923 // just set the cursor.
1932 wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."),
1933 wxGetMessageName(message));
1934 #endif // __WXDEBUG__
1935 rc.result = MSWDefWindowProc(message, wParam, lParam);
1941 // Dialog window proc
1942 MRESULT
wxDlgProc(HWND hWnd
, UINT message
, MPARAM wParam
, MPARAM lParam
)
1946 if ( message == WM_INITDIALOG )
1948 // for this message, returning TRUE tells system to set focus to the
1949 // first control in the dialog box
1954 // for all the other ones, FALSE means that we didn't process the
1962 wxWindow
*wxFindWinFromHandle(WXHWND hWnd
)
1964 wxNode
*node
= wxWinHandleList
->Find((long)hWnd
);
1967 return (wxWindow
*)node
->Data();
1970 void wxAssociateWinWithHandle(HWND hWnd
, wxWindow
*win
)
1972 // adding NULL hWnd is (first) surely a result of an error and
1973 // (secondly) breaks menu command processing
1974 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
1975 wxT("attempt to add a NULL hWnd to window list ignored") );
1978 wxWindow
*oldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
1979 if ( oldWin
&& (oldWin
!= win
) )
1981 wxString
str(win
->GetClassInfo()->GetClassName());
1982 wxLogError("Bug! Found existing HWND %X for new window of class %s", (int) hWnd
, (const char*) str
);
1986 wxWinHandleList
->Append((long)hWnd
, win
);
1990 void wxRemoveHandleAssociation(wxWindow
*win
)
1992 wxWinHandleList
->DeleteObject(win
);
1995 // Default destroyer - override if you destroy it in some other way
1996 // (e.g. with MDI child windows)
1997 void wxWindow::OS2DestroyWindow()
2001 void wxWindow::OS2DetachWindowMenu()
2005 HMENU hMenu
= (HMENU
)m_hMenu
;
2007 int N
= (int)WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
2009 for (i
= 0; i
< N
; i
++)
2012 int chars
= (int)WinSendMsg(hMenu
, MM_QUERYITEMTEXT
, MPFROM2SHORT(i
, N
), buf
);
2015 wxLogLastError(wxT("GetMenuString"));
2020 if ( wxStrcmp(buf
, wxT("&Window")) == 0 )
2022 WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
2029 bool wxWindow::OS2Create(int id
,
2031 const wxChar
*wclass
,
2033 const wxChar
*title
,
2039 const wxChar
*dialog_template
,
2040 WXDWORD extendedStyle
)
2044 int x1 = CW_USEDEFAULT;
2046 int width1 = CW_USEDEFAULT;
2049 // Find parent's size, if it exists, to set up a possible default
2050 // panel size the size of the parent window
2054 ::GetClientRect((HWND) parent->GetHWND(), &parent_rect);
2056 width1 = parent_rect.right - parent_rect.left;
2057 height1 = parent_rect.bottom - parent_rect.top;
2060 if ( x > -1 ) x1 = x;
2061 if ( y > -1 ) y1 = y;
2062 if ( width > -1 ) width1 = width;
2063 if ( height > -1 ) height1 = height;
2065 HWND hParent = (HWND)NULL;
2067 hParent = (HWND) parent->GetHWND();
2071 if ( dialog_template )
2073 m_hWnd = (WXHWND)::CreateDialog(wxGetInstance(),
2076 (DLGPROC)wxDlgProc);
2080 wxLogError(_("Can't find dummy dialog template!\n"
2081 "Check resource include path for finding wx.rc."));
2086 // ::SetWindowLong(GWL_EXSTYLE) doesn't work for the dialogs, so try
2087 // to take care of (at least some) extended style flags ourselves
2088 if ( extendedStyle & WS_EX_TOPMOST )
2090 if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
2091 SWP_NOSIZE | SWP_NOMOVE) )
2093 wxLogLastError(wxT("SetWindowPos"));
2097 // move the dialog to its initial position without forcing repainting
2098 if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) )
2100 wxLogLastError(wxT("MoveWindow"));
2106 if ( style & WS_CHILD )
2109 wxString className(wclass);
2110 if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
2112 className += wxT("NR");
2115 m_hWnd = (WXHWND)CreateWindowEx(extendedStyle,
2117 title ? title : wxT(""),
2121 hParent, (HMENU)controlId,
2127 wxLogError(_("Can't create window of class %s!\n"
2128 "Possible Windows 3.x compatibility problem?"),
2137 wxNode* node = wxWinHandleList->Member(this);
2140 HWND hWnd = (HWND) node->GetKeyInteger();
2141 if (hWnd != (HWND) m_hWnd)
2143 wxLogError("A second HWND association is being added for the same window!");
2148 wxAssociateWinWithHandle((HWND
) m_hWnd
, this);
2153 // ===========================================================================
2154 // OS2 PM message handlers
2155 // ===========================================================================
2157 // ---------------------------------------------------------------------------
2159 // ---------------------------------------------------------------------------
2161 bool wxWindow::HandleNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
)
2167 bool wxWindow::OS2OnNotify(int WXUNUSED(idCtrl
),
2169 WXLPARAM
* WXUNUSED(result
))
2175 // ---------------------------------------------------------------------------
2176 // end session messages
2177 // ---------------------------------------------------------------------------
2179 bool wxWindow::HandleQueryEndSession(long logOff
, bool *mayEnd
)
2181 wxCloseEvent
event(wxEVT_QUERY_END_SESSION
, -1);
2182 event
.SetEventObject(wxTheApp
);
2183 event
.SetCanVeto(TRUE
);
2184 event
.SetLoggingOff(logOff
== ENDSESSION_LOGOFF
);
2186 bool rc
= wxTheApp
->ProcessEvent(event
);
2190 // we may end only if the app didn't veto session closing (double
2192 *mayEnd
= !event
.GetVeto();
2198 bool wxWindow::HandleEndSession(bool endSession
, long logOff
)
2200 // do nothing if the session isn't ending
2204 wxCloseEvent
event(wxEVT_END_SESSION
, -1);
2205 event
.SetEventObject(wxTheApp
);
2206 event
.SetCanVeto(FALSE
);
2207 event
.SetLoggingOff( (logOff
== ENDSESSION_LOGOFF
) );
2208 if ( (this == wxTheApp
->GetTopWindow()) && // Only send once
2209 wxTheApp
->ProcessEvent(event
))
2215 // ---------------------------------------------------------------------------
2216 // window creation/destruction
2217 // ---------------------------------------------------------------------------
2219 bool wxWindow::HandleCreate(WXLPCREATESTRUCT cs
, bool *mayCreate
)
2221 // TODO: should generate this event from WM_NCCREATE
2222 wxWindowCreateEvent
event(this);
2223 (void)GetEventHandler()->ProcessEvent(event
);
2230 bool wxWindow::HandleDestroy()
2232 wxWindowDestroyEvent
event(this);
2233 (void)GetEventHandler()->ProcessEvent(event
);
2235 // delete our drop target if we've got one
2236 #if wxUSE_DRAG_AND_DROP
2237 if ( m_dropTarget
!= NULL
)
2239 // m_dropTarget->Revoke(m_hWnd);
2241 delete m_dropTarget
;
2242 m_dropTarget
= NULL
;
2244 #endif // wxUSE_DRAG_AND_DROP
2246 // WM_DESTROY handled
2250 // ---------------------------------------------------------------------------
2252 // ---------------------------------------------------------------------------
2254 bool wxWindow::HandleActivate(int state
,
2255 bool WXUNUSED(minimized
),
2256 WXHWND
WXUNUSED(activate
))
2260 wxActivateEvent event(wxEVT_ACTIVATE,
2261 (state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
2263 event.SetEventObject(this);
2265 return GetEventHandler()->ProcessEvent(event);
2270 bool wxWindow::HandleSetFocus(WXHWND
WXUNUSED(hwnd
))
2276 m_caret
->OnSetFocus();
2278 #endif // wxUSE_CARET
2280 // panel wants to track the window which was the last to have focus in it
2281 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
2284 panel
->SetLastFocus(this);
2287 wxFocusEvent
event(wxEVT_SET_FOCUS
, m_windowId
);
2288 event
.SetEventObject(this);
2290 return GetEventHandler()->ProcessEvent(event
);
2293 bool wxWindow::HandleKillFocus(WXHWND
WXUNUSED(hwnd
))
2299 m_caret
->OnKillFocus();
2301 #endif // wxUSE_CARET
2303 wxFocusEvent
event(wxEVT_KILL_FOCUS
, m_windowId
);
2304 event
.SetEventObject(this);
2306 return GetEventHandler()->ProcessEvent(event
);
2309 // ---------------------------------------------------------------------------
2311 // ---------------------------------------------------------------------------
2313 bool wxWindow::HandleShow(bool show
, int status
)
2315 wxShowEvent
event(GetId(), show
);
2316 event
.m_eventObject
= this;
2318 return GetEventHandler()->ProcessEvent(event
);
2321 bool wxWindow::HandleInitDialog(WXHWND
WXUNUSED(hWndFocus
))
2323 wxInitDialogEvent
event(GetId());
2324 event
.m_eventObject
= this;
2326 return GetEventHandler()->ProcessEvent(event
);
2329 bool wxWindow::HandleDropFiles(WXWPARAM wParam
)
2335 bool wxWindow::HandleSetCursor(WXHWND hWnd
,
2337 int WXUNUSED(mouseMsg
))
2339 // don't set cursor for other windows, only for this one: this prevents
2340 // children of this window from getting the same cursor as the parent has
2341 // (don't forget that this message is propagated by default up the window
2342 // parent-child hierarchy)
2343 if ( GetHWND() == hWnd
)
2345 // don't set cursor when the mouse is not in the client part
2348 if ( nHitTest == HTCLIENT || nHitTest == HTERROR )
2350 HCURSOR hcursor = 0;
2353 // from msw\utils.cpp
2354 extern HCURSOR gs_wxBusyCursor;
2356 hcursor = gs_wxBusyCursor;
2360 wxCursor *cursor = NULL;
2362 if ( m_cursor.Ok() )
2368 // from msw\data.cpp
2369 extern wxCursor *g_globalCursor;
2371 if ( g_globalCursor && g_globalCursor->Ok() )
2372 cursor = g_globalCursor;
2376 hcursor = (HCURSOR)cursor->GetHCURSOR();
2381 // ::SetCursor(hcursor);
2392 // ---------------------------------------------------------------------------
2393 // owner drawn stuff
2394 // ---------------------------------------------------------------------------
2396 bool wxWindow::OS2OnDrawItem(int id
, WXDRAWITEMSTRUCT
*itemStruct
)
2400 #if wxUSE_OWNER_DRAWN
2401 // is it a menu item?
2404 DRAWITEMSTRUCT *pDrawStruct = (DRAWITEMSTRUCT *)itemStruct;
2405 wxMenuItem *pMenuItem = (wxMenuItem *)(pDrawStruct->itemData);
2407 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
2409 // prepare to call OnDrawItem()
2411 dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE);
2412 wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top,
2413 pDrawStruct->rcItem.right - pDrawStruct->rcItem.left,
2414 pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top);
2416 return pMenuItem->OnDrawItem
2419 (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction,
2420 (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
2424 wxWindow *item = FindItem(id);
2425 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
2427 return ((wxControl *)item)->MSWOnDraw(itemStruct);
2436 bool wxWindow::OS2OnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*itemStruct
)
2440 #if wxUSE_OWNER_DRAWN
2441 // is it a menu item?
2444 MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
2445 wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
2447 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
2449 return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
2450 &pMeasureStruct->itemHeight);
2453 wxWindow *item = FindItem(id);
2454 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
2456 return ((wxControl *)item)->MSWOnMeasure(itemStruct);
2458 #endif // owner-drawn menus
2463 // ---------------------------------------------------------------------------
2464 // colours and palettes
2465 // ---------------------------------------------------------------------------
2467 bool wxWindow::HandleSysColorChange()
2469 wxSysColourChangedEvent event
;
2470 event
.SetEventObject(this);
2472 return GetEventHandler()->ProcessEvent(event
);
2475 bool wxWindow::HandleCtlColor(WXHBRUSH
*brush
,
2483 WXHBRUSH hBrush
= 0;
2486 if ( nCtlColor == CTLCOLOR_DLG )
2488 hBrush = OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
2492 wxControl *item = (wxControl *)FindItemByHWND(pWnd, TRUE);
2494 hBrush = item->OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
2505 // Define for each class of dialog and control
2506 WXHBRUSH
wxWindow::OnCtlColor(WXHDC hDC
,
2516 bool wxWindow::HandlePaletteChanged(WXHWND hWndPalChange
)
2518 wxPaletteChangedEvent
event(GetId());
2519 event
.SetEventObject(this);
2520 event
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
2522 return GetEventHandler()->ProcessEvent(event
);
2525 bool wxWindow::HandleQueryNewPalette()
2527 wxQueryNewPaletteEvent
event(GetId());
2528 event
.SetEventObject(this);
2530 return GetEventHandler()->ProcessEvent(event
) && event
.GetPaletteRealized();
2533 // Responds to colour changes: passes event on to children.
2534 void wxWindow::OnSysColourChanged(wxSysColourChangedEvent
& event
)
2536 wxNode
*node
= GetChildren().First();
2539 // Only propagate to non-top-level windows
2540 wxWindow
*win
= (wxWindow
*)node
->Data();
2541 if ( win
->GetParent() )
2543 wxSysColourChangedEvent event2
;
2544 event
.m_eventObject
= win
;
2545 win
->GetEventHandler()->ProcessEvent(event2
);
2548 node
= node
->Next();
2552 // ---------------------------------------------------------------------------
2554 // ---------------------------------------------------------------------------
2556 bool wxWindow::HandlePaint()
2562 bool wxWindow::HandleEraseBkgnd(WXHDC hdc
)
2564 // Prevents flicker when dragging
2565 // if ( ::IsIconic(GetHwnd()) )
2574 wxEraseEvent
event(m_windowId
, &dc
);
2575 event
.SetEventObject(this);
2576 bool rc
= GetEventHandler()->ProcessEvent(event
);
2579 dc
.SelectOldObjects(hdc
);
2580 dc
.SetHDC((WXHDC
) NULL
);
2585 void wxWindow::OnEraseBackground(wxEraseEvent
& event
)
2590 // ---------------------------------------------------------------------------
2591 // moving and resizing
2592 // ---------------------------------------------------------------------------
2594 bool wxWindow::HandleMinimize()
2596 wxIconizeEvent
event(m_windowId
);
2597 event
.SetEventObject(this);
2599 return GetEventHandler()->ProcessEvent(event
);
2602 bool wxWindow::HandleMaximize()
2604 wxMaximizeEvent
event(m_windowId
);
2605 event
.SetEventObject(this);
2607 return GetEventHandler()->ProcessEvent(event
);
2610 bool wxWindow::HandleMove(int x
, int y
)
2612 wxMoveEvent
event(wxPoint(x
, y
), m_windowId
);
2613 event
.SetEventObject(this);
2615 return GetEventHandler()->ProcessEvent(event
);
2618 bool wxWindow::HandleSize(int w
, int h
, WXUINT
WXUNUSED(flag
))
2620 wxSizeEvent
event(wxSize(w
, h
), m_windowId
);
2621 event
.SetEventObject(this);
2623 return GetEventHandler()->ProcessEvent(event
);
2626 bool wxWindow::HandleGetMinMaxInfo(void *mmInfo
)
2630 MINMAXINFO *info = (MINMAXINFO *)mmInfo;
2634 if ( m_minWidth != -1 )
2636 info->ptMinTrackSize.x = m_minWidth;
2640 if ( m_minHeight != -1 )
2642 info->ptMinTrackSize.y = m_minHeight;
2646 if ( m_maxWidth != -1 )
2648 info->ptMaxTrackSize.x = m_maxWidth;
2652 if ( m_maxHeight != -1 )
2654 info->ptMaxTrackSize.y = m_maxHeight;
2663 // ---------------------------------------------------------------------------
2665 // ---------------------------------------------------------------------------
2667 bool wxWindow::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
2669 if ( wxCurrentPopupMenu
)
2671 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
2672 wxCurrentPopupMenu
= NULL
;
2674 return popupMenu
->OS2Command(cmd
, id
);
2677 wxWindow
*win
= FindItem(id
);
2680 win
= wxFindWinFromHandle(control
);
2684 return win
->OS2Command(cmd
, id
);
2689 bool wxWindow::HandleSysCommand(WXWPARAM wParam
, WXLPARAM lParam
)
2695 // ---------------------------------------------------------------------------
2697 // ---------------------------------------------------------------------------
2699 void wxWindow::InitMouseEvent(wxMouseEvent
& event
, int x
, int y
, WXUINT flags
)
2705 event.m_shiftDown = ((flags & MK_SHIFT) != 0);
2706 event.m_controlDown = ((flags & MK_CONTROL) != 0);
2707 event.m_leftDown = ((flags & MK_LBUTTON) != 0);
2708 event.m_middleDown = ((flags & MK_MBUTTON) != 0);
2709 event.m_rightDown = ((flags & MK_RBUTTON) != 0);
2710 event.SetTimestamp(s_currentMsg.time);
2711 event.m_eventObject = this;
2713 #if wxUSE_MOUSEEVENT_HACK
2716 m_lastMouseEvent = event.GetEventType();
2717 #endif // wxUSE_MOUSEEVENT_HACK
2721 bool wxWindow::HandleMouseEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
2723 // the mouse events take consecutive IDs from WM_MOUSEFIRST to
2724 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
2725 // from the message id and take the value in the table to get wxWin event
2727 static const wxEventType eventsMouse
[] =
2741 wxMouseEvent
event(eventsMouse
[msg
- WM_MOUSEMOVE
]);
2742 InitMouseEvent(event
, x
, y
, flags
);
2744 return GetEventHandler()->ProcessEvent(event
);
2747 bool wxWindow::HandleMouseMove(int x
, int y
, WXUINT flags
)
2749 if ( !m_bMouseInWindow
)
2751 // Generate an ENTER event
2752 m_bMouseInWindow
= TRUE
;
2754 wxMouseEvent
event(wxEVT_ENTER_WINDOW
);
2755 InitMouseEvent(event
, x
, y
, flags
);
2757 (void)GetEventHandler()->ProcessEvent(event
);
2760 #if wxUSE_MOUSEEVENT_HACK
2761 // Window gets a click down message followed by a mouse move message even
2762 // if position isn't changed! We want to discard the trailing move event
2763 // if x and y are the same.
2764 if ( (m_lastMouseEvent
== wxEVT_RIGHT_DOWN
||
2765 m_lastMouseEvent
== wxEVT_LEFT_DOWN
||
2766 m_lastMouseEvent
== wxEVT_MIDDLE_DOWN
) &&
2767 (m_lastMouseX
== event
.m_x
&& m_lastMouseY
== event
.m_y
) )
2769 m_lastMouseEvent
= wxEVT_MOTION
;
2773 #endif // wxUSE_MOUSEEVENT_HACK
2775 return HandleMouseEvent(WM_MOUSEMOVE
, x
, y
, flags
);
2778 // ---------------------------------------------------------------------------
2779 // keyboard handling
2780 // ---------------------------------------------------------------------------
2782 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
2784 bool wxWindow::HandleChar(WXWORD wParam
, WXLPARAM lParam
, bool isASCII
)
2790 bool wxWindow::HandleKeyDown(WXWORD wParam
, WXLPARAM lParam
)
2796 bool wxWindow::HandleKeyUp(WXWORD wParam
, WXLPARAM lParam
)
2802 // ---------------------------------------------------------------------------
2804 // ---------------------------------------------------------------------------
2806 bool wxWindow::HandleJoystickEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
2812 // ---------------------------------------------------------------------------
2814 // ---------------------------------------------------------------------------
2816 bool wxWindow::OS2OnScroll(int orientation
, WXWORD wParam
,
2817 WXWORD pos
, WXHWND control
)
2821 wxWindow
*child
= wxFindWinFromHandle(control
);
2823 return child
->OS2OnScroll(orientation
, wParam
, pos
, control
);
2826 wxScrollWinEvent event
;
2827 event
.SetPosition(pos
);
2828 event
.SetOrientation(orientation
);
2829 event
.m_eventObject
= this;
2834 // ===========================================================================
2836 // ===========================================================================
2838 void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
)
2843 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
2844 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
2845 int wxCharCodeOS2ToWX(int keySym
)
2852 case VK_CANCEL: id = WXK_CANCEL; break;
2853 case VK_BACK: id = WXK_BACK; break;
2854 case VK_TAB: id = WXK_TAB; break;
2855 case VK_CLEAR: id = WXK_CLEAR; break;
2856 case VK_RETURN: id = WXK_RETURN; break;
2857 case VK_SHIFT: id = WXK_SHIFT; break;
2858 case VK_CONTROL: id = WXK_CONTROL; break;
2859 case VK_MENU : id = WXK_MENU; break;
2860 case VK_PAUSE: id = WXK_PAUSE; break;
2861 case VK_SPACE: id = WXK_SPACE; break;
2862 case VK_ESCAPE: id = WXK_ESCAPE; break;
2863 case VK_PRIOR: id = WXK_PRIOR; break;
2864 case VK_NEXT : id = WXK_NEXT; break;
2865 case VK_END: id = WXK_END; break;
2866 case VK_HOME : id = WXK_HOME; break;
2867 case VK_LEFT : id = WXK_LEFT; break;
2868 case VK_UP: id = WXK_UP; break;
2869 case VK_RIGHT: id = WXK_RIGHT; break;
2870 case VK_DOWN : id = WXK_DOWN; break;
2871 case VK_SELECT: id = WXK_SELECT; break;
2872 case VK_PRINT: id = WXK_PRINT; break;
2873 case VK_EXECUTE: id = WXK_EXECUTE; break;
2874 case VK_INSERT: id = WXK_INSERT; break;
2875 case VK_DELETE: id = WXK_DELETE; break;
2876 case VK_HELP : id = WXK_HELP; break;
2877 case VK_NUMPAD0: id = WXK_NUMPAD0; break;
2878 case VK_NUMPAD1: id = WXK_NUMPAD1; break;
2879 case VK_NUMPAD2: id = WXK_NUMPAD2; break;
2880 case VK_NUMPAD3: id = WXK_NUMPAD3; break;
2881 case VK_NUMPAD4: id = WXK_NUMPAD4; break;
2882 case VK_NUMPAD5: id = WXK_NUMPAD5; break;
2883 case VK_NUMPAD6: id = WXK_NUMPAD6; break;
2884 case VK_NUMPAD7: id = WXK_NUMPAD7; break;
2885 case VK_NUMPAD8: id = WXK_NUMPAD8; break;
2886 case VK_NUMPAD9: id = WXK_NUMPAD9; break;
2887 case VK_MULTIPLY: id = WXK_MULTIPLY; break;
2888 case VK_ADD: id = WXK_ADD; break;
2889 case VK_SUBTRACT: id = WXK_SUBTRACT; break;
2890 case VK_DECIMAL: id = WXK_DECIMAL; break;
2891 case VK_DIVIDE: id = WXK_DIVIDE; break;
2892 case VK_F1: id = WXK_F1; break;
2893 case VK_F2: id = WXK_F2; break;
2894 case VK_F3: id = WXK_F3; break;
2895 case VK_F4: id = WXK_F4; break;
2896 case VK_F5: id = WXK_F5; break;
2897 case VK_F6: id = WXK_F6; break;
2898 case VK_F7: id = WXK_F7; break;
2899 case VK_F8: id = WXK_F8; break;
2900 case VK_F9: id = WXK_F9; break;
2901 case VK_F10: id = WXK_F10; break;
2902 case VK_F11: id = WXK_F11; break;
2903 case VK_F12: id = WXK_F12; break;
2904 case VK_F13: id = WXK_F13; break;
2905 case VK_F14: id = WXK_F14; break;
2906 case VK_F15: id = WXK_F15; break;
2907 case VK_F16: id = WXK_F16; break;
2908 case VK_F17: id = WXK_F17; break;
2909 case VK_F18: id = WXK_F18; break;
2910 case VK_F19: id = WXK_F19; break;
2911 case VK_F20: id = WXK_F20; break;
2912 case VK_F21: id = WXK_F21; break;
2913 case VK_F22: id = WXK_F22; break;
2914 case VK_F23: id = WXK_F23; break;
2915 case VK_F24: id = WXK_F24; break;
2916 case VK_NUMLOCK: id = WXK_NUMLOCK; break;
2917 case VK_SCROLL: id = WXK_SCROLL; break;
2927 int wxCharCodeWXToOS2(int id
, bool *isVirtual
)
2935 case WXK_CANCEL: keySym = VK_CANCEL; break;
2936 case WXK_CLEAR: keySym = VK_CLEAR; break;
2937 case WXK_SHIFT: keySym = VK_SHIFT; break;
2938 case WXK_CONTROL: keySym = VK_CONTROL; break;
2939 case WXK_MENU : keySym = VK_MENU; break;
2940 case WXK_PAUSE: keySym = VK_PAUSE; break;
2941 case WXK_PRIOR: keySym = VK_PRIOR; break;
2942 case WXK_NEXT : keySym = VK_NEXT; break;
2943 case WXK_END: keySym = VK_END; break;
2944 case WXK_HOME : keySym = VK_HOME; break;
2945 case WXK_LEFT : keySym = VK_LEFT; break;
2946 case WXK_UP: keySym = VK_UP; break;
2947 case WXK_RIGHT: keySym = VK_RIGHT; break;
2948 case WXK_DOWN : keySym = VK_DOWN; break;
2949 case WXK_SELECT: keySym = VK_SELECT; break;
2950 case WXK_PRINT: keySym = VK_PRINT; break;
2951 case WXK_EXECUTE: keySym = VK_EXECUTE; break;
2952 case WXK_INSERT: keySym = VK_INSERT; break;
2953 case WXK_DELETE: keySym = VK_DELETE; break;
2954 case WXK_HELP : keySym = VK_HELP; break;
2955 case WXK_NUMPAD0: keySym = VK_NUMPAD0; break;
2956 case WXK_NUMPAD1: keySym = VK_NUMPAD1; break;
2957 case WXK_NUMPAD2: keySym = VK_NUMPAD2; break;
2958 case WXK_NUMPAD3: keySym = VK_NUMPAD3; break;
2959 case WXK_NUMPAD4: keySym = VK_NUMPAD4; break;
2960 case WXK_NUMPAD5: keySym = VK_NUMPAD5; break;
2961 case WXK_NUMPAD6: keySym = VK_NUMPAD6; break;
2962 case WXK_NUMPAD7: keySym = VK_NUMPAD7; break;
2963 case WXK_NUMPAD8: keySym = VK_NUMPAD8; break;
2964 case WXK_NUMPAD9: keySym = VK_NUMPAD9; break;
2965 case WXK_MULTIPLY: keySym = VK_MULTIPLY; break;
2966 case WXK_ADD: keySym = VK_ADD; break;
2967 case WXK_SUBTRACT: keySym = VK_SUBTRACT; break;
2968 case WXK_DECIMAL: keySym = VK_DECIMAL; break;
2969 case WXK_DIVIDE: keySym = VK_DIVIDE; break;
2970 case WXK_F1: keySym = VK_F1; break;
2971 case WXK_F2: keySym = VK_F2; break;
2972 case WXK_F3: keySym = VK_F3; break;
2973 case WXK_F4: keySym = VK_F4; break;
2974 case WXK_F5: keySym = VK_F5; break;
2975 case WXK_F6: keySym = VK_F6; break;
2976 case WXK_F7: keySym = VK_F7; break;
2977 case WXK_F8: keySym = VK_F8; break;
2978 case WXK_F9: keySym = VK_F9; break;
2979 case WXK_F10: keySym = VK_F10; break;
2980 case WXK_F11: keySym = VK_F11; break;
2981 case WXK_F12: keySym = VK_F12; break;
2982 case WXK_F13: keySym = VK_F13; break;
2983 case WXK_F14: keySym = VK_F14; break;
2984 case WXK_F15: keySym = VK_F15; break;
2985 case WXK_F16: keySym = VK_F16; break;
2986 case WXK_F17: keySym = VK_F17; break;
2987 case WXK_F18: keySym = VK_F18; break;
2988 case WXK_F19: keySym = VK_F19; break;
2989 case WXK_F20: keySym = VK_F20; break;
2990 case WXK_F21: keySym = VK_F21; break;
2991 case WXK_F22: keySym = VK_F22; break;
2992 case WXK_F23: keySym = VK_F23; break;
2993 case WXK_F24: keySym = VK_F24; break;
2994 case WXK_NUMLOCK: keySym = VK_NUMLOCK; break;
2995 case WXK_SCROLL: keySym = VK_SCROLL; break;
3007 wxWindow
*wxGetActiveWindow()
3013 // Windows keyboard hook. Allows interception of e.g. F1, ESCAPE
3014 // in active frames and dialogs, regardless of where the focus is.
3015 //static HHOOK wxTheKeyboardHook = 0;
3016 //static FARPROC wxTheKeyboardHookProc = 0;
3017 int wxKeyboardHook(int nCode
, WORD wParam
, DWORD lParam
);
3019 void wxSetKeyboardHook(bool doIt
)
3024 int wxKeyboardHook(int nCode
, WORD wParam
, DWORD lParam
)
3032 const char *wxGetMessageName(int message
)
3038 case 0x0000: return "WM_NULL";
3039 case 0x0001: return "WM_CREATE";
3040 case 0x0002: return "WM_DESTROY";
3041 case 0x0003: return "WM_MOVE";
3042 case 0x0005: return "WM_SIZE";
3043 case 0x0006: return "WM_ACTIVATE";
3044 case 0x0007: return "WM_SETFOCUS";
3045 case 0x0008: return "WM_KILLFOCUS";
3046 case 0x000A: return "WM_ENABLE";
3047 case 0x000B: return "WM_SETREDRAW";
3048 case 0x000C: return "WM_SETTEXT";
3049 case 0x000D: return "WM_GETTEXT";
3050 case 0x000E: return "WM_GETTEXTLENGTH";
3051 case 0x000F: return "WM_PAINT";
3052 case 0x0010: return "WM_CLOSE";
3053 case 0x0011: return "WM_QUERYENDSESSION";
3054 case 0x0012: return "WM_QUIT";
3055 case 0x0013: return "WM_QUERYOPEN";
3056 case 0x0014: return "WM_ERASEBKGND";
3057 case 0x0015: return "WM_SYSCOLORCHANGE";
3058 case 0x0016: return "WM_ENDSESSION";
3059 case 0x0017: return "WM_SYSTEMERROR";
3060 case 0x0018: return "WM_SHOWWINDOW";
3061 case 0x0019: return "WM_CTLCOLOR";
3062 case 0x001A: return "WM_WININICHANGE";
3063 case 0x001B: return "WM_DEVMODECHANGE";
3064 case 0x001C: return "WM_ACTIVATEAPP";
3065 case 0x001D: return "WM_FONTCHANGE";
3066 case 0x001E: return "WM_TIMECHANGE";
3067 case 0x001F: return "WM_CANCELMODE";
3068 case 0x0020: return "WM_SETCURSOR";
3069 case 0x0021: return "WM_MOUSEACTIVATE";
3070 case 0x0022: return "WM_CHILDACTIVATE";
3071 case 0x0023: return "WM_QUEUESYNC";
3072 case 0x0024: return "WM_GETMINMAXINFO";
3073 case 0x0026: return "WM_PAINTICON";
3074 case 0x0027: return "WM_ICONERASEBKGND";
3075 case 0x0028: return "WM_NEXTDLGCTL";
3076 case 0x002A: return "WM_SPOOLERSTATUS";
3077 case 0x002B: return "WM_DRAWITEM";
3078 case 0x002C: return "WM_MEASUREITEM";
3079 case 0x002D: return "WM_DELETEITEM";
3080 case 0x002E: return "WM_VKEYTOITEM";
3081 case 0x002F: return "WM_CHARTOITEM";
3082 case 0x0030: return "WM_SETFONT";
3083 case 0x0031: return "WM_GETFONT";
3084 case 0x0037: return "WM_QUERYDRAGICON";
3085 case 0x0039: return "WM_COMPAREITEM";
3086 case 0x0041: return "WM_COMPACTING";
3087 case 0x0044: return "WM_COMMNOTIFY";
3088 case 0x0046: return "WM_WINDOWPOSCHANGING";
3089 case 0x0047: return "WM_WINDOWPOSCHANGED";
3090 case 0x0048: return "WM_POWER";
3093 case 0x004A: return "WM_COPYDATA";
3094 case 0x004B: return "WM_CANCELJOURNAL";
3095 case 0x004E: return "WM_NOTIFY";
3096 case 0x0050: return "WM_INPUTLANGCHANGEREQUEST";
3097 case 0x0051: return "WM_INPUTLANGCHANGE";
3098 case 0x0052: return "WM_TCARD";
3099 case 0x0053: return "WM_HELP";
3100 case 0x0054: return "WM_USERCHANGED";
3101 case 0x0055: return "WM_NOTIFYFORMAT";
3102 case 0x007B: return "WM_CONTEXTMENU";
3103 case 0x007C: return "WM_STYLECHANGING";
3104 case 0x007D: return "WM_STYLECHANGED";
3105 case 0x007E: return "WM_DISPLAYCHANGE";
3106 case 0x007F: return "WM_GETICON";
3107 case 0x0080: return "WM_SETICON";
3110 case 0x0081: return "WM_NCCREATE";
3111 case 0x0082: return "WM_NCDESTROY";
3112 case 0x0083: return "WM_NCCALCSIZE";
3113 case 0x0084: return "WM_NCHITTEST";
3114 case 0x0085: return "WM_NCPAINT";
3115 case 0x0086: return "WM_NCACTIVATE";
3116 case 0x0087: return "WM_GETDLGCODE";
3117 case 0x00A0: return "WM_NCMOUSEMOVE";
3118 case 0x00A1: return "WM_NCLBUTTONDOWN";
3119 case 0x00A2: return "WM_NCLBUTTONUP";
3120 case 0x00A3: return "WM_NCLBUTTONDBLCLK";
3121 case 0x00A4: return "WM_NCRBUTTONDOWN";
3122 case 0x00A5: return "WM_NCRBUTTONUP";
3123 case 0x00A6: return "WM_NCRBUTTONDBLCLK";
3124 case 0x00A7: return "WM_NCMBUTTONDOWN";
3125 case 0x00A8: return "WM_NCMBUTTONUP";
3126 case 0x00A9: return "WM_NCMBUTTONDBLCLK";
3127 case 0x0100: return "WM_KEYDOWN";
3128 case 0x0101: return "WM_KEYUP";
3129 case 0x0102: return "WM_CHAR";
3130 case 0x0103: return "WM_DEADCHAR";
3131 case 0x0104: return "WM_SYSKEYDOWN";
3132 case 0x0105: return "WM_SYSKEYUP";
3133 case 0x0106: return "WM_SYSCHAR";
3134 case 0x0107: return "WM_SYSDEADCHAR";
3135 case 0x0108: return "WM_KEYLAST";
3138 case 0x010D: return "WM_IME_STARTCOMPOSITION";
3139 case 0x010E: return "WM_IME_ENDCOMPOSITION";
3140 case 0x010F: return "WM_IME_COMPOSITION";
3143 case 0x0110: return "WM_INITDIALOG";
3144 case 0x0111: return "WM_COMMAND";
3145 case 0x0112: return "WM_SYSCOMMAND";
3146 case 0x0113: return "WM_TIMER";
3147 case 0x0114: return "WM_HSCROLL";
3148 case 0x0115: return "WM_VSCROLL";
3149 case 0x0116: return "WM_INITMENU";
3150 case 0x0117: return "WM_INITMENUPOPUP";
3151 case 0x011F: return "WM_MENUSELECT";
3152 case 0x0120: return "WM_MENUCHAR";
3153 case 0x0121: return "WM_ENTERIDLE";
3154 case 0x0200: return "WM_MOUSEMOVE";
3155 case 0x0201: return "WM_LBUTTONDOWN";
3156 case 0x0202: return "WM_LBUTTONUP";
3157 case 0x0203: return "WM_LBUTTONDBLCLK";
3158 case 0x0204: return "WM_RBUTTONDOWN";
3159 case 0x0205: return "WM_RBUTTONUP";
3160 case 0x0206: return "WM_RBUTTONDBLCLK";
3161 case 0x0207: return "WM_MBUTTONDOWN";
3162 case 0x0208: return "WM_MBUTTONUP";
3163 case 0x0209: return "WM_MBUTTONDBLCLK";
3164 case 0x0210: return "WM_PARENTNOTIFY";
3165 case 0x0211: return "WM_ENTERMENULOOP";
3166 case 0x0212: return "WM_EXITMENULOOP";
3169 case 0x0213: return "WM_NEXTMENU";
3170 case 0x0214: return "WM_SIZING";
3171 case 0x0215: return "WM_CAPTURECHANGED";
3172 case 0x0216: return "WM_MOVING";
3173 case 0x0218: return "WM_POWERBROADCAST";
3174 case 0x0219: return "WM_DEVICECHANGE";
3177 case 0x0220: return "WM_MDICREATE";
3178 case 0x0221: return "WM_MDIDESTROY";
3179 case 0x0222: return "WM_MDIACTIVATE";
3180 case 0x0223: return "WM_MDIRESTORE";
3181 case 0x0224: return "WM_MDINEXT";
3182 case 0x0225: return "WM_MDIMAXIMIZE";
3183 case 0x0226: return "WM_MDITILE";
3184 case 0x0227: return "WM_MDICASCADE";
3185 case 0x0228: return "WM_MDIICONARRANGE";
3186 case 0x0229: return "WM_MDIGETACTIVE";
3187 case 0x0230: return "WM_MDISETMENU";
3188 case 0x0233: return "WM_DROPFILES";
3191 case 0x0281: return "WM_IME_SETCONTEXT";
3192 case 0x0282: return "WM_IME_NOTIFY";
3193 case 0x0283: return "WM_IME_CONTROL";
3194 case 0x0284: return "WM_IME_COMPOSITIONFULL";
3195 case 0x0285: return "WM_IME_SELECT";
3196 case 0x0286: return "WM_IME_CHAR";
3197 case 0x0290: return "WM_IME_KEYDOWN";
3198 case 0x0291: return "WM_IME_KEYUP";
3201 case 0x0300: return "WM_CUT";
3202 case 0x0301: return "WM_COPY";
3203 case 0x0302: return "WM_PASTE";
3204 case 0x0303: return "WM_CLEAR";
3205 case 0x0304: return "WM_UNDO";
3206 case 0x0305: return "WM_RENDERFORMAT";
3207 case 0x0306: return "WM_RENDERALLFORMATS";
3208 case 0x0307: return "WM_DESTROYCLIPBOARD";
3209 case 0x0308: return "WM_DRAWCLIPBOARD";
3210 case 0x0309: return "WM_PAINTCLIPBOARD";
3211 case 0x030A: return "WM_VSCROLLCLIPBOARD";
3212 case 0x030B: return "WM_SIZECLIPBOARD";
3213 case 0x030C: return "WM_ASKCBFORMATNAME";
3214 case 0x030D: return "WM_CHANGECBCHAIN";
3215 case 0x030E: return "WM_HSCROLLCLIPBOARD";
3216 case 0x030F: return "WM_QUERYNEWPALETTE";
3217 case 0x0310: return "WM_PALETTEISCHANGING";
3218 case 0x0311: return "WM_PALETTECHANGED";
3221 // common controls messages - although they're not strictly speaking
3222 // standard, it's nice to decode them nevertheless
3225 case 0x1000 + 0: return "LVM_GETBKCOLOR";
3226 case 0x1000 + 1: return "LVM_SETBKCOLOR";
3227 case 0x1000 + 2: return "LVM_GETIMAGELIST";
3228 case 0x1000 + 3: return "LVM_SETIMAGELIST";
3229 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
3230 case 0x1000 + 5: return "LVM_GETITEMA";
3231 case 0x1000 + 75: return "LVM_GETITEMW";
3232 case 0x1000 + 6: return "LVM_SETITEMA";
3233 case 0x1000 + 76: return "LVM_SETITEMW";
3234 case 0x1000 + 7: return "LVM_INSERTITEMA";
3235 case 0x1000 + 77: return "LVM_INSERTITEMW";
3236 case 0x1000 + 8: return "LVM_DELETEITEM";
3237 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
3238 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
3239 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
3240 case 0x1000 + 12: return "LVM_GETNEXTITEM";
3241 case 0x1000 + 13: return "LVM_FINDITEMA";
3242 case 0x1000 + 83: return "LVM_FINDITEMW";
3243 case 0x1000 + 14: return "LVM_GETITEMRECT";
3244 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
3245 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
3246 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
3247 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
3248 case 0x1000 + 18: return "LVM_HITTEST";
3249 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
3250 case 0x1000 + 20: return "LVM_SCROLL";
3251 case 0x1000 + 21: return "LVM_REDRAWITEMS";
3252 case 0x1000 + 22: return "LVM_ARRANGE";
3253 case 0x1000 + 23: return "LVM_EDITLABELA";
3254 case 0x1000 + 118: return "LVM_EDITLABELW";
3255 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
3256 case 0x1000 + 25: return "LVM_GETCOLUMNA";
3257 case 0x1000 + 95: return "LVM_GETCOLUMNW";
3258 case 0x1000 + 26: return "LVM_SETCOLUMNA";
3259 case 0x1000 + 96: return "LVM_SETCOLUMNW";
3260 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
3261 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
3262 case 0x1000 + 28: return "LVM_DELETECOLUMN";
3263 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
3264 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
3265 case 0x1000 + 31: return "LVM_GETHEADER";
3266 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
3267 case 0x1000 + 34: return "LVM_GETVIEWRECT";
3268 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
3269 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
3270 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
3271 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
3272 case 0x1000 + 39: return "LVM_GETTOPINDEX";
3273 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
3274 case 0x1000 + 41: return "LVM_GETORIGIN";
3275 case 0x1000 + 42: return "LVM_UPDATE";
3276 case 0x1000 + 43: return "LVM_SETITEMSTATE";
3277 case 0x1000 + 44: return "LVM_GETITEMSTATE";
3278 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
3279 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
3280 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
3281 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
3282 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
3283 case 0x1000 + 48: return "LVM_SORTITEMS";
3284 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
3285 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
3286 case 0x1000 + 51: return "LVM_GETITEMSPACING";
3287 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
3288 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
3289 case 0x1000 + 53: return "LVM_SETICONSPACING";
3290 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
3291 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
3292 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
3293 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
3294 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
3295 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
3296 case 0x1000 + 60: return "LVM_SETHOTITEM";
3297 case 0x1000 + 61: return "LVM_GETHOTITEM";
3298 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
3299 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
3300 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
3301 case 0x1000 + 65: return "LVM_SETWORKAREA";
3304 case 0x1100 + 0: return "TVM_INSERTITEMA";
3305 case 0x1100 + 50: return "TVM_INSERTITEMW";
3306 case 0x1100 + 1: return "TVM_DELETEITEM";
3307 case 0x1100 + 2: return "TVM_EXPAND";
3308 case 0x1100 + 4: return "TVM_GETITEMRECT";
3309 case 0x1100 + 5: return "TVM_GETCOUNT";
3310 case 0x1100 + 6: return "TVM_GETINDENT";
3311 case 0x1100 + 7: return "TVM_SETINDENT";
3312 case 0x1100 + 8: return "TVM_GETIMAGELIST";
3313 case 0x1100 + 9: return "TVM_SETIMAGELIST";
3314 case 0x1100 + 10: return "TVM_GETNEXTITEM";
3315 case 0x1100 + 11: return "TVM_SELECTITEM";
3316 case 0x1100 + 12: return "TVM_GETITEMA";
3317 case 0x1100 + 62: return "TVM_GETITEMW";
3318 case 0x1100 + 13: return "TVM_SETITEMA";
3319 case 0x1100 + 63: return "TVM_SETITEMW";
3320 case 0x1100 + 14: return "TVM_EDITLABELA";
3321 case 0x1100 + 65: return "TVM_EDITLABELW";
3322 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
3323 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
3324 case 0x1100 + 17: return "TVM_HITTEST";
3325 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
3326 case 0x1100 + 19: return "TVM_SORTCHILDREN";
3327 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
3328 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
3329 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
3330 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
3331 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
3332 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
3333 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
3336 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
3337 case 0x1200 + 1: return "HDM_INSERTITEMA";
3338 case 0x1200 + 10: return "HDM_INSERTITEMW";
3339 case 0x1200 + 2: return "HDM_DELETEITEM";
3340 case 0x1200 + 3: return "HDM_GETITEMA";
3341 case 0x1200 + 11: return "HDM_GETITEMW";
3342 case 0x1200 + 4: return "HDM_SETITEMA";
3343 case 0x1200 + 12: return "HDM_SETITEMW";
3344 case 0x1200 + 5: return "HDM_LAYOUT";
3345 case 0x1200 + 6: return "HDM_HITTEST";
3346 case 0x1200 + 7: return "HDM_GETITEMRECT";
3347 case 0x1200 + 8: return "HDM_SETIMAGELIST";
3348 case 0x1200 + 9: return "HDM_GETIMAGELIST";
3349 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
3350 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
3351 case 0x1200 + 17: return "HDM_GETORDERARRAY";
3352 case 0x1200 + 18: return "HDM_SETORDERARRAY";
3353 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
3356 case 0x1300 + 2: return "TCM_GETIMAGELIST";
3357 case 0x1300 + 3: return "TCM_SETIMAGELIST";
3358 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
3359 case 0x1300 + 5: return "TCM_GETITEMA";
3360 case 0x1300 + 60: return "TCM_GETITEMW";
3361 case 0x1300 + 6: return "TCM_SETITEMA";
3362 case 0x1300 + 61: return "TCM_SETITEMW";
3363 case 0x1300 + 7: return "TCM_INSERTITEMA";
3364 case 0x1300 + 62: return "TCM_INSERTITEMW";
3365 case 0x1300 + 8: return "TCM_DELETEITEM";
3366 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
3367 case 0x1300 + 10: return "TCM_GETITEMRECT";
3368 case 0x1300 + 11: return "TCM_GETCURSEL";
3369 case 0x1300 + 12: return "TCM_SETCURSEL";
3370 case 0x1300 + 13: return "TCM_HITTEST";
3371 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
3372 case 0x1300 + 40: return "TCM_ADJUSTRECT";
3373 case 0x1300 + 41: return "TCM_SETITEMSIZE";
3374 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
3375 case 0x1300 + 43: return "TCM_SETPADDING";
3376 case 0x1300 + 44: return "TCM_GETROWCOUNT";
3377 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
3378 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
3379 case 0x1300 + 47: return "TCM_GETCURFOCUS";
3380 case 0x1300 + 48: return "TCM_SETCURFOCUS";
3381 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
3382 case 0x1300 + 50: return "TCM_DESELECTALL";
3385 case WM_USER+1: return "TB_ENABLEBUTTON";
3386 case WM_USER+2: return "TB_CHECKBUTTON";
3387 case WM_USER+3: return "TB_PRESSBUTTON";
3388 case WM_USER+4: return "TB_HIDEBUTTON";
3389 case WM_USER+5: return "TB_INDETERMINATE";
3390 case WM_USER+9: return "TB_ISBUTTONENABLED";
3391 case WM_USER+10: return "TB_ISBUTTONCHECKED";
3392 case WM_USER+11: return "TB_ISBUTTONPRESSED";
3393 case WM_USER+12: return "TB_ISBUTTONHIDDEN";
3394 case WM_USER+13: return "TB_ISBUTTONINDETERMINATE";
3395 case WM_USER+17: return "TB_SETSTATE";
3396 case WM_USER+18: return "TB_GETSTATE";
3397 case WM_USER+19: return "TB_ADDBITMAP";
3398 case WM_USER+20: return "TB_ADDBUTTONS";
3399 case WM_USER+21: return "TB_INSERTBUTTON";
3400 case WM_USER+22: return "TB_DELETEBUTTON";
3401 case WM_USER+23: return "TB_GETBUTTON";
3402 case WM_USER+24: return "TB_BUTTONCOUNT";
3403 case WM_USER+25: return "TB_COMMANDTOINDEX";
3404 case WM_USER+26: return "TB_SAVERESTOREA";
3405 case WM_USER+76: return "TB_SAVERESTOREW";
3406 case WM_USER+27: return "TB_CUSTOMIZE";
3407 case WM_USER+28: return "TB_ADDSTRINGA";
3408 case WM_USER+77: return "TB_ADDSTRINGW";
3409 case WM_USER+29: return "TB_GETITEMRECT";
3410 case WM_USER+30: return "TB_BUTTONSTRUCTSIZE";
3411 case WM_USER+31: return "TB_SETBUTTONSIZE";
3412 case WM_USER+32: return "TB_SETBITMAPSIZE";
3413 case WM_USER+33: return "TB_AUTOSIZE";
3414 case WM_USER+35: return "TB_GETTOOLTIPS";
3415 case WM_USER+36: return "TB_SETTOOLTIPS";
3416 case WM_USER+37: return "TB_SETPARENT";
3417 case WM_USER+39: return "TB_SETROWS";
3418 case WM_USER+40: return "TB_GETROWS";
3419 case WM_USER+42: return "TB_SETCMDID";
3420 case WM_USER+43: return "TB_CHANGEBITMAP";
3421 case WM_USER+44: return "TB_GETBITMAP";
3422 case WM_USER+45: return "TB_GETBUTTONTEXTA";
3423 case WM_USER+75: return "TB_GETBUTTONTEXTW";
3424 case WM_USER+46: return "TB_REPLACEBITMAP";
3425 case WM_USER+47: return "TB_SETINDENT";
3426 case WM_USER+48: return "TB_SETIMAGELIST";
3427 case WM_USER+49: return "TB_GETIMAGELIST";
3428 case WM_USER+50: return "TB_LOADIMAGES";
3429 case WM_USER+51: return "TB_GETRECT";
3430 case WM_USER+52: return "TB_SETHOTIMAGELIST";
3431 case WM_USER+53: return "TB_GETHOTIMAGELIST";
3432 case WM_USER+54: return "TB_SETDISABLEDIMAGELIST";
3433 case WM_USER+55: return "TB_GETDISABLEDIMAGELIST";
3434 case WM_USER+56: return "TB_SETSTYLE";
3435 case WM_USER+57: return "TB_GETSTYLE";
3436 case WM_USER+58: return "TB_GETBUTTONSIZE";
3437 case WM_USER+59: return "TB_SETBUTTONWIDTH";
3438 case WM_USER+60: return "TB_SETMAXTEXTROWS";
3439 case WM_USER+61: return "TB_GETTEXTROWS";
3440 case WM_USER+41: return "TB_GETBITMAPFLAGS";
3445 static char s_szBuf[128];
3446 sprintf(s_szBuf, "<unknown message = %d>", message);
3453 #endif // __WXDEBUG__