]> git.saurik.com Git - wxWidgets.git/blob - src/os2/window.cpp
Frame and Window coding
[wxWidgets.git] / src / os2 / window.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: windows.cpp
3 // Purpose: wxWindow
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/12/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 //
13 // For compilers that support precompilation, includes "wx.h".
14 //
15 #include "wx/wxprec.h"
16
17 #ifndef WX_PRECOMP
18 #define INCL_DOS
19 #define INCL_PM
20 #include <os2.h>
21 #include "wx/window.h"
22 #include "wx/accel.h"
23 #include "wx/setup.h"
24 #include "wx/menu.h"
25 #include "wx/dc.h"
26 #include "wx/dcclient.h"
27 #include "wx/utils.h"
28 #include "wx/app.h"
29 #include "wx/panel.h"
30 #include "wx/layout.h"
31 #include "wx/dialog.h"
32 #include "wx/frame.h"
33 #include "wx/listbox.h"
34 #include "wx/button.h"
35 #include "wx/msgdlg.h"
36
37 #include <stdio.h>
38 #endif
39
40 #if wxUSE_OWNER_DRAWN
41 #include "wx/ownerdrw.h"
42 #endif
43
44 #if wxUSE_DRAG_AND_DROP
45 #include "wx/dnd.h"
46 #endif
47
48 #include "wx/menuitem.h"
49 #include "wx/log.h"
50
51 #include "wx/os2/private.h"
52
53 #if wxUSE_TOOLTIPS
54 #include "wx/tooltip.h"
55 #endif
56
57 #if wxUSE_CARET
58 #include "wx/caret.h"
59 #endif // wxUSE_CARET
60
61 #include "wx/intl.h"
62 #include "wx/log.h"
63
64
65 #include "wx/textctrl.h"
66
67 #include <string.h>
68
69 //
70 // Place compiler, OS specific includes here
71 //
72
73 //
74 // Standard macros -- these are for OS/2 PM, but most GUI's have something similar
75 //
76 #ifndef GET_X_LPARAM
77 //
78 // SHORT1FROMMP -- LOWORD
79 //
80 #define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp))
81 //
82 // SHORT2FROMMP -- HIWORD
83 //
84 #define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16))
85 #endif // GET_X_LPARAM
86
87 // ---------------------------------------------------------------------------
88 // global variables
89 // ---------------------------------------------------------------------------
90
91 //
92 // The last Windows message we got (MT-UNSAFE)
93 //
94 extern WXMSGID s_currentMsg;
95
96 wxMenu* wxCurrentPopupMenu = NULL;
97 extern wxList WXDLLEXPORT wxPendingDelete;
98 extern wxChar* wxCanvasClassName;
99 wxList* wxWinHandleList = NULL;
100
101 // ---------------------------------------------------------------------------
102 // private functions
103 // ---------------------------------------------------------------------------
104
105 //
106 // the window proc for all our windows; most gui's have something similar
107 //
108 MRESULT wxWndProc( HWND hWnd
109 ,ULONG message
110 ,MPARAM mp1
111 ,MPARAM mp2
112 );
113
114 #ifdef __WXDEBUG__
115 const char *wxGetMessageName(int message);
116 #endif //__WXDEBUG__
117
118 void wxRemoveHandleAssociation(wxWindow* pWin);
119 void wxAssociateWinWithHandle( HWND hWnd
120 ,wxWindow* pWin
121 );
122 wxWindow* wxFindWinFromHandle(WXHWND hWnd);
123
124 //
125 // This magical function is used to translate VK_APPS key presses to right
126 // mouse clicks
127 //
128 static void TranslateKbdEventToMouse( wxWindow* pWin
129 ,int* pX
130 ,int* pY
131 ,MPARAM* pFlags
132 );
133
134 //
135 // get the current state of SHIFT/CTRL keys
136 //
137 static inline bool IsShiftDown() { return (::WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000) != 0; }
138 static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000) != 0; }
139 // ---------------------------------------------------------------------------
140 // event tables
141 // ---------------------------------------------------------------------------
142
143 IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
144
145 BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
146 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
147 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
148 EVT_INIT_DIALOG(wxWindow::OnInitDialog)
149 EVT_IDLE(wxWindow::OnIdle)
150 END_EVENT_TABLE()
151
152 // ===========================================================================
153 // implementation
154 // ===========================================================================
155
156 //
157 // Find an item given the PM Window id
158 //
159 wxWindow* wxWindow::FindItem(
160 long lId
161 ) const
162 {
163 wxControl* pItem = wxDynamicCast( this
164 ,wxControl
165 );
166
167 if (pItem)
168 {
169 //
170 // I it we or one of our "internal" children?
171 //
172 if (pItem->GetId() == lId ||
173 (pItem->GetSubcontrols().Index(lId) != wxNOT_FOUND))
174 {
175 return pItem;
176 }
177 }
178
179 wxWindowList::Node* pCurrent = GetChildren().GetFirst();
180
181 while (pCurrent)
182 {
183 wxWindow* pChildWin = pCurrent->GetData();
184 wxWindow* pWnd = pChildWin->FindItem(lId);
185
186 if (pWnd)
187 return pWnd;
188
189 pCurrent = pCurrent->GetNext();
190 }
191 return(NULL);
192 } // end of wxWindow::FindItem
193
194 //
195 // Find an item given the PM Window handle
196 //
197 wxWindow* wxWindow::FindItemByHWND(
198 WXHWND hWnd
199 , bool bControlOnly
200 ) const
201 {
202 wxWindowList::Node* pCurrent = GetChildren().GetFirst();
203
204 while (pCurrent)
205 {
206 wxWindow* pParent = pCurrent->GetData();
207
208 //
209 // Do a recursive search.
210 //
211 wxWindow* pWnd = pParent->FindItemByHWND(hWnd);
212
213 if (pWnd)
214 return(pWnd);
215
216 if (!bControlOnly || pParent->IsKindOf(CLASSINFO(wxControl)))
217 {
218 wxWindow* pItem = pCurrent->GetData();
219
220 if (pItem->GetHWND() == hWnd)
221 return(pItem);
222 else
223 {
224 if (pItem->ContainsHWND(hWnd))
225 return(pItem);
226 }
227 }
228 pCurrent = pCurrent->GetNext();
229 }
230 return(NULL);
231 } // end of wxWindow::FindItemByHWND
232
233 //
234 // Default command handler
235 //
236 bool wxWindow::OS2Command(
237 WXUINT WXUNUSED(uParam)
238 , WXWORD WXUNUSED(uId)
239 )
240 {
241 return(FALSE);
242 }
243
244 // ----------------------------------------------------------------------------
245 // constructors and such
246 // ----------------------------------------------------------------------------
247
248 void wxWindow::Init()
249 {
250 //
251 // Generic
252 //
253 InitBase();
254
255 //
256 // PM specific
257 //
258 m_bDoubleClickAllowed = 0;
259 m_bWinCaptured = FALSE;
260
261 m_isBeingDeleted = FALSE;
262 m_fnOldWndProc = 0;
263 m_bUseCtl3D = FALSE;
264 m_bMouseInWindow = FALSE;
265
266 //
267 // wxWnd
268 //
269 m_hMenu = 0;
270 m_hWnd = 0;
271
272 //
273 // Pass WM_GETDLGCODE to DefWindowProc()
274 m_lDlgCode = 0;
275
276 m_nXThumbSize = 0;
277 m_nYThumbSize = 0;
278 m_bBackgroundTransparent = FALSE;
279
280 //
281 // As all windows are created with WS_VISIBLE style...
282 //
283 m_isShown = TRUE;
284
285 #if wxUSE_MOUSEEVENT_HACK
286 m_lLastMouseX =
287 m_lLastMouseY = -1;
288 m_nLastMouseEvent = -1;
289 #endif // wxUSE_MOUSEEVENT_HACK
290 } // wxWindow::Init
291
292 //
293 // Destructor
294 //
295 wxWindow::~wxWindow()
296 {
297 m_isBeingDeleted = TRUE;
298
299 OS2DetachWindowMenu();
300 if (m_parent)
301 m_parent->RemoveChild(this);
302 DestroyChildren();
303 if (m_hWnd)
304 {
305 if(!::WinDestroyWindow(GetHWND()))
306 wxLogLastError(wxT("DestroyWindow"));
307 //
308 // remove hWnd <-> wxWindow association
309 //
310 wxRemoveHandleAssociation(this);
311 }
312 } // end of wxWindow::~wxWindow
313
314 bool wxWindow::Create(
315 wxWindow* pParent
316 , wxWindowID vId
317 , const wxPoint& rPos
318 , const wxSize& rSize
319 , long lStyle
320 , const wxString& rName
321 )
322 {
323 wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent"));
324
325 if ( !CreateBase( pParent
326 ,vId
327 ,rPos
328 ,rSize
329 ,lStyle
330 ,wxDefaultValidator
331 ,rName
332 ))
333 return(FALSE);
334
335 pParent->AddChild(this);
336
337 ULONG ulFlags = 0L;
338
339 //
340 // Frame windows and their derivatives only
341 //
342 if (lStyle & wxBORDER)
343 ulFlags |= FCF_BORDER;
344 if (lStyle & wxTHICK_FRAME )
345 ulFlags |= FCF_SIZEBORDER;
346
347 //
348 // Some generic window styles
349 //
350 ulFlags |= WS_VISIBLE;
351 if (lStyle & wxCLIP_CHILDREN )
352 ulFlags |= WS_CLIPCHILDREN;
353
354 bool bWant3D;
355 WXDWORD dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D);
356
357 //
358 // OS/2 PM doesn't have "extended" styles but if the library specifies
359 // them and we are creating a frame window then at least give it a border
360 //
361 if ( bWant3D ||
362 (m_windowStyle & wxSIMPLE_BORDER) ||
363 (m_windowStyle & wxRAISED_BORDER ) ||
364 (m_windowStyle & wxSUNKEN_BORDER) ||
365 (m_windowStyle & wxDOUBLE_BORDER)
366 )
367 {
368 ulFlags |= FCF_BORDER;
369 }
370 OS2Create( m_windowId
371 ,pParent
372 ,wxCanvasClassName
373 ,this
374 ,NULL
375 ,rPos.x
376 ,rPos.y
377 ,WidthDefault(rSize.x)
378 ,HeightDefault(rSize.y)
379 ,ulFlags
380 ,NULL
381 ,dwExStyle
382 );
383 return(TRUE);
384 } // end of wxWindow::Create
385
386 // ---------------------------------------------------------------------------
387 // basic operations
388 // ---------------------------------------------------------------------------
389
390 void wxWindow::SetFocus()
391 {
392 HWND hWnd = GetHwnd();
393
394 if (hWnd)
395 ::WinSetFocus(HWND_DESKTOP, hWnd);
396 } // end of wxWindow::SetFocus
397
398 wxWindow* wxWindowBase::FindFocus()
399 {
400 HWND hWnd = ::WinQueryFocus(HWND_DESKTOP);
401
402 if (hWnd)
403 {
404 return wxFindWinFromHandle((WXHWND)hWnd);
405 }
406 return NULL;
407 } // wxWindowBase::FindFocus
408
409 bool wxWindow::Enable(
410 bool bEnable
411 )
412 {
413 if (!wxWindowBase::Enable(bEnable))
414 return(FALSE);
415
416 HWND hWnd = GetHwnd();
417
418 if ( hWnd )
419 ::WinEnableWindow(hWnd, (BOOL)bEnable);
420
421 wxWindowList::Node* pNode = GetChildren().GetFirst();
422
423 while (pNode)
424 {
425 wxWindow* pChild = pNode->GetData();
426
427 pChild->Enable(bEnable);
428 pNode = pNode->GetNext();
429 }
430 return(TRUE);
431 } // end of wxWindow::Enable
432
433 bool wxWindow::Show(
434 bool bShow
435 )
436 {
437 if (!wxWindowBase::Show(bShow))
438 return(FALSE);
439
440 HWND hWnd = GetHwnd();
441
442 ::WinShowWindow(hWnd, bShow);
443
444 if (bShow)
445 {
446 ::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER);
447 }
448 return(TRUE);
449 } // end of wxWindow::Show
450
451 void wxWindow::Raise()
452 {
453 ::WinSetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE);
454 } // end of wxWindow::Raise
455
456 void wxWindow::Lower()
457 {
458 ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER | SWP_DEACTIVATE);
459 } // end of wxWindow::Lower
460
461 void wxWindow::SetTitle(
462 const wxString& rTitle
463 )
464 {
465 ::WinSetWindowText(GetHwnd(), rTitle.c_str());
466 } // end of wxWindow::SetTitle
467
468 wxString wxWindow::GetTitle() const
469 {
470 return wxGetWindowText(GetHWND());
471 } // end of wxWindow::GetTitle
472
473 void wxWindow::CaptureMouse()
474 {
475 HWND hWnd = GetHwnd();
476
477 if (hWnd && !m_bWinCaptured)
478 {
479 ::WinSetCapture(HWND_DESKTOP, hWnd);
480 m_bWinCaptured = TRUE;
481 }
482 } // end of wxWindow::GetTitle
483
484 void wxWindow::ReleaseMouse()
485 {
486 if (m_bWinCaptured)
487 {
488 ::WinSetCapture(HWND_DESKTOP, NULLHANDLE);
489 m_bWinCaptured = FALSE;
490 }
491 } // end of wxWindow::ReleaseMouse
492
493 bool wxWindow::SetFont(
494 const wxFont& rFont
495 )
496 {
497 if (!wxWindowBase::SetFont(rFont))
498 {
499 // nothing to do
500 return(FALSE);
501 }
502
503 HWND hWnd = GetHwnd();
504
505 if (hWnd != 0)
506 {
507 wxChar zFont[128];
508
509 sprintf(zFont, "%d.%s", rFont.GetPointSize(), rFont.GetFaceName().c_str());
510 return(::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont));
511 }
512 return(TRUE);
513 }
514
515 bool wxWindow::SetCursor(
516 const wxCursor& rCursor
517 ) // check if base implementation is OK
518 {
519 if ( !wxWindowBase::SetCursor(rCursor))
520 {
521 // no change
522 return FALSE;
523 }
524
525 wxASSERT_MSG( m_cursor.Ok(),
526 wxT("cursor must be valid after call to the base version"));
527
528 HWND hWnd = GetHwnd();
529 POINTL vPoint;
530 RECTL vRect;
531 HPS hPS;
532 HRGN hRGN;
533
534 hPS = ::WinGetPS(hWnd);
535
536 ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
537 ::WinQueryWindowRect(hWnd, &vRect);
538
539 hRGN = ::GpiCreateRegion(hPS, 1L, &vRect);
540
541 if ((::GpiPtInRegion(hPS, hRGN, &vPoint) == PRGN_INSIDE) && !wxIsBusy())
542 {
543 ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
544 }
545 return TRUE;
546 } // end of wxWindow::SetCursor
547
548 void wxWindow::WarpPointer(
549 int nXPos
550 , int nYPos
551 )
552 {
553 int nX = nXPos;
554 int nY = nYPos;
555 RECTL vRect;
556
557 ::WinQueryWindowRect(GetHwnd(), &vRect);
558 nX += vRect.xLeft;
559 nY += vRect.yBottom;
560
561 ::WinSetPointerPos(HWND_DESKTOP, (LONG)nX, (LONG)(nY));
562 } // end of wxWindow::WarpPointer
563
564 #if WXWIN_COMPATIBILITY
565 void wxWindow::OS2DeviceToLogical (float *x, float *y) const
566 {
567 }
568 #endif // WXWIN_COMPATIBILITY
569
570 // ---------------------------------------------------------------------------
571 // scrolling stuff
572 // ---------------------------------------------------------------------------
573
574 #if WXWIN_COMPATIBILITY
575 void wxWindow::SetScrollRange(
576 int nOrient
577 , int nRange
578 , bool bRefresh
579 )
580 {
581 ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR, (MPARAM)0, MPFROM2SHORT(0, nRange));
582 } // end of wxWindow::SetScrollRange
583
584 void wxWindow::SetScrollPage(
585 int nOrient
586 , int nPage
587 , bool bRefresh
588 )
589 {
590 if ( orient == wxHORIZONTAL )
591 m_xThumbSize = page;
592 else
593 m_yThumbSize = page;
594 }
595
596 int wxWindow::OldGetScrollRange(
597 int nOrient
598 ) const
599 {
600 MRESULT mRc;
601 HWND hWnd = GetHwnd();
602
603 if (hWnd)
604 {
605 mRc = WinSendMsg(hWnd, SBM_QUERYRANGE, (MPARAM)0L, (MPARAM)0L);
606 return(SHORT2FROMMR(mRc));
607 }
608 return 0;
609 } // end of wxWindow::OldGetScrollRange
610
611 int wxWindow::GetScrollPage(
612 int nOrient
613 ) const
614 {
615 if (nOrient == wxHORIZONTAL)
616 return m_xThumbSize;
617 else
618 return m_yThumbSize;
619 } // end of wxWindow::GetScrollPage
620 #endif // WXWIN_COMPATIBILITY
621
622 int wxWindow::GetScrollPos(int orient) const
623 {
624 // TODO:
625 return(1);
626 }
627
628 int wxWindow::GetScrollRange(int orient) const
629 {
630 // TODO:
631 return(1);
632 }
633
634 int wxWindow::GetScrollThumb(int orient) const
635 {
636 // TODO:
637 return(1);
638 }
639
640 void wxWindow::SetScrollPos( int orient
641 ,int pos
642 ,bool refresh
643 )
644 {
645 // TODO:
646 }
647
648 void wxWindow::SetScrollbar( int orient
649 ,int pos
650 ,int thumbVisible
651 ,int range
652 ,bool refresh
653 )
654 {
655 // TODO:
656 }
657
658 void wxWindow::ScrollWindow( int dx
659 ,int dy
660 ,const wxRect* rect
661 )
662 {
663 // TODO:
664 }
665
666 // ---------------------------------------------------------------------------
667 // subclassing
668 // ---------------------------------------------------------------------------
669
670 void wxWindow::SubclassWin(WXHWND hWnd)
671 {
672 wxASSERT_MSG( !m_fnOldWndProc, wxT("subclassing window twice?") );
673
674 HWND hwnd = (HWND)hWnd;
675 /*
676 * TODO: implement something like this:
677 * wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in SubclassWin") );
678 *
679 * wxAssociateWinWithHandle(hwnd, this);
680 *
681 * m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
682 * SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
683 */
684 }
685
686 void wxWindow::UnsubclassWin()
687 {
688 /*
689 * TODO:
690
691 wxRemoveHandleAssociation(this);
692
693 // Restore old Window proc
694 HWND hwnd = GetHwnd();
695 if ( hwnd )
696 {
697 m_hWnd = 0;
698
699 wxCHECK_RET( ::IsWindow(hwnd), wxT("invalid HWND in UnsubclassWin") );
700
701 FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
702 if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) )
703 {
704 SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
705 m_oldWndProc = 0;
706 }
707 }
708 */
709 }
710
711 // Make a Windows extended style from the given wxWindows window style
712 WXDWORD wxWindow::MakeExtendedStyle(long style, bool eliminateBorders)
713 {
714 // TODO:
715 WXDWORD exStyle = 0;
716 /*
717 if ( style & wxTRANSPARENT_WINDOW )
718 exStyle |= WS_EX_TRANSPARENT;
719
720 if ( !eliminateBorders )
721 {
722 if ( style & wxSUNKEN_BORDER )
723 exStyle |= WS_EX_CLIENTEDGE;
724 if ( style & wxDOUBLE_BORDER )
725 exStyle |= WS_EX_DLGMODALFRAME;
726 if ( style & wxRAISED_BORDER )
727 exStyle |= WS_EX_WINDOWEDGE;
728 if ( style & wxSTATIC_BORDER )
729 exStyle |= WS_EX_STATICEDGE;
730 }
731 */
732 return exStyle;
733 }
734
735 // Determines whether native 3D effects or CTL3D should be used,
736 // applying a default border style if required, and returning an extended
737 // style to pass to CreateWindowEx.
738 WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle,
739 bool *want3D) const
740 {
741 DWORD exStyle = 0L; // remove after implementation doe
742 /* TODO: this ought to be fun
743 *
744 // If matches certain criteria, then assume no 3D effects
745 // unless specifically requested (dealt with in MakeExtendedStyle)
746 if ( !GetParent() || !IsKindOf(CLASSINFO(wxControl)) || (m_windowStyle & wxNO_BORDER) )
747 {
748 *want3D = FALSE;
749 return MakeExtendedStyle(m_windowStyle, FALSE);
750 }
751
752 // Determine whether we should be using 3D effects or not.
753 bool nativeBorder = FALSE; // by default, we don't want a Win95 effect
754
755 // 1) App can specify global 3D effects
756 *want3D = wxTheApp->GetAuto3D();
757
758 // 2) If the parent is being drawn with user colours, or simple border specified,
759 // switch effects off. TODO: replace wxUSER_COLOURS with wxNO_3D
760 if ( GetParent() && (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) || (m_windowStyle & wxSIMPLE_BORDER) )
761 *want3D = FALSE;
762
763 // 3) Control can override this global setting by defining
764 // a border style, e.g. wxSUNKEN_BORDER
765 if ( m_windowStyle & wxSUNKEN_BORDER )
766 *want3D = TRUE;
767
768 // 4) If it's a special border, CTL3D can't cope so we want a native border
769 if ( (m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
770 (m_windowStyle & wxSTATIC_BORDER) )
771 {
772 *want3D = TRUE;
773 nativeBorder = TRUE;
774 }
775
776 // 5) If this isn't a Win95 app, and we are using CTL3D, remove border
777 // effects from extended style
778 #if wxUSE_CTL3D
779 if ( *want3D )
780 nativeBorder = FALSE;
781 #endif
782
783 DWORD exStyle = MakeExtendedStyle(m_windowStyle, !nativeBorder);
784
785 // If we want 3D, but haven't specified a border here,
786 // apply the default border style specified.
787 // TODO what about non-Win95 WIN32? Does it have borders?
788 #if defined(__WIN95__) && !wxUSE_CTL3D
789 if ( defaultBorderStyle && (*want3D) && ! ((m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
790 (m_windowStyle & wxSTATIC_BORDER) || (m_windowStyle & wxSIMPLE_BORDER) ))
791 exStyle |= defaultBorderStyle; // WS_EX_CLIENTEDGE;
792 #endif
793 */
794 return exStyle;
795 }
796
797 #if WXWIN_COMPATIBILITY
798 void wxWindow::OnCommand(wxWindow& win, wxCommandEvent& event)
799 {
800 // TODO:
801 }
802
803 wxObject* wxWindow::GetChild(int number) const
804 {
805 // TODO:
806 return((wxObject*)this);
807 }
808
809 void wxWindow::OnDefaultAction(wxControl *initiatingItem)
810 {
811 // TODO:
812 }
813
814 #endif // WXWIN_COMPATIBILITY
815
816 // Setup background and foreground colours correctly
817 void wxWindow::SetupColours()
818 {
819 if ( GetParent() )
820 SetBackgroundColour(GetParent()->GetBackgroundColour());
821 }
822
823 void wxWindow::OnIdle(wxIdleEvent& event)
824 {
825 // TODO:
826 }
827
828 // Set this window to be the child of 'parent'.
829 bool wxWindow::Reparent(wxWindow *parent)
830 {
831 if ( !wxWindowBase::Reparent(parent) )
832 return FALSE;
833 // TODO:
834 return FALSE;
835 }
836
837 void wxWindow::Clear()
838 {
839 // TODO:
840 }
841
842 void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
843 {
844 // TODO:
845 }
846
847 // ---------------------------------------------------------------------------
848 // drag and drop
849 // ---------------------------------------------------------------------------
850
851 #if wxUSE_DRAG_AND_DROP
852 void wxWindow::SetDropTarget(wxDropTarget *pDropTarget)
853 {
854 // TODO:
855 }
856 #endif
857
858 // old style file-manager drag&drop support: we retain the old-style
859 // DragAcceptFiles in parallel with SetDropTarget.
860 void wxWindow::DragAcceptFiles(bool accept)
861 {
862 // TODO:
863 }
864
865 // ----------------------------------------------------------------------------
866 // tooltips
867 // ----------------------------------------------------------------------------
868
869 #if wxUSE_TOOLTIPS
870
871 void wxWindow::DoSetToolTip(wxToolTip *tooltip)
872 {
873 wxWindowBase::DoSetToolTip(tooltip);
874
875 if ( m_tooltip )
876 m_tooltip->SetWindow(this);
877 }
878
879 #endif // wxUSE_TOOLTIPS
880
881 // ---------------------------------------------------------------------------
882 // moving and resizing
883 // ---------------------------------------------------------------------------
884
885 // Get total size
886 void wxWindow::DoGetSize( int *width, int *height ) const
887 {
888 // TODO:
889 }
890
891 void wxWindow::DoGetPosition( int *x, int *y ) const
892 {
893 // TODO:
894 }
895
896 void wxWindow::DoScreenToClient( int *x, int *y ) const
897 {
898 // TODO:
899 }
900
901 void wxWindow::DoClientToScreen( int *x, int *y ) const
902 {
903 // TODO:
904 }
905
906 // Get size *available for subwindows* i.e. excluding menu bar etc.
907 void wxWindow::DoGetClientSize( int *width, int *height ) const
908 {
909 // TODO:
910 }
911
912 void wxWindow::DoMoveWindow(int x, int y, int width, int height)
913 {
914 // TODO:
915 }
916
917 // set the size of the window: if the dimensions are positive, just use them,
918 // but if any of them is equal to -1, it means that we must find the value for
919 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
920 // which case -1 is a valid value for x and y)
921 //
922 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
923 // the width/height to best suit our contents, otherwise we reuse the current
924 // width/height
925 void wxWindow::DoSetSize(int x, int y,
926 int width, int height,
927 int sizeFlags)
928 {
929 // TODO:
930 }
931
932 void wxWindow::DoSetClientSize(int width, int height)
933 {
934 // TODO:
935 }
936
937 wxPoint wxWindow::GetClientAreaOrigin() const
938 {
939 return wxPoint(0, 0);
940 }
941
942 void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
943 {
944 // TODO:
945 }
946
947 // ---------------------------------------------------------------------------
948 // text metrics
949 // ---------------------------------------------------------------------------
950
951 int wxWindow::GetCharHeight() const
952 {
953 // TODO:
954 return(1);
955 }
956
957 int wxWindow::GetCharWidth() const
958 {
959 // TODO:
960 return(1);
961 }
962
963 void wxWindow::GetTextExtent( const wxString& string
964 ,int* x
965 ,int* y
966 ,int* descent
967 ,int* externalLeading
968 ,const wxFont* theFont
969 ) const
970 {
971 // TODO:
972 }
973
974 #if wxUSE_CARET && WXWIN_COMPATIBILITY
975 // ---------------------------------------------------------------------------
976 // Caret manipulation
977 // ---------------------------------------------------------------------------
978
979 void wxWindow::CreateCaret(int w, int h)
980 {
981 // TODO:
982 }
983
984 void wxWindow::CreateCaret(const wxBitmap *bitmap)
985 {
986 // TODO:
987 }
988
989 void wxWindow::ShowCaret(bool show)
990 {
991 // TODO:
992 }
993
994 void wxWindow::DestroyCaret()
995 {
996 // TODO:
997 }
998
999 void wxWindow::SetCaretPos(int x, int y)
1000 {
1001 // TODO:
1002 }
1003
1004 void wxWindow::GetCaretPos(int *x, int *y) const
1005 {
1006 // TODO:
1007 }
1008
1009 #endif //wxUSE_CARET
1010
1011 // ---------------------------------------------------------------------------
1012 // popup menu
1013 // ---------------------------------------------------------------------------
1014
1015 bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
1016 {
1017 // TODO:
1018 return(TRUE);
1019 }
1020
1021 // ===========================================================================
1022 // pre/post message processing
1023 // ===========================================================================
1024
1025 MRESULT wxWindow::OS2DefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
1026 {
1027 // TODO:
1028 return (MRESULT)0;
1029 }
1030
1031 bool wxWindow::OS2ProcessMessage(WXMSG* pMsg)
1032 {
1033 // TODO:
1034 return FALSE;
1035 }
1036
1037 bool wxWindow::OS2TranslateMessage(WXMSG* pMsg)
1038 {
1039 return m_acceleratorTable.Translate(this, pMsg);
1040 }
1041
1042 // ---------------------------------------------------------------------------
1043 // message params unpackers (different for Win16 and Win32)
1044 // ---------------------------------------------------------------------------
1045
1046 void wxWindow::UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
1047 WORD *id, WXHWND *hwnd, WORD *cmd)
1048 {
1049 *id = LOWORD(wParam);
1050 *hwnd = (WXHWND)lParam;
1051 *cmd = HIWORD(wParam);
1052 }
1053
1054 void wxWindow::UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
1055 WXWORD *state, WXWORD *minimized, WXHWND *hwnd)
1056 {
1057 *state = LOWORD(wParam);
1058 *minimized = HIWORD(wParam);
1059 *hwnd = (WXHWND)lParam;
1060 }
1061
1062 void wxWindow::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
1063 WXWORD *code, WXWORD *pos, WXHWND *hwnd)
1064 {
1065 *code = LOWORD(wParam);
1066 *pos = HIWORD(wParam);
1067 *hwnd = (WXHWND)lParam;
1068 }
1069
1070 void wxWindow::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
1071 WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd)
1072 {
1073 *nCtlColor = 0; // TODO: CTLCOLOR_BTN;
1074 *hwnd = (WXHWND)lParam;
1075 *hdc = (WXHDC)wParam;
1076 }
1077
1078 void wxWindow::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
1079 WXWORD *item, WXWORD *flags, WXHMENU *hmenu)
1080 {
1081 *item = (WXWORD)LOWORD(wParam);
1082 *flags = HIWORD(wParam);
1083 *hmenu = (WXHMENU)lParam;
1084 }
1085
1086 // ---------------------------------------------------------------------------
1087 // Main wxWindows window proc and the window proc for wxWindow
1088 // ---------------------------------------------------------------------------
1089
1090 // Hook for new window just as it's being created, when the window isn't yet
1091 // associated with the handle
1092 wxWindow *wxWndHook = NULL;
1093
1094 // Main window proc
1095 MRESULT wxWndProc(HWND hWnd, ULONG message, MPARAM wParam, MPARAM lParam)
1096 {
1097 // trace all messages - useful for the debugging
1098 #ifdef __WXDEBUG__
1099 wxLogTrace(wxTraceMessages, wxT("Processing %s(wParam=%8lx, lParam=%8lx)"),
1100 wxGetMessageName(message), wParam, lParam);
1101 #endif // __WXDEBUG__
1102
1103 wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd);
1104
1105 // when we get the first message for the HWND we just created, we associate
1106 // it with wxWindow stored in wxWndHook
1107 if ( !wnd && wxWndHook )
1108 {
1109 #if 0 // def __WXDEBUG__
1110 char buf[512];
1111 ::GetClassNameA((HWND) hWnd, buf, 512);
1112 wxString className(buf);
1113 #endif
1114
1115 wxAssociateWinWithHandle(hWnd, wxWndHook);
1116 wnd = wxWndHook;
1117 wxWndHook = NULL;
1118 wnd->SetHWND((WXHWND)hWnd);
1119 }
1120
1121 MRESULT rc;
1122
1123 // Stop right here if we don't have a valid handle in our wxWindow object.
1124 if ( wnd && !wnd->GetHWND() )
1125 {
1126 // FIXME: why do we do this?
1127 wnd->SetHWND((WXHWND) hWnd);
1128 rc = wnd->OS2DefWindowProc(message, wParam, lParam );
1129 wnd->SetHWND(0);
1130 }
1131 else
1132 {
1133 if ( wnd )
1134 rc = wnd->OS2WindowProc(message, wParam, lParam);
1135 else
1136 rc = 0; //TODO: DefWindowProc( hWnd, message, wParam, lParam );
1137 }
1138
1139 return rc;
1140 }
1141
1142 MRESULT wxWindow::OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
1143 {
1144 // did we process the message?
1145 bool processed = FALSE;
1146
1147 // the return value
1148 union
1149 {
1150 bool allow;
1151 long result;
1152 WXHICON hIcon;
1153 WXHBRUSH hBrush;
1154 } rc;
1155
1156 // for most messages we should return 0 when we do process the message
1157 rc.result = 0;
1158 // TODO:
1159 /*
1160 switch ( message )
1161 {
1162 case WM_CREATE:
1163 {
1164 bool mayCreate;
1165 processed = HandleCreate((WXLPCREATESTRUCT)lParam, &mayCreate);
1166 if ( processed )
1167 {
1168 // return 0 to allow window creation
1169 rc.result = mayCreate ? 0 : -1;
1170 }
1171 }
1172 break;
1173
1174 case WM_DESTROY:
1175 processed = HandleDestroy();
1176 break;
1177
1178 case WM_MOVE:
1179 processed = HandleMove(LOWORD(lParam), HIWORD(lParam));
1180 break;
1181
1182 case WM_SIZE:
1183 processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
1184 break;
1185
1186 case WM_ACTIVATE:
1187 {
1188 WXWORD state, minimized;
1189 WXHWND hwnd;
1190 UnpackActivate(wParam, lParam, &state, &minimized, &hwnd);
1191
1192 processed = HandleActivate(state, minimized != 0, (WXHWND)hwnd);
1193 }
1194 break;
1195
1196 case WM_SETFOCUS:
1197 processed = HandleSetFocus((WXHWND)(HWND)wParam);
1198 break;
1199
1200 case WM_KILLFOCUS:
1201 processed = HandleKillFocus((WXHWND)(HWND)wParam);
1202 break;
1203
1204 case WM_PAINT:
1205 processed = HandlePaint();
1206 break;
1207
1208 case WM_CLOSE:
1209 // don't let the DefWindowProc() destroy our window - we'll do it
1210 // ourselves in ~wxWindow
1211 processed = TRUE;
1212 rc.result = TRUE;
1213 break;
1214
1215 case WM_SHOWWINDOW:
1216 processed = HandleShow(wParam != 0, (int)lParam);
1217 break;
1218
1219 case WM_MOUSEMOVE:
1220 case WM_LBUTTONDOWN:
1221 case WM_LBUTTONUP:
1222 case WM_LBUTTONDBLCLK:
1223 case WM_RBUTTONDOWN:
1224 case WM_RBUTTONUP:
1225 case WM_RBUTTONDBLCLK:
1226 case WM_MBUTTONDOWN:
1227 case WM_MBUTTONUP:
1228 case WM_MBUTTONDBLCLK:
1229 {
1230 short x = LOWORD(lParam);
1231 short y = HIWORD(lParam);
1232
1233 processed = HandleMouseEvent(message, x, y, wParam);
1234 }
1235 break;
1236
1237 case MM_JOY1MOVE:
1238 case MM_JOY2MOVE:
1239 case MM_JOY1ZMOVE:
1240 case MM_JOY2ZMOVE:
1241 case MM_JOY1BUTTONDOWN:
1242 case MM_JOY2BUTTONDOWN:
1243 case MM_JOY1BUTTONUP:
1244 case MM_JOY2BUTTONUP:
1245 {
1246 int x = LOWORD(lParam);
1247 int y = HIWORD(lParam);
1248
1249 processed = HandleJoystickEvent(message, x, y, wParam);
1250 }
1251 break;
1252
1253 case WM_SYSCOMMAND:
1254 processed = HandleSysCommand(wParam, lParam);
1255 break;
1256
1257 case WM_COMMAND:
1258 {
1259 WORD id, cmd;
1260 WXHWND hwnd;
1261 UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);
1262
1263 processed = HandleCommand(id, cmd, hwnd);
1264 }
1265 break;
1266
1267 #ifdef __WIN95__
1268 case WM_NOTIFY:
1269 processed = HandleNotify((int)wParam, lParam, &rc.result);
1270 break;
1271 #endif // Win95
1272
1273 // for these messages we must return TRUE if process the message
1274 case WM_DRAWITEM:
1275 case WM_MEASUREITEM:
1276 {
1277 int idCtrl = (UINT)wParam;
1278 if ( message == WM_DRAWITEM )
1279 {
1280 processed = MSWOnDrawItem(idCtrl,
1281 (WXDRAWITEMSTRUCT *)lParam);
1282 }
1283 else
1284 {
1285 processed = MSWOnMeasureItem(idCtrl,
1286 (WXMEASUREITEMSTRUCT *)lParam);
1287 }
1288
1289 if ( processed )
1290 rc.result = TRUE;
1291 }
1292 break;
1293
1294 case WM_GETDLGCODE:
1295 if ( m_lDlgCode )
1296 {
1297 rc.result = m_lDlgCode;
1298 processed = TRUE;
1299 }
1300 //else: get the dlg code from the DefWindowProc()
1301 break;
1302
1303 case WM_KEYDOWN:
1304 // If this has been processed by an event handler,
1305 // return 0 now (we've handled it).
1306 if ( HandleKeyDown((WORD) wParam, lParam) )
1307 {
1308 processed = TRUE;
1309
1310 break;
1311 }
1312
1313 // we consider these message "not interesting" to OnChar
1314 if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
1315 {
1316 processed = TRUE;
1317
1318 break;
1319 }
1320
1321 switch ( wParam )
1322 {
1323 // avoid duplicate messages to OnChar for these ASCII keys: they
1324 // will be translated by TranslateMessage() and received in WM_CHAR
1325 case VK_ESCAPE:
1326 case VK_SPACE:
1327 case VK_RETURN:
1328 case VK_BACK:
1329 case VK_TAB:
1330 // but set processed to FALSE, not TRUE to still pass them to
1331 // the control's default window proc - otherwise built-in
1332 // keyboard handling won't work
1333 processed = FALSE;
1334
1335 break;
1336
1337 #ifdef VK_APPS
1338 // special case of VK_APPS: treat it the same as right mouse
1339 // click because both usually pop up a context menu
1340 case VK_APPS:
1341 {
1342 // construct the key mask
1343 WPARAM fwKeys = MK_RBUTTON;
1344 if ( (::GetKeyState(VK_CONTROL) & 0x100) != 0 )
1345 fwKeys |= MK_CONTROL;
1346 if ( (::GetKeyState(VK_SHIFT) & 0x100) != 0 )
1347 fwKeys |= MK_SHIFT;
1348
1349 // simulate right mouse button click
1350 DWORD dwPos = ::GetMessagePos();
1351 int x = GET_X_LPARAM(dwPos),
1352 y = GET_Y_LPARAM(dwPos);
1353
1354 ScreenToClient(&x, &y);
1355 processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, fwKeys);
1356 }
1357 break;
1358 #endif // VK_APPS
1359
1360 case VK_LEFT:
1361 case VK_RIGHT:
1362 case VK_DOWN:
1363 case VK_UP:
1364 default:
1365 processed = HandleChar((WORD)wParam, lParam);
1366 }
1367 break;
1368
1369 case WM_KEYUP:
1370 processed = HandleKeyUp((WORD) wParam, lParam);
1371 break;
1372
1373 case WM_CHAR: // Always an ASCII character
1374 processed = HandleChar((WORD)wParam, lParam, TRUE);
1375 break;
1376
1377 case WM_HSCROLL:
1378 case WM_VSCROLL:
1379 {
1380 WXWORD code, pos;
1381 WXHWND hwnd;
1382 UnpackScroll(wParam, lParam, &code, &pos, &hwnd);
1383
1384 processed = MSWOnScroll(message == WM_HSCROLL ? wxHORIZONTAL
1385 : wxVERTICAL,
1386 code, pos, hwnd);
1387 }
1388 break;
1389
1390 // CTLCOLOR messages are sent by children to query the parent for their
1391 // colors
1392 #ifdef __WIN32__
1393 case WM_CTLCOLORMSGBOX:
1394 case WM_CTLCOLOREDIT:
1395 case WM_CTLCOLORLISTBOX:
1396 case WM_CTLCOLORBTN:
1397 case WM_CTLCOLORDLG:
1398 case WM_CTLCOLORSCROLLBAR:
1399 case WM_CTLCOLORSTATIC:
1400 #else // Win16
1401 case WM_CTLCOLOR:
1402 #endif // Win32/16
1403 {
1404 WXWORD nCtlColor;
1405 WXHDC hdc;
1406 WXHWND hwnd;
1407 UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd);
1408
1409 processed = HandleCtlColor(&rc.hBrush,
1410 (WXHDC)hdc,
1411 (WXHWND)hwnd,
1412 nCtlColor,
1413 message,
1414 wParam,
1415 lParam);
1416 }
1417 break;
1418
1419 // the return value for this message is ignored
1420 case WM_SYSCOLORCHANGE:
1421 processed = HandleSysColorChange();
1422 break;
1423
1424 case WM_PALETTECHANGED:
1425 processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
1426 break;
1427
1428 case WM_QUERYNEWPALETTE:
1429 processed = HandleQueryNewPalette();
1430 break;
1431
1432 case WM_ERASEBKGND:
1433 processed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
1434 if ( processed )
1435 {
1436 // we processed the message, i.e. erased the background
1437 rc.result = TRUE;
1438 }
1439 break;
1440
1441 case WM_DROPFILES:
1442 processed = HandleDropFiles(wParam);
1443 break;
1444
1445 case WM_INITDIALOG:
1446 processed = HandleInitDialog((WXHWND)(HWND)wParam);
1447
1448 if ( processed )
1449 {
1450 // we never set focus from here
1451 rc.result = FALSE;
1452 }
1453 break;
1454
1455 case WM_QUERYENDSESSION:
1456 processed = HandleQueryEndSession(lParam, &rc.allow);
1457 break;
1458
1459 case WM_ENDSESSION:
1460 processed = HandleEndSession(wParam != 0, lParam);
1461 break;
1462
1463 case WM_GETMINMAXINFO:
1464 processed = HandleGetMinMaxInfo((MINMAXINFO*)lParam);
1465 break;
1466
1467 case WM_SETCURSOR:
1468 processed = HandleSetCursor((WXHWND)(HWND)wParam,
1469 LOWORD(lParam), // hit test
1470 HIWORD(lParam)); // mouse msg
1471
1472 if ( processed )
1473 {
1474 // returning TRUE stops the DefWindowProc() from further
1475 // processing this message - exactly what we need because we've
1476 // just set the cursor.
1477 rc.result = TRUE;
1478 }
1479 break;
1480 }
1481
1482 if ( !processed )
1483 {
1484 #ifdef __WXDEBUG__
1485 wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."),
1486 wxGetMessageName(message));
1487 #endif // __WXDEBUG__
1488 rc.result = MSWDefWindowProc(message, wParam, lParam);
1489 }
1490 */
1491 return (MRESULT)0;
1492 }
1493
1494 // Dialog window proc
1495 MRESULT wxDlgProc(HWND hWnd, UINT message, MPARAM wParam, MPARAM lParam)
1496 {
1497 // TODO:
1498 /*
1499 if ( message == WM_INITDIALOG )
1500 {
1501 // for this message, returning TRUE tells system to set focus to the
1502 // first control in the dialog box
1503 return TRUE;
1504 }
1505 else
1506 {
1507 // for all the other ones, FALSE means that we didn't process the
1508 // message
1509 return 0;
1510 }
1511 */
1512 return (MRESULT)0;
1513 }
1514
1515 wxWindow *wxFindWinFromHandle(WXHWND hWnd)
1516 {
1517 wxNode *node = wxWinHandleList->Find((long)hWnd);
1518 if ( !node )
1519 return NULL;
1520 return (wxWindow *)node->Data();
1521 }
1522
1523 void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
1524 {
1525 // adding NULL hWnd is (first) surely a result of an error and
1526 // (secondly) breaks menu command processing
1527 wxCHECK_RET( hWnd != (HWND)NULL,
1528 wxT("attempt to add a NULL hWnd to window list ignored") );
1529
1530
1531 wxWindow *oldWin = wxFindWinFromHandle((WXHWND) hWnd);
1532 if ( oldWin && (oldWin != win) )
1533 {
1534 wxString str(win->GetClassInfo()->GetClassName());
1535 wxLogError("Bug! Found existing HWND %X for new window of class %s", (int) hWnd, (const char*) str);
1536 }
1537 else if (!oldWin)
1538 {
1539 wxWinHandleList->Append((long)hWnd, win);
1540 }
1541 }
1542
1543 void wxRemoveHandleAssociation(wxWindow *win)
1544 {
1545 wxWinHandleList->DeleteObject(win);
1546 }
1547
1548 // Default destroyer - override if you destroy it in some other way
1549 // (e.g. with MDI child windows)
1550 void wxWindow::OS2DestroyWindow()
1551 {
1552 }
1553
1554 void wxWindow::OS2DetachWindowMenu()
1555 {
1556 if ( m_hMenu )
1557 {
1558 HMENU hMenu = (HMENU)m_hMenu;
1559
1560 int N = (int)WinSendMsg(hMenu, MM_QUERYITEMCOUNT, 0, 0);
1561 int i;
1562 for (i = 0; i < N; i++)
1563 {
1564 wxChar buf[100];
1565 int chars = (int)WinSendMsg(hMenu, MM_QUERYITEMTEXT, MPFROM2SHORT(i, N), buf);
1566 if ( !chars )
1567 {
1568 wxLogLastError(wxT("GetMenuString"));
1569
1570 continue;
1571 }
1572
1573 if ( wxStrcmp(buf, wxT("&Window")) == 0 )
1574 {
1575 WinSendMsg(hMenu, MM_DELETEITEM, MPFROM2SHORT(i, TRUE), 0);
1576 break;
1577 }
1578 }
1579 }
1580 }
1581
1582 bool wxWindow::OS2Create(int id,
1583 wxWindow *parent,
1584 const wxChar *wclass,
1585 wxWindow *wx_win,
1586 const wxChar *title,
1587 int x,
1588 int y,
1589 int width,
1590 int height,
1591 WXDWORD style,
1592 const wxChar *dialog_template,
1593 WXDWORD extendedStyle)
1594 {
1595 // TODO:
1596 /*
1597 int x1 = CW_USEDEFAULT;
1598 int y1 = 0;
1599 int width1 = CW_USEDEFAULT;
1600 int height1 = 100;
1601
1602 // Find parent's size, if it exists, to set up a possible default
1603 // panel size the size of the parent window
1604 RECT parent_rect;
1605 if ( parent )
1606 {
1607 ::GetClientRect((HWND) parent->GetHWND(), &parent_rect);
1608
1609 width1 = parent_rect.right - parent_rect.left;
1610 height1 = parent_rect.bottom - parent_rect.top;
1611 }
1612
1613 if ( x > -1 ) x1 = x;
1614 if ( y > -1 ) y1 = y;
1615 if ( width > -1 ) width1 = width;
1616 if ( height > -1 ) height1 = height;
1617
1618 HWND hParent = (HWND)NULL;
1619 if ( parent )
1620 hParent = (HWND) parent->GetHWND();
1621
1622 wxWndHook = this;
1623
1624 if ( dialog_template )
1625 {
1626 m_hWnd = (WXHWND)::CreateDialog(wxGetInstance(),
1627 dialog_template,
1628 hParent,
1629 (DLGPROC)wxDlgProc);
1630
1631 if ( m_hWnd == 0 )
1632 {
1633 wxLogError(_("Can't find dummy dialog template!\n"
1634 "Check resource include path for finding wx.rc."));
1635
1636 return FALSE;
1637 }
1638
1639 // ::SetWindowLong(GWL_EXSTYLE) doesn't work for the dialogs, so try
1640 // to take care of (at least some) extended style flags ourselves
1641 if ( extendedStyle & WS_EX_TOPMOST )
1642 {
1643 if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
1644 SWP_NOSIZE | SWP_NOMOVE) )
1645 {
1646 wxLogLastError(wxT("SetWindowPos"));
1647 }
1648 }
1649
1650 // move the dialog to its initial position without forcing repainting
1651 if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) )
1652 {
1653 wxLogLastError(wxT("MoveWindow"));
1654 }
1655 }
1656 else
1657 {
1658 int controlId = 0;
1659 if ( style & WS_CHILD )
1660 controlId = id;
1661
1662 wxString className(wclass);
1663 if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
1664 {
1665 className += wxT("NR");
1666 }
1667
1668 m_hWnd = (WXHWND)CreateWindowEx(extendedStyle,
1669 className,
1670 title ? title : wxT(""),
1671 style,
1672 x1, y1,
1673 width1, height1,
1674 hParent, (HMENU)controlId,
1675 wxGetInstance(),
1676 NULL);
1677
1678 if ( !m_hWnd )
1679 {
1680 wxLogError(_("Can't create window of class %s!\n"
1681 "Possible Windows 3.x compatibility problem?"),
1682 wclass);
1683
1684 return FALSE;
1685 }
1686 }
1687
1688 wxWndHook = NULL;
1689 #ifdef __WXDEBUG__
1690 wxNode* node = wxWinHandleList->Member(this);
1691 if (node)
1692 {
1693 HWND hWnd = (HWND) node->GetKeyInteger();
1694 if (hWnd != (HWND) m_hWnd)
1695 {
1696 wxLogError("A second HWND association is being added for the same window!");
1697 }
1698 }
1699 #endif
1700 */
1701 wxAssociateWinWithHandle((HWND) m_hWnd, this);
1702
1703 return TRUE;
1704 }
1705
1706 // ===========================================================================
1707 // OS2 PM message handlers
1708 // ===========================================================================
1709
1710 // ---------------------------------------------------------------------------
1711 // WM_NOTIFY
1712 // ---------------------------------------------------------------------------
1713
1714 bool wxWindow::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
1715 {
1716 // TODO:
1717 return FALSE;
1718 }
1719
1720 bool wxWindow::OS2OnNotify(int WXUNUSED(idCtrl),
1721 WXLPARAM lParam,
1722 WXLPARAM* WXUNUSED(result))
1723 {
1724 // TODO:
1725 return FALSE;
1726 }
1727
1728 // ---------------------------------------------------------------------------
1729 // end session messages
1730 // ---------------------------------------------------------------------------
1731
1732 bool wxWindow::HandleQueryEndSession(long logOff, bool *mayEnd)
1733 {
1734 wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1);
1735 event.SetEventObject(wxTheApp);
1736 event.SetCanVeto(TRUE);
1737 event.SetLoggingOff(logOff == ENDSESSION_LOGOFF);
1738
1739 bool rc = wxTheApp->ProcessEvent(event);
1740
1741 if ( rc )
1742 {
1743 // we may end only if the app didn't veto session closing (double
1744 // negation...)
1745 *mayEnd = !event.GetVeto();
1746 }
1747
1748 return rc;
1749 }
1750
1751 bool wxWindow::HandleEndSession(bool endSession, long logOff)
1752 {
1753 // do nothing if the session isn't ending
1754 if ( !endSession )
1755 return FALSE;
1756
1757 wxCloseEvent event(wxEVT_END_SESSION, -1);
1758 event.SetEventObject(wxTheApp);
1759 event.SetCanVeto(FALSE);
1760 event.SetLoggingOff( (logOff == ENDSESSION_LOGOFF) );
1761 if ( (this == wxTheApp->GetTopWindow()) && // Only send once
1762 wxTheApp->ProcessEvent(event))
1763 {
1764 }
1765 return TRUE;
1766 }
1767
1768 // ---------------------------------------------------------------------------
1769 // window creation/destruction
1770 // ---------------------------------------------------------------------------
1771
1772 bool wxWindow::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate)
1773 {
1774 // TODO: should generate this event from WM_NCCREATE
1775 wxWindowCreateEvent event(this);
1776 (void)GetEventHandler()->ProcessEvent(event);
1777
1778 *mayCreate = TRUE;
1779
1780 return TRUE;
1781 }
1782
1783 bool wxWindow::HandleDestroy()
1784 {
1785 wxWindowDestroyEvent event(this);
1786 (void)GetEventHandler()->ProcessEvent(event);
1787
1788 // delete our drop target if we've got one
1789 #if wxUSE_DRAG_AND_DROP
1790 if ( m_dropTarget != NULL )
1791 {
1792 // m_dropTarget->Revoke(m_hWnd);
1793
1794 delete m_dropTarget;
1795 m_dropTarget = NULL;
1796 }
1797 #endif // wxUSE_DRAG_AND_DROP
1798
1799 // WM_DESTROY handled
1800 return TRUE;
1801 }
1802
1803 // ---------------------------------------------------------------------------
1804 // activation/focus
1805 // ---------------------------------------------------------------------------
1806
1807 bool wxWindow::HandleActivate(int state,
1808 bool WXUNUSED(minimized),
1809 WXHWND WXUNUSED(activate))
1810 {
1811 // TODO:
1812 /*
1813 wxActivateEvent event(wxEVT_ACTIVATE,
1814 (state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
1815 m_windowId);
1816 event.SetEventObject(this);
1817
1818 return GetEventHandler()->ProcessEvent(event);
1819 */
1820 return FALSE;
1821 }
1822
1823 bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd))
1824 {
1825 #if wxUSE_CARET
1826 // Deal with caret
1827 if ( m_caret )
1828 {
1829 m_caret->OnSetFocus();
1830 }
1831 #endif // wxUSE_CARET
1832
1833 // panel wants to track the window which was the last to have focus in it
1834 wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
1835 if ( panel )
1836 {
1837 panel->SetLastFocus(this);
1838 }
1839
1840 wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
1841 event.SetEventObject(this);
1842
1843 return GetEventHandler()->ProcessEvent(event);
1844 }
1845
1846 bool wxWindow::HandleKillFocus(WXHWND WXUNUSED(hwnd))
1847 {
1848 #if wxUSE_CARET
1849 // Deal with caret
1850 if ( m_caret )
1851 {
1852 m_caret->OnKillFocus();
1853 }
1854 #endif // wxUSE_CARET
1855
1856 wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId);
1857 event.SetEventObject(this);
1858
1859 return GetEventHandler()->ProcessEvent(event);
1860 }
1861
1862 // ---------------------------------------------------------------------------
1863 // miscellaneous
1864 // ---------------------------------------------------------------------------
1865
1866 bool wxWindow::HandleShow(bool show, int status)
1867 {
1868 wxShowEvent event(GetId(), show);
1869 event.m_eventObject = this;
1870
1871 return GetEventHandler()->ProcessEvent(event);
1872 }
1873
1874 bool wxWindow::HandleInitDialog(WXHWND WXUNUSED(hWndFocus))
1875 {
1876 wxInitDialogEvent event(GetId());
1877 event.m_eventObject = this;
1878
1879 return GetEventHandler()->ProcessEvent(event);
1880 }
1881
1882 bool wxWindow::HandleDropFiles(WXWPARAM wParam)
1883 {
1884 // TODO:
1885 return FALSE;
1886 }
1887
1888 bool wxWindow::HandleSetCursor(WXHWND hWnd,
1889 short nHitTest,
1890 int WXUNUSED(mouseMsg))
1891 {
1892 // don't set cursor for other windows, only for this one: this prevents
1893 // children of this window from getting the same cursor as the parent has
1894 // (don't forget that this message is propagated by default up the window
1895 // parent-child hierarchy)
1896 if ( GetHWND() == hWnd )
1897 {
1898 // don't set cursor when the mouse is not in the client part
1899 // TODO
1900 /*
1901 if ( nHitTest == HTCLIENT || nHitTest == HTERROR )
1902 {
1903 HCURSOR hcursor = 0;
1904 if ( wxIsBusy() )
1905 {
1906 // from msw\utils.cpp
1907 extern HCURSOR gs_wxBusyCursor;
1908
1909 hcursor = gs_wxBusyCursor;
1910 }
1911 else
1912 {
1913 wxCursor *cursor = NULL;
1914
1915 if ( m_cursor.Ok() )
1916 {
1917 cursor = &m_cursor;
1918 }
1919 else
1920 {
1921 // from msw\data.cpp
1922 extern wxCursor *g_globalCursor;
1923
1924 if ( g_globalCursor && g_globalCursor->Ok() )
1925 cursor = g_globalCursor;
1926 }
1927
1928 if ( cursor )
1929 hcursor = (HCURSOR)cursor->GetHCURSOR();
1930 }
1931
1932 if ( hcursor )
1933 {
1934 // ::SetCursor(hcursor);
1935
1936 return TRUE;
1937 }
1938 }
1939 */
1940 }
1941
1942 return FALSE;
1943 }
1944
1945 // ---------------------------------------------------------------------------
1946 // owner drawn stuff
1947 // ---------------------------------------------------------------------------
1948
1949 bool wxWindow::OS2OnDrawItem(int id, WXDRAWITEMSTRUCT *itemStruct)
1950 {
1951 // TODO:
1952 /*
1953 #if wxUSE_OWNER_DRAWN
1954 // is it a menu item?
1955 if ( id == 0 )
1956 {
1957 DRAWITEMSTRUCT *pDrawStruct = (DRAWITEMSTRUCT *)itemStruct;
1958 wxMenuItem *pMenuItem = (wxMenuItem *)(pDrawStruct->itemData);
1959
1960 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
1961
1962 // prepare to call OnDrawItem()
1963 wxDC dc;
1964 dc.SetHDC((WXHDC)pDrawStruct->hDC, FALSE);
1965 wxRect rect(pDrawStruct->rcItem.left, pDrawStruct->rcItem.top,
1966 pDrawStruct->rcItem.right - pDrawStruct->rcItem.left,
1967 pDrawStruct->rcItem.bottom - pDrawStruct->rcItem.top);
1968
1969 return pMenuItem->OnDrawItem
1970 (
1971 dc, rect,
1972 (wxOwnerDrawn::wxODAction)pDrawStruct->itemAction,
1973 (wxOwnerDrawn::wxODStatus)pDrawStruct->itemState
1974 );
1975 }
1976
1977 wxWindow *item = FindItem(id);
1978 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
1979 {
1980 return ((wxControl *)item)->MSWOnDraw(itemStruct);
1981 }
1982 else
1983 #endif
1984 return FALSE;
1985 */
1986 return FALSE;
1987 }
1988
1989 bool wxWindow::OS2OnMeasureItem(int id, WXMEASUREITEMSTRUCT *itemStruct)
1990 {
1991 // TODO:
1992 /*
1993 #if wxUSE_OWNER_DRAWN
1994 // is it a menu item?
1995 if ( id == 0 )
1996 {
1997 MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
1998 wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
1999
2000 wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
2001
2002 return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
2003 &pMeasureStruct->itemHeight);
2004 }
2005
2006 wxWindow *item = FindItem(id);
2007 if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
2008 {
2009 return ((wxControl *)item)->MSWOnMeasure(itemStruct);
2010 }
2011 #endif // owner-drawn menus
2012 */
2013 return FALSE;
2014 }
2015
2016 // ---------------------------------------------------------------------------
2017 // colours and palettes
2018 // ---------------------------------------------------------------------------
2019
2020 bool wxWindow::HandleSysColorChange()
2021 {
2022 wxSysColourChangedEvent event;
2023 event.SetEventObject(this);
2024
2025 return GetEventHandler()->ProcessEvent(event);
2026 }
2027
2028 bool wxWindow::HandleCtlColor(WXHBRUSH *brush,
2029 WXHDC pDC,
2030 WXHWND pWnd,
2031 WXUINT nCtlColor,
2032 WXUINT message,
2033 WXWPARAM wParam,
2034 WXLPARAM lParam)
2035 {
2036 WXHBRUSH hBrush = 0;
2037 // TODO:
2038 /*
2039 if ( nCtlColor == CTLCOLOR_DLG )
2040 {
2041 hBrush = OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
2042 }
2043 else
2044 {
2045 wxControl *item = (wxControl *)FindItemByHWND(pWnd, TRUE);
2046 if ( item )
2047 hBrush = item->OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
2048 }
2049
2050 if ( hBrush )
2051 *brush = hBrush;
2052
2053 return hBrush != 0;
2054 */
2055 return FALSE;
2056 }
2057
2058 // Define for each class of dialog and control
2059 WXHBRUSH wxWindow::OnCtlColor(WXHDC hDC,
2060 WXHWND hWnd,
2061 WXUINT nCtlColor,
2062 WXUINT message,
2063 WXWPARAM wParam,
2064 WXLPARAM lParam)
2065 {
2066 return (WXHBRUSH)0;
2067 }
2068
2069 bool wxWindow::HandlePaletteChanged(WXHWND hWndPalChange)
2070 {
2071 wxPaletteChangedEvent event(GetId());
2072 event.SetEventObject(this);
2073 event.SetChangedWindow(wxFindWinFromHandle(hWndPalChange));
2074
2075 return GetEventHandler()->ProcessEvent(event);
2076 }
2077
2078 bool wxWindow::HandleQueryNewPalette()
2079 {
2080 wxQueryNewPaletteEvent event(GetId());
2081 event.SetEventObject(this);
2082
2083 return GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized();
2084 }
2085
2086 // Responds to colour changes: passes event on to children.
2087 void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
2088 {
2089 wxNode *node = GetChildren().First();
2090 while ( node )
2091 {
2092 // Only propagate to non-top-level windows
2093 wxWindow *win = (wxWindow *)node->Data();
2094 if ( win->GetParent() )
2095 {
2096 wxSysColourChangedEvent event2;
2097 event.m_eventObject = win;
2098 win->GetEventHandler()->ProcessEvent(event2);
2099 }
2100
2101 node = node->Next();
2102 }
2103 }
2104
2105 // ---------------------------------------------------------------------------
2106 // painting
2107 // ---------------------------------------------------------------------------
2108
2109 bool wxWindow::HandlePaint()
2110 {
2111 // TODO:
2112 return FALSE;
2113 }
2114
2115 bool wxWindow::HandleEraseBkgnd(WXHDC hdc)
2116 {
2117 // Prevents flicker when dragging
2118 // if ( ::IsIconic(GetHwnd()) )
2119 // return TRUE;
2120
2121 wxDC dc;
2122
2123 dc.SetHDC(hdc);
2124 dc.SetWindow(this);
2125 dc.BeginDrawing();
2126
2127 wxEraseEvent event(m_windowId, &dc);
2128 event.SetEventObject(this);
2129 bool rc = GetEventHandler()->ProcessEvent(event);
2130
2131 dc.EndDrawing();
2132 dc.SelectOldObjects(hdc);
2133 dc.SetHDC((WXHDC) NULL);
2134
2135 return rc;
2136 }
2137
2138 void wxWindow::OnEraseBackground(wxEraseEvent& event)
2139 {
2140 // TODO:
2141 }
2142
2143 // ---------------------------------------------------------------------------
2144 // moving and resizing
2145 // ---------------------------------------------------------------------------
2146
2147 bool wxWindow::HandleMinimize()
2148 {
2149 wxIconizeEvent event(m_windowId);
2150 event.SetEventObject(this);
2151
2152 return GetEventHandler()->ProcessEvent(event);
2153 }
2154
2155 bool wxWindow::HandleMaximize()
2156 {
2157 wxMaximizeEvent event(m_windowId);
2158 event.SetEventObject(this);
2159
2160 return GetEventHandler()->ProcessEvent(event);
2161 }
2162
2163 bool wxWindow::HandleMove(int x, int y)
2164 {
2165 wxMoveEvent event(wxPoint(x, y), m_windowId);
2166 event.SetEventObject(this);
2167
2168 return GetEventHandler()->ProcessEvent(event);
2169 }
2170
2171 bool wxWindow::HandleSize(int w, int h, WXUINT WXUNUSED(flag))
2172 {
2173 wxSizeEvent event(wxSize(w, h), m_windowId);
2174 event.SetEventObject(this);
2175
2176 return GetEventHandler()->ProcessEvent(event);
2177 }
2178
2179 bool wxWindow::HandleGetMinMaxInfo(void *mmInfo)
2180 {
2181 // TODO:
2182 /*
2183 MINMAXINFO *info = (MINMAXINFO *)mmInfo;
2184
2185 bool rc = FALSE;
2186
2187 if ( m_minWidth != -1 )
2188 {
2189 info->ptMinTrackSize.x = m_minWidth;
2190 rc = TRUE;
2191 }
2192
2193 if ( m_minHeight != -1 )
2194 {
2195 info->ptMinTrackSize.y = m_minHeight;
2196 rc = TRUE;
2197 }
2198
2199 if ( m_maxWidth != -1 )
2200 {
2201 info->ptMaxTrackSize.x = m_maxWidth;
2202 rc = TRUE;
2203 }
2204
2205 if ( m_maxHeight != -1 )
2206 {
2207 info->ptMaxTrackSize.y = m_maxHeight;
2208 rc = TRUE;
2209 }
2210
2211 return rc;
2212 */
2213 return FALSE;
2214 }
2215
2216 // ---------------------------------------------------------------------------
2217 // command messages
2218 // ---------------------------------------------------------------------------
2219
2220 bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
2221 {
2222 if ( wxCurrentPopupMenu )
2223 {
2224 wxMenu *popupMenu = wxCurrentPopupMenu;
2225 wxCurrentPopupMenu = NULL;
2226
2227 return popupMenu->OS2Command(cmd, id);
2228 }
2229
2230 wxWindow *win = FindItem(id);
2231 if ( !win )
2232 {
2233 win = wxFindWinFromHandle(control);
2234 }
2235
2236 if ( win )
2237 return win->OS2Command(cmd, id);
2238
2239 return FALSE;
2240 }
2241
2242 bool wxWindow::HandleSysCommand(WXWPARAM wParam, WXLPARAM lParam)
2243 {
2244 // TODO:
2245 return FALSE;
2246 }
2247
2248 // ---------------------------------------------------------------------------
2249 // mouse events
2250 // ---------------------------------------------------------------------------
2251
2252 void wxWindow::InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags)
2253 {
2254 // TODO:
2255 /*
2256 event.m_x = x;
2257 event.m_y = y;
2258 event.m_shiftDown = ((flags & MK_SHIFT) != 0);
2259 event.m_controlDown = ((flags & MK_CONTROL) != 0);
2260 event.m_leftDown = ((flags & MK_LBUTTON) != 0);
2261 event.m_middleDown = ((flags & MK_MBUTTON) != 0);
2262 event.m_rightDown = ((flags & MK_RBUTTON) != 0);
2263 event.SetTimestamp(s_currentMsg.time);
2264 event.m_eventObject = this;
2265
2266 #if wxUSE_MOUSEEVENT_HACK
2267 m_lastMouseX = x;
2268 m_lastMouseY = y;
2269 m_lastMouseEvent = event.GetEventType();
2270 #endif // wxUSE_MOUSEEVENT_HACK
2271 */
2272 }
2273
2274 bool wxWindow::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags)
2275 {
2276 // the mouse events take consecutive IDs from WM_MOUSEFIRST to
2277 // WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
2278 // from the message id and take the value in the table to get wxWin event
2279 // id
2280 static const wxEventType eventsMouse[] =
2281 {
2282 wxEVT_MOTION,
2283 wxEVT_LEFT_DOWN,
2284 wxEVT_LEFT_UP,
2285 wxEVT_LEFT_DCLICK,
2286 wxEVT_RIGHT_DOWN,
2287 wxEVT_RIGHT_UP,
2288 wxEVT_RIGHT_DCLICK,
2289 wxEVT_MIDDLE_DOWN,
2290 wxEVT_MIDDLE_UP,
2291 wxEVT_MIDDLE_DCLICK
2292 };
2293
2294 wxMouseEvent event(eventsMouse[msg - WM_MOUSEMOVE]);
2295 InitMouseEvent(event, x, y, flags);
2296
2297 return GetEventHandler()->ProcessEvent(event);
2298 }
2299
2300 bool wxWindow::HandleMouseMove(int x, int y, WXUINT flags)
2301 {
2302 if ( !m_bMouseInWindow )
2303 {
2304 // Generate an ENTER event
2305 m_bMouseInWindow = TRUE;
2306
2307 wxMouseEvent event(wxEVT_ENTER_WINDOW);
2308 InitMouseEvent(event, x, y, flags);
2309
2310 (void)GetEventHandler()->ProcessEvent(event);
2311 }
2312
2313 #if wxUSE_MOUSEEVENT_HACK
2314 // Window gets a click down message followed by a mouse move message even
2315 // if position isn't changed! We want to discard the trailing move event
2316 // if x and y are the same.
2317 if ( (m_lastMouseEvent == wxEVT_RIGHT_DOWN ||
2318 m_lastMouseEvent == wxEVT_LEFT_DOWN ||
2319 m_lastMouseEvent == wxEVT_MIDDLE_DOWN) &&
2320 (m_lastMouseX == event.m_x && m_lastMouseY == event.m_y) )
2321 {
2322 m_lastMouseEvent = wxEVT_MOTION;
2323
2324 return FALSE;
2325 }
2326 #endif // wxUSE_MOUSEEVENT_HACK
2327
2328 return HandleMouseEvent(WM_MOUSEMOVE, x, y, flags);
2329 }
2330
2331 // ---------------------------------------------------------------------------
2332 // keyboard handling
2333 // ---------------------------------------------------------------------------
2334
2335 // isASCII is TRUE only when we're called from WM_CHAR handler and not from
2336 // WM_KEYDOWN one
2337 bool wxWindow::HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII)
2338 {
2339 // TODO:
2340 return FALSE;
2341 }
2342
2343 bool wxWindow::HandleKeyDown(WXWORD wParam, WXLPARAM lParam)
2344 {
2345 // TODO:
2346 return FALSE;
2347 }
2348
2349 bool wxWindow::HandleKeyUp(WXWORD wParam, WXLPARAM lParam)
2350 {
2351 // TODO:
2352 return FALSE;
2353 }
2354
2355 // ---------------------------------------------------------------------------
2356 // joystick
2357 // ---------------------------------------------------------------------------
2358
2359 bool wxWindow::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags)
2360 {
2361 // TODO:
2362 return FALSE;
2363 }
2364
2365 // ---------------------------------------------------------------------------
2366 // scrolling
2367 // ---------------------------------------------------------------------------
2368
2369 bool wxWindow::OS2OnScroll(int orientation, WXWORD wParam,
2370 WXWORD pos, WXHWND control)
2371 {
2372 if ( control )
2373 {
2374 wxWindow *child = wxFindWinFromHandle(control);
2375 if ( child )
2376 return child->OS2OnScroll(orientation, wParam, pos, control);
2377 }
2378
2379 wxScrollWinEvent event;
2380 event.SetPosition(pos);
2381 event.SetOrientation(orientation);
2382 event.m_eventObject = this;
2383 // TODO:
2384 return FALSE;
2385 }
2386
2387 // ===========================================================================
2388 // global functions
2389 // ===========================================================================
2390
2391 void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
2392 {
2393 // TODO:
2394 }
2395
2396 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
2397 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
2398 int wxCharCodeOS2ToWX(int keySym)
2399 {
2400 int id = 0;
2401 // TODO:
2402 /*
2403 switch (keySym)
2404 {
2405 case VK_CANCEL: id = WXK_CANCEL; break;
2406 case VK_BACK: id = WXK_BACK; break;
2407 case VK_TAB: id = WXK_TAB; break;
2408 case VK_CLEAR: id = WXK_CLEAR; break;
2409 case VK_RETURN: id = WXK_RETURN; break;
2410 case VK_SHIFT: id = WXK_SHIFT; break;
2411 case VK_CONTROL: id = WXK_CONTROL; break;
2412 case VK_MENU : id = WXK_MENU; break;
2413 case VK_PAUSE: id = WXK_PAUSE; break;
2414 case VK_SPACE: id = WXK_SPACE; break;
2415 case VK_ESCAPE: id = WXK_ESCAPE; break;
2416 case VK_PRIOR: id = WXK_PRIOR; break;
2417 case VK_NEXT : id = WXK_NEXT; break;
2418 case VK_END: id = WXK_END; break;
2419 case VK_HOME : id = WXK_HOME; break;
2420 case VK_LEFT : id = WXK_LEFT; break;
2421 case VK_UP: id = WXK_UP; break;
2422 case VK_RIGHT: id = WXK_RIGHT; break;
2423 case VK_DOWN : id = WXK_DOWN; break;
2424 case VK_SELECT: id = WXK_SELECT; break;
2425 case VK_PRINT: id = WXK_PRINT; break;
2426 case VK_EXECUTE: id = WXK_EXECUTE; break;
2427 case VK_INSERT: id = WXK_INSERT; break;
2428 case VK_DELETE: id = WXK_DELETE; break;
2429 case VK_HELP : id = WXK_HELP; break;
2430 case VK_NUMPAD0: id = WXK_NUMPAD0; break;
2431 case VK_NUMPAD1: id = WXK_NUMPAD1; break;
2432 case VK_NUMPAD2: id = WXK_NUMPAD2; break;
2433 case VK_NUMPAD3: id = WXK_NUMPAD3; break;
2434 case VK_NUMPAD4: id = WXK_NUMPAD4; break;
2435 case VK_NUMPAD5: id = WXK_NUMPAD5; break;
2436 case VK_NUMPAD6: id = WXK_NUMPAD6; break;
2437 case VK_NUMPAD7: id = WXK_NUMPAD7; break;
2438 case VK_NUMPAD8: id = WXK_NUMPAD8; break;
2439 case VK_NUMPAD9: id = WXK_NUMPAD9; break;
2440 case VK_MULTIPLY: id = WXK_MULTIPLY; break;
2441 case VK_ADD: id = WXK_ADD; break;
2442 case VK_SUBTRACT: id = WXK_SUBTRACT; break;
2443 case VK_DECIMAL: id = WXK_DECIMAL; break;
2444 case VK_DIVIDE: id = WXK_DIVIDE; break;
2445 case VK_F1: id = WXK_F1; break;
2446 case VK_F2: id = WXK_F2; break;
2447 case VK_F3: id = WXK_F3; break;
2448 case VK_F4: id = WXK_F4; break;
2449 case VK_F5: id = WXK_F5; break;
2450 case VK_F6: id = WXK_F6; break;
2451 case VK_F7: id = WXK_F7; break;
2452 case VK_F8: id = WXK_F8; break;
2453 case VK_F9: id = WXK_F9; break;
2454 case VK_F10: id = WXK_F10; break;
2455 case VK_F11: id = WXK_F11; break;
2456 case VK_F12: id = WXK_F12; break;
2457 case VK_F13: id = WXK_F13; break;
2458 case VK_F14: id = WXK_F14; break;
2459 case VK_F15: id = WXK_F15; break;
2460 case VK_F16: id = WXK_F16; break;
2461 case VK_F17: id = WXK_F17; break;
2462 case VK_F18: id = WXK_F18; break;
2463 case VK_F19: id = WXK_F19; break;
2464 case VK_F20: id = WXK_F20; break;
2465 case VK_F21: id = WXK_F21; break;
2466 case VK_F22: id = WXK_F22; break;
2467 case VK_F23: id = WXK_F23; break;
2468 case VK_F24: id = WXK_F24; break;
2469 case VK_NUMLOCK: id = WXK_NUMLOCK; break;
2470 case VK_SCROLL: id = WXK_SCROLL; break;
2471 default:
2472 {
2473 return 0;
2474 }
2475 }
2476 */
2477 return id;
2478 }
2479
2480 int wxCharCodeWXToOS2(int id, bool *isVirtual)
2481 {
2482 *isVirtual = TRUE;
2483 int keySym = 0;
2484 // TODO
2485 /*
2486 switch (id)
2487 {
2488 case WXK_CANCEL: keySym = VK_CANCEL; break;
2489 case WXK_CLEAR: keySym = VK_CLEAR; break;
2490 case WXK_SHIFT: keySym = VK_SHIFT; break;
2491 case WXK_CONTROL: keySym = VK_CONTROL; break;
2492 case WXK_MENU : keySym = VK_MENU; break;
2493 case WXK_PAUSE: keySym = VK_PAUSE; break;
2494 case WXK_PRIOR: keySym = VK_PRIOR; break;
2495 case WXK_NEXT : keySym = VK_NEXT; break;
2496 case WXK_END: keySym = VK_END; break;
2497 case WXK_HOME : keySym = VK_HOME; break;
2498 case WXK_LEFT : keySym = VK_LEFT; break;
2499 case WXK_UP: keySym = VK_UP; break;
2500 case WXK_RIGHT: keySym = VK_RIGHT; break;
2501 case WXK_DOWN : keySym = VK_DOWN; break;
2502 case WXK_SELECT: keySym = VK_SELECT; break;
2503 case WXK_PRINT: keySym = VK_PRINT; break;
2504 case WXK_EXECUTE: keySym = VK_EXECUTE; break;
2505 case WXK_INSERT: keySym = VK_INSERT; break;
2506 case WXK_DELETE: keySym = VK_DELETE; break;
2507 case WXK_HELP : keySym = VK_HELP; break;
2508 case WXK_NUMPAD0: keySym = VK_NUMPAD0; break;
2509 case WXK_NUMPAD1: keySym = VK_NUMPAD1; break;
2510 case WXK_NUMPAD2: keySym = VK_NUMPAD2; break;
2511 case WXK_NUMPAD3: keySym = VK_NUMPAD3; break;
2512 case WXK_NUMPAD4: keySym = VK_NUMPAD4; break;
2513 case WXK_NUMPAD5: keySym = VK_NUMPAD5; break;
2514 case WXK_NUMPAD6: keySym = VK_NUMPAD6; break;
2515 case WXK_NUMPAD7: keySym = VK_NUMPAD7; break;
2516 case WXK_NUMPAD8: keySym = VK_NUMPAD8; break;
2517 case WXK_NUMPAD9: keySym = VK_NUMPAD9; break;
2518 case WXK_MULTIPLY: keySym = VK_MULTIPLY; break;
2519 case WXK_ADD: keySym = VK_ADD; break;
2520 case WXK_SUBTRACT: keySym = VK_SUBTRACT; break;
2521 case WXK_DECIMAL: keySym = VK_DECIMAL; break;
2522 case WXK_DIVIDE: keySym = VK_DIVIDE; break;
2523 case WXK_F1: keySym = VK_F1; break;
2524 case WXK_F2: keySym = VK_F2; break;
2525 case WXK_F3: keySym = VK_F3; break;
2526 case WXK_F4: keySym = VK_F4; break;
2527 case WXK_F5: keySym = VK_F5; break;
2528 case WXK_F6: keySym = VK_F6; break;
2529 case WXK_F7: keySym = VK_F7; break;
2530 case WXK_F8: keySym = VK_F8; break;
2531 case WXK_F9: keySym = VK_F9; break;
2532 case WXK_F10: keySym = VK_F10; break;
2533 case WXK_F11: keySym = VK_F11; break;
2534 case WXK_F12: keySym = VK_F12; break;
2535 case WXK_F13: keySym = VK_F13; break;
2536 case WXK_F14: keySym = VK_F14; break;
2537 case WXK_F15: keySym = VK_F15; break;
2538 case WXK_F16: keySym = VK_F16; break;
2539 case WXK_F17: keySym = VK_F17; break;
2540 case WXK_F18: keySym = VK_F18; break;
2541 case WXK_F19: keySym = VK_F19; break;
2542 case WXK_F20: keySym = VK_F20; break;
2543 case WXK_F21: keySym = VK_F21; break;
2544 case WXK_F22: keySym = VK_F22; break;
2545 case WXK_F23: keySym = VK_F23; break;
2546 case WXK_F24: keySym = VK_F24; break;
2547 case WXK_NUMLOCK: keySym = VK_NUMLOCK; break;
2548 case WXK_SCROLL: keySym = VK_SCROLL; break;
2549 default:
2550 {
2551 *isVirtual = FALSE;
2552 keySym = id;
2553 break;
2554 }
2555 }
2556 */
2557 return keySym;
2558 }
2559
2560 wxWindow *wxGetActiveWindow()
2561 {
2562 // TODO
2563 return NULL;
2564 }
2565
2566 // Windows keyboard hook. Allows interception of e.g. F1, ESCAPE
2567 // in active frames and dialogs, regardless of where the focus is.
2568 //static HHOOK wxTheKeyboardHook = 0;
2569 //static FARPROC wxTheKeyboardHookProc = 0;
2570 int wxKeyboardHook(int nCode, WORD wParam, DWORD lParam);
2571
2572 void wxSetKeyboardHook(bool doIt)
2573 {
2574 // TODO:
2575 }
2576
2577 int wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
2578 {
2579 // TODO:
2580
2581 return 0;
2582 }
2583
2584 #ifdef __WXDEBUG__
2585 const char *wxGetMessageName(int message)
2586 {
2587 // TODO
2588 /*
2589 switch ( message )
2590 {
2591 case 0x0000: return "WM_NULL";
2592 case 0x0001: return "WM_CREATE";
2593 case 0x0002: return "WM_DESTROY";
2594 case 0x0003: return "WM_MOVE";
2595 case 0x0005: return "WM_SIZE";
2596 case 0x0006: return "WM_ACTIVATE";
2597 case 0x0007: return "WM_SETFOCUS";
2598 case 0x0008: return "WM_KILLFOCUS";
2599 case 0x000A: return "WM_ENABLE";
2600 case 0x000B: return "WM_SETREDRAW";
2601 case 0x000C: return "WM_SETTEXT";
2602 case 0x000D: return "WM_GETTEXT";
2603 case 0x000E: return "WM_GETTEXTLENGTH";
2604 case 0x000F: return "WM_PAINT";
2605 case 0x0010: return "WM_CLOSE";
2606 case 0x0011: return "WM_QUERYENDSESSION";
2607 case 0x0012: return "WM_QUIT";
2608 case 0x0013: return "WM_QUERYOPEN";
2609 case 0x0014: return "WM_ERASEBKGND";
2610 case 0x0015: return "WM_SYSCOLORCHANGE";
2611 case 0x0016: return "WM_ENDSESSION";
2612 case 0x0017: return "WM_SYSTEMERROR";
2613 case 0x0018: return "WM_SHOWWINDOW";
2614 case 0x0019: return "WM_CTLCOLOR";
2615 case 0x001A: return "WM_WININICHANGE";
2616 case 0x001B: return "WM_DEVMODECHANGE";
2617 case 0x001C: return "WM_ACTIVATEAPP";
2618 case 0x001D: return "WM_FONTCHANGE";
2619 case 0x001E: return "WM_TIMECHANGE";
2620 case 0x001F: return "WM_CANCELMODE";
2621 case 0x0020: return "WM_SETCURSOR";
2622 case 0x0021: return "WM_MOUSEACTIVATE";
2623 case 0x0022: return "WM_CHILDACTIVATE";
2624 case 0x0023: return "WM_QUEUESYNC";
2625 case 0x0024: return "WM_GETMINMAXINFO";
2626 case 0x0026: return "WM_PAINTICON";
2627 case 0x0027: return "WM_ICONERASEBKGND";
2628 case 0x0028: return "WM_NEXTDLGCTL";
2629 case 0x002A: return "WM_SPOOLERSTATUS";
2630 case 0x002B: return "WM_DRAWITEM";
2631 case 0x002C: return "WM_MEASUREITEM";
2632 case 0x002D: return "WM_DELETEITEM";
2633 case 0x002E: return "WM_VKEYTOITEM";
2634 case 0x002F: return "WM_CHARTOITEM";
2635 case 0x0030: return "WM_SETFONT";
2636 case 0x0031: return "WM_GETFONT";
2637 case 0x0037: return "WM_QUERYDRAGICON";
2638 case 0x0039: return "WM_COMPAREITEM";
2639 case 0x0041: return "WM_COMPACTING";
2640 case 0x0044: return "WM_COMMNOTIFY";
2641 case 0x0046: return "WM_WINDOWPOSCHANGING";
2642 case 0x0047: return "WM_WINDOWPOSCHANGED";
2643 case 0x0048: return "WM_POWER";
2644
2645 #ifdef __WIN32__
2646 case 0x004A: return "WM_COPYDATA";
2647 case 0x004B: return "WM_CANCELJOURNAL";
2648 case 0x004E: return "WM_NOTIFY";
2649 case 0x0050: return "WM_INPUTLANGCHANGEREQUEST";
2650 case 0x0051: return "WM_INPUTLANGCHANGE";
2651 case 0x0052: return "WM_TCARD";
2652 case 0x0053: return "WM_HELP";
2653 case 0x0054: return "WM_USERCHANGED";
2654 case 0x0055: return "WM_NOTIFYFORMAT";
2655 case 0x007B: return "WM_CONTEXTMENU";
2656 case 0x007C: return "WM_STYLECHANGING";
2657 case 0x007D: return "WM_STYLECHANGED";
2658 case 0x007E: return "WM_DISPLAYCHANGE";
2659 case 0x007F: return "WM_GETICON";
2660 case 0x0080: return "WM_SETICON";
2661 #endif //WIN32
2662
2663 case 0x0081: return "WM_NCCREATE";
2664 case 0x0082: return "WM_NCDESTROY";
2665 case 0x0083: return "WM_NCCALCSIZE";
2666 case 0x0084: return "WM_NCHITTEST";
2667 case 0x0085: return "WM_NCPAINT";
2668 case 0x0086: return "WM_NCACTIVATE";
2669 case 0x0087: return "WM_GETDLGCODE";
2670 case 0x00A0: return "WM_NCMOUSEMOVE";
2671 case 0x00A1: return "WM_NCLBUTTONDOWN";
2672 case 0x00A2: return "WM_NCLBUTTONUP";
2673 case 0x00A3: return "WM_NCLBUTTONDBLCLK";
2674 case 0x00A4: return "WM_NCRBUTTONDOWN";
2675 case 0x00A5: return "WM_NCRBUTTONUP";
2676 case 0x00A6: return "WM_NCRBUTTONDBLCLK";
2677 case 0x00A7: return "WM_NCMBUTTONDOWN";
2678 case 0x00A8: return "WM_NCMBUTTONUP";
2679 case 0x00A9: return "WM_NCMBUTTONDBLCLK";
2680 case 0x0100: return "WM_KEYDOWN";
2681 case 0x0101: return "WM_KEYUP";
2682 case 0x0102: return "WM_CHAR";
2683 case 0x0103: return "WM_DEADCHAR";
2684 case 0x0104: return "WM_SYSKEYDOWN";
2685 case 0x0105: return "WM_SYSKEYUP";
2686 case 0x0106: return "WM_SYSCHAR";
2687 case 0x0107: return "WM_SYSDEADCHAR";
2688 case 0x0108: return "WM_KEYLAST";
2689
2690 #ifdef __WIN32__
2691 case 0x010D: return "WM_IME_STARTCOMPOSITION";
2692 case 0x010E: return "WM_IME_ENDCOMPOSITION";
2693 case 0x010F: return "WM_IME_COMPOSITION";
2694 #endif //WIN32
2695
2696 case 0x0110: return "WM_INITDIALOG";
2697 case 0x0111: return "WM_COMMAND";
2698 case 0x0112: return "WM_SYSCOMMAND";
2699 case 0x0113: return "WM_TIMER";
2700 case 0x0114: return "WM_HSCROLL";
2701 case 0x0115: return "WM_VSCROLL";
2702 case 0x0116: return "WM_INITMENU";
2703 case 0x0117: return "WM_INITMENUPOPUP";
2704 case 0x011F: return "WM_MENUSELECT";
2705 case 0x0120: return "WM_MENUCHAR";
2706 case 0x0121: return "WM_ENTERIDLE";
2707 case 0x0200: return "WM_MOUSEMOVE";
2708 case 0x0201: return "WM_LBUTTONDOWN";
2709 case 0x0202: return "WM_LBUTTONUP";
2710 case 0x0203: return "WM_LBUTTONDBLCLK";
2711 case 0x0204: return "WM_RBUTTONDOWN";
2712 case 0x0205: return "WM_RBUTTONUP";
2713 case 0x0206: return "WM_RBUTTONDBLCLK";
2714 case 0x0207: return "WM_MBUTTONDOWN";
2715 case 0x0208: return "WM_MBUTTONUP";
2716 case 0x0209: return "WM_MBUTTONDBLCLK";
2717 case 0x0210: return "WM_PARENTNOTIFY";
2718 case 0x0211: return "WM_ENTERMENULOOP";
2719 case 0x0212: return "WM_EXITMENULOOP";
2720
2721 #ifdef __WIN32__
2722 case 0x0213: return "WM_NEXTMENU";
2723 case 0x0214: return "WM_SIZING";
2724 case 0x0215: return "WM_CAPTURECHANGED";
2725 case 0x0216: return "WM_MOVING";
2726 case 0x0218: return "WM_POWERBROADCAST";
2727 case 0x0219: return "WM_DEVICECHANGE";
2728 #endif //WIN32
2729
2730 case 0x0220: return "WM_MDICREATE";
2731 case 0x0221: return "WM_MDIDESTROY";
2732 case 0x0222: return "WM_MDIACTIVATE";
2733 case 0x0223: return "WM_MDIRESTORE";
2734 case 0x0224: return "WM_MDINEXT";
2735 case 0x0225: return "WM_MDIMAXIMIZE";
2736 case 0x0226: return "WM_MDITILE";
2737 case 0x0227: return "WM_MDICASCADE";
2738 case 0x0228: return "WM_MDIICONARRANGE";
2739 case 0x0229: return "WM_MDIGETACTIVE";
2740 case 0x0230: return "WM_MDISETMENU";
2741 case 0x0233: return "WM_DROPFILES";
2742
2743 #ifdef __WIN32__
2744 case 0x0281: return "WM_IME_SETCONTEXT";
2745 case 0x0282: return "WM_IME_NOTIFY";
2746 case 0x0283: return "WM_IME_CONTROL";
2747 case 0x0284: return "WM_IME_COMPOSITIONFULL";
2748 case 0x0285: return "WM_IME_SELECT";
2749 case 0x0286: return "WM_IME_CHAR";
2750 case 0x0290: return "WM_IME_KEYDOWN";
2751 case 0x0291: return "WM_IME_KEYUP";
2752 #endif //WIN32
2753
2754 case 0x0300: return "WM_CUT";
2755 case 0x0301: return "WM_COPY";
2756 case 0x0302: return "WM_PASTE";
2757 case 0x0303: return "WM_CLEAR";
2758 case 0x0304: return "WM_UNDO";
2759 case 0x0305: return "WM_RENDERFORMAT";
2760 case 0x0306: return "WM_RENDERALLFORMATS";
2761 case 0x0307: return "WM_DESTROYCLIPBOARD";
2762 case 0x0308: return "WM_DRAWCLIPBOARD";
2763 case 0x0309: return "WM_PAINTCLIPBOARD";
2764 case 0x030A: return "WM_VSCROLLCLIPBOARD";
2765 case 0x030B: return "WM_SIZECLIPBOARD";
2766 case 0x030C: return "WM_ASKCBFORMATNAME";
2767 case 0x030D: return "WM_CHANGECBCHAIN";
2768 case 0x030E: return "WM_HSCROLLCLIPBOARD";
2769 case 0x030F: return "WM_QUERYNEWPALETTE";
2770 case 0x0310: return "WM_PALETTEISCHANGING";
2771 case 0x0311: return "WM_PALETTECHANGED";
2772
2773 #ifdef __WIN32__
2774 // common controls messages - although they're not strictly speaking
2775 // standard, it's nice to decode them nevertheless
2776
2777 // listview
2778 case 0x1000 + 0: return "LVM_GETBKCOLOR";
2779 case 0x1000 + 1: return "LVM_SETBKCOLOR";
2780 case 0x1000 + 2: return "LVM_GETIMAGELIST";
2781 case 0x1000 + 3: return "LVM_SETIMAGELIST";
2782 case 0x1000 + 4: return "LVM_GETITEMCOUNT";
2783 case 0x1000 + 5: return "LVM_GETITEMA";
2784 case 0x1000 + 75: return "LVM_GETITEMW";
2785 case 0x1000 + 6: return "LVM_SETITEMA";
2786 case 0x1000 + 76: return "LVM_SETITEMW";
2787 case 0x1000 + 7: return "LVM_INSERTITEMA";
2788 case 0x1000 + 77: return "LVM_INSERTITEMW";
2789 case 0x1000 + 8: return "LVM_DELETEITEM";
2790 case 0x1000 + 9: return "LVM_DELETEALLITEMS";
2791 case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
2792 case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
2793 case 0x1000 + 12: return "LVM_GETNEXTITEM";
2794 case 0x1000 + 13: return "LVM_FINDITEMA";
2795 case 0x1000 + 83: return "LVM_FINDITEMW";
2796 case 0x1000 + 14: return "LVM_GETITEMRECT";
2797 case 0x1000 + 15: return "LVM_SETITEMPOSITION";
2798 case 0x1000 + 16: return "LVM_GETITEMPOSITION";
2799 case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
2800 case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
2801 case 0x1000 + 18: return "LVM_HITTEST";
2802 case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
2803 case 0x1000 + 20: return "LVM_SCROLL";
2804 case 0x1000 + 21: return "LVM_REDRAWITEMS";
2805 case 0x1000 + 22: return "LVM_ARRANGE";
2806 case 0x1000 + 23: return "LVM_EDITLABELA";
2807 case 0x1000 + 118: return "LVM_EDITLABELW";
2808 case 0x1000 + 24: return "LVM_GETEDITCONTROL";
2809 case 0x1000 + 25: return "LVM_GETCOLUMNA";
2810 case 0x1000 + 95: return "LVM_GETCOLUMNW";
2811 case 0x1000 + 26: return "LVM_SETCOLUMNA";
2812 case 0x1000 + 96: return "LVM_SETCOLUMNW";
2813 case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
2814 case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
2815 case 0x1000 + 28: return "LVM_DELETECOLUMN";
2816 case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
2817 case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
2818 case 0x1000 + 31: return "LVM_GETHEADER";
2819 case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
2820 case 0x1000 + 34: return "LVM_GETVIEWRECT";
2821 case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
2822 case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
2823 case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
2824 case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
2825 case 0x1000 + 39: return "LVM_GETTOPINDEX";
2826 case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
2827 case 0x1000 + 41: return "LVM_GETORIGIN";
2828 case 0x1000 + 42: return "LVM_UPDATE";
2829 case 0x1000 + 43: return "LVM_SETITEMSTATE";
2830 case 0x1000 + 44: return "LVM_GETITEMSTATE";
2831 case 0x1000 + 45: return "LVM_GETITEMTEXTA";
2832 case 0x1000 + 115: return "LVM_GETITEMTEXTW";
2833 case 0x1000 + 46: return "LVM_SETITEMTEXTA";
2834 case 0x1000 + 116: return "LVM_SETITEMTEXTW";
2835 case 0x1000 + 47: return "LVM_SETITEMCOUNT";
2836 case 0x1000 + 48: return "LVM_SORTITEMS";
2837 case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
2838 case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
2839 case 0x1000 + 51: return "LVM_GETITEMSPACING";
2840 case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
2841 case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
2842 case 0x1000 + 53: return "LVM_SETICONSPACING";
2843 case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
2844 case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
2845 case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
2846 case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
2847 case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
2848 case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
2849 case 0x1000 + 60: return "LVM_SETHOTITEM";
2850 case 0x1000 + 61: return "LVM_GETHOTITEM";
2851 case 0x1000 + 62: return "LVM_SETHOTCURSOR";
2852 case 0x1000 + 63: return "LVM_GETHOTCURSOR";
2853 case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
2854 case 0x1000 + 65: return "LVM_SETWORKAREA";
2855
2856 // tree view
2857 case 0x1100 + 0: return "TVM_INSERTITEMA";
2858 case 0x1100 + 50: return "TVM_INSERTITEMW";
2859 case 0x1100 + 1: return "TVM_DELETEITEM";
2860 case 0x1100 + 2: return "TVM_EXPAND";
2861 case 0x1100 + 4: return "TVM_GETITEMRECT";
2862 case 0x1100 + 5: return "TVM_GETCOUNT";
2863 case 0x1100 + 6: return "TVM_GETINDENT";
2864 case 0x1100 + 7: return "TVM_SETINDENT";
2865 case 0x1100 + 8: return "TVM_GETIMAGELIST";
2866 case 0x1100 + 9: return "TVM_SETIMAGELIST";
2867 case 0x1100 + 10: return "TVM_GETNEXTITEM";
2868 case 0x1100 + 11: return "TVM_SELECTITEM";
2869 case 0x1100 + 12: return "TVM_GETITEMA";
2870 case 0x1100 + 62: return "TVM_GETITEMW";
2871 case 0x1100 + 13: return "TVM_SETITEMA";
2872 case 0x1100 + 63: return "TVM_SETITEMW";
2873 case 0x1100 + 14: return "TVM_EDITLABELA";
2874 case 0x1100 + 65: return "TVM_EDITLABELW";
2875 case 0x1100 + 15: return "TVM_GETEDITCONTROL";
2876 case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
2877 case 0x1100 + 17: return "TVM_HITTEST";
2878 case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
2879 case 0x1100 + 19: return "TVM_SORTCHILDREN";
2880 case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
2881 case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
2882 case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
2883 case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
2884 case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
2885 case 0x1100 + 24: return "TVM_SETTOOLTIPS";
2886 case 0x1100 + 25: return "TVM_GETTOOLTIPS";
2887
2888 // header
2889 case 0x1200 + 0: return "HDM_GETITEMCOUNT";
2890 case 0x1200 + 1: return "HDM_INSERTITEMA";
2891 case 0x1200 + 10: return "HDM_INSERTITEMW";
2892 case 0x1200 + 2: return "HDM_DELETEITEM";
2893 case 0x1200 + 3: return "HDM_GETITEMA";
2894 case 0x1200 + 11: return "HDM_GETITEMW";
2895 case 0x1200 + 4: return "HDM_SETITEMA";
2896 case 0x1200 + 12: return "HDM_SETITEMW";
2897 case 0x1200 + 5: return "HDM_LAYOUT";
2898 case 0x1200 + 6: return "HDM_HITTEST";
2899 case 0x1200 + 7: return "HDM_GETITEMRECT";
2900 case 0x1200 + 8: return "HDM_SETIMAGELIST";
2901 case 0x1200 + 9: return "HDM_GETIMAGELIST";
2902 case 0x1200 + 15: return "HDM_ORDERTOINDEX";
2903 case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
2904 case 0x1200 + 17: return "HDM_GETORDERARRAY";
2905 case 0x1200 + 18: return "HDM_SETORDERARRAY";
2906 case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
2907
2908 // tab control
2909 case 0x1300 + 2: return "TCM_GETIMAGELIST";
2910 case 0x1300 + 3: return "TCM_SETIMAGELIST";
2911 case 0x1300 + 4: return "TCM_GETITEMCOUNT";
2912 case 0x1300 + 5: return "TCM_GETITEMA";
2913 case 0x1300 + 60: return "TCM_GETITEMW";
2914 case 0x1300 + 6: return "TCM_SETITEMA";
2915 case 0x1300 + 61: return "TCM_SETITEMW";
2916 case 0x1300 + 7: return "TCM_INSERTITEMA";
2917 case 0x1300 + 62: return "TCM_INSERTITEMW";
2918 case 0x1300 + 8: return "TCM_DELETEITEM";
2919 case 0x1300 + 9: return "TCM_DELETEALLITEMS";
2920 case 0x1300 + 10: return "TCM_GETITEMRECT";
2921 case 0x1300 + 11: return "TCM_GETCURSEL";
2922 case 0x1300 + 12: return "TCM_SETCURSEL";
2923 case 0x1300 + 13: return "TCM_HITTEST";
2924 case 0x1300 + 14: return "TCM_SETITEMEXTRA";
2925 case 0x1300 + 40: return "TCM_ADJUSTRECT";
2926 case 0x1300 + 41: return "TCM_SETITEMSIZE";
2927 case 0x1300 + 42: return "TCM_REMOVEIMAGE";
2928 case 0x1300 + 43: return "TCM_SETPADDING";
2929 case 0x1300 + 44: return "TCM_GETROWCOUNT";
2930 case 0x1300 + 45: return "TCM_GETTOOLTIPS";
2931 case 0x1300 + 46: return "TCM_SETTOOLTIPS";
2932 case 0x1300 + 47: return "TCM_GETCURFOCUS";
2933 case 0x1300 + 48: return "TCM_SETCURFOCUS";
2934 case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
2935 case 0x1300 + 50: return "TCM_DESELECTALL";
2936
2937 // toolbar
2938 case WM_USER+1: return "TB_ENABLEBUTTON";
2939 case WM_USER+2: return "TB_CHECKBUTTON";
2940 case WM_USER+3: return "TB_PRESSBUTTON";
2941 case WM_USER+4: return "TB_HIDEBUTTON";
2942 case WM_USER+5: return "TB_INDETERMINATE";
2943 case WM_USER+9: return "TB_ISBUTTONENABLED";
2944 case WM_USER+10: return "TB_ISBUTTONCHECKED";
2945 case WM_USER+11: return "TB_ISBUTTONPRESSED";
2946 case WM_USER+12: return "TB_ISBUTTONHIDDEN";
2947 case WM_USER+13: return "TB_ISBUTTONINDETERMINATE";
2948 case WM_USER+17: return "TB_SETSTATE";
2949 case WM_USER+18: return "TB_GETSTATE";
2950 case WM_USER+19: return "TB_ADDBITMAP";
2951 case WM_USER+20: return "TB_ADDBUTTONS";
2952 case WM_USER+21: return "TB_INSERTBUTTON";
2953 case WM_USER+22: return "TB_DELETEBUTTON";
2954 case WM_USER+23: return "TB_GETBUTTON";
2955 case WM_USER+24: return "TB_BUTTONCOUNT";
2956 case WM_USER+25: return "TB_COMMANDTOINDEX";
2957 case WM_USER+26: return "TB_SAVERESTOREA";
2958 case WM_USER+76: return "TB_SAVERESTOREW";
2959 case WM_USER+27: return "TB_CUSTOMIZE";
2960 case WM_USER+28: return "TB_ADDSTRINGA";
2961 case WM_USER+77: return "TB_ADDSTRINGW";
2962 case WM_USER+29: return "TB_GETITEMRECT";
2963 case WM_USER+30: return "TB_BUTTONSTRUCTSIZE";
2964 case WM_USER+31: return "TB_SETBUTTONSIZE";
2965 case WM_USER+32: return "TB_SETBITMAPSIZE";
2966 case WM_USER+33: return "TB_AUTOSIZE";
2967 case WM_USER+35: return "TB_GETTOOLTIPS";
2968 case WM_USER+36: return "TB_SETTOOLTIPS";
2969 case WM_USER+37: return "TB_SETPARENT";
2970 case WM_USER+39: return "TB_SETROWS";
2971 case WM_USER+40: return "TB_GETROWS";
2972 case WM_USER+42: return "TB_SETCMDID";
2973 case WM_USER+43: return "TB_CHANGEBITMAP";
2974 case WM_USER+44: return "TB_GETBITMAP";
2975 case WM_USER+45: return "TB_GETBUTTONTEXTA";
2976 case WM_USER+75: return "TB_GETBUTTONTEXTW";
2977 case WM_USER+46: return "TB_REPLACEBITMAP";
2978 case WM_USER+47: return "TB_SETINDENT";
2979 case WM_USER+48: return "TB_SETIMAGELIST";
2980 case WM_USER+49: return "TB_GETIMAGELIST";
2981 case WM_USER+50: return "TB_LOADIMAGES";
2982 case WM_USER+51: return "TB_GETRECT";
2983 case WM_USER+52: return "TB_SETHOTIMAGELIST";
2984 case WM_USER+53: return "TB_GETHOTIMAGELIST";
2985 case WM_USER+54: return "TB_SETDISABLEDIMAGELIST";
2986 case WM_USER+55: return "TB_GETDISABLEDIMAGELIST";
2987 case WM_USER+56: return "TB_SETSTYLE";
2988 case WM_USER+57: return "TB_GETSTYLE";
2989 case WM_USER+58: return "TB_GETBUTTONSIZE";
2990 case WM_USER+59: return "TB_SETBUTTONWIDTH";
2991 case WM_USER+60: return "TB_SETMAXTEXTROWS";
2992 case WM_USER+61: return "TB_GETTEXTROWS";
2993 case WM_USER+41: return "TB_GETBITMAPFLAGS";
2994
2995 #endif //WIN32
2996
2997 default:
2998 static char s_szBuf[128];
2999 sprintf(s_szBuf, "<unknown message = %d>", message);
3000 return s_szBuf;
3001 }
3002 */
3003 return NULL;
3004 }
3005
3006 #endif // __WXDEBUG__
3007