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