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