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