1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
19 #include "wx/window.h"
24 #include "wx/dcclient.h"
28 #include "wx/layout.h"
29 #include "wx/dialog.h"
31 #include "wx/listbox.h"
32 #include "wx/button.h"
33 #include "wx/msgdlg.h"
39 #include "wx/ownerdrw.h"
42 #if wxUSE_DRAG_AND_DROP
46 #include "wx/menuitem.h"
49 #include "wx/os2/private.h"
52 #include "wx/tooltip.h"
63 #include "wx/textctrl.h"
67 // place compiler, OS specific includes here
70 // standard macros -- these are for OS/2 PM, but most GUI's have something similar
72 // SHORT1FROMMP -- LOWORD
73 #define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp))
74 // SHORT2FROMMP -- HIWORD
75 #define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16))
76 #endif // GET_X_LPARAM
78 // ---------------------------------------------------------------------------
80 // ---------------------------------------------------------------------------
82 // the last Windows message we got (MT-UNSAFE)
83 extern WXMSGID s_currentMsg
;
84 extern wxList WXDLLEXPORT wxPendingDelete
;
85 extern wxChar wxCanvasClassName
[];
87 wxMenu
*wxCurrentPopupMenu
= NULL
;
88 wxList
*wxWinHandleList
= NULL
;
90 // ---------------------------------------------------------------------------
92 // ---------------------------------------------------------------------------
93 // the window proc for all our windows; most gui's have something similar
94 MRESULT
wxWndProc( HWND hWnd
101 const char *wxGetMessageName(int message
);
104 void wxRemoveHandleAssociation(wxWindow
*win
);
105 void wxAssociateWinWithHandle(HWND hWnd
, wxWindow
*win
);
106 wxWindow
*wxFindWinFromHandle(WXHWND hWnd
);
108 // ---------------------------------------------------------------------------
110 // ---------------------------------------------------------------------------
112 #if !USE_SHARED_LIBRARY
113 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxWindowBase
)
116 BEGIN_EVENT_TABLE(wxWindow
, wxWindowBase
)
117 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground
)
118 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged
)
119 EVT_INIT_DIALOG(wxWindow::OnInitDialog
)
120 EVT_IDLE(wxWindow::OnIdle
)
123 // ===========================================================================
125 // ===========================================================================
127 // Find an item given the PM Window id
128 wxWindow
* wxWindow::FindItem(
132 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
136 wxWindow
* pChildWin
= pCurrent
->GetData();
137 wxWindow
* pWnd
= pChildWin
->FindItem(ulId
);
142 if (pChildWin
->IsKindOf(CLASSINFO(wxControl
)))
144 wxControl
* pItem
= (wxControl
*)pChildWin
;
146 if (pItem
->GetId() == ulId
)
150 // In case it's a 'virtual' control (e.g. radiobox)
151 if (pItem
->GetSubcontrols().Member((wxObject
*)ulId
))
155 pCurrent
= pCurrent
->GetNext();
160 // Find an item given the PM Window handle
161 wxWindow
* wxWindow::FindItemByHWND(
166 wxWindowList::Node
* pCurrent
= GetChildren().GetFirst();
170 wxWindow
* pParent
= pCurrent
->GetData();
172 // Do a recursive search.
173 wxWindow
* pWnd
= pParent
->FindItemByHWND(hWnd
);
178 if (!bControlOnly
|| pParent
->IsKindOf(CLASSINFO(wxControl
)))
180 wxWindow
* pItem
= pCurrent
->GetData();
182 if (pItem
->GetHWND() == hWnd
)
186 if (pItem
->ContainsHWND(hWnd
))
190 pCurrent
= pCurrent
->GetNext();
195 // Default command handler
196 bool wxWindow::OS2Command(
197 WXUINT
WXUNUSED(uParam
)
198 , WXWORD
WXUNUSED(uId
)
204 // ----------------------------------------------------------------------------
205 // constructors and such
206 // ----------------------------------------------------------------------------
208 void wxWindow::Init()
214 m_bDoubleClickAllowed
= 0;
215 m_bWinCaptured
= FALSE
;
217 m_isBeingDeleted
= FALSE
;
220 m_bMouseInWindow
= FALSE
;
227 // pass WM_GETDLGCODE to DefWindowProc()
232 m_bBackgroundTransparent
= FALSE
;
234 // as all windows are created with WS_VISIBLE style...
237 #if wxUSE_MOUSEEVENT_HACK
240 m_nLastMouseEvent
= -1;
241 #endif // wxUSE_MOUSEEVENT_HACK
245 wxWindow::~wxWindow()
247 m_isBeingDeleted
= TRUE
;
249 OS2DetachWindowMenu();
252 m_parent
->RemoveChild(this);
256 if(!WinDestroyWindow(GetHWND()))
257 wxLogLastError(wxT("DestroyWindow"));
258 // remove hWnd <-> wxWindow association
259 wxRemoveHandleAssociation(this);
263 bool wxWindow::Create(
266 , const wxPoint
& rPos
267 , const wxSize
& rSize
269 , const wxString
& rName
272 wxCHECK_MSG(pParent
, FALSE
, wxT("can't create wxWindow without parent"));
274 if ( !CreateBase( pParent
284 pParent
->AddChild(this);
287 WXDWORD dwExStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &bWant3D
);
290 OS2Create( m_windowId
297 ,WidthDefault(rSize
.x
)
298 ,HeightDefault(rSize
.y
)
306 // ---------------------------------------------------------------------------
308 // ---------------------------------------------------------------------------
310 void wxWindow::SetFocus()
312 HWND hWnd
= GetHwnd();
315 ::WinSetFocus(HWND_DESKTOP
, hWnd
);
318 wxWindow
* wxWindowBase::FindFocus()
320 HWND hWnd
= ::WinQueryFocus(HWND_DESKTOP
);
324 return wxFindWinFromHandle((WXHWND
)hWnd
);
329 bool wxWindow::Enable(
333 if (!wxWindowBase::Enable(bEnable
))
336 HWND hWnd
= GetHwnd();
339 ::WinEnableWindow(hWnd
, (BOOL
)bEnable
);
341 wxWindowList::Node
* pNode
= GetChildren().GetFirst();
345 wxWindow
* pChild
= pNode
->GetData();
347 pChild
->Enable(bEnable
);
348 pNode
= pNode
->GetNext();
357 if (!wxWindowBase::Show(bShow
))
360 HWND hWnd
= GetHwnd();
362 ::WinShowWindow(hWnd
, bShow
);
366 ::WinSetWindowPos(hWnd
, HWND_TOP
, 0, 0, 0, 0, SWP_ACTIVATE
);
371 void wxWindow::Raise()
373 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_ACTIVATE
);
376 void wxWindow::Lower()
378 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM
, 0, 0, 0, 0, SWP_DEACTIVATE
);
381 void wxWindow::SetTitle(
382 const wxString
& rTitle
385 ::WinSetWindowText(GetHwnd(), title
.c_str());
388 wxString
wxWindow::GetTitle() const
390 return wxGetWindowText(GetHWND());
393 void wxWindow::CaptureMouse()
398 void wxWindow::ReleaseMouse()
403 bool wxWindow::SetFont(const wxFont
& f
)
409 bool wxWindow::SetCursor(const wxCursor
& cursor
) // check if base implementation is OK
415 void wxWindow::WarpPointer(int x_pos
, int y_pos
)
420 #if WXWIN_COMPATIBILITY
421 void wxWindow::OS2DeviceToLogical (float *x
, float *y
) const
424 #endif // WXWIN_COMPATIBILITY
426 // ---------------------------------------------------------------------------
428 // ---------------------------------------------------------------------------
430 #if WXWIN_COMPATIBILITY
431 void wxWindow::SetScrollRange(int orient
, int range
, bool refresh
)
436 void wxWindow::SetScrollPage(int orient
, int page
, bool refresh
)
441 int wxWindow::OldGetScrollRange(int orient
) const
447 int wxWindow::GetScrollPage(int orient
) const
452 #endif // WXWIN_COMPATIBILITY
454 int wxWindow::GetScrollPos(int orient
) const
460 int wxWindow::GetScrollRange(int orient
) const
466 int wxWindow::GetScrollThumb(int orient
) const
472 void wxWindow::SetScrollPos( int orient
480 void wxWindow::SetScrollbar( int orient
490 void wxWindow::ScrollWindow( int dx
498 // ---------------------------------------------------------------------------
500 // ---------------------------------------------------------------------------
502 void wxWindow::SubclassWin(WXHWND hWnd
)
504 wxASSERT_MSG( !m_fnOldWndProc
, wxT("subclassing window twice?") );
506 HWND hwnd
= (HWND
)hWnd
;
508 * TODO: implement something like this:
509 * wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in SubclassWin") );
511 * wxAssociateWinWithHandle(hwnd, this);
513 * m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
514 * SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
518 void wxWindow::UnsubclassWin()
523 wxRemoveHandleAssociation(this);
525 // Restore old Window proc
526 HWND hwnd = GetHwnd();
531 wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in UnsubclassWin") );
533 FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
534 if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) )
536 SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
543 // Make a Windows extended style from the given wxWindows window style
544 WXDWORD
wxWindow::MakeExtendedStyle(long style
, bool eliminateBorders
)
549 if ( style & wxTRANSPARENT_WINDOW )
550 exStyle |= WS_EX_TRANSPARENT;
552 if ( !eliminateBorders )
554 if ( style & wxSUNKEN_BORDER )
555 exStyle |= WS_EX_CLIENTEDGE;
556 if ( style & wxDOUBLE_BORDER )
557 exStyle |= WS_EX_DLGMODALFRAME;
558 if ( style & wxRAISED_BORDER )
559 exStyle |= WS_EX_WINDOWEDGE;
560 if ( style & wxSTATIC_BORDER )
561 exStyle |= WS_EX_STATICEDGE;
567 // Determines whether native 3D effects or CTL3D should be used,
568 // applying a default border style if required, and returning an extended
569 // style to pass to CreateWindowEx.
570 WXDWORD
wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle
,
573 DWORD exStyle
; // remove after implementation doe
574 /* TODO: this ought to be fun
576 // If matches certain criteria, then assume no 3D effects
577 // unless specifically requested (dealt with in MakeExtendedStyle)
578 if ( !GetParent() || !IsKindOf(CLASSINFO(wxControl)) || (m_windowStyle & wxNO_BORDER) )
581 return MakeExtendedStyle(m_windowStyle, FALSE);
584 // Determine whether we should be using 3D effects or not.
585 bool nativeBorder = FALSE; // by default, we don't want a Win95 effect
587 // 1) App can specify global 3D effects
588 *want3D = wxTheApp->GetAuto3D();
590 // 2) If the parent is being drawn with user colours, or simple border specified,
591 // switch effects off. TODO: replace wxUSER_COLOURS with wxNO_3D
592 if ( GetParent() && (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) || (m_windowStyle & wxSIMPLE_BORDER) )
595 // 3) Control can override this global setting by defining
596 // a border style, e.g. wxSUNKEN_BORDER
597 if ( m_windowStyle & wxSUNKEN_BORDER )
600 // 4) If it's a special border, CTL3D can't cope so we want a native border
601 if ( (m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
602 (m_windowStyle & wxSTATIC_BORDER) )
608 // 5) If this isn't a Win95 app, and we are using CTL3D, remove border
609 // effects from extended style
612 nativeBorder = FALSE;
615 DWORD exStyle = MakeExtendedStyle(m_windowStyle, !nativeBorder);
617 // If we want 3D, but haven't specified a border here,
618 // apply the default border style specified.
619 // TODO what about non-Win95 WIN32? Does it have borders?
620 #if defined(__WIN95__) && !wxUSE_CTL3D
621 if ( defaultBorderStyle && (*want3D) && ! ((m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
622 (m_windowStyle & wxSTATIC_BORDER) || (m_windowStyle & wxSIMPLE_BORDER) ))
623 exStyle |= defaultBorderStyle; // WS_EX_CLIENTEDGE;
629 #if WXWIN_COMPATIBILITY
630 void wxWindow::OnCommand(wxWindow
& win
, wxCommandEvent
& event
)
635 wxObject
* wxWindow::GetChild(int number
) const
638 return((wxObject
*)this);
641 void wxWindow::OnDefaultAction(wxControl
*initiatingItem
)
646 #endif // WXWIN_COMPATIBILITY
648 // Setup background and foreground colours correctly
649 void wxWindow::SetupColours()
652 SetBackgroundColour(GetParent()->GetBackgroundColour());
655 void wxWindow::OnIdle(wxIdleEvent
& event
)
660 // Set this window to be the child of 'parent'.
661 bool wxWindow::Reparent(wxWindow
*parent
)
663 if ( !wxWindowBase::Reparent(parent
) )
669 void wxWindow::Clear()
674 void wxWindow::Refresh(bool eraseBack
, const wxRect
*rect
)
679 // ---------------------------------------------------------------------------
681 // ---------------------------------------------------------------------------
683 #if wxUSE_DRAG_AND_DROP
684 void wxWindow::SetDropTarget(wxDropTarget
*pDropTarget
)
690 // old style file-manager drag&drop support: we retain the old-style
691 // DragAcceptFiles in parallel with SetDropTarget.
692 void wxWindow::DragAcceptFiles(bool accept
)
697 // ----------------------------------------------------------------------------
699 // ----------------------------------------------------------------------------
703 void wxWindow::DoSetToolTip(wxToolTip
*tooltip
)
705 wxWindowBase::DoSetToolTip(tooltip
);
708 m_tooltip
->SetWindow(this);
711 #endif // wxUSE_TOOLTIPS
713 // ---------------------------------------------------------------------------
714 // moving and resizing
715 // ---------------------------------------------------------------------------
718 void wxWindow::DoGetSize( int *width
, int *height
) const
723 void wxWindow::DoGetPosition( int *x
, int *y
) const
728 void wxWindow::DoScreenToClient( int *x
, int *y
) const
733 void wxWindow::DoClientToScreen( int *x
, int *y
) const
738 // Get size *available for subwindows* i.e. excluding menu bar etc.
739 void wxWindow::DoGetClientSize( int *width
, int *height
) const
744 void wxWindow::DoMoveWindow(int x
, int y
, int width
, int height
)
749 // set the size of the window: if the dimensions are positive, just use them,
750 // but if any of them is equal to -1, it means that we must find the value for
751 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
752 // which case -1 is a valid value for x and y)
754 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
755 // the width/height to best suit our contents, otherwise we reuse the current
757 void wxWindow::DoSetSize(int x
, int y
,
758 int width
, int height
,
764 // for a generic window there is no natural best size - just use the current one
765 wxSize
wxWindow::DoGetBestSize()
770 void wxWindow::DoSetClientSize(int width
, int height
)
775 wxPoint
wxWindow::GetClientAreaOrigin() const
777 return wxPoint(0, 0);
780 void wxWindow::AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
)
785 // ---------------------------------------------------------------------------
787 // ---------------------------------------------------------------------------
789 int wxWindow::GetCharHeight() const
795 int wxWindow::GetCharWidth() const
801 void wxWindow::GetTextExtent( const wxString
& string
805 ,int* externalLeading
806 ,const wxFont
* theFont
812 #if wxUSE_CARET && WXWIN_COMPATIBILITY
813 // ---------------------------------------------------------------------------
814 // Caret manipulation
815 // ---------------------------------------------------------------------------
817 void wxWindow::CreateCaret(int w
, int h
)
822 void wxWindow::CreateCaret(const wxBitmap
*bitmap
)
827 void wxWindow::ShowCaret(bool show
)
832 void wxWindow::DestroyCaret()
837 void wxWindow::SetCaretPos(int x
, int y
)
842 void wxWindow::GetCaretPos(int *x
, int *y
) const
849 // ---------------------------------------------------------------------------
851 // ---------------------------------------------------------------------------
853 bool wxWindow::DoPopupMenu( wxMenu
*menu
, int x
, int y
)
859 // ===========================================================================
860 // pre/post message processing
861 // ===========================================================================
863 MRESULT
wxWindow::OS2DefWindowProc(HWND hwnd
, WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
869 bool wxWindow::OS2ProcessMessage(WXMSG
* pMsg
)
875 bool wxWindow::OS2TranslateMessage(WXMSG
* pMsg
)
877 return m_acceleratorTable
.Translate(this, pMsg
);
880 // ---------------------------------------------------------------------------
881 // message params unpackers (different for Win16 and Win32)
882 // ---------------------------------------------------------------------------
884 void wxWindow::UnpackCommand(WXWPARAM wParam
, WXLPARAM lParam
,
885 WORD
*id
, WXHWND
*hwnd
, WORD
*cmd
)
887 *id
= LOWORD(wParam
);
888 *hwnd
= (WXHWND
)lParam
;
889 *cmd
= HIWORD(wParam
);
892 void wxWindow::UnpackActivate(WXWPARAM wParam
, WXLPARAM lParam
,
893 WXWORD
*state
, WXWORD
*minimized
, WXHWND
*hwnd
)
895 *state
= LOWORD(wParam
);
896 *minimized
= HIWORD(wParam
);
897 *hwnd
= (WXHWND
)lParam
;
900 void wxWindow::UnpackScroll(WXWPARAM wParam
, WXLPARAM lParam
,
901 WXWORD
*code
, WXWORD
*pos
, WXHWND
*hwnd
)
903 *code
= LOWORD(wParam
);
904 *pos
= HIWORD(wParam
);
905 *hwnd
= (WXHWND
)lParam
;
908 void wxWindow::UnpackCtlColor(WXWPARAM wParam
, WXLPARAM lParam
,
909 WXWORD
*nCtlColor
, WXHDC
*hdc
, WXHWND
*hwnd
)
911 *nCtlColor
= 0; // TODO: CTLCOLOR_BTN;
912 *hwnd
= (WXHWND
)lParam
;
913 *hdc
= (WXHDC
)wParam
;
916 void wxWindow::UnpackMenuSelect(WXWPARAM wParam
, WXLPARAM lParam
,
917 WXWORD
*item
, WXWORD
*flags
, WXHMENU
*hmenu
)
919 *item
= (WXWORD
)LOWORD(wParam
);
920 *flags
= HIWORD(wParam
);
921 *hmenu
= (WXHMENU
)lParam
;
924 // ---------------------------------------------------------------------------
925 // Main wxWindows window proc and the window proc for wxWindow
926 // ---------------------------------------------------------------------------
928 // Hook for new window just as it's being created, when the window isn't yet
929 // associated with the handle
930 wxWindow
*wxWndHook
= NULL
;
933 MRESULT
wxWndProc(HWND hWnd
, UINT message
, MPARAM wParam
, MPARAM lParam
)
935 // trace all messages - useful for the debugging
937 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
938 wxGetMessageName(message
), wParam
, lParam
);
939 #endif // __WXDEBUG__
941 wxWindow
*wnd
= wxFindWinFromHandle((WXHWND
) hWnd
);
943 // when we get the first message for the HWND we just created, we associate
944 // it with wxWindow stored in wxWndHook
945 if ( !wnd
&& wxWndHook
)
947 #if 0 // def __WXDEBUG__
949 ::GetClassNameA((HWND
) hWnd
, buf
, 512);
950 wxString
className(buf
);
953 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
956 wnd
->SetHWND((WXHWND
)hWnd
);
961 // Stop right here if we don't have a valid handle in our wxWindow object.
962 if ( wnd
&& !wnd
->GetHWND() )
964 // FIXME: why do we do this?
965 wnd
->SetHWND((WXHWND
) hWnd
);
966 rc
= wnd
->OS2DefWindowProc(hWnd
, message
, wParam
, lParam
);
972 rc
= wnd
->OS2WindowProc(hWnd
, message
, wParam
, lParam
);
974 rc
= 0; //TODO: DefWindowProc( hWnd, message, wParam, lParam );
980 MRESULT
wxWindow::OS2WindowProc(HWND hWnd
, WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
982 // did we process the message?
983 bool processed
= FALSE
;
994 // for most messages we should return 0 when we do process the message
1003 processed = HandleCreate((WXLPCREATESTRUCT)lParam, &mayCreate);
1006 // return 0 to allow window creation
1007 rc.result = mayCreate ? 0 : -1;
1013 processed = HandleDestroy();
1017 processed = HandleMove(LOWORD(lParam), HIWORD(lParam));
1021 processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
1026 WXWORD state, minimized;
1028 UnpackActivate(wParam, lParam, &state, &minimized, &hwnd);
1030 processed = HandleActivate(state, minimized != 0, (WXHWND)hwnd);
1035 processed = HandleSetFocus((WXHWND)(HWND)wParam);
1039 processed = HandleKillFocus((WXHWND)(HWND)wParam);
1043 processed = HandlePaint();
1047 // don't let the DefWindowProc() destroy our window - we'll do it
1048 // ourselves in ~wxWindow
1054 processed = HandleShow(wParam != 0, (int)lParam);
1058 case WM_LBUTTONDOWN:
1060 case WM_LBUTTONDBLCLK:
1061 case WM_RBUTTONDOWN:
1063 case WM_RBUTTONDBLCLK:
1064 case WM_MBUTTONDOWN:
1066 case WM_MBUTTONDBLCLK:
1068 short x = LOWORD(lParam);
1069 short y = HIWORD(lParam);
1071 processed = HandleMouseEvent(message, x, y, wParam);
1079 case MM_JOY1BUTTONDOWN:
1080 case MM_JOY2BUTTONDOWN:
1081 case MM_JOY1BUTTONUP:
1082 case MM_JOY2BUTTONUP:
1084 int x = LOWORD(lParam);
1085 int y = HIWORD(lParam);
1087 processed = HandleJoystickEvent(message, x, y, wParam);
1092 processed = HandleSysCommand(wParam, lParam);
1099 UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);
1101 processed = HandleCommand(id, cmd, hwnd);
1107 processed = HandleNotify((int)wParam, lParam, &rc.result);
1111 // for these messages we must return TRUE if process the message
1113 case WM_MEASUREITEM:
1115 int idCtrl = (UINT)wParam;
1116 if ( message == WM_DRAWITEM )
1118 processed = MSWOnDrawItem(idCtrl,
1119 (WXDRAWITEMSTRUCT *)lParam);
1123 processed = MSWOnMeasureItem(idCtrl,
1124 (WXMEASUREITEMSTRUCT *)lParam);
1135 rc.result = m_lDlgCode;
1138 //else: get the dlg code from the DefWindowProc()
1142 // If this has been processed by an event handler,
1143 // return 0 now (we've handled it).
1144 if ( HandleKeyDown((WORD) wParam, lParam) )
1151 // we consider these message "not interesting" to OnChar
1152 if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
1161 // avoid duplicate messages to OnChar for these ASCII keys: they
1162 // will be translated by TranslateMessage() and received in WM_CHAR
1168 // but set processed to FALSE, not TRUE to still pass them to
1169 // the control's default window proc - otherwise built-in
1170 // keyboard handling won't work
1176 // special case of VK_APPS: treat it the same as right mouse
1177 // click because both usually pop up a context menu
1180 // construct the key mask
1181 WPARAM fwKeys = MK_RBUTTON;
1182 if ( (::GetKeyState(VK_CONTROL) & 0x100) != 0 )
1183 fwKeys |= MK_CONTROL;
1184 if ( (::GetKeyState(VK_SHIFT) & 0x100) != 0 )
1187 // simulate right mouse button click
1188 DWORD dwPos = ::GetMessagePos();
1189 int x = GET_X_LPARAM(dwPos),
1190 y = GET_Y_LPARAM(dwPos);
1192 ScreenToClient(&x, &y);
1193 processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, fwKeys);
1203 processed = HandleChar((WORD)wParam, lParam);
1208 processed = HandleKeyUp((WORD) wParam, lParam);
1211 case WM_CHAR: // Always an ASCII character
1212 processed = HandleChar((WORD)wParam, lParam, TRUE);
1220 UnpackScroll(wParam, lParam, &code, &pos, &hwnd);
1222 processed = MSWOnScroll(message == WM_HSCROLL ? wxHORIZONTAL
1228 // CTLCOLOR messages are sent by children to query the parent for their
1231 case WM_CTLCOLORMSGBOX:
1232 case WM_CTLCOLOREDIT:
1233 case WM_CTLCOLORLISTBOX:
1234 case WM_CTLCOLORBTN:
1235 case WM_CTLCOLORDLG:
1236 case WM_CTLCOLORSCROLLBAR:
1237 case WM_CTLCOLORSTATIC:
1245 UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd);
1247 processed = HandleCtlColor(&rc.hBrush,
1257 // the return value for this message is ignored
1258 case WM_SYSCOLORCHANGE:
1259 processed = HandleSysColorChange();
1262 case WM_PALETTECHANGED:
1263 processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
1266 case WM_QUERYNEWPALETTE:
1267 processed = HandleQueryNewPalette();
1271 processed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
1274 // we processed the message, i.e. erased the background
1280 processed = HandleDropFiles(wParam);
1284 processed = HandleInitDialog((WXHWND)(HWND)wParam);
1288 // we never set focus from here
1293 case WM_QUERYENDSESSION:
1294 processed = HandleQueryEndSession(lParam, &rc.allow);
1298 processed = HandleEndSession(wParam != 0, lParam);
1301 case WM_GETMINMAXINFO:
1302 processed = HandleGetMinMaxInfo((MINMAXINFO*)lParam);
1306 processed = HandleSetCursor((WXHWND)(HWND)wParam,
1307 LOWORD(lParam), // hit test
1308 HIWORD(lParam)); // mouse msg
1312 // returning TRUE stops the DefWindowProc() from further
1313 // processing this message - exactly what we need because we've
1314 // just set the cursor.
1323 wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."),
1324 wxGetMessageName(message));
1325 #endif // __WXDEBUG__
1326 rc.result = MSWDefWindowProc(message, wParam, lParam);
1332 // Dialog window proc
1333 MRESULT
wxDlgProc(HWND hWnd
, UINT message
, MPARAM wParam
, MPARAM lParam
)
1337 if ( message == WM_INITDIALOG )
1339 // for this message, returning TRUE tells system to set focus to the
1340 // first control in the dialog box
1345 // for all the other ones, FALSE means that we didn't process the
1353 wxWindow
*wxFindWinFromHandle(WXHWND hWnd
)
1355 wxNode
*node
= wxWinHandleList
->Find((long)hWnd
);
1358 return (wxWindow
*)node
->Data();
1361 void wxAssociateWinWithHandle(HWND hWnd
, wxWindow
*win
)
1363 // adding NULL hWnd is (first) surely a result of an error and
1364 // (secondly) breaks menu command processing
1365 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
1366 wxT("attempt to add a NULL hWnd to window list ignored") );
1369 wxWindow
*oldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
1370 if ( oldWin
&& (oldWin
!= win
) )
1372 wxString
str(win
->GetClassInfo()->GetClassName());
1373 wxLogError("Bug! Found existing HWND %X for new window of class %s", (int) hWnd
, (const char*) str
);
1377 wxWinHandleList
->Append((long)hWnd
, win
);
1381 void wxRemoveHandleAssociation(wxWindow
*win
)
1383 wxWinHandleList
->DeleteObject(win
);
1386 // Default destroyer - override if you destroy it in some other way
1387 // (e.g. with MDI child windows)
1388 void wxWindow::OS2DestroyWindow()
1392 void wxWindow::OS2DetachWindowMenu()
1396 HMENU hMenu
= (HMENU
)m_hMenu
;
1398 int N
= (int)WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
1400 for (i
= 0; i
< N
; i
++)
1403 int chars
= (int)WinSendMsg(hMenu
, MM_QUERYITEMTEXT
, MPFROM2SHORT(i
, N
), buf
);
1406 wxLogLastError(wxT("GetMenuString"));
1411 if ( wxStrcmp(buf
, wxT("&Window")) == 0 )
1413 WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
1420 bool wxWindow::OS2Create(int id
,
1422 const wxChar
*wclass
,
1424 const wxChar
*title
,
1430 const wxChar
*dialog_template
,
1431 WXDWORD extendedStyle
)
1435 int x1 = CW_USEDEFAULT;
1437 int width1 = CW_USEDEFAULT;
1440 // Find parent's size, if it exists, to set up a possible default
1441 // panel size the size of the parent window
1445 ::GetClientRect((HWND) parent->GetHWND(), &parent_rect);
1447 width1 = parent_rect.right - parent_rect.left;
1448 height1 = parent_rect.bottom - parent_rect.top;
1451 if ( x > -1 ) x1 = x;
1452 if ( y > -1 ) y1 = y;
1453 if ( width > -1 ) width1 = width;
1454 if ( height > -1 ) height1 = height;
1456 HWND hParent = (HWND)NULL;
1458 hParent = (HWND) parent->GetHWND();
1462 if ( dialog_template )
1464 m_hWnd = (WXHWND)::CreateDialog(wxGetInstance(),
1467 (DLGPROC)wxDlgProc);
1471 wxLogError(_("Can't find dummy dialog template!\n"
1472 "Check resource include path for finding wx.rc."));
1477 // ::SetWindowLong(GWL_EXSTYLE) doesn't work for the dialogs, so try
1478 // to take care of (at least some) extended style flags ourselves
1479 if ( extendedStyle & WS_EX_TOPMOST )
1481 if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
1482 SWP_NOSIZE | SWP_NOMOVE) )
1484 wxLogLastError(wxT("SetWindowPos"));
1488 // move the dialog to its initial position without forcing repainting
1489 if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) )
1491 wxLogLastError(wxT("MoveWindow"));
1497 if ( style & WS_CHILD )
1500 wxString className(wclass);
1501 if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
1503 className += wxT("NR");
1506 m_hWnd = (WXHWND)CreateWindowEx(extendedStyle,
1508 title ? title : wxT(""),
1512 hParent, (HMENU)controlId,
1518 wxLogError(_("Can't create window of class %s!\n"
1519 "Possible Windows 3.x compatibility problem?"),
1528 wxNode* node = wxWinHandleList->Member(this);
1531 HWND hWnd = (HWND) node->GetKeyInteger();
1532 if (hWnd != (HWND) m_hWnd)
1534 wxLogError("A second HWND association is being added for the same window!");
1539 wxAssociateWinWithHandle((HWND
) m_hWnd
, this);
1544 // ===========================================================================
1545 // OS2 PM message handlers
1546 // ===========================================================================
1548 // ---------------------------------------------------------------------------
1550 // ---------------------------------------------------------------------------
1552 bool wxWindow::HandleNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
)
1558 bool wxWindow::OS2OnNotify(int WXUNUSED(idCtrl
),
1560 WXLPARAM
* WXUNUSED(result
))
1566 // ---------------------------------------------------------------------------
1567 // end session messages
1568 // ---------------------------------------------------------------------------
1570 bool wxWindow::HandleQueryEndSession(long logOff
, bool *mayEnd
)
1572 wxCloseEvent
event(wxEVT_QUERY_END_SESSION
, -1);
1573 event
.SetEventObject(wxTheApp
);
1574 event
.SetCanVeto(TRUE
);
1575 event
.SetLoggingOff(logOff
== ENDSESSION_LOGOFF
);
1577 bool rc
= wxTheApp
->ProcessEvent(event
);
1581 // we may end only if the app didn't veto session closing (double
1583 *mayEnd
= !event
.GetVeto();
1589 bool wxWindow::HandleEndSession(bool endSession
, long logOff
)
1591 // do nothing if the session isn't ending
1595 wxCloseEvent
event(wxEVT_END_SESSION
, -1);
1596 event
.SetEventObject(wxTheApp
);
1597 event
.SetCanVeto(FALSE
);
1598 event
.SetLoggingOff( (logOff
== ENDSESSION_LOGOFF
) );
1599 if ( (this == wxTheApp
->GetTopWindow()) && // Only send once
1600 wxTheApp
->ProcessEvent(event
))
1606 // ---------------------------------------------------------------------------
1607 // window creation/destruction
1608 // ---------------------------------------------------------------------------
1610 bool wxWindow::HandleCreate(WXLPCREATESTRUCT cs
, bool *mayCreate
)
1612 // TODO: should generate this event from WM_NCCREATE
1613 wxWindowCreateEvent
event(this);
1614 (void)GetEventHandler()->ProcessEvent(event
);
1621 bool wxWindow::HandleDestroy()
1623 wxWindowDestroyEvent
event(this);
1624 (void)GetEventHandler()->ProcessEvent(event
);
1626 // delete our drop target if we've got one
1627 #if wxUSE_DRAG_AND_DROP
1628 if ( m_dropTarget
!= NULL
)
1630 // m_dropTarget->Revoke(m_hWnd);
1632 delete m_dropTarget
;
1633 m_dropTarget
= NULL
;
1635 #endif // wxUSE_DRAG_AND_DROP
1637 // WM_DESTROY handled
1641 // ---------------------------------------------------------------------------
1643 // ---------------------------------------------------------------------------
1645 bool wxWindow::HandleActivate(int state
,
1646 bool WXUNUSED(minimized
),
1647 WXHWND
WXUNUSED(activate
))
1651 wxActivateEvent event(wxEVT_ACTIVATE,
1652 (state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
1654 event.SetEventObject(this);
1656 return GetEventHandler()->ProcessEvent(event);
1661 bool wxWindow::HandleSetFocus(WXHWND
WXUNUSED(hwnd
))
1667 m_caret
->OnSetFocus();
1669 #endif // wxUSE_CARET
1671 // panel wants to track the window which was the last to have focus in it
1672 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
1675 panel
->SetLastFocus(this);
1678 wxFocusEvent
event(wxEVT_SET_FOCUS
, m_windowId
);
1679 event
.SetEventObject(this);
1681 return GetEventHandler()->ProcessEvent(event
);
1684 bool wxWindow::HandleKillFocus(WXHWND
WXUNUSED(hwnd
))
1690 m_caret
->OnKillFocus();
1692 #endif // wxUSE_CARET
1694 wxFocusEvent
event(wxEVT_KILL_FOCUS
, m_windowId
);
1695 event
.SetEventObject(this);
1697 return GetEventHandler()->ProcessEvent(event
);
1700 // ---------------------------------------------------------------------------
1702 // ---------------------------------------------------------------------------
1704 bool wxWindow::HandleShow(bool show
, int status
)
1706 wxShowEvent
event(GetId(), show
);
1707 event
.m_eventObject
= this;
1709 return GetEventHandler()->ProcessEvent(event
);
1712 bool wxWindow::HandleInitDialog(WXHWND
WXUNUSED(hWndFocus
))
1714 wxInitDialogEvent
event(GetId());
1715 event
.m_eventObject
= this;
1717 return GetEventHandler()->ProcessEvent(event
);
1720 bool wxWindow::HandleDropFiles(WXWPARAM wParam
)
1726 bool wxWindow::HandleSetCursor(WXHWND hWnd
,
1728 int WXUNUSED(mouseMsg
))
1730 // don't set cursor for other windows, only for this one: this prevents
1731 // children of this window from getting the same cursor as the parent has
1732 // (don't forget that this message is propagated by default up the window
1733 // parent-child hierarchy)
1734 if ( GetHWND() == hWnd
)
1736 // don't set cursor when the mouse is not in the client part
1739 if ( nHitTest == HTCLIENT || nHitTest == HTERROR )
1741 HCURSOR hcursor = 0;
1744 // from msw\utils.cpp
1745 extern HCURSOR gs_wxBusyCursor;
1747 hcursor = gs_wxBusyCursor;
1751 wxCursor *cursor = NULL;
1753 if ( m_cursor.Ok() )
1759 // from msw\data.cpp
1760 extern wxCursor *g_globalCursor;
1762 if ( g_globalCursor && g_globalCursor->Ok() )
1763 cursor = g_globalCursor;
1767 hcursor = (HCURSOR)cursor->GetHCURSOR();
1772 // ::SetCursor(hcursor);
1783 // ---------------------------------------------------------------------------
1784 // owner drawn stuff
1785 // ---------------------------------------------------------------------------
1787 bool wxWindow::OS2OnDrawItem(int id
, WXDRAWITEMSTRUCT
*itemStruct
)
1791 #if wxUSE_OWNER_DRAWN
1792 // is it a menu item?
1795 DRAWITEMSTRUCT *pDrawStruct = (DRAWITEMSTRUCT *)itemStruct;
1796 wxMenuItem *pMenuItem = (wxMenuItem *)(pDrawStruct->itemData);
1798 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
1800 // prepare to call OnDrawItem()
1802 dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE);
1803 wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top,
1804 pDrawStruct->rcItem.right - pDrawStruct->rcItem.left,
1805 pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top);
1807 return pMenuItem->OnDrawItem
1810 (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction,
1811 (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
1815 wxWindow *item = FindItem(id);
1816 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
1818 return ((wxControl *)item)->MSWOnDraw(itemStruct);
1827 bool wxWindow::OS2OnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*itemStruct
)
1831 #if wxUSE_OWNER_DRAWN
1832 // is it a menu item?
1835 MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
1836 wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
1838 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
1840 return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
1841 &pMeasureStruct->itemHeight);
1844 wxWindow *item = FindItem(id);
1845 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
1847 return ((wxControl *)item)->MSWOnMeasure(itemStruct);
1849 #endif // owner-drawn menus
1854 // ---------------------------------------------------------------------------
1855 // colours and palettes
1856 // ---------------------------------------------------------------------------
1858 bool wxWindow::HandleSysColorChange()
1860 wxSysColourChangedEvent event
;
1861 event
.SetEventObject(this);
1863 return GetEventHandler()->ProcessEvent(event
);
1866 bool wxWindow::HandleCtlColor(WXHBRUSH
*brush
,
1874 WXHBRUSH hBrush
= 0;
1877 if ( nCtlColor == CTLCOLOR_DLG )
1879 hBrush = OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
1883 wxControl *item = (wxControl *)FindItemByHWND(pWnd, TRUE);
1885 hBrush = item->OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
1896 // Define for each class of dialog and control
1897 WXHBRUSH
wxWindow::OnCtlColor(WXHDC hDC
,
1907 bool wxWindow::HandlePaletteChanged(WXHWND hWndPalChange
)
1909 wxPaletteChangedEvent
event(GetId());
1910 event
.SetEventObject(this);
1911 event
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
1913 return GetEventHandler()->ProcessEvent(event
);
1916 bool wxWindow::HandleQueryNewPalette()
1918 wxQueryNewPaletteEvent
event(GetId());
1919 event
.SetEventObject(this);
1921 return GetEventHandler()->ProcessEvent(event
) && event
.GetPaletteRealized();
1924 // Responds to colour changes: passes event on to children.
1925 void wxWindow::OnSysColourChanged(wxSysColourChangedEvent
& event
)
1927 wxNode
*node
= GetChildren().First();
1930 // Only propagate to non-top-level windows
1931 wxWindow
*win
= (wxWindow
*)node
->Data();
1932 if ( win
->GetParent() )
1934 wxSysColourChangedEvent event2
;
1935 event
.m_eventObject
= win
;
1936 win
->GetEventHandler()->ProcessEvent(event2
);
1939 node
= node
->Next();
1943 // ---------------------------------------------------------------------------
1945 // ---------------------------------------------------------------------------
1947 bool wxWindow::HandlePaint()
1953 bool wxWindow::HandleEraseBkgnd(WXHDC hdc
)
1955 // Prevents flicker when dragging
1956 // if ( ::IsIconic(GetHwnd()) )
1965 wxEraseEvent
event(m_windowId
, &dc
);
1966 event
.SetEventObject(this);
1967 bool rc
= GetEventHandler()->ProcessEvent(event
);
1970 dc
.SelectOldObjects(hdc
);
1971 dc
.SetHDC((WXHDC
) NULL
);
1976 void wxWindow::OnEraseBackground(wxEraseEvent
& event
)
1981 // ---------------------------------------------------------------------------
1982 // moving and resizing
1983 // ---------------------------------------------------------------------------
1985 bool wxWindow::HandleMinimize()
1987 wxIconizeEvent
event(m_windowId
);
1988 event
.SetEventObject(this);
1990 return GetEventHandler()->ProcessEvent(event
);
1993 bool wxWindow::HandleMaximize()
1995 wxMaximizeEvent
event(m_windowId
);
1996 event
.SetEventObject(this);
1998 return GetEventHandler()->ProcessEvent(event
);
2001 bool wxWindow::HandleMove(int x
, int y
)
2003 wxMoveEvent
event(wxPoint(x
, y
), m_windowId
);
2004 event
.SetEventObject(this);
2006 return GetEventHandler()->ProcessEvent(event
);
2009 bool wxWindow::HandleSize(int w
, int h
, WXUINT
WXUNUSED(flag
))
2011 wxSizeEvent
event(wxSize(w
, h
), m_windowId
);
2012 event
.SetEventObject(this);
2014 return GetEventHandler()->ProcessEvent(event
);
2017 bool wxWindow::HandleGetMinMaxInfo(void *mmInfo
)
2021 MINMAXINFO *info = (MINMAXINFO *)mmInfo;
2025 if ( m_minWidth != -1 )
2027 info->ptMinTrackSize.x = m_minWidth;
2031 if ( m_minHeight != -1 )
2033 info->ptMinTrackSize.y = m_minHeight;
2037 if ( m_maxWidth != -1 )
2039 info->ptMaxTrackSize.x = m_maxWidth;
2043 if ( m_maxHeight != -1 )
2045 info->ptMaxTrackSize.y = m_maxHeight;
2054 // ---------------------------------------------------------------------------
2056 // ---------------------------------------------------------------------------
2058 bool wxWindow::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
2060 if ( wxCurrentPopupMenu
)
2062 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
2063 wxCurrentPopupMenu
= NULL
;
2065 return popupMenu
->OS2Command(cmd
, id
);
2068 wxWindow
*win
= FindItem(id
);
2071 win
= wxFindWinFromHandle(control
);
2075 return win
->OS2Command(cmd
, id
);
2080 bool wxWindow::HandleSysCommand(WXWPARAM wParam
, WXLPARAM lParam
)
2086 // ---------------------------------------------------------------------------
2088 // ---------------------------------------------------------------------------
2090 void wxWindow::InitMouseEvent(wxMouseEvent
& event
, int x
, int y
, WXUINT flags
)
2096 event.m_shiftDown = ((flags & MK_SHIFT) != 0);
2097 event.m_controlDown = ((flags & MK_CONTROL) != 0);
2098 event.m_leftDown = ((flags & MK_LBUTTON) != 0);
2099 event.m_middleDown = ((flags & MK_MBUTTON) != 0);
2100 event.m_rightDown = ((flags & MK_RBUTTON) != 0);
2101 event.SetTimestamp(s_currentMsg.time);
2102 event.m_eventObject = this;
2104 #if wxUSE_MOUSEEVENT_HACK
2107 m_lastMouseEvent = event.GetEventType();
2108 #endif // wxUSE_MOUSEEVENT_HACK
2112 bool wxWindow::HandleMouseEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
2114 // the mouse events take consecutive IDs from WM_MOUSEFIRST to
2115 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
2116 // from the message id and take the value in the table to get wxWin event
2118 static const wxEventType eventsMouse
[] =
2132 wxMouseEvent
event(eventsMouse
[msg
- WM_MOUSEMOVE
]);
2133 InitMouseEvent(event
, x
, y
, flags
);
2135 return GetEventHandler()->ProcessEvent(event
);
2138 bool wxWindow::HandleMouseMove(int x
, int y
, WXUINT flags
)
2140 if ( !m_bMouseInWindow
)
2142 // Generate an ENTER event
2143 m_bMouseInWindow
= TRUE
;
2145 wxMouseEvent
event(wxEVT_ENTER_WINDOW
);
2146 InitMouseEvent(event
, x
, y
, flags
);
2148 (void)GetEventHandler()->ProcessEvent(event
);
2151 #if wxUSE_MOUSEEVENT_HACK
2152 // Window gets a click down message followed by a mouse move message even
2153 // if position isn't changed! We want to discard the trailing move event
2154 // if x and y are the same.
2155 if ( (m_lastMouseEvent
== wxEVT_RIGHT_DOWN
||
2156 m_lastMouseEvent
== wxEVT_LEFT_DOWN
||
2157 m_lastMouseEvent
== wxEVT_MIDDLE_DOWN
) &&
2158 (m_lastMouseX
== event
.m_x
&& m_lastMouseY
== event
.m_y
) )
2160 m_lastMouseEvent
= wxEVT_MOTION
;
2164 #endif // wxUSE_MOUSEEVENT_HACK
2166 return HandleMouseEvent(WM_MOUSEMOVE
, x
, y
, flags
);
2169 // ---------------------------------------------------------------------------
2170 // keyboard handling
2171 // ---------------------------------------------------------------------------
2173 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
2175 bool wxWindow::HandleChar(WXWORD wParam
, WXLPARAM lParam
, bool isASCII
)
2181 bool wxWindow::HandleKeyDown(WXWORD wParam
, WXLPARAM lParam
)
2187 bool wxWindow::HandleKeyUp(WXWORD wParam
, WXLPARAM lParam
)
2193 // ---------------------------------------------------------------------------
2195 // ---------------------------------------------------------------------------
2197 bool wxWindow::HandleJoystickEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
2203 // ---------------------------------------------------------------------------
2205 // ---------------------------------------------------------------------------
2207 bool wxWindow::OS2OnScroll(int orientation
, WXWORD wParam
,
2208 WXWORD pos
, WXHWND control
)
2212 wxWindow
*child
= wxFindWinFromHandle(control
);
2214 return child
->OS2OnScroll(orientation
, wParam
, pos
, control
);
2217 wxScrollWinEvent event
;
2218 event
.SetPosition(pos
);
2219 event
.SetOrientation(orientation
);
2220 event
.m_eventObject
= this;
2225 // ===========================================================================
2227 // ===========================================================================
2229 void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
)
2234 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
2235 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
2236 int wxCharCodeOS2ToWX(int keySym
)
2243 case VK_CANCEL: id = WXK_CANCEL; break;
2244 case VK_BACK: id = WXK_BACK; break;
2245 case VK_TAB: id = WXK_TAB; break;
2246 case VK_CLEAR: id = WXK_CLEAR; break;
2247 case VK_RETURN: id = WXK_RETURN; break;
2248 case VK_SHIFT: id = WXK_SHIFT; break;
2249 case VK_CONTROL: id = WXK_CONTROL; break;
2250 case VK_MENU : id = WXK_MENU; break;
2251 case VK_PAUSE: id = WXK_PAUSE; break;
2252 case VK_SPACE: id = WXK_SPACE; break;
2253 case VK_ESCAPE: id = WXK_ESCAPE; break;
2254 case VK_PRIOR: id = WXK_PRIOR; break;
2255 case VK_NEXT : id = WXK_NEXT; break;
2256 case VK_END: id = WXK_END; break;
2257 case VK_HOME : id = WXK_HOME; break;
2258 case VK_LEFT : id = WXK_LEFT; break;
2259 case VK_UP: id = WXK_UP; break;
2260 case VK_RIGHT: id = WXK_RIGHT; break;
2261 case VK_DOWN : id = WXK_DOWN; break;
2262 case VK_SELECT: id = WXK_SELECT; break;
2263 case VK_PRINT: id = WXK_PRINT; break;
2264 case VK_EXECUTE: id = WXK_EXECUTE; break;
2265 case VK_INSERT: id = WXK_INSERT; break;
2266 case VK_DELETE: id = WXK_DELETE; break;
2267 case VK_HELP : id = WXK_HELP; break;
2268 case VK_NUMPAD0: id = WXK_NUMPAD0; break;
2269 case VK_NUMPAD1: id = WXK_NUMPAD1; break;
2270 case VK_NUMPAD2: id = WXK_NUMPAD2; break;
2271 case VK_NUMPAD3: id = WXK_NUMPAD3; break;
2272 case VK_NUMPAD4: id = WXK_NUMPAD4; break;
2273 case VK_NUMPAD5: id = WXK_NUMPAD5; break;
2274 case VK_NUMPAD6: id = WXK_NUMPAD6; break;
2275 case VK_NUMPAD7: id = WXK_NUMPAD7; break;
2276 case VK_NUMPAD8: id = WXK_NUMPAD8; break;
2277 case VK_NUMPAD9: id = WXK_NUMPAD9; break;
2278 case VK_MULTIPLY: id = WXK_MULTIPLY; break;
2279 case VK_ADD: id = WXK_ADD; break;
2280 case VK_SUBTRACT: id = WXK_SUBTRACT; break;
2281 case VK_DECIMAL: id = WXK_DECIMAL; break;
2282 case VK_DIVIDE: id = WXK_DIVIDE; break;
2283 case VK_F1: id = WXK_F1; break;
2284 case VK_F2: id = WXK_F2; break;
2285 case VK_F3: id = WXK_F3; break;
2286 case VK_F4: id = WXK_F4; break;
2287 case VK_F5: id = WXK_F5; break;
2288 case VK_F6: id = WXK_F6; break;
2289 case VK_F7: id = WXK_F7; break;
2290 case VK_F8: id = WXK_F8; break;
2291 case VK_F9: id = WXK_F9; break;
2292 case VK_F10: id = WXK_F10; break;
2293 case VK_F11: id = WXK_F11; break;
2294 case VK_F12: id = WXK_F12; break;
2295 case VK_F13: id = WXK_F13; break;
2296 case VK_F14: id = WXK_F14; break;
2297 case VK_F15: id = WXK_F15; break;
2298 case VK_F16: id = WXK_F16; break;
2299 case VK_F17: id = WXK_F17; break;
2300 case VK_F18: id = WXK_F18; break;
2301 case VK_F19: id = WXK_F19; break;
2302 case VK_F20: id = WXK_F20; break;
2303 case VK_F21: id = WXK_F21; break;
2304 case VK_F22: id = WXK_F22; break;
2305 case VK_F23: id = WXK_F23; break;
2306 case VK_F24: id = WXK_F24; break;
2307 case VK_NUMLOCK: id = WXK_NUMLOCK; break;
2308 case VK_SCROLL: id = WXK_SCROLL; break;
2318 int wxCharCodeWXToOS2(int id
, bool *isVirtual
)
2326 case WXK_CANCEL: keySym = VK_CANCEL; break;
2327 case WXK_CLEAR: keySym = VK_CLEAR; break;
2328 case WXK_SHIFT: keySym = VK_SHIFT; break;
2329 case WXK_CONTROL: keySym = VK_CONTROL; break;
2330 case WXK_MENU : keySym = VK_MENU; break;
2331 case WXK_PAUSE: keySym = VK_PAUSE; break;
2332 case WXK_PRIOR: keySym = VK_PRIOR; break;
2333 case WXK_NEXT : keySym = VK_NEXT; break;
2334 case WXK_END: keySym = VK_END; break;
2335 case WXK_HOME : keySym = VK_HOME; break;
2336 case WXK_LEFT : keySym = VK_LEFT; break;
2337 case WXK_UP: keySym = VK_UP; break;
2338 case WXK_RIGHT: keySym = VK_RIGHT; break;
2339 case WXK_DOWN : keySym = VK_DOWN; break;
2340 case WXK_SELECT: keySym = VK_SELECT; break;
2341 case WXK_PRINT: keySym = VK_PRINT; break;
2342 case WXK_EXECUTE: keySym = VK_EXECUTE; break;
2343 case WXK_INSERT: keySym = VK_INSERT; break;
2344 case WXK_DELETE: keySym = VK_DELETE; break;
2345 case WXK_HELP : keySym = VK_HELP; break;
2346 case WXK_NUMPAD0: keySym = VK_NUMPAD0; break;
2347 case WXK_NUMPAD1: keySym = VK_NUMPAD1; break;
2348 case WXK_NUMPAD2: keySym = VK_NUMPAD2; break;
2349 case WXK_NUMPAD3: keySym = VK_NUMPAD3; break;
2350 case WXK_NUMPAD4: keySym = VK_NUMPAD4; break;
2351 case WXK_NUMPAD5: keySym = VK_NUMPAD5; break;
2352 case WXK_NUMPAD6: keySym = VK_NUMPAD6; break;
2353 case WXK_NUMPAD7: keySym = VK_NUMPAD7; break;
2354 case WXK_NUMPAD8: keySym = VK_NUMPAD8; break;
2355 case WXK_NUMPAD9: keySym = VK_NUMPAD9; break;
2356 case WXK_MULTIPLY: keySym = VK_MULTIPLY; break;
2357 case WXK_ADD: keySym = VK_ADD; break;
2358 case WXK_SUBTRACT: keySym = VK_SUBTRACT; break;
2359 case WXK_DECIMAL: keySym = VK_DECIMAL; break;
2360 case WXK_DIVIDE: keySym = VK_DIVIDE; break;
2361 case WXK_F1: keySym = VK_F1; break;
2362 case WXK_F2: keySym = VK_F2; break;
2363 case WXK_F3: keySym = VK_F3; break;
2364 case WXK_F4: keySym = VK_F4; break;
2365 case WXK_F5: keySym = VK_F5; break;
2366 case WXK_F6: keySym = VK_F6; break;
2367 case WXK_F7: keySym = VK_F7; break;
2368 case WXK_F8: keySym = VK_F8; break;
2369 case WXK_F9: keySym = VK_F9; break;
2370 case WXK_F10: keySym = VK_F10; break;
2371 case WXK_F11: keySym = VK_F11; break;
2372 case WXK_F12: keySym = VK_F12; break;
2373 case WXK_F13: keySym = VK_F13; break;
2374 case WXK_F14: keySym = VK_F14; break;
2375 case WXK_F15: keySym = VK_F15; break;
2376 case WXK_F16: keySym = VK_F16; break;
2377 case WXK_F17: keySym = VK_F17; break;
2378 case WXK_F18: keySym = VK_F18; break;
2379 case WXK_F19: keySym = VK_F19; break;
2380 case WXK_F20: keySym = VK_F20; break;
2381 case WXK_F21: keySym = VK_F21; break;
2382 case WXK_F22: keySym = VK_F22; break;
2383 case WXK_F23: keySym = VK_F23; break;
2384 case WXK_F24: keySym = VK_F24; break;
2385 case WXK_NUMLOCK: keySym = VK_NUMLOCK; break;
2386 case WXK_SCROLL: keySym = VK_SCROLL; break;
2398 wxWindow
*wxGetActiveWindow()
2404 // Windows keyboard hook. Allows interception of e.g. F1, ESCAPE
2405 // in active frames and dialogs, regardless of where the focus is.
2406 //static HHOOK wxTheKeyboardHook = 0;
2407 //static FARPROC wxTheKeyboardHookProc = 0;
2408 int wxKeyboardHook(int nCode
, WORD wParam
, DWORD lParam
);
2410 void wxSetKeyboardHook(bool doIt
)
2415 int wxKeyboardHook(int nCode
, WORD wParam
, DWORD lParam
)
2423 const char *wxGetMessageName(int message
)
2429 case 0x0000: return "WM_NULL";
2430 case 0x0001: return "WM_CREATE";
2431 case 0x0002: return "WM_DESTROY";
2432 case 0x0003: return "WM_MOVE";
2433 case 0x0005: return "WM_SIZE";
2434 case 0x0006: return "WM_ACTIVATE";
2435 case 0x0007: return "WM_SETFOCUS";
2436 case 0x0008: return "WM_KILLFOCUS";
2437 case 0x000A: return "WM_ENABLE";
2438 case 0x000B: return "WM_SETREDRAW";
2439 case 0x000C: return "WM_SETTEXT";
2440 case 0x000D: return "WM_GETTEXT";
2441 case 0x000E: return "WM_GETTEXTLENGTH";
2442 case 0x000F: return "WM_PAINT";
2443 case 0x0010: return "WM_CLOSE";
2444 case 0x0011: return "WM_QUERYENDSESSION";
2445 case 0x0012: return "WM_QUIT";
2446 case 0x0013: return "WM_QUERYOPEN";
2447 case 0x0014: return "WM_ERASEBKGND";
2448 case 0x0015: return "WM_SYSCOLORCHANGE";
2449 case 0x0016: return "WM_ENDSESSION";
2450 case 0x0017: return "WM_SYSTEMERROR";
2451 case 0x0018: return "WM_SHOWWINDOW";
2452 case 0x0019: return "WM_CTLCOLOR";
2453 case 0x001A: return "WM_WININICHANGE";
2454 case 0x001B: return "WM_DEVMODECHANGE";
2455 case 0x001C: return "WM_ACTIVATEAPP";
2456 case 0x001D: return "WM_FONTCHANGE";
2457 case 0x001E: return "WM_TIMECHANGE";
2458 case 0x001F: return "WM_CANCELMODE";
2459 case 0x0020: return "WM_SETCURSOR";
2460 case 0x0021: return "WM_MOUSEACTIVATE";
2461 case 0x0022: return "WM_CHILDACTIVATE";
2462 case 0x0023: return "WM_QUEUESYNC";
2463 case 0x0024: return "WM_GETMINMAXINFO";
2464 case 0x0026: return "WM_PAINTICON";
2465 case 0x0027: return "WM_ICONERASEBKGND";
2466 case 0x0028: return "WM_NEXTDLGCTL";
2467 case 0x002A: return "WM_SPOOLERSTATUS";
2468 case 0x002B: return "WM_DRAWITEM";
2469 case 0x002C: return "WM_MEASUREITEM";
2470 case 0x002D: return "WM_DELETEITEM";
2471 case 0x002E: return "WM_VKEYTOITEM";
2472 case 0x002F: return "WM_CHARTOITEM";
2473 case 0x0030: return "WM_SETFONT";
2474 case 0x0031: return "WM_GETFONT";
2475 case 0x0037: return "WM_QUERYDRAGICON";
2476 case 0x0039: return "WM_COMPAREITEM";
2477 case 0x0041: return "WM_COMPACTING";
2478 case 0x0044: return "WM_COMMNOTIFY";
2479 case 0x0046: return "WM_WINDOWPOSCHANGING";
2480 case 0x0047: return "WM_WINDOWPOSCHANGED";
2481 case 0x0048: return "WM_POWER";
2484 case 0x004A: return "WM_COPYDATA";
2485 case 0x004B: return "WM_CANCELJOURNAL";
2486 case 0x004E: return "WM_NOTIFY";
2487 case 0x0050: return "WM_INPUTLANGCHANGEREQUEST";
2488 case 0x0051: return "WM_INPUTLANGCHANGE";
2489 case 0x0052: return "WM_TCARD";
2490 case 0x0053: return "WM_HELP";
2491 case 0x0054: return "WM_USERCHANGED";
2492 case 0x0055: return "WM_NOTIFYFORMAT";
2493 case 0x007B: return "WM_CONTEXTMENU";
2494 case 0x007C: return "WM_STYLECHANGING";
2495 case 0x007D: return "WM_STYLECHANGED";
2496 case 0x007E: return "WM_DISPLAYCHANGE";
2497 case 0x007F: return "WM_GETICON";
2498 case 0x0080: return "WM_SETICON";
2501 case 0x0081: return "WM_NCCREATE";
2502 case 0x0082: return "WM_NCDESTROY";
2503 case 0x0083: return "WM_NCCALCSIZE";
2504 case 0x0084: return "WM_NCHITTEST";
2505 case 0x0085: return "WM_NCPAINT";
2506 case 0x0086: return "WM_NCACTIVATE";
2507 case 0x0087: return "WM_GETDLGCODE";
2508 case 0x00A0: return "WM_NCMOUSEMOVE";
2509 case 0x00A1: return "WM_NCLBUTTONDOWN";
2510 case 0x00A2: return "WM_NCLBUTTONUP";
2511 case 0x00A3: return "WM_NCLBUTTONDBLCLK";
2512 case 0x00A4: return "WM_NCRBUTTONDOWN";
2513 case 0x00A5: return "WM_NCRBUTTONUP";
2514 case 0x00A6: return "WM_NCRBUTTONDBLCLK";
2515 case 0x00A7: return "WM_NCMBUTTONDOWN";
2516 case 0x00A8: return "WM_NCMBUTTONUP";
2517 case 0x00A9: return "WM_NCMBUTTONDBLCLK";
2518 case 0x0100: return "WM_KEYDOWN";
2519 case 0x0101: return "WM_KEYUP";
2520 case 0x0102: return "WM_CHAR";
2521 case 0x0103: return "WM_DEADCHAR";
2522 case 0x0104: return "WM_SYSKEYDOWN";
2523 case 0x0105: return "WM_SYSKEYUP";
2524 case 0x0106: return "WM_SYSCHAR";
2525 case 0x0107: return "WM_SYSDEADCHAR";
2526 case 0x0108: return "WM_KEYLAST";
2529 case 0x010D: return "WM_IME_STARTCOMPOSITION";
2530 case 0x010E: return "WM_IME_ENDCOMPOSITION";
2531 case 0x010F: return "WM_IME_COMPOSITION";
2534 case 0x0110: return "WM_INITDIALOG";
2535 case 0x0111: return "WM_COMMAND";
2536 case 0x0112: return "WM_SYSCOMMAND";
2537 case 0x0113: return "WM_TIMER";
2538 case 0x0114: return "WM_HSCROLL";
2539 case 0x0115: return "WM_VSCROLL";
2540 case 0x0116: return "WM_INITMENU";
2541 case 0x0117: return "WM_INITMENUPOPUP";
2542 case 0x011F: return "WM_MENUSELECT";
2543 case 0x0120: return "WM_MENUCHAR";
2544 case 0x0121: return "WM_ENTERIDLE";
2545 case 0x0200: return "WM_MOUSEMOVE";
2546 case 0x0201: return "WM_LBUTTONDOWN";
2547 case 0x0202: return "WM_LBUTTONUP";
2548 case 0x0203: return "WM_LBUTTONDBLCLK";
2549 case 0x0204: return "WM_RBUTTONDOWN";
2550 case 0x0205: return "WM_RBUTTONUP";
2551 case 0x0206: return "WM_RBUTTONDBLCLK";
2552 case 0x0207: return "WM_MBUTTONDOWN";
2553 case 0x0208: return "WM_MBUTTONUP";
2554 case 0x0209: return "WM_MBUTTONDBLCLK";
2555 case 0x0210: return "WM_PARENTNOTIFY";
2556 case 0x0211: return "WM_ENTERMENULOOP";
2557 case 0x0212: return "WM_EXITMENULOOP";
2560 case 0x0213: return "WM_NEXTMENU";
2561 case 0x0214: return "WM_SIZING";
2562 case 0x0215: return "WM_CAPTURECHANGED";
2563 case 0x0216: return "WM_MOVING";
2564 case 0x0218: return "WM_POWERBROADCAST";
2565 case 0x0219: return "WM_DEVICECHANGE";
2568 case 0x0220: return "WM_MDICREATE";
2569 case 0x0221: return "WM_MDIDESTROY";
2570 case 0x0222: return "WM_MDIACTIVATE";
2571 case 0x0223: return "WM_MDIRESTORE";
2572 case 0x0224: return "WM_MDINEXT";
2573 case 0x0225: return "WM_MDIMAXIMIZE";
2574 case 0x0226: return "WM_MDITILE";
2575 case 0x0227: return "WM_MDICASCADE";
2576 case 0x0228: return "WM_MDIICONARRANGE";
2577 case 0x0229: return "WM_MDIGETACTIVE";
2578 case 0x0230: return "WM_MDISETMENU";
2579 case 0x0233: return "WM_DROPFILES";
2582 case 0x0281: return "WM_IME_SETCONTEXT";
2583 case 0x0282: return "WM_IME_NOTIFY";
2584 case 0x0283: return "WM_IME_CONTROL";
2585 case 0x0284: return "WM_IME_COMPOSITIONFULL";
2586 case 0x0285: return "WM_IME_SELECT";
2587 case 0x0286: return "WM_IME_CHAR";
2588 case 0x0290: return "WM_IME_KEYDOWN";
2589 case 0x0291: return "WM_IME_KEYUP";
2592 case 0x0300: return "WM_CUT";
2593 case 0x0301: return "WM_COPY";
2594 case 0x0302: return "WM_PASTE";
2595 case 0x0303: return "WM_CLEAR";
2596 case 0x0304: return "WM_UNDO";
2597 case 0x0305: return "WM_RENDERFORMAT";
2598 case 0x0306: return "WM_RENDERALLFORMATS";
2599 case 0x0307: return "WM_DESTROYCLIPBOARD";
2600 case 0x0308: return "WM_DRAWCLIPBOARD";
2601 case 0x0309: return "WM_PAINTCLIPBOARD";
2602 case 0x030A: return "WM_VSCROLLCLIPBOARD";
2603 case 0x030B: return "WM_SIZECLIPBOARD";
2604 case 0x030C: return "WM_ASKCBFORMATNAME";
2605 case 0x030D: return "WM_CHANGECBCHAIN";
2606 case 0x030E: return "WM_HSCROLLCLIPBOARD";
2607 case 0x030F: return "WM_QUERYNEWPALETTE";
2608 case 0x0310: return "WM_PALETTEISCHANGING";
2609 case 0x0311: return "WM_PALETTECHANGED";
2612 // common controls messages - although they're not strictly speaking
2613 // standard, it's nice to decode them nevertheless
2616 case 0x1000 + 0: return "LVM_GETBKCOLOR";
2617 case 0x1000 + 1: return "LVM_SETBKCOLOR";
2618 case 0x1000 + 2: return "LVM_GETIMAGELIST";
2619 case 0x1000 + 3: return "LVM_SETIMAGELIST";
2620 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
2621 case 0x1000 + 5: return "LVM_GETITEMA";
2622 case 0x1000 + 75: return "LVM_GETITEMW";
2623 case 0x1000 + 6: return "LVM_SETITEMA";
2624 case 0x1000 + 76: return "LVM_SETITEMW";
2625 case 0x1000 + 7: return "LVM_INSERTITEMA";
2626 case 0x1000 + 77: return "LVM_INSERTITEMW";
2627 case 0x1000 + 8: return "LVM_DELETEITEM";
2628 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
2629 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
2630 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
2631 case 0x1000 + 12: return "LVM_GETNEXTITEM";
2632 case 0x1000 + 13: return "LVM_FINDITEMA";
2633 case 0x1000 + 83: return "LVM_FINDITEMW";
2634 case 0x1000 + 14: return "LVM_GETITEMRECT";
2635 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
2636 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
2637 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
2638 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
2639 case 0x1000 + 18: return "LVM_HITTEST";
2640 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
2641 case 0x1000 + 20: return "LVM_SCROLL";
2642 case 0x1000 + 21: return "LVM_REDRAWITEMS";
2643 case 0x1000 + 22: return "LVM_ARRANGE";
2644 case 0x1000 + 23: return "LVM_EDITLABELA";
2645 case 0x1000 + 118: return "LVM_EDITLABELW";
2646 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
2647 case 0x1000 + 25: return "LVM_GETCOLUMNA";
2648 case 0x1000 + 95: return "LVM_GETCOLUMNW";
2649 case 0x1000 + 26: return "LVM_SETCOLUMNA";
2650 case 0x1000 + 96: return "LVM_SETCOLUMNW";
2651 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
2652 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
2653 case 0x1000 + 28: return "LVM_DELETECOLUMN";
2654 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
2655 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
2656 case 0x1000 + 31: return "LVM_GETHEADER";
2657 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
2658 case 0x1000 + 34: return "LVM_GETVIEWRECT";
2659 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
2660 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
2661 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
2662 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
2663 case 0x1000 + 39: return "LVM_GETTOPINDEX";
2664 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
2665 case 0x1000 + 41: return "LVM_GETORIGIN";
2666 case 0x1000 + 42: return "LVM_UPDATE";
2667 case 0x1000 + 43: return "LVM_SETITEMSTATE";
2668 case 0x1000 + 44: return "LVM_GETITEMSTATE";
2669 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
2670 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
2671 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
2672 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
2673 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
2674 case 0x1000 + 48: return "LVM_SORTITEMS";
2675 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
2676 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
2677 case 0x1000 + 51: return "LVM_GETITEMSPACING";
2678 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
2679 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
2680 case 0x1000 + 53: return "LVM_SETICONSPACING";
2681 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
2682 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
2683 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
2684 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
2685 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
2686 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
2687 case 0x1000 + 60: return "LVM_SETHOTITEM";
2688 case 0x1000 + 61: return "LVM_GETHOTITEM";
2689 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
2690 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
2691 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
2692 case 0x1000 + 65: return "LVM_SETWORKAREA";
2695 case 0x1100 + 0: return "TVM_INSERTITEMA";
2696 case 0x1100 + 50: return "TVM_INSERTITEMW";
2697 case 0x1100 + 1: return "TVM_DELETEITEM";
2698 case 0x1100 + 2: return "TVM_EXPAND";
2699 case 0x1100 + 4: return "TVM_GETITEMRECT";
2700 case 0x1100 + 5: return "TVM_GETCOUNT";
2701 case 0x1100 + 6: return "TVM_GETINDENT";
2702 case 0x1100 + 7: return "TVM_SETINDENT";
2703 case 0x1100 + 8: return "TVM_GETIMAGELIST";
2704 case 0x1100 + 9: return "TVM_SETIMAGELIST";
2705 case 0x1100 + 10: return "TVM_GETNEXTITEM";
2706 case 0x1100 + 11: return "TVM_SELECTITEM";
2707 case 0x1100 + 12: return "TVM_GETITEMA";
2708 case 0x1100 + 62: return "TVM_GETITEMW";
2709 case 0x1100 + 13: return "TVM_SETITEMA";
2710 case 0x1100 + 63: return "TVM_SETITEMW";
2711 case 0x1100 + 14: return "TVM_EDITLABELA";
2712 case 0x1100 + 65: return "TVM_EDITLABELW";
2713 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
2714 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
2715 case 0x1100 + 17: return "TVM_HITTEST";
2716 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
2717 case 0x1100 + 19: return "TVM_SORTCHILDREN";
2718 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
2719 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
2720 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
2721 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
2722 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
2723 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
2724 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
2727 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
2728 case 0x1200 + 1: return "HDM_INSERTITEMA";
2729 case 0x1200 + 10: return "HDM_INSERTITEMW";
2730 case 0x1200 + 2: return "HDM_DELETEITEM";
2731 case 0x1200 + 3: return "HDM_GETITEMA";
2732 case 0x1200 + 11: return "HDM_GETITEMW";
2733 case 0x1200 + 4: return "HDM_SETITEMA";
2734 case 0x1200 + 12: return "HDM_SETITEMW";
2735 case 0x1200 + 5: return "HDM_LAYOUT";
2736 case 0x1200 + 6: return "HDM_HITTEST";
2737 case 0x1200 + 7: return "HDM_GETITEMRECT";
2738 case 0x1200 + 8: return "HDM_SETIMAGELIST";
2739 case 0x1200 + 9: return "HDM_GETIMAGELIST";
2740 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
2741 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
2742 case 0x1200 + 17: return "HDM_GETORDERARRAY";
2743 case 0x1200 + 18: return "HDM_SETORDERARRAY";
2744 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
2747 case 0x1300 + 2: return "TCM_GETIMAGELIST";
2748 case 0x1300 + 3: return "TCM_SETIMAGELIST";
2749 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
2750 case 0x1300 + 5: return "TCM_GETITEMA";
2751 case 0x1300 + 60: return "TCM_GETITEMW";
2752 case 0x1300 + 6: return "TCM_SETITEMA";
2753 case 0x1300 + 61: return "TCM_SETITEMW";
2754 case 0x1300 + 7: return "TCM_INSERTITEMA";
2755 case 0x1300 + 62: return "TCM_INSERTITEMW";
2756 case 0x1300 + 8: return "TCM_DELETEITEM";
2757 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
2758 case 0x1300 + 10: return "TCM_GETITEMRECT";
2759 case 0x1300 + 11: return "TCM_GETCURSEL";
2760 case 0x1300 + 12: return "TCM_SETCURSEL";
2761 case 0x1300 + 13: return "TCM_HITTEST";
2762 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
2763 case 0x1300 + 40: return "TCM_ADJUSTRECT";
2764 case 0x1300 + 41: return "TCM_SETITEMSIZE";
2765 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
2766 case 0x1300 + 43: return "TCM_SETPADDING";
2767 case 0x1300 + 44: return "TCM_GETROWCOUNT";
2768 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
2769 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
2770 case 0x1300 + 47: return "TCM_GETCURFOCUS";
2771 case 0x1300 + 48: return "TCM_SETCURFOCUS";
2772 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
2773 case 0x1300 + 50: return "TCM_DESELECTALL";
2776 case WM_USER+1: return "TB_ENABLEBUTTON";
2777 case WM_USER+2: return "TB_CHECKBUTTON";
2778 case WM_USER+3: return "TB_PRESSBUTTON";
2779 case WM_USER+4: return "TB_HIDEBUTTON";
2780 case WM_USER+5: return "TB_INDETERMINATE";
2781 case WM_USER+9: return "TB_ISBUTTONENABLED";
2782 case WM_USER+10: return "TB_ISBUTTONCHECKED";
2783 case WM_USER+11: return "TB_ISBUTTONPRESSED";
2784 case WM_USER+12: return "TB_ISBUTTONHIDDEN";
2785 case WM_USER+13: return "TB_ISBUTTONINDETERMINATE";
2786 case WM_USER+17: return "TB_SETSTATE";
2787 case WM_USER+18: return "TB_GETSTATE";
2788 case WM_USER+19: return "TB_ADDBITMAP";
2789 case WM_USER+20: return "TB_ADDBUTTONS";
2790 case WM_USER+21: return "TB_INSERTBUTTON";
2791 case WM_USER+22: return "TB_DELETEBUTTON";
2792 case WM_USER+23: return "TB_GETBUTTON";
2793 case WM_USER+24: return "TB_BUTTONCOUNT";
2794 case WM_USER+25: return "TB_COMMANDTOINDEX";
2795 case WM_USER+26: return "TB_SAVERESTOREA";
2796 case WM_USER+76: return "TB_SAVERESTOREW";
2797 case WM_USER+27: return "TB_CUSTOMIZE";
2798 case WM_USER+28: return "TB_ADDSTRINGA";
2799 case WM_USER+77: return "TB_ADDSTRINGW";
2800 case WM_USER+29: return "TB_GETITEMRECT";
2801 case WM_USER+30: return "TB_BUTTONSTRUCTSIZE";
2802 case WM_USER+31: return "TB_SETBUTTONSIZE";
2803 case WM_USER+32: return "TB_SETBITMAPSIZE";
2804 case WM_USER+33: return "TB_AUTOSIZE";
2805 case WM_USER+35: return "TB_GETTOOLTIPS";
2806 case WM_USER+36: return "TB_SETTOOLTIPS";
2807 case WM_USER+37: return "TB_SETPARENT";
2808 case WM_USER+39: return "TB_SETROWS";
2809 case WM_USER+40: return "TB_GETROWS";
2810 case WM_USER+42: return "TB_SETCMDID";
2811 case WM_USER+43: return "TB_CHANGEBITMAP";
2812 case WM_USER+44: return "TB_GETBITMAP";
2813 case WM_USER+45: return "TB_GETBUTTONTEXTA";
2814 case WM_USER+75: return "TB_GETBUTTONTEXTW";
2815 case WM_USER+46: return "TB_REPLACEBITMAP";
2816 case WM_USER+47: return "TB_SETINDENT";
2817 case WM_USER+48: return "TB_SETIMAGELIST";
2818 case WM_USER+49: return "TB_GETIMAGELIST";
2819 case WM_USER+50: return "TB_LOADIMAGES";
2820 case WM_USER+51: return "TB_GETRECT";
2821 case WM_USER+52: return "TB_SETHOTIMAGELIST";
2822 case WM_USER+53: return "TB_GETHOTIMAGELIST";
2823 case WM_USER+54: return "TB_SETDISABLEDIMAGELIST";
2824 case WM_USER+55: return "TB_GETDISABLEDIMAGELIST";
2825 case WM_USER+56: return "TB_SETSTYLE";
2826 case WM_USER+57: return "TB_GETSTYLE";
2827 case WM_USER+58: return "TB_GETBUTTONSIZE";
2828 case WM_USER+59: return "TB_SETBUTTONWIDTH";
2829 case WM_USER+60: return "TB_SETMAXTEXTROWS";
2830 case WM_USER+61: return "TB_GETTEXTROWS";
2831 case WM_USER+41: return "TB_GETBITMAPFLAGS";
2836 static char s_szBuf[128];
2837 sprintf(s_szBuf, "<unknown message = %d>", message);
2844 #endif // __WXDEBUG__