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 MS Windows id
128 wxWindow
*wxWindow::FindItem(long id
) const
130 wxWindowList::Node
*current
= GetChildren().GetFirst();
133 wxWindow
*childWin
= current
->GetData();
135 wxWindow
*wnd
= childWin
->FindItem(id
);
139 if ( childWin
->IsKindOf(CLASSINFO(wxControl
)) )
141 wxControl
*item
= (wxControl
*)childWin
;
142 if ( item
->GetId() == id
)
146 // In case it's a 'virtual' control (e.g. radiobox)
147 if ( item
->GetSubcontrols().Member((wxObject
*)id
) )
152 current
= current
->GetNext();
158 // Find an item given the MS Windows handle
159 wxWindow
*wxWindow::FindItemByHWND(WXHWND hWnd
, bool controlOnly
) const
161 wxWindowList::Node
*current
= GetChildren().GetFirst();
164 wxWindow
*parent
= current
->GetData();
166 // Do a recursive search.
167 wxWindow
*wnd
= parent
->FindItemByHWND(hWnd
);
171 if ( !controlOnly
|| parent
->IsKindOf(CLASSINFO(wxControl
)) )
173 wxWindow
*item
= current
->GetData();
174 if ( item
->GetHWND() == hWnd
)
178 if ( item
->ContainsHWND(hWnd
) )
183 current
= current
->GetNext();
188 // Default command handler
189 bool wxWindow::OS2Command(WXUINT
WXUNUSED(param
), WXWORD
WXUNUSED(id
))
194 // ----------------------------------------------------------------------------
195 // constructors and such
196 // ----------------------------------------------------------------------------
198 void wxWindow::Init()
204 m_doubleClickAllowed
= 0;
205 m_winCaptured
= FALSE
;
207 m_isBeingDeleted
= FALSE
;
210 m_mouseInWindow
= FALSE
;
217 // pass WM_GETDLGCODE to DefWindowProc()
222 m_backgroundTransparent
= FALSE
;
224 // as all windows are created with WS_VISIBLE style...
227 #if wxUSE_MOUSEEVENT_HACK
230 m_lastMouseEvent
= -1;
231 #endif // wxUSE_MOUSEEVENT_HACK
235 wxWindow::~wxWindow()
237 m_isBeingDeleted
= TRUE
;
239 OS2DetachWindowMenu();
242 m_parent
->RemoveChild(this);
246 if(!WinDestroyWindow(GetHWND()))
247 wxLogLastError(wxT("DestroyWindow"));
248 // remove hWnd <-> wxWindow association
249 wxRemoveHandleAssociation(this);
253 bool wxWindow::Create(wxWindow
*parent
, wxWindowID id
,
257 const wxString
& name
)
259 wxCHECK_MSG( parent
, FALSE
, wxT("can't create wxWindow without parent") );
261 if ( !CreateBase(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
264 parent
->AddChild(this);
267 WXDWORD exStyle
= 0; // TODO: Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
271 // TODO: PM Specific initialization
272 OS2Create(m_windowId
, parent
, wxCanvasClassName
, this, NULL
,
274 WidthDefault(size
.x
), HeightDefault(size
.y
),
275 msflags
, NULL
, exStyle
);
279 // ---------------------------------------------------------------------------
281 // ---------------------------------------------------------------------------
283 void wxWindow::SetFocus()
288 wxWindow
* wxWindowBase::FindFocus()
290 wxWindow
* window
= NULL
;
295 bool wxWindow::Enable(bool enable
) // check if base implementation is OK
301 bool wxWindow::Show(bool show
) // check if base implementation is OK
307 void wxWindow::Raise()
312 void wxWindow::Lower()
317 void wxWindow::SetTitle( const wxString
& title
)
319 // TODO: SetWindowText(GetHwnd(), title.c_str());
322 wxString
wxWindow::GetTitle() const
324 return wxGetWindowText(GetHWND());
327 void wxWindow::CaptureMouse()
332 void wxWindow::ReleaseMouse()
337 bool wxWindow::SetFont(const wxFont
& f
)
343 bool wxWindow::SetCursor(const wxCursor
& cursor
) // check if base implementation is OK
349 void wxWindow::WarpPointer(int x_pos
, int y_pos
)
354 #if WXWIN_COMPATIBILITY
355 void wxWindow::OS2DeviceToLogical (float *x
, float *y
) const
358 #endif // WXWIN_COMPATIBILITY
360 // ---------------------------------------------------------------------------
362 // ---------------------------------------------------------------------------
364 #if WXWIN_COMPATIBILITY
365 void wxWindow::SetScrollRange(int orient
, int range
, bool refresh
)
370 void wxWindow::SetScrollPage(int orient
, int page
, bool refresh
)
375 int wxWindow::OldGetScrollRange(int orient
) const
381 int wxWindow::GetScrollPage(int orient
) const
386 #endif // WXWIN_COMPATIBILITY
388 int wxWindow::GetScrollPos(int orient
) const
394 int wxWindow::GetScrollRange(int orient
) const
400 int wxWindow::GetScrollThumb(int orient
) const
406 void wxWindow::SetScrollPos( int orient
414 void wxWindow::SetScrollbar( int orient
424 void wxWindow::ScrollWindow( int dx
432 // ---------------------------------------------------------------------------
434 // ---------------------------------------------------------------------------
436 void wxWindow::SubclassWin(WXHWND hWnd
)
438 wxASSERT_MSG( !m_oldWndProc
, wxT("subclassing window twice?") );
440 HWND hwnd
= (HWND
)hWnd
;
442 * TODO: implement something like this:
443 * wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in SubclassWin") );
445 * wxAssociateWinWithHandle(hwnd, this);
447 * m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
448 * SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
452 void wxWindow::UnsubclassWin()
457 wxRemoveHandleAssociation(this);
459 // Restore old Window proc
460 HWND hwnd = GetHwnd();
465 wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in UnsubclassWin") );
467 FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
468 if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) )
470 SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
477 // Make a Windows extended style from the given wxWindows window style
478 WXDWORD
wxWindow::MakeExtendedStyle(long style
, bool eliminateBorders
)
483 if ( style & wxTRANSPARENT_WINDOW )
484 exStyle |= WS_EX_TRANSPARENT;
486 if ( !eliminateBorders )
488 if ( style & wxSUNKEN_BORDER )
489 exStyle |= WS_EX_CLIENTEDGE;
490 if ( style & wxDOUBLE_BORDER )
491 exStyle |= WS_EX_DLGMODALFRAME;
492 if ( style & wxRAISED_BORDER )
493 exStyle |= WS_EX_WINDOWEDGE;
494 if ( style & wxSTATIC_BORDER )
495 exStyle |= WS_EX_STATICEDGE;
501 // Determines whether native 3D effects or CTL3D should be used,
502 // applying a default border style if required, and returning an extended
503 // style to pass to CreateWindowEx.
504 WXDWORD
wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle
,
507 DWORD exStyle
; // remove after implementation doe
508 /* TODO: this ought to be fun
510 // If matches certain criteria, then assume no 3D effects
511 // unless specifically requested (dealt with in MakeExtendedStyle)
512 if ( !GetParent() || !IsKindOf(CLASSINFO(wxControl)) || (m_windowStyle & wxNO_BORDER) )
515 return MakeExtendedStyle(m_windowStyle, FALSE);
518 // Determine whether we should be using 3D effects or not.
519 bool nativeBorder = FALSE; // by default, we don't want a Win95 effect
521 // 1) App can specify global 3D effects
522 *want3D = wxTheApp->GetAuto3D();
524 // 2) If the parent is being drawn with user colours, or simple border specified,
525 // switch effects off. TODO: replace wxUSER_COLOURS with wxNO_3D
526 if ( GetParent() && (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) || (m_windowStyle & wxSIMPLE_BORDER) )
529 // 3) Control can override this global setting by defining
530 // a border style, e.g. wxSUNKEN_BORDER
531 if ( m_windowStyle & wxSUNKEN_BORDER )
534 // 4) If it's a special border, CTL3D can't cope so we want a native border
535 if ( (m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
536 (m_windowStyle & wxSTATIC_BORDER) )
542 // 5) If this isn't a Win95 app, and we are using CTL3D, remove border
543 // effects from extended style
546 nativeBorder = FALSE;
549 DWORD exStyle = MakeExtendedStyle(m_windowStyle, !nativeBorder);
551 // If we want 3D, but haven't specified a border here,
552 // apply the default border style specified.
553 // TODO what about non-Win95 WIN32? Does it have borders?
554 #if defined(__WIN95__) && !wxUSE_CTL3D
555 if ( defaultBorderStyle && (*want3D) && ! ((m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
556 (m_windowStyle & wxSTATIC_BORDER) || (m_windowStyle & wxSIMPLE_BORDER) ))
557 exStyle |= defaultBorderStyle; // WS_EX_CLIENTEDGE;
563 #if WXWIN_COMPATIBILITY
564 void wxWindow::OnCommand(wxWindow
& win
, wxCommandEvent
& event
)
569 wxObject
* wxWindow::GetChild(int number
) const
572 return((wxObject
*)this);
575 void wxWindow::OnDefaultAction(wxControl
*initiatingItem
)
580 #endif // WXWIN_COMPATIBILITY
582 // Setup background and foreground colours correctly
583 void wxWindow::SetupColours()
586 SetBackgroundColour(GetParent()->GetBackgroundColour());
589 void wxWindow::OnIdle(wxIdleEvent
& event
)
594 // Set this window to be the child of 'parent'.
595 bool wxWindow::Reparent(wxWindow
*parent
)
597 if ( !wxWindowBase::Reparent(parent
) )
603 void wxWindow::Clear()
608 void wxWindow::Refresh(bool eraseBack
, const wxRect
*rect
)
613 // ---------------------------------------------------------------------------
615 // ---------------------------------------------------------------------------
617 #if wxUSE_DRAG_AND_DROP
618 void wxWindow::SetDropTarget(wxDropTarget
*pDropTarget
)
624 // old style file-manager drag&drop support: we retain the old-style
625 // DragAcceptFiles in parallel with SetDropTarget.
626 void wxWindow::DragAcceptFiles(bool accept
)
631 // ----------------------------------------------------------------------------
633 // ----------------------------------------------------------------------------
637 void wxWindow::DoSetToolTip(wxToolTip
*tooltip
)
639 wxWindowBase::DoSetToolTip(tooltip
);
642 m_tooltip
->SetWindow(this);
645 #endif // wxUSE_TOOLTIPS
647 // ---------------------------------------------------------------------------
648 // moving and resizing
649 // ---------------------------------------------------------------------------
652 void wxWindow::DoGetSize( int *width
, int *height
) const
657 void wxWindow::DoGetPosition( int *x
, int *y
) const
662 void wxWindow::DoScreenToClient( int *x
, int *y
) const
667 void wxWindow::DoClientToScreen( int *x
, int *y
) const
672 // Get size *available for subwindows* i.e. excluding menu bar etc.
673 void wxWindow::DoGetClientSize( int *width
, int *height
) const
678 void wxWindow::DoMoveWindow(int x
, int y
, int width
, int height
)
683 // set the size of the window: if the dimensions are positive, just use them,
684 // but if any of them is equal to -1, it means that we must find the value for
685 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
686 // which case -1 is a valid value for x and y)
688 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
689 // the width/height to best suit our contents, otherwise we reuse the current
691 void wxWindow::DoSetSize(int x
, int y
,
692 int width
, int height
,
698 // for a generic window there is no natural best size - just use the current one
699 wxSize
wxWindow::DoGetBestSize()
704 void wxWindow::DoSetClientSize(int width
, int height
)
709 wxPoint
wxWindow::GetClientAreaOrigin() const
711 return wxPoint(0, 0);
714 void wxWindow::AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
)
719 // ---------------------------------------------------------------------------
721 // ---------------------------------------------------------------------------
723 int wxWindow::GetCharHeight() const
729 int wxWindow::GetCharWidth() const
735 void wxWindow::GetTextExtent( const wxString
& string
739 ,int* externalLeading
740 ,const wxFont
* theFont
746 #if wxUSE_CARET && WXWIN_COMPATIBILITY
747 // ---------------------------------------------------------------------------
748 // Caret manipulation
749 // ---------------------------------------------------------------------------
751 void wxWindow::CreateCaret(int w
, int h
)
756 void wxWindow::CreateCaret(const wxBitmap
*bitmap
)
761 void wxWindow::ShowCaret(bool show
)
766 void wxWindow::DestroyCaret()
771 void wxWindow::SetCaretPos(int x
, int y
)
776 void wxWindow::GetCaretPos(int *x
, int *y
) const
783 // ---------------------------------------------------------------------------
785 // ---------------------------------------------------------------------------
787 bool wxWindow::DoPopupMenu( wxMenu
*menu
, int x
, int y
)
793 // ===========================================================================
794 // pre/post message processing
795 // ===========================================================================
797 MRESULT
wxWindow::OS2DefWindowProc(HWND hwnd
, WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
803 bool wxWindow::OS2ProcessMessage(WXMSG
* pMsg
)
809 bool wxWindow::OS2TranslateMessage(WXMSG
* pMsg
)
811 return m_acceleratorTable
.Translate(this, pMsg
);
814 // ---------------------------------------------------------------------------
815 // message params unpackers (different for Win16 and Win32)
816 // ---------------------------------------------------------------------------
818 void wxWindow::UnpackCommand(WXWPARAM wParam
, WXLPARAM lParam
,
819 WORD
*id
, WXHWND
*hwnd
, WORD
*cmd
)
821 *id
= LOWORD(wParam
);
822 *hwnd
= (WXHWND
)lParam
;
823 *cmd
= HIWORD(wParam
);
826 void wxWindow::UnpackActivate(WXWPARAM wParam
, WXLPARAM lParam
,
827 WXWORD
*state
, WXWORD
*minimized
, WXHWND
*hwnd
)
829 *state
= LOWORD(wParam
);
830 *minimized
= HIWORD(wParam
);
831 *hwnd
= (WXHWND
)lParam
;
834 void wxWindow::UnpackScroll(WXWPARAM wParam
, WXLPARAM lParam
,
835 WXWORD
*code
, WXWORD
*pos
, WXHWND
*hwnd
)
837 *code
= LOWORD(wParam
);
838 *pos
= HIWORD(wParam
);
839 *hwnd
= (WXHWND
)lParam
;
842 void wxWindow::UnpackCtlColor(WXWPARAM wParam
, WXLPARAM lParam
,
843 WXWORD
*nCtlColor
, WXHDC
*hdc
, WXHWND
*hwnd
)
845 *nCtlColor
= 0; // TODO: CTLCOLOR_BTN;
846 *hwnd
= (WXHWND
)lParam
;
847 *hdc
= (WXHDC
)wParam
;
850 void wxWindow::UnpackMenuSelect(WXWPARAM wParam
, WXLPARAM lParam
,
851 WXWORD
*item
, WXWORD
*flags
, WXHMENU
*hmenu
)
853 *item
= (WXWORD
)LOWORD(wParam
);
854 *flags
= HIWORD(wParam
);
855 *hmenu
= (WXHMENU
)lParam
;
858 // ---------------------------------------------------------------------------
859 // Main wxWindows window proc and the window proc for wxWindow
860 // ---------------------------------------------------------------------------
862 // Hook for new window just as it's being created, when the window isn't yet
863 // associated with the handle
864 wxWindow
*wxWndHook
= NULL
;
867 MRESULT
wxWndProc(HWND hWnd
, UINT message
, MPARAM wParam
, MPARAM lParam
)
869 // trace all messages - useful for the debugging
871 wxLogTrace(wxTraceMessages
, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
872 wxGetMessageName(message
), wParam
, lParam
);
873 #endif // __WXDEBUG__
875 wxWindow
*wnd
= wxFindWinFromHandle((WXHWND
) hWnd
);
877 // when we get the first message for the HWND we just created, we associate
878 // it with wxWindow stored in wxWndHook
879 if ( !wnd
&& wxWndHook
)
881 #if 0 // def __WXDEBUG__
883 ::GetClassNameA((HWND
) hWnd
, buf
, 512);
884 wxString
className(buf
);
887 wxAssociateWinWithHandle(hWnd
, wxWndHook
);
890 wnd
->SetHWND((WXHWND
)hWnd
);
895 // Stop right here if we don't have a valid handle in our wxWindow object.
896 if ( wnd
&& !wnd
->GetHWND() )
898 // FIXME: why do we do this?
899 wnd
->SetHWND((WXHWND
) hWnd
);
900 rc
= wnd
->OS2DefWindowProc(hWnd
, message
, wParam
, lParam
);
906 rc
= wnd
->OS2WindowProc(hWnd
, message
, wParam
, lParam
);
908 rc
= 0; //TODO: DefWindowProc( hWnd, message, wParam, lParam );
914 MRESULT
wxWindow::OS2WindowProc(HWND hWnd
, WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
916 // did we process the message?
917 bool processed
= FALSE
;
928 // for most messages we should return 0 when we do process the message
937 processed = HandleCreate((WXLPCREATESTRUCT)lParam, &mayCreate);
940 // return 0 to allow window creation
941 rc.result = mayCreate ? 0 : -1;
947 processed = HandleDestroy();
951 processed = HandleMove(LOWORD(lParam), HIWORD(lParam));
955 processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
960 WXWORD state, minimized;
962 UnpackActivate(wParam, lParam, &state, &minimized, &hwnd);
964 processed = HandleActivate(state, minimized != 0, (WXHWND)hwnd);
969 processed = HandleSetFocus((WXHWND)(HWND)wParam);
973 processed = HandleKillFocus((WXHWND)(HWND)wParam);
977 processed = HandlePaint();
981 // don't let the DefWindowProc() destroy our window - we'll do it
982 // ourselves in ~wxWindow
988 processed = HandleShow(wParam != 0, (int)lParam);
994 case WM_LBUTTONDBLCLK:
997 case WM_RBUTTONDBLCLK:
1000 case WM_MBUTTONDBLCLK:
1002 short x = LOWORD(lParam);
1003 short y = HIWORD(lParam);
1005 processed = HandleMouseEvent(message, x, y, wParam);
1013 case MM_JOY1BUTTONDOWN:
1014 case MM_JOY2BUTTONDOWN:
1015 case MM_JOY1BUTTONUP:
1016 case MM_JOY2BUTTONUP:
1018 int x = LOWORD(lParam);
1019 int y = HIWORD(lParam);
1021 processed = HandleJoystickEvent(message, x, y, wParam);
1026 processed = HandleSysCommand(wParam, lParam);
1033 UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);
1035 processed = HandleCommand(id, cmd, hwnd);
1041 processed = HandleNotify((int)wParam, lParam, &rc.result);
1045 // for these messages we must return TRUE if process the message
1047 case WM_MEASUREITEM:
1049 int idCtrl = (UINT)wParam;
1050 if ( message == WM_DRAWITEM )
1052 processed = MSWOnDrawItem(idCtrl,
1053 (WXDRAWITEMSTRUCT *)lParam);
1057 processed = MSWOnMeasureItem(idCtrl,
1058 (WXMEASUREITEMSTRUCT *)lParam);
1069 rc.result = m_lDlgCode;
1072 //else: get the dlg code from the DefWindowProc()
1076 // If this has been processed by an event handler,
1077 // return 0 now (we've handled it).
1078 if ( HandleKeyDown((WORD) wParam, lParam) )
1085 // we consider these message "not interesting" to OnChar
1086 if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
1095 // avoid duplicate messages to OnChar for these ASCII keys: they
1096 // will be translated by TranslateMessage() and received in WM_CHAR
1102 // but set processed to FALSE, not TRUE to still pass them to
1103 // the control's default window proc - otherwise built-in
1104 // keyboard handling won't work
1110 // special case of VK_APPS: treat it the same as right mouse
1111 // click because both usually pop up a context menu
1114 // construct the key mask
1115 WPARAM fwKeys = MK_RBUTTON;
1116 if ( (::GetKeyState(VK_CONTROL) & 0x100) != 0 )
1117 fwKeys |= MK_CONTROL;
1118 if ( (::GetKeyState(VK_SHIFT) & 0x100) != 0 )
1121 // simulate right mouse button click
1122 DWORD dwPos = ::GetMessagePos();
1123 int x = GET_X_LPARAM(dwPos),
1124 y = GET_Y_LPARAM(dwPos);
1126 ScreenToClient(&x, &y);
1127 processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, fwKeys);
1137 processed = HandleChar((WORD)wParam, lParam);
1142 processed = HandleKeyUp((WORD) wParam, lParam);
1145 case WM_CHAR: // Always an ASCII character
1146 processed = HandleChar((WORD)wParam, lParam, TRUE);
1154 UnpackScroll(wParam, lParam, &code, &pos, &hwnd);
1156 processed = MSWOnScroll(message == WM_HSCROLL ? wxHORIZONTAL
1162 // CTLCOLOR messages are sent by children to query the parent for their
1165 case WM_CTLCOLORMSGBOX:
1166 case WM_CTLCOLOREDIT:
1167 case WM_CTLCOLORLISTBOX:
1168 case WM_CTLCOLORBTN:
1169 case WM_CTLCOLORDLG:
1170 case WM_CTLCOLORSCROLLBAR:
1171 case WM_CTLCOLORSTATIC:
1179 UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd);
1181 processed = HandleCtlColor(&rc.hBrush,
1191 // the return value for this message is ignored
1192 case WM_SYSCOLORCHANGE:
1193 processed = HandleSysColorChange();
1196 case WM_PALETTECHANGED:
1197 processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
1200 case WM_QUERYNEWPALETTE:
1201 processed = HandleQueryNewPalette();
1205 processed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
1208 // we processed the message, i.e. erased the background
1214 processed = HandleDropFiles(wParam);
1218 processed = HandleInitDialog((WXHWND)(HWND)wParam);
1222 // we never set focus from here
1227 case WM_QUERYENDSESSION:
1228 processed = HandleQueryEndSession(lParam, &rc.allow);
1232 processed = HandleEndSession(wParam != 0, lParam);
1235 case WM_GETMINMAXINFO:
1236 processed = HandleGetMinMaxInfo((MINMAXINFO*)lParam);
1240 processed = HandleSetCursor((WXHWND)(HWND)wParam,
1241 LOWORD(lParam), // hit test
1242 HIWORD(lParam)); // mouse msg
1246 // returning TRUE stops the DefWindowProc() from further
1247 // processing this message - exactly what we need because we've
1248 // just set the cursor.
1257 wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."),
1258 wxGetMessageName(message));
1259 #endif // __WXDEBUG__
1260 rc.result = MSWDefWindowProc(message, wParam, lParam);
1266 // Dialog window proc
1267 MRESULT
wxDlgProc(HWND hWnd
, UINT message
, MPARAM wParam
, MPARAM lParam
)
1271 if ( message == WM_INITDIALOG )
1273 // for this message, returning TRUE tells system to set focus to the
1274 // first control in the dialog box
1279 // for all the other ones, FALSE means that we didn't process the
1287 wxWindow
*wxFindWinFromHandle(WXHWND hWnd
)
1289 wxNode
*node
= wxWinHandleList
->Find((long)hWnd
);
1292 return (wxWindow
*)node
->Data();
1295 void wxAssociateWinWithHandle(HWND hWnd
, wxWindow
*win
)
1297 // adding NULL hWnd is (first) surely a result of an error and
1298 // (secondly) breaks menu command processing
1299 wxCHECK_RET( hWnd
!= (HWND
)NULL
,
1300 wxT("attempt to add a NULL hWnd to window list ignored") );
1303 wxWindow
*oldWin
= wxFindWinFromHandle((WXHWND
) hWnd
);
1304 if ( oldWin
&& (oldWin
!= win
) )
1306 wxString
str(win
->GetClassInfo()->GetClassName());
1307 wxLogError("Bug! Found existing HWND %X for new window of class %s", (int) hWnd
, (const char*) str
);
1311 wxWinHandleList
->Append((long)hWnd
, win
);
1315 void wxRemoveHandleAssociation(wxWindow
*win
)
1317 wxWinHandleList
->DeleteObject(win
);
1320 // Default destroyer - override if you destroy it in some other way
1321 // (e.g. with MDI child windows)
1322 void wxWindow::OS2DestroyWindow()
1326 void wxWindow::OS2DetachWindowMenu()
1330 HMENU hMenu
= (HMENU
)m_hMenu
;
1332 int N
= (int)WinSendMsg(hMenu
, MM_QUERYITEMCOUNT
, 0, 0);
1334 for (i
= 0; i
< N
; i
++)
1337 int chars
= (int)WinSendMsg(hMenu
, MM_QUERYITEMTEXT
, MPFROM2SHORT(i
, N
), buf
);
1340 wxLogLastError(wxT("GetMenuString"));
1345 if ( wxStrcmp(buf
, wxT("&Window")) == 0 )
1347 WinSendMsg(hMenu
, MM_DELETEITEM
, MPFROM2SHORT(i
, TRUE
), 0);
1354 bool wxWindow::OS2Create(int id
,
1356 const wxChar
*wclass
,
1358 const wxChar
*title
,
1364 const wxChar
*dialog_template
,
1365 WXDWORD extendedStyle
)
1369 int x1 = CW_USEDEFAULT;
1371 int width1 = CW_USEDEFAULT;
1374 // Find parent's size, if it exists, to set up a possible default
1375 // panel size the size of the parent window
1379 ::GetClientRect((HWND) parent->GetHWND(), &parent_rect);
1381 width1 = parent_rect.right - parent_rect.left;
1382 height1 = parent_rect.bottom - parent_rect.top;
1385 if ( x > -1 ) x1 = x;
1386 if ( y > -1 ) y1 = y;
1387 if ( width > -1 ) width1 = width;
1388 if ( height > -1 ) height1 = height;
1390 HWND hParent = (HWND)NULL;
1392 hParent = (HWND) parent->GetHWND();
1396 if ( dialog_template )
1398 m_hWnd = (WXHWND)::CreateDialog(wxGetInstance(),
1401 (DLGPROC)wxDlgProc);
1405 wxLogError(_("Can't find dummy dialog template!\n"
1406 "Check resource include path for finding wx.rc."));
1411 // ::SetWindowLong(GWL_EXSTYLE) doesn't work for the dialogs, so try
1412 // to take care of (at least some) extended style flags ourselves
1413 if ( extendedStyle & WS_EX_TOPMOST )
1415 if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
1416 SWP_NOSIZE | SWP_NOMOVE) )
1418 wxLogLastError(wxT("SetWindowPos"));
1422 // move the dialog to its initial position without forcing repainting
1423 if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) )
1425 wxLogLastError(wxT("MoveWindow"));
1431 if ( style & WS_CHILD )
1434 wxString className(wclass);
1435 if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
1437 className += wxT("NR");
1440 m_hWnd = (WXHWND)CreateWindowEx(extendedStyle,
1442 title ? title : wxT(""),
1446 hParent, (HMENU)controlId,
1452 wxLogError(_("Can't create window of class %s!\n"
1453 "Possible Windows 3.x compatibility problem?"),
1462 wxNode* node = wxWinHandleList->Member(this);
1465 HWND hWnd = (HWND) node->GetKeyInteger();
1466 if (hWnd != (HWND) m_hWnd)
1468 wxLogError("A second HWND association is being added for the same window!");
1473 wxAssociateWinWithHandle((HWND
) m_hWnd
, this);
1478 // ===========================================================================
1479 // OS2 PM message handlers
1480 // ===========================================================================
1482 // ---------------------------------------------------------------------------
1484 // ---------------------------------------------------------------------------
1486 bool wxWindow::HandleNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
)
1492 bool wxWindow::OS2OnNotify(int WXUNUSED(idCtrl
),
1494 WXLPARAM
* WXUNUSED(result
))
1500 // ---------------------------------------------------------------------------
1501 // end session messages
1502 // ---------------------------------------------------------------------------
1504 bool wxWindow::HandleQueryEndSession(long logOff
, bool *mayEnd
)
1506 wxCloseEvent
event(wxEVT_QUERY_END_SESSION
, -1);
1507 event
.SetEventObject(wxTheApp
);
1508 event
.SetCanVeto(TRUE
);
1509 event
.SetLoggingOff(logOff
== ENDSESSION_LOGOFF
);
1511 bool rc
= wxTheApp
->ProcessEvent(event
);
1515 // we may end only if the app didn't veto session closing (double
1517 *mayEnd
= !event
.GetVeto();
1523 bool wxWindow::HandleEndSession(bool endSession
, long logOff
)
1525 // do nothing if the session isn't ending
1529 wxCloseEvent
event(wxEVT_END_SESSION
, -1);
1530 event
.SetEventObject(wxTheApp
);
1531 event
.SetCanVeto(FALSE
);
1532 event
.SetLoggingOff( (logOff
== ENDSESSION_LOGOFF
) );
1533 if ( (this == wxTheApp
->GetTopWindow()) && // Only send once
1534 wxTheApp
->ProcessEvent(event
))
1540 // ---------------------------------------------------------------------------
1541 // window creation/destruction
1542 // ---------------------------------------------------------------------------
1544 bool wxWindow::HandleCreate(WXLPCREATESTRUCT cs
, bool *mayCreate
)
1546 // TODO: should generate this event from WM_NCCREATE
1547 wxWindowCreateEvent
event(this);
1548 (void)GetEventHandler()->ProcessEvent(event
);
1555 bool wxWindow::HandleDestroy()
1557 wxWindowDestroyEvent
event(this);
1558 (void)GetEventHandler()->ProcessEvent(event
);
1560 // delete our drop target if we've got one
1561 #if wxUSE_DRAG_AND_DROP
1562 if ( m_dropTarget
!= NULL
)
1564 // m_dropTarget->Revoke(m_hWnd);
1566 delete m_dropTarget
;
1567 m_dropTarget
= NULL
;
1569 #endif // wxUSE_DRAG_AND_DROP
1571 // WM_DESTROY handled
1575 // ---------------------------------------------------------------------------
1577 // ---------------------------------------------------------------------------
1579 bool wxWindow::HandleActivate(int state
,
1580 bool WXUNUSED(minimized
),
1581 WXHWND
WXUNUSED(activate
))
1585 wxActivateEvent event(wxEVT_ACTIVATE,
1586 (state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
1588 event.SetEventObject(this);
1590 return GetEventHandler()->ProcessEvent(event);
1595 bool wxWindow::HandleSetFocus(WXHWND
WXUNUSED(hwnd
))
1601 m_caret
->OnSetFocus();
1603 #endif // wxUSE_CARET
1605 // panel wants to track the window which was the last to have focus in it
1606 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
1609 panel
->SetLastFocus(this);
1612 wxFocusEvent
event(wxEVT_SET_FOCUS
, m_windowId
);
1613 event
.SetEventObject(this);
1615 return GetEventHandler()->ProcessEvent(event
);
1618 bool wxWindow::HandleKillFocus(WXHWND
WXUNUSED(hwnd
))
1624 m_caret
->OnKillFocus();
1626 #endif // wxUSE_CARET
1628 wxFocusEvent
event(wxEVT_KILL_FOCUS
, m_windowId
);
1629 event
.SetEventObject(this);
1631 return GetEventHandler()->ProcessEvent(event
);
1634 // ---------------------------------------------------------------------------
1636 // ---------------------------------------------------------------------------
1638 bool wxWindow::HandleShow(bool show
, int status
)
1640 wxShowEvent
event(GetId(), show
);
1641 event
.m_eventObject
= this;
1643 return GetEventHandler()->ProcessEvent(event
);
1646 bool wxWindow::HandleInitDialog(WXHWND
WXUNUSED(hWndFocus
))
1648 wxInitDialogEvent
event(GetId());
1649 event
.m_eventObject
= this;
1651 return GetEventHandler()->ProcessEvent(event
);
1654 bool wxWindow::HandleDropFiles(WXWPARAM wParam
)
1660 bool wxWindow::HandleSetCursor(WXHWND hWnd
,
1662 int WXUNUSED(mouseMsg
))
1664 // don't set cursor for other windows, only for this one: this prevents
1665 // children of this window from getting the same cursor as the parent has
1666 // (don't forget that this message is propagated by default up the window
1667 // parent-child hierarchy)
1668 if ( GetHWND() == hWnd
)
1670 // don't set cursor when the mouse is not in the client part
1673 if ( nHitTest == HTCLIENT || nHitTest == HTERROR )
1675 HCURSOR hcursor = 0;
1678 // from msw\utils.cpp
1679 extern HCURSOR gs_wxBusyCursor;
1681 hcursor = gs_wxBusyCursor;
1685 wxCursor *cursor = NULL;
1687 if ( m_cursor.Ok() )
1693 // from msw\data.cpp
1694 extern wxCursor *g_globalCursor;
1696 if ( g_globalCursor && g_globalCursor->Ok() )
1697 cursor = g_globalCursor;
1701 hcursor = (HCURSOR)cursor->GetHCURSOR();
1706 // ::SetCursor(hcursor);
1717 // ---------------------------------------------------------------------------
1718 // owner drawn stuff
1719 // ---------------------------------------------------------------------------
1721 bool wxWindow::OS2OnDrawItem(int id
, WXDRAWITEMSTRUCT
*itemStruct
)
1725 #if wxUSE_OWNER_DRAWN
1726 // is it a menu item?
1729 DRAWITEMSTRUCT *pDrawStruct = (DRAWITEMSTRUCT *)itemStruct;
1730 wxMenuItem *pMenuItem = (wxMenuItem *)(pDrawStruct->itemData);
1732 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
1734 // prepare to call OnDrawItem()
1736 dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE);
1737 wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top,
1738 pDrawStruct->rcItem.right - pDrawStruct->rcItem.left,
1739 pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top);
1741 return pMenuItem->OnDrawItem
1744 (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction,
1745 (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
1749 wxWindow *item = FindItem(id);
1750 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
1752 return ((wxControl *)item)->MSWOnDraw(itemStruct);
1761 bool wxWindow::OS2OnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*itemStruct
)
1765 #if wxUSE_OWNER_DRAWN
1766 // is it a menu item?
1769 MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
1770 wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
1772 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
1774 return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
1775 &pMeasureStruct->itemHeight);
1778 wxWindow *item = FindItem(id);
1779 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
1781 return ((wxControl *)item)->MSWOnMeasure(itemStruct);
1783 #endif // owner-drawn menus
1788 // ---------------------------------------------------------------------------
1789 // colours and palettes
1790 // ---------------------------------------------------------------------------
1792 bool wxWindow::HandleSysColorChange()
1794 wxSysColourChangedEvent event
;
1795 event
.SetEventObject(this);
1797 return GetEventHandler()->ProcessEvent(event
);
1800 bool wxWindow::HandleCtlColor(WXHBRUSH
*brush
,
1808 WXHBRUSH hBrush
= 0;
1811 if ( nCtlColor == CTLCOLOR_DLG )
1813 hBrush = OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
1817 wxControl *item = (wxControl *)FindItemByHWND(pWnd, TRUE);
1819 hBrush = item->OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
1830 // Define for each class of dialog and control
1831 WXHBRUSH
wxWindow::OnCtlColor(WXHDC hDC
,
1841 bool wxWindow::HandlePaletteChanged(WXHWND hWndPalChange
)
1843 wxPaletteChangedEvent
event(GetId());
1844 event
.SetEventObject(this);
1845 event
.SetChangedWindow(wxFindWinFromHandle(hWndPalChange
));
1847 return GetEventHandler()->ProcessEvent(event
);
1850 bool wxWindow::HandleQueryNewPalette()
1852 wxQueryNewPaletteEvent
event(GetId());
1853 event
.SetEventObject(this);
1855 return GetEventHandler()->ProcessEvent(event
) && event
.GetPaletteRealized();
1858 // Responds to colour changes: passes event on to children.
1859 void wxWindow::OnSysColourChanged(wxSysColourChangedEvent
& event
)
1861 wxNode
*node
= GetChildren().First();
1864 // Only propagate to non-top-level windows
1865 wxWindow
*win
= (wxWindow
*)node
->Data();
1866 if ( win
->GetParent() )
1868 wxSysColourChangedEvent event2
;
1869 event
.m_eventObject
= win
;
1870 win
->GetEventHandler()->ProcessEvent(event2
);
1873 node
= node
->Next();
1877 // ---------------------------------------------------------------------------
1879 // ---------------------------------------------------------------------------
1881 bool wxWindow::HandlePaint()
1887 bool wxWindow::HandleEraseBkgnd(WXHDC hdc
)
1889 // Prevents flicker when dragging
1890 // if ( ::IsIconic(GetHwnd()) )
1899 wxEraseEvent
event(m_windowId
, &dc
);
1900 event
.SetEventObject(this);
1901 bool rc
= GetEventHandler()->ProcessEvent(event
);
1904 dc
.SelectOldObjects(hdc
);
1905 dc
.SetHDC((WXHDC
) NULL
);
1910 void wxWindow::OnEraseBackground(wxEraseEvent
& event
)
1915 // ---------------------------------------------------------------------------
1916 // moving and resizing
1917 // ---------------------------------------------------------------------------
1919 bool wxWindow::HandleMinimize()
1921 wxIconizeEvent
event(m_windowId
);
1922 event
.SetEventObject(this);
1924 return GetEventHandler()->ProcessEvent(event
);
1927 bool wxWindow::HandleMaximize()
1929 wxMaximizeEvent
event(m_windowId
);
1930 event
.SetEventObject(this);
1932 return GetEventHandler()->ProcessEvent(event
);
1935 bool wxWindow::HandleMove(int x
, int y
)
1937 wxMoveEvent
event(wxPoint(x
, y
), m_windowId
);
1938 event
.SetEventObject(this);
1940 return GetEventHandler()->ProcessEvent(event
);
1943 bool wxWindow::HandleSize(int w
, int h
, WXUINT
WXUNUSED(flag
))
1945 wxSizeEvent
event(wxSize(w
, h
), m_windowId
);
1946 event
.SetEventObject(this);
1948 return GetEventHandler()->ProcessEvent(event
);
1951 bool wxWindow::HandleGetMinMaxInfo(void *mmInfo
)
1955 MINMAXINFO *info = (MINMAXINFO *)mmInfo;
1959 if ( m_minWidth != -1 )
1961 info->ptMinTrackSize.x = m_minWidth;
1965 if ( m_minHeight != -1 )
1967 info->ptMinTrackSize.y = m_minHeight;
1971 if ( m_maxWidth != -1 )
1973 info->ptMaxTrackSize.x = m_maxWidth;
1977 if ( m_maxHeight != -1 )
1979 info->ptMaxTrackSize.y = m_maxHeight;
1988 // ---------------------------------------------------------------------------
1990 // ---------------------------------------------------------------------------
1992 bool wxWindow::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
1994 if ( wxCurrentPopupMenu
)
1996 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
1997 wxCurrentPopupMenu
= NULL
;
1999 return popupMenu
->OS2Command(cmd
, id
);
2002 wxWindow
*win
= FindItem(id
);
2005 win
= wxFindWinFromHandle(control
);
2009 return win
->OS2Command(cmd
, id
);
2014 bool wxWindow::HandleSysCommand(WXWPARAM wParam
, WXLPARAM lParam
)
2020 // ---------------------------------------------------------------------------
2022 // ---------------------------------------------------------------------------
2024 void wxWindow::InitMouseEvent(wxMouseEvent
& event
, int x
, int y
, WXUINT flags
)
2030 event.m_shiftDown = ((flags & MK_SHIFT) != 0);
2031 event.m_controlDown = ((flags & MK_CONTROL) != 0);
2032 event.m_leftDown = ((flags & MK_LBUTTON) != 0);
2033 event.m_middleDown = ((flags & MK_MBUTTON) != 0);
2034 event.m_rightDown = ((flags & MK_RBUTTON) != 0);
2035 event.SetTimestamp(s_currentMsg.time);
2036 event.m_eventObject = this;
2038 #if wxUSE_MOUSEEVENT_HACK
2041 m_lastMouseEvent = event.GetEventType();
2042 #endif // wxUSE_MOUSEEVENT_HACK
2046 bool wxWindow::HandleMouseEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
2048 // the mouse events take consecutive IDs from WM_MOUSEFIRST to
2049 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
2050 // from the message id and take the value in the table to get wxWin event
2052 static const wxEventType eventsMouse
[] =
2066 wxMouseEvent
event(eventsMouse
[msg
- WM_MOUSEMOVE
]);
2067 InitMouseEvent(event
, x
, y
, flags
);
2069 return GetEventHandler()->ProcessEvent(event
);
2072 bool wxWindow::HandleMouseMove(int x
, int y
, WXUINT flags
)
2074 if ( !m_mouseInWindow
)
2076 // Generate an ENTER event
2077 m_mouseInWindow
= TRUE
;
2079 wxMouseEvent
event(wxEVT_ENTER_WINDOW
);
2080 InitMouseEvent(event
, x
, y
, flags
);
2082 (void)GetEventHandler()->ProcessEvent(event
);
2085 #if wxUSE_MOUSEEVENT_HACK
2086 // Window gets a click down message followed by a mouse move message even
2087 // if position isn't changed! We want to discard the trailing move event
2088 // if x and y are the same.
2089 if ( (m_lastMouseEvent
== wxEVT_RIGHT_DOWN
||
2090 m_lastMouseEvent
== wxEVT_LEFT_DOWN
||
2091 m_lastMouseEvent
== wxEVT_MIDDLE_DOWN
) &&
2092 (m_lastMouseX
== event
.m_x
&& m_lastMouseY
== event
.m_y
) )
2094 m_lastMouseEvent
= wxEVT_MOTION
;
2098 #endif // wxUSE_MOUSEEVENT_HACK
2100 return HandleMouseEvent(WM_MOUSEMOVE
, x
, y
, flags
);
2103 // ---------------------------------------------------------------------------
2104 // keyboard handling
2105 // ---------------------------------------------------------------------------
2107 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
2109 bool wxWindow::HandleChar(WXWORD wParam
, WXLPARAM lParam
, bool isASCII
)
2115 bool wxWindow::HandleKeyDown(WXWORD wParam
, WXLPARAM lParam
)
2121 bool wxWindow::HandleKeyUp(WXWORD wParam
, WXLPARAM lParam
)
2127 // ---------------------------------------------------------------------------
2129 // ---------------------------------------------------------------------------
2131 bool wxWindow::HandleJoystickEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
2137 // ---------------------------------------------------------------------------
2139 // ---------------------------------------------------------------------------
2141 bool wxWindow::OS2OnScroll(int orientation
, WXWORD wParam
,
2142 WXWORD pos
, WXHWND control
)
2146 wxWindow
*child
= wxFindWinFromHandle(control
);
2148 return child
->OS2OnScroll(orientation
, wParam
, pos
, control
);
2151 wxScrollWinEvent event
;
2152 event
.SetPosition(pos
);
2153 event
.SetOrientation(orientation
);
2154 event
.m_eventObject
= this;
2159 // ===========================================================================
2161 // ===========================================================================
2163 void wxGetCharSize(WXHWND wnd
, int *x
, int *y
,wxFont
*the_font
)
2168 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
2169 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
2170 int wxCharCodeOS2ToWX(int keySym
)
2177 case VK_CANCEL: id = WXK_CANCEL; break;
2178 case VK_BACK: id = WXK_BACK; break;
2179 case VK_TAB: id = WXK_TAB; break;
2180 case VK_CLEAR: id = WXK_CLEAR; break;
2181 case VK_RETURN: id = WXK_RETURN; break;
2182 case VK_SHIFT: id = WXK_SHIFT; break;
2183 case VK_CONTROL: id = WXK_CONTROL; break;
2184 case VK_MENU : id = WXK_MENU; break;
2185 case VK_PAUSE: id = WXK_PAUSE; break;
2186 case VK_SPACE: id = WXK_SPACE; break;
2187 case VK_ESCAPE: id = WXK_ESCAPE; break;
2188 case VK_PRIOR: id = WXK_PRIOR; break;
2189 case VK_NEXT : id = WXK_NEXT; break;
2190 case VK_END: id = WXK_END; break;
2191 case VK_HOME : id = WXK_HOME; break;
2192 case VK_LEFT : id = WXK_LEFT; break;
2193 case VK_UP: id = WXK_UP; break;
2194 case VK_RIGHT: id = WXK_RIGHT; break;
2195 case VK_DOWN : id = WXK_DOWN; break;
2196 case VK_SELECT: id = WXK_SELECT; break;
2197 case VK_PRINT: id = WXK_PRINT; break;
2198 case VK_EXECUTE: id = WXK_EXECUTE; break;
2199 case VK_INSERT: id = WXK_INSERT; break;
2200 case VK_DELETE: id = WXK_DELETE; break;
2201 case VK_HELP : id = WXK_HELP; break;
2202 case VK_NUMPAD0: id = WXK_NUMPAD0; break;
2203 case VK_NUMPAD1: id = WXK_NUMPAD1; break;
2204 case VK_NUMPAD2: id = WXK_NUMPAD2; break;
2205 case VK_NUMPAD3: id = WXK_NUMPAD3; break;
2206 case VK_NUMPAD4: id = WXK_NUMPAD4; break;
2207 case VK_NUMPAD5: id = WXK_NUMPAD5; break;
2208 case VK_NUMPAD6: id = WXK_NUMPAD6; break;
2209 case VK_NUMPAD7: id = WXK_NUMPAD7; break;
2210 case VK_NUMPAD8: id = WXK_NUMPAD8; break;
2211 case VK_NUMPAD9: id = WXK_NUMPAD9; break;
2212 case VK_MULTIPLY: id = WXK_MULTIPLY; break;
2213 case VK_ADD: id = WXK_ADD; break;
2214 case VK_SUBTRACT: id = WXK_SUBTRACT; break;
2215 case VK_DECIMAL: id = WXK_DECIMAL; break;
2216 case VK_DIVIDE: id = WXK_DIVIDE; break;
2217 case VK_F1: id = WXK_F1; break;
2218 case VK_F2: id = WXK_F2; break;
2219 case VK_F3: id = WXK_F3; break;
2220 case VK_F4: id = WXK_F4; break;
2221 case VK_F5: id = WXK_F5; break;
2222 case VK_F6: id = WXK_F6; break;
2223 case VK_F7: id = WXK_F7; break;
2224 case VK_F8: id = WXK_F8; break;
2225 case VK_F9: id = WXK_F9; break;
2226 case VK_F10: id = WXK_F10; break;
2227 case VK_F11: id = WXK_F11; break;
2228 case VK_F12: id = WXK_F12; break;
2229 case VK_F13: id = WXK_F13; break;
2230 case VK_F14: id = WXK_F14; break;
2231 case VK_F15: id = WXK_F15; break;
2232 case VK_F16: id = WXK_F16; break;
2233 case VK_F17: id = WXK_F17; break;
2234 case VK_F18: id = WXK_F18; break;
2235 case VK_F19: id = WXK_F19; break;
2236 case VK_F20: id = WXK_F20; break;
2237 case VK_F21: id = WXK_F21; break;
2238 case VK_F22: id = WXK_F22; break;
2239 case VK_F23: id = WXK_F23; break;
2240 case VK_F24: id = WXK_F24; break;
2241 case VK_NUMLOCK: id = WXK_NUMLOCK; break;
2242 case VK_SCROLL: id = WXK_SCROLL; break;
2252 int wxCharCodeWXToOS2(int id
, bool *isVirtual
)
2260 case WXK_CANCEL: keySym = VK_CANCEL; break;
2261 case WXK_CLEAR: keySym = VK_CLEAR; break;
2262 case WXK_SHIFT: keySym = VK_SHIFT; break;
2263 case WXK_CONTROL: keySym = VK_CONTROL; break;
2264 case WXK_MENU : keySym = VK_MENU; break;
2265 case WXK_PAUSE: keySym = VK_PAUSE; break;
2266 case WXK_PRIOR: keySym = VK_PRIOR; break;
2267 case WXK_NEXT : keySym = VK_NEXT; break;
2268 case WXK_END: keySym = VK_END; break;
2269 case WXK_HOME : keySym = VK_HOME; break;
2270 case WXK_LEFT : keySym = VK_LEFT; break;
2271 case WXK_UP: keySym = VK_UP; break;
2272 case WXK_RIGHT: keySym = VK_RIGHT; break;
2273 case WXK_DOWN : keySym = VK_DOWN; break;
2274 case WXK_SELECT: keySym = VK_SELECT; break;
2275 case WXK_PRINT: keySym = VK_PRINT; break;
2276 case WXK_EXECUTE: keySym = VK_EXECUTE; break;
2277 case WXK_INSERT: keySym = VK_INSERT; break;
2278 case WXK_DELETE: keySym = VK_DELETE; break;
2279 case WXK_HELP : keySym = VK_HELP; break;
2280 case WXK_NUMPAD0: keySym = VK_NUMPAD0; break;
2281 case WXK_NUMPAD1: keySym = VK_NUMPAD1; break;
2282 case WXK_NUMPAD2: keySym = VK_NUMPAD2; break;
2283 case WXK_NUMPAD3: keySym = VK_NUMPAD3; break;
2284 case WXK_NUMPAD4: keySym = VK_NUMPAD4; break;
2285 case WXK_NUMPAD5: keySym = VK_NUMPAD5; break;
2286 case WXK_NUMPAD6: keySym = VK_NUMPAD6; break;
2287 case WXK_NUMPAD7: keySym = VK_NUMPAD7; break;
2288 case WXK_NUMPAD8: keySym = VK_NUMPAD8; break;
2289 case WXK_NUMPAD9: keySym = VK_NUMPAD9; break;
2290 case WXK_MULTIPLY: keySym = VK_MULTIPLY; break;
2291 case WXK_ADD: keySym = VK_ADD; break;
2292 case WXK_SUBTRACT: keySym = VK_SUBTRACT; break;
2293 case WXK_DECIMAL: keySym = VK_DECIMAL; break;
2294 case WXK_DIVIDE: keySym = VK_DIVIDE; break;
2295 case WXK_F1: keySym = VK_F1; break;
2296 case WXK_F2: keySym = VK_F2; break;
2297 case WXK_F3: keySym = VK_F3; break;
2298 case WXK_F4: keySym = VK_F4; break;
2299 case WXK_F5: keySym = VK_F5; break;
2300 case WXK_F6: keySym = VK_F6; break;
2301 case WXK_F7: keySym = VK_F7; break;
2302 case WXK_F8: keySym = VK_F8; break;
2303 case WXK_F9: keySym = VK_F9; break;
2304 case WXK_F10: keySym = VK_F10; break;
2305 case WXK_F11: keySym = VK_F11; break;
2306 case WXK_F12: keySym = VK_F12; break;
2307 case WXK_F13: keySym = VK_F13; break;
2308 case WXK_F14: keySym = VK_F14; break;
2309 case WXK_F15: keySym = VK_F15; break;
2310 case WXK_F16: keySym = VK_F16; break;
2311 case WXK_F17: keySym = VK_F17; break;
2312 case WXK_F18: keySym = VK_F18; break;
2313 case WXK_F19: keySym = VK_F19; break;
2314 case WXK_F20: keySym = VK_F20; break;
2315 case WXK_F21: keySym = VK_F21; break;
2316 case WXK_F22: keySym = VK_F22; break;
2317 case WXK_F23: keySym = VK_F23; break;
2318 case WXK_F24: keySym = VK_F24; break;
2319 case WXK_NUMLOCK: keySym = VK_NUMLOCK; break;
2320 case WXK_SCROLL: keySym = VK_SCROLL; break;
2332 wxWindow
*wxGetActiveWindow()
2338 // Windows keyboard hook. Allows interception of e.g. F1, ESCAPE
2339 // in active frames and dialogs, regardless of where the focus is.
2340 //static HHOOK wxTheKeyboardHook = 0;
2341 //static FARPROC wxTheKeyboardHookProc = 0;
2342 int wxKeyboardHook(int nCode
, WORD wParam
, DWORD lParam
);
2344 void wxSetKeyboardHook(bool doIt
)
2349 int wxKeyboardHook(int nCode
, WORD wParam
, DWORD lParam
)
2357 const char *wxGetMessageName(int message
)
2363 case 0x0000: return "WM_NULL";
2364 case 0x0001: return "WM_CREATE";
2365 case 0x0002: return "WM_DESTROY";
2366 case 0x0003: return "WM_MOVE";
2367 case 0x0005: return "WM_SIZE";
2368 case 0x0006: return "WM_ACTIVATE";
2369 case 0x0007: return "WM_SETFOCUS";
2370 case 0x0008: return "WM_KILLFOCUS";
2371 case 0x000A: return "WM_ENABLE";
2372 case 0x000B: return "WM_SETREDRAW";
2373 case 0x000C: return "WM_SETTEXT";
2374 case 0x000D: return "WM_GETTEXT";
2375 case 0x000E: return "WM_GETTEXTLENGTH";
2376 case 0x000F: return "WM_PAINT";
2377 case 0x0010: return "WM_CLOSE";
2378 case 0x0011: return "WM_QUERYENDSESSION";
2379 case 0x0012: return "WM_QUIT";
2380 case 0x0013: return "WM_QUERYOPEN";
2381 case 0x0014: return "WM_ERASEBKGND";
2382 case 0x0015: return "WM_SYSCOLORCHANGE";
2383 case 0x0016: return "WM_ENDSESSION";
2384 case 0x0017: return "WM_SYSTEMERROR";
2385 case 0x0018: return "WM_SHOWWINDOW";
2386 case 0x0019: return "WM_CTLCOLOR";
2387 case 0x001A: return "WM_WININICHANGE";
2388 case 0x001B: return "WM_DEVMODECHANGE";
2389 case 0x001C: return "WM_ACTIVATEAPP";
2390 case 0x001D: return "WM_FONTCHANGE";
2391 case 0x001E: return "WM_TIMECHANGE";
2392 case 0x001F: return "WM_CANCELMODE";
2393 case 0x0020: return "WM_SETCURSOR";
2394 case 0x0021: return "WM_MOUSEACTIVATE";
2395 case 0x0022: return "WM_CHILDACTIVATE";
2396 case 0x0023: return "WM_QUEUESYNC";
2397 case 0x0024: return "WM_GETMINMAXINFO";
2398 case 0x0026: return "WM_PAINTICON";
2399 case 0x0027: return "WM_ICONERASEBKGND";
2400 case 0x0028: return "WM_NEXTDLGCTL";
2401 case 0x002A: return "WM_SPOOLERSTATUS";
2402 case 0x002B: return "WM_DRAWITEM";
2403 case 0x002C: return "WM_MEASUREITEM";
2404 case 0x002D: return "WM_DELETEITEM";
2405 case 0x002E: return "WM_VKEYTOITEM";
2406 case 0x002F: return "WM_CHARTOITEM";
2407 case 0x0030: return "WM_SETFONT";
2408 case 0x0031: return "WM_GETFONT";
2409 case 0x0037: return "WM_QUERYDRAGICON";
2410 case 0x0039: return "WM_COMPAREITEM";
2411 case 0x0041: return "WM_COMPACTING";
2412 case 0x0044: return "WM_COMMNOTIFY";
2413 case 0x0046: return "WM_WINDOWPOSCHANGING";
2414 case 0x0047: return "WM_WINDOWPOSCHANGED";
2415 case 0x0048: return "WM_POWER";
2418 case 0x004A: return "WM_COPYDATA";
2419 case 0x004B: return "WM_CANCELJOURNAL";
2420 case 0x004E: return "WM_NOTIFY";
2421 case 0x0050: return "WM_INPUTLANGCHANGEREQUEST";
2422 case 0x0051: return "WM_INPUTLANGCHANGE";
2423 case 0x0052: return "WM_TCARD";
2424 case 0x0053: return "WM_HELP";
2425 case 0x0054: return "WM_USERCHANGED";
2426 case 0x0055: return "WM_NOTIFYFORMAT";
2427 case 0x007B: return "WM_CONTEXTMENU";
2428 case 0x007C: return "WM_STYLECHANGING";
2429 case 0x007D: return "WM_STYLECHANGED";
2430 case 0x007E: return "WM_DISPLAYCHANGE";
2431 case 0x007F: return "WM_GETICON";
2432 case 0x0080: return "WM_SETICON";
2435 case 0x0081: return "WM_NCCREATE";
2436 case 0x0082: return "WM_NCDESTROY";
2437 case 0x0083: return "WM_NCCALCSIZE";
2438 case 0x0084: return "WM_NCHITTEST";
2439 case 0x0085: return "WM_NCPAINT";
2440 case 0x0086: return "WM_NCACTIVATE";
2441 case 0x0087: return "WM_GETDLGCODE";
2442 case 0x00A0: return "WM_NCMOUSEMOVE";
2443 case 0x00A1: return "WM_NCLBUTTONDOWN";
2444 case 0x00A2: return "WM_NCLBUTTONUP";
2445 case 0x00A3: return "WM_NCLBUTTONDBLCLK";
2446 case 0x00A4: return "WM_NCRBUTTONDOWN";
2447 case 0x00A5: return "WM_NCRBUTTONUP";
2448 case 0x00A6: return "WM_NCRBUTTONDBLCLK";
2449 case 0x00A7: return "WM_NCMBUTTONDOWN";
2450 case 0x00A8: return "WM_NCMBUTTONUP";
2451 case 0x00A9: return "WM_NCMBUTTONDBLCLK";
2452 case 0x0100: return "WM_KEYDOWN";
2453 case 0x0101: return "WM_KEYUP";
2454 case 0x0102: return "WM_CHAR";
2455 case 0x0103: return "WM_DEADCHAR";
2456 case 0x0104: return "WM_SYSKEYDOWN";
2457 case 0x0105: return "WM_SYSKEYUP";
2458 case 0x0106: return "WM_SYSCHAR";
2459 case 0x0107: return "WM_SYSDEADCHAR";
2460 case 0x0108: return "WM_KEYLAST";
2463 case 0x010D: return "WM_IME_STARTCOMPOSITION";
2464 case 0x010E: return "WM_IME_ENDCOMPOSITION";
2465 case 0x010F: return "WM_IME_COMPOSITION";
2468 case 0x0110: return "WM_INITDIALOG";
2469 case 0x0111: return "WM_COMMAND";
2470 case 0x0112: return "WM_SYSCOMMAND";
2471 case 0x0113: return "WM_TIMER";
2472 case 0x0114: return "WM_HSCROLL";
2473 case 0x0115: return "WM_VSCROLL";
2474 case 0x0116: return "WM_INITMENU";
2475 case 0x0117: return "WM_INITMENUPOPUP";
2476 case 0x011F: return "WM_MENUSELECT";
2477 case 0x0120: return "WM_MENUCHAR";
2478 case 0x0121: return "WM_ENTERIDLE";
2479 case 0x0200: return "WM_MOUSEMOVE";
2480 case 0x0201: return "WM_LBUTTONDOWN";
2481 case 0x0202: return "WM_LBUTTONUP";
2482 case 0x0203: return "WM_LBUTTONDBLCLK";
2483 case 0x0204: return "WM_RBUTTONDOWN";
2484 case 0x0205: return "WM_RBUTTONUP";
2485 case 0x0206: return "WM_RBUTTONDBLCLK";
2486 case 0x0207: return "WM_MBUTTONDOWN";
2487 case 0x0208: return "WM_MBUTTONUP";
2488 case 0x0209: return "WM_MBUTTONDBLCLK";
2489 case 0x0210: return "WM_PARENTNOTIFY";
2490 case 0x0211: return "WM_ENTERMENULOOP";
2491 case 0x0212: return "WM_EXITMENULOOP";
2494 case 0x0213: return "WM_NEXTMENU";
2495 case 0x0214: return "WM_SIZING";
2496 case 0x0215: return "WM_CAPTURECHANGED";
2497 case 0x0216: return "WM_MOVING";
2498 case 0x0218: return "WM_POWERBROADCAST";
2499 case 0x0219: return "WM_DEVICECHANGE";
2502 case 0x0220: return "WM_MDICREATE";
2503 case 0x0221: return "WM_MDIDESTROY";
2504 case 0x0222: return "WM_MDIACTIVATE";
2505 case 0x0223: return "WM_MDIRESTORE";
2506 case 0x0224: return "WM_MDINEXT";
2507 case 0x0225: return "WM_MDIMAXIMIZE";
2508 case 0x0226: return "WM_MDITILE";
2509 case 0x0227: return "WM_MDICASCADE";
2510 case 0x0228: return "WM_MDIICONARRANGE";
2511 case 0x0229: return "WM_MDIGETACTIVE";
2512 case 0x0230: return "WM_MDISETMENU";
2513 case 0x0233: return "WM_DROPFILES";
2516 case 0x0281: return "WM_IME_SETCONTEXT";
2517 case 0x0282: return "WM_IME_NOTIFY";
2518 case 0x0283: return "WM_IME_CONTROL";
2519 case 0x0284: return "WM_IME_COMPOSITIONFULL";
2520 case 0x0285: return "WM_IME_SELECT";
2521 case 0x0286: return "WM_IME_CHAR";
2522 case 0x0290: return "WM_IME_KEYDOWN";
2523 case 0x0291: return "WM_IME_KEYUP";
2526 case 0x0300: return "WM_CUT";
2527 case 0x0301: return "WM_COPY";
2528 case 0x0302: return "WM_PASTE";
2529 case 0x0303: return "WM_CLEAR";
2530 case 0x0304: return "WM_UNDO";
2531 case 0x0305: return "WM_RENDERFORMAT";
2532 case 0x0306: return "WM_RENDERALLFORMATS";
2533 case 0x0307: return "WM_DESTROYCLIPBOARD";
2534 case 0x0308: return "WM_DRAWCLIPBOARD";
2535 case 0x0309: return "WM_PAINTCLIPBOARD";
2536 case 0x030A: return "WM_VSCROLLCLIPBOARD";
2537 case 0x030B: return "WM_SIZECLIPBOARD";
2538 case 0x030C: return "WM_ASKCBFORMATNAME";
2539 case 0x030D: return "WM_CHANGECBCHAIN";
2540 case 0x030E: return "WM_HSCROLLCLIPBOARD";
2541 case 0x030F: return "WM_QUERYNEWPALETTE";
2542 case 0x0310: return "WM_PALETTEISCHANGING";
2543 case 0x0311: return "WM_PALETTECHANGED";
2546 // common controls messages - although they're not strictly speaking
2547 // standard, it's nice to decode them nevertheless
2550 case 0x1000 + 0: return "LVM_GETBKCOLOR";
2551 case 0x1000 + 1: return "LVM_SETBKCOLOR";
2552 case 0x1000 + 2: return "LVM_GETIMAGELIST";
2553 case 0x1000 + 3: return "LVM_SETIMAGELIST";
2554 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
2555 case 0x1000 + 5: return "LVM_GETITEMA";
2556 case 0x1000 + 75: return "LVM_GETITEMW";
2557 case 0x1000 + 6: return "LVM_SETITEMA";
2558 case 0x1000 + 76: return "LVM_SETITEMW";
2559 case 0x1000 + 7: return "LVM_INSERTITEMA";
2560 case 0x1000 + 77: return "LVM_INSERTITEMW";
2561 case 0x1000 + 8: return "LVM_DELETEITEM";
2562 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
2563 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
2564 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
2565 case 0x1000 + 12: return "LVM_GETNEXTITEM";
2566 case 0x1000 + 13: return "LVM_FINDITEMA";
2567 case 0x1000 + 83: return "LVM_FINDITEMW";
2568 case 0x1000 + 14: return "LVM_GETITEMRECT";
2569 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
2570 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
2571 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
2572 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
2573 case 0x1000 + 18: return "LVM_HITTEST";
2574 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
2575 case 0x1000 + 20: return "LVM_SCROLL";
2576 case 0x1000 + 21: return "LVM_REDRAWITEMS";
2577 case 0x1000 + 22: return "LVM_ARRANGE";
2578 case 0x1000 + 23: return "LVM_EDITLABELA";
2579 case 0x1000 + 118: return "LVM_EDITLABELW";
2580 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
2581 case 0x1000 + 25: return "LVM_GETCOLUMNA";
2582 case 0x1000 + 95: return "LVM_GETCOLUMNW";
2583 case 0x1000 + 26: return "LVM_SETCOLUMNA";
2584 case 0x1000 + 96: return "LVM_SETCOLUMNW";
2585 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
2586 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
2587 case 0x1000 + 28: return "LVM_DELETECOLUMN";
2588 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
2589 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
2590 case 0x1000 + 31: return "LVM_GETHEADER";
2591 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
2592 case 0x1000 + 34: return "LVM_GETVIEWRECT";
2593 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
2594 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
2595 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
2596 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
2597 case 0x1000 + 39: return "LVM_GETTOPINDEX";
2598 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
2599 case 0x1000 + 41: return "LVM_GETORIGIN";
2600 case 0x1000 + 42: return "LVM_UPDATE";
2601 case 0x1000 + 43: return "LVM_SETITEMSTATE";
2602 case 0x1000 + 44: return "LVM_GETITEMSTATE";
2603 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
2604 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
2605 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
2606 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
2607 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
2608 case 0x1000 + 48: return "LVM_SORTITEMS";
2609 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
2610 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
2611 case 0x1000 + 51: return "LVM_GETITEMSPACING";
2612 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
2613 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
2614 case 0x1000 + 53: return "LVM_SETICONSPACING";
2615 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
2616 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
2617 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
2618 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
2619 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
2620 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
2621 case 0x1000 + 60: return "LVM_SETHOTITEM";
2622 case 0x1000 + 61: return "LVM_GETHOTITEM";
2623 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
2624 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
2625 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
2626 case 0x1000 + 65: return "LVM_SETWORKAREA";
2629 case 0x1100 + 0: return "TVM_INSERTITEMA";
2630 case 0x1100 + 50: return "TVM_INSERTITEMW";
2631 case 0x1100 + 1: return "TVM_DELETEITEM";
2632 case 0x1100 + 2: return "TVM_EXPAND";
2633 case 0x1100 + 4: return "TVM_GETITEMRECT";
2634 case 0x1100 + 5: return "TVM_GETCOUNT";
2635 case 0x1100 + 6: return "TVM_GETINDENT";
2636 case 0x1100 + 7: return "TVM_SETINDENT";
2637 case 0x1100 + 8: return "TVM_GETIMAGELIST";
2638 case 0x1100 + 9: return "TVM_SETIMAGELIST";
2639 case 0x1100 + 10: return "TVM_GETNEXTITEM";
2640 case 0x1100 + 11: return "TVM_SELECTITEM";
2641 case 0x1100 + 12: return "TVM_GETITEMA";
2642 case 0x1100 + 62: return "TVM_GETITEMW";
2643 case 0x1100 + 13: return "TVM_SETITEMA";
2644 case 0x1100 + 63: return "TVM_SETITEMW";
2645 case 0x1100 + 14: return "TVM_EDITLABELA";
2646 case 0x1100 + 65: return "TVM_EDITLABELW";
2647 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
2648 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
2649 case 0x1100 + 17: return "TVM_HITTEST";
2650 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
2651 case 0x1100 + 19: return "TVM_SORTCHILDREN";
2652 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
2653 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
2654 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
2655 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
2656 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
2657 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
2658 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
2661 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
2662 case 0x1200 + 1: return "HDM_INSERTITEMA";
2663 case 0x1200 + 10: return "HDM_INSERTITEMW";
2664 case 0x1200 + 2: return "HDM_DELETEITEM";
2665 case 0x1200 + 3: return "HDM_GETITEMA";
2666 case 0x1200 + 11: return "HDM_GETITEMW";
2667 case 0x1200 + 4: return "HDM_SETITEMA";
2668 case 0x1200 + 12: return "HDM_SETITEMW";
2669 case 0x1200 + 5: return "HDM_LAYOUT";
2670 case 0x1200 + 6: return "HDM_HITTEST";
2671 case 0x1200 + 7: return "HDM_GETITEMRECT";
2672 case 0x1200 + 8: return "HDM_SETIMAGELIST";
2673 case 0x1200 + 9: return "HDM_GETIMAGELIST";
2674 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
2675 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
2676 case 0x1200 + 17: return "HDM_GETORDERARRAY";
2677 case 0x1200 + 18: return "HDM_SETORDERARRAY";
2678 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
2681 case 0x1300 + 2: return "TCM_GETIMAGELIST";
2682 case 0x1300 + 3: return "TCM_SETIMAGELIST";
2683 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
2684 case 0x1300 + 5: return "TCM_GETITEMA";
2685 case 0x1300 + 60: return "TCM_GETITEMW";
2686 case 0x1300 + 6: return "TCM_SETITEMA";
2687 case 0x1300 + 61: return "TCM_SETITEMW";
2688 case 0x1300 + 7: return "TCM_INSERTITEMA";
2689 case 0x1300 + 62: return "TCM_INSERTITEMW";
2690 case 0x1300 + 8: return "TCM_DELETEITEM";
2691 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
2692 case 0x1300 + 10: return "TCM_GETITEMRECT";
2693 case 0x1300 + 11: return "TCM_GETCURSEL";
2694 case 0x1300 + 12: return "TCM_SETCURSEL";
2695 case 0x1300 + 13: return "TCM_HITTEST";
2696 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
2697 case 0x1300 + 40: return "TCM_ADJUSTRECT";
2698 case 0x1300 + 41: return "TCM_SETITEMSIZE";
2699 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
2700 case 0x1300 + 43: return "TCM_SETPADDING";
2701 case 0x1300 + 44: return "TCM_GETROWCOUNT";
2702 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
2703 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
2704 case 0x1300 + 47: return "TCM_GETCURFOCUS";
2705 case 0x1300 + 48: return "TCM_SETCURFOCUS";
2706 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
2707 case 0x1300 + 50: return "TCM_DESELECTALL";
2710 case WM_USER+1: return "TB_ENABLEBUTTON";
2711 case WM_USER+2: return "TB_CHECKBUTTON";
2712 case WM_USER+3: return "TB_PRESSBUTTON";
2713 case WM_USER+4: return "TB_HIDEBUTTON";
2714 case WM_USER+5: return "TB_INDETERMINATE";
2715 case WM_USER+9: return "TB_ISBUTTONENABLED";
2716 case WM_USER+10: return "TB_ISBUTTONCHECKED";
2717 case WM_USER+11: return "TB_ISBUTTONPRESSED";
2718 case WM_USER+12: return "TB_ISBUTTONHIDDEN";
2719 case WM_USER+13: return "TB_ISBUTTONINDETERMINATE";
2720 case WM_USER+17: return "TB_SETSTATE";
2721 case WM_USER+18: return "TB_GETSTATE";
2722 case WM_USER+19: return "TB_ADDBITMAP";
2723 case WM_USER+20: return "TB_ADDBUTTONS";
2724 case WM_USER+21: return "TB_INSERTBUTTON";
2725 case WM_USER+22: return "TB_DELETEBUTTON";
2726 case WM_USER+23: return "TB_GETBUTTON";
2727 case WM_USER+24: return "TB_BUTTONCOUNT";
2728 case WM_USER+25: return "TB_COMMANDTOINDEX";
2729 case WM_USER+26: return "TB_SAVERESTOREA";
2730 case WM_USER+76: return "TB_SAVERESTOREW";
2731 case WM_USER+27: return "TB_CUSTOMIZE";
2732 case WM_USER+28: return "TB_ADDSTRINGA";
2733 case WM_USER+77: return "TB_ADDSTRINGW";
2734 case WM_USER+29: return "TB_GETITEMRECT";
2735 case WM_USER+30: return "TB_BUTTONSTRUCTSIZE";
2736 case WM_USER+31: return "TB_SETBUTTONSIZE";
2737 case WM_USER+32: return "TB_SETBITMAPSIZE";
2738 case WM_USER+33: return "TB_AUTOSIZE";
2739 case WM_USER+35: return "TB_GETTOOLTIPS";
2740 case WM_USER+36: return "TB_SETTOOLTIPS";
2741 case WM_USER+37: return "TB_SETPARENT";
2742 case WM_USER+39: return "TB_SETROWS";
2743 case WM_USER+40: return "TB_GETROWS";
2744 case WM_USER+42: return "TB_SETCMDID";
2745 case WM_USER+43: return "TB_CHANGEBITMAP";
2746 case WM_USER+44: return "TB_GETBITMAP";
2747 case WM_USER+45: return "TB_GETBUTTONTEXTA";
2748 case WM_USER+75: return "TB_GETBUTTONTEXTW";
2749 case WM_USER+46: return "TB_REPLACEBITMAP";
2750 case WM_USER+47: return "TB_SETINDENT";
2751 case WM_USER+48: return "TB_SETIMAGELIST";
2752 case WM_USER+49: return "TB_GETIMAGELIST";
2753 case WM_USER+50: return "TB_LOADIMAGES";
2754 case WM_USER+51: return "TB_GETRECT";
2755 case WM_USER+52: return "TB_SETHOTIMAGELIST";
2756 case WM_USER+53: return "TB_GETHOTIMAGELIST";
2757 case WM_USER+54: return "TB_SETDISABLEDIMAGELIST";
2758 case WM_USER+55: return "TB_GETDISABLEDIMAGELIST";
2759 case WM_USER+56: return "TB_SETSTYLE";
2760 case WM_USER+57: return "TB_GETSTYLE";
2761 case WM_USER+58: return "TB_GETBUTTONSIZE";
2762 case WM_USER+59: return "TB_SETBUTTONWIDTH";
2763 case WM_USER+60: return "TB_SETMAXTEXTROWS";
2764 case WM_USER+61: return "TB_GETTEXTROWS";
2765 case WM_USER+41: return "TB_GETBITMAPFLAGS";
2770 static char s_szBuf[128];
2771 sprintf(s_szBuf, "<unknown message = %d>", message);
2778 #endif // __WXDEBUG__