]> git.saurik.com Git - wxWidgets.git/blame - src/msw/dialog.cpp
compilation fix
[wxWidgets.git] / src / msw / dialog.cpp
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dialog.cpp
3// Purpose: wxDialog class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
dc1c4b62 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "dialog.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
24#include "wx/dialog.h"
25#include "wx/utils.h"
26#include "wx/frame.h"
27#include "wx/app.h"
28#include "wx/settings.h"
0c589ad0
BM
29#include "wx/intl.h"
30#include "wx/log.h"
2bda0e17
KB
31#endif
32
33#include "wx/msw/private.h"
dbda9e86 34#include "wx/log.h"
2bda0e17 35
47d67540 36#if wxUSE_COMMON_DIALOGS
2bda0e17
KB
37#include <commdlg.h>
38#endif
39
40#define wxDIALOG_DEFAULT_X 300
41#define wxDIALOG_DEFAULT_Y 300
42
43// Lists to keep track of windows, so we can disable/enable them
44// for modal dialogs
a23fd0e1
VZ
45wxWindowList wxModalDialogs;
46wxWindowList wxModelessWindows; // Frames and modeless dialogs
cde9f08e 47extern wxList WXDLLEXPORT wxPendingDelete;
2bda0e17
KB
48
49#if !USE_SHARED_LIBRARY
462e2437
VZ
50 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
51
52 BEGIN_EVENT_TABLE(wxDialog, wxPanel)
53 EVT_SIZE(wxDialog::OnSize)
54 EVT_BUTTON(wxID_OK, wxDialog::OnOK)
55 EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
56 EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
57 EVT_CHAR_HOOK(wxDialog::OnCharHook)
58 EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
59 EVT_CLOSE(wxDialog::OnCloseWindow)
60 END_EVENT_TABLE()
2bda0e17
KB
61#endif
62
a23fd0e1 63wxDialog::wxDialog()
2bda0e17
KB
64{
65 m_isShown = FALSE;
66 m_modalShowing = FALSE;
67
68 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
2bda0e17
KB
69}
70
debe6624 71bool wxDialog::Create(wxWindow *parent, wxWindowID id,
462e2437
VZ
72 const wxString& title,
73 const wxPoint& pos,
74 const wxSize& size,
75 long style,
76 const wxString& name)
2bda0e17 77{
bd9d76cb
VZ
78#if wxUSE_TOOLTIPS
79 m_hwndToolTip = 0;
80#endif
81
462e2437
VZ
82 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
83 SetName(name);
bd9d76cb 84
462e2437
VZ
85 if (!parent)
86 wxTopLevelWindows.Append(this);
2bda0e17 87
462e2437 88 // windowFont = wxTheFontList->FindOrCreateFont(11, wxSWISS, wxNORMAL, wxNORMAL);
2bda0e17 89
462e2437 90 if (parent) parent->AddChild(this);
2bda0e17 91
462e2437
VZ
92 if ( id == -1 )
93 m_windowId = (int)NewControlId();
94 else
95 m_windowId = id;
96
97 int x = pos.x;
98 int y = pos.y;
99 int width = size.x;
100 int height = size.y;
101
102 if (x < 0) x = wxDIALOG_DEFAULT_X;
103 if (y < 0) y = wxDIALOG_DEFAULT_Y;
104
105 m_windowStyle = style;
106
107 m_isShown = FALSE;
108 m_modalShowing = FALSE;
109
110 if (width < 0)
111 width = 500;
112 if (height < 0)
113 height = 500;
114
706bb5f9
JS
115 // All dialogs should really have this style
116 m_windowStyle |= wxTAB_TRAVERSAL;
117
462e2437
VZ
118 WXDWORD extendedStyle = MakeExtendedStyle(m_windowStyle);
119 if (m_windowStyle & wxSTAY_ON_TOP)
120 extendedStyle |= WS_EX_TOPMOST;
121
122 // Allows creation of dialogs with & without captions under MSWindows,
123 // resizeable or not (but a resizeable dialog always has caption -
124 // otherwise it would look too strange)
837e5743 125 const wxChar *dlg;
257bf510 126 if ( style & wxRESIZE_BORDER )
223d09f6 127 dlg = wxT("wxResizeableDialog");
462e2437 128 else if ( style & wxCAPTION )
223d09f6 129 dlg = wxT("wxCaptionDialog");
462e2437 130 else
223d09f6 131 dlg = wxT("wxNoCaptionDialog");
462e2437
VZ
132 MSWCreate(m_windowId, parent, NULL, this, NULL,
133 x, y, width, height,
134 0, // style is not used if we have dlg template
135 dlg,
136 extendedStyle);
2bda0e17 137
462e2437 138 HWND hwnd = (HWND)GetHWND();
2bda0e17 139
462e2437
VZ
140 if ( !hwnd )
141 {
68ad65f8 142 wxLogError(_("Failed to create dialog."));
2bda0e17 143
462e2437
VZ
144 return FALSE;
145 }
2bda0e17 146
462e2437 147 SubclassWin(GetHWND());
bd9d76cb 148
462e2437
VZ
149 SetWindowText(hwnd, title);
150 SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
2bda0e17 151
462e2437 152 return TRUE;
2bda0e17
KB
153}
154
debe6624 155void wxDialog::SetModal(bool flag)
2bda0e17 156{
dc1c4b62
VZ
157 if ( flag )
158 m_windowStyle |= wxDIALOG_MODAL ;
159 else
160 if ( m_windowStyle & wxDIALOG_MODAL )
161 m_windowStyle -= wxDIALOG_MODAL ;
bd9d76cb 162
2bda0e17
KB
163 wxModelessWindows.DeleteObject(this);
164 if (!flag)
165 wxModelessWindows.Append(this);
166}
167
168wxDialog::~wxDialog()
169{
170 m_isBeingDeleted = TRUE;
171
172 wxTopLevelWindows.DeleteObject(this);
173
edccf428
VZ
174 Show(FALSE);
175
2bda0e17
KB
176 if (m_modalShowing)
177 {
2bda0e17
KB
178 // For some reason, wxWindows can activate another task altogether
179 // when a frame is destroyed after a modal dialog has been invoked.
180 // Try to bring the parent to the top.
181 // dfgg: I moved this following line from end of function -
182 // must not call if another window is on top!!
183 // This can often happen with Close() and delayed deleting
184 if (GetParent() && GetParent()->GetHWND())
185 ::BringWindowToTop((HWND) GetParent()->GetHWND());
186 }
187
188 m_modalShowing = FALSE;
2bda0e17
KB
189
190 if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
191 wxModelessWindows.DeleteObject(this);
192
2bda0e17
KB
193 // If this is the last top-level window, exit.
194 if (wxTheApp && (wxTopLevelWindows.Number() == 0))
195 {
196 wxTheApp->SetTopWindow(NULL);
197
198 if (wxTheApp->GetExitOnFrameDelete())
199 {
200 PostQuitMessage(0);
201 }
202 }
203}
204
205// By default, pressing escape cancels the dialog
206void wxDialog::OnCharHook(wxKeyEvent& event)
207{
208 if (GetHWND())
209 {
210 if (event.m_keyCode == WXK_ESCAPE)
211 {
2a47d3c1
JS
212 // Behaviour changed in 2.0: we'll send a Cancel message
213 // to the dialog instead of Close.
214 wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
215 cancelEvent.SetEventObject( this );
216 GetEventHandler()->ProcessEvent(cancelEvent);
2bda0e17 217
2a47d3c1 218 return;
2bda0e17
KB
219 }
220 }
221 // We didn't process this event.
222 event.Skip();
223}
224
225void wxDialog::OnPaint(wxPaintEvent& event)
226{
dc1c4b62
VZ
227 // No: if you call the default procedure, it makes
228 // the following painting code not work.
229// wxWindow::OnPaint(event);
2bda0e17
KB
230}
231
a23fd0e1 232void wxDialog::Fit()
2bda0e17
KB
233{
234 wxWindow::Fit();
235}
236
debe6624 237void wxDialog::Iconize(bool WXUNUSED(iconize))
2bda0e17
KB
238{
239 // Windows dialog boxes can't be iconized
240}
241
a23fd0e1 242bool wxDialog::IsIconized() const
2bda0e17
KB
243{
244 return FALSE;
245}
246
721b32e0 247void wxDialog::DoSetClientSize(int width, int height)
2bda0e17
KB
248{
249 HWND hWnd = (HWND) GetHWND();
250 RECT rect;
2de8030d 251 ::GetClientRect(hWnd, &rect);
2bda0e17
KB
252
253 RECT rect2;
254 GetWindowRect(hWnd, &rect2);
255
256 // Find the difference between the entire window (title bar and all)
257 // and the client area; add this to the new client size to move the
258 // window
259 int actual_width = rect2.right - rect2.left - rect.right + width;
260 int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
261
262 MoveWindow(hWnd, rect2.left, rect2.top, actual_width, actual_height, TRUE);
debe6624 263
2bda0e17 264 wxSizeEvent event(wxSize(actual_width, actual_height), m_windowId);
debe6624 265 event.SetEventObject( this );
2bda0e17 266 GetEventHandler()->ProcessEvent(event);
2bda0e17
KB
267}
268
269void wxDialog::GetPosition(int *x, int *y) const
270{
271 HWND hWnd = (HWND) GetHWND();
272 RECT rect;
273 GetWindowRect(hWnd, &rect);
274
275 *x = rect.left;
276 *y = rect.top;
277}
278
a23fd0e1 279bool wxDialog::IsShown() const
2bda0e17 280{
a35faffd 281 return m_isShown;
22cf5fec
VZ
282}
283
284bool wxDialog::IsModal() const
285{
a35faffd 286 return wxModalDialogs.Find((wxDialog *)this) != 0; // const_cast
2bda0e17
KB
287}
288
debe6624 289bool wxDialog::Show(bool show)
2bda0e17
KB
290{
291 m_isShown = show;
292
293 if (show)
294 InitDialog();
295
296 bool modal = ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL) ;
297
298#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
299 if (!modal) {
300 if (show) {
a23fd0e1
VZ
301 if (!wxModelessWindows.Find(this))
302 wxModelessWindows.Append(this);
2bda0e17
KB
303 } else
304 wxModelessWindows.DeleteObject(this);
305 }
306 if (show) {
a23fd0e1 307 if (!wxTopLevelWindows.Find(this))
2bda0e17
KB
308 wxTopLevelWindows.Append(this);
309 } else
310 wxTopLevelWindows.DeleteObject(this);
311#endif
312
313 if (modal)
314 {
315 if (show)
316 {
7f68042c
VZ
317 // find the top level window which had focus before - we will restore
318 // focus to it later
319 m_hwndOldFocus = 0;
320 for ( HWND hwnd = ::GetFocus(); hwnd; hwnd = ::GetParent(hwnd) )
321 {
322 m_hwndOldFocus = (WXHWND)hwnd;
323 }
dc1c4b62 324
2bda0e17
KB
325 if (m_modalShowing)
326 {
327 BringWindowToTop((HWND) GetHWND());
328 return TRUE;
329 }
bd9d76cb 330
2bda0e17
KB
331 m_modalShowing = TRUE;
332 wxNode *node = wxModalDialogs.First();
333 while (node)
334 {
335 wxDialog *box = (wxDialog *)node->Data();
336 if (box != this)
337 ::EnableWindow((HWND) box->GetHWND(), FALSE);
338 node = node->Next();
339 }
9c9cff0b
VZ
340
341 // if we don't do it, some window might be deleted while we have pointers
342 // to them in our disabledWindows list and the program will crash when it
343 // will try to reenable them after the modal dialog end
344 wxTheApp->DeletePendingObjects();
345 wxList disabledWindows;
346
2bda0e17
KB
347 node = wxModelessWindows.First();
348 while (node)
349 {
350 wxWindow *win = (wxWindow *)node->Data();
dc1c4b62
VZ
351 if (::IsWindowEnabled((HWND) win->GetHWND()))
352 {
2bda0e17 353 ::EnableWindow((HWND) win->GetHWND(), FALSE);
9c9cff0b 354 disabledWindows.Append(win);
dc1c4b62 355 }
2bda0e17
KB
356 node = node->Next();
357 }
358
359 ShowWindow((HWND) GetHWND(), SW_SHOW);
360 EnableWindow((HWND) GetHWND(), TRUE);
361 BringWindowToTop((HWND) GetHWND());
362
a23fd0e1 363 if ( !wxModalDialogs.Find(this) )
2bda0e17
KB
364 wxModalDialogs.Append(this);
365
366 MSG msg;
367 // Must test whether this dialog still exists: we may not process
368 // a message before the deletion.
a23fd0e1 369 while (wxModalDialogs.Find(this) && m_modalShowing && GetMessage(&msg, NULL, 0, 0))
2bda0e17 370 {
0a54c4a8
VZ
371 if ( m_acceleratorTable.Ok() &&
372 ::TranslateAccelerator((HWND)GetHWND(),
373 (HACCEL)m_acceleratorTable.GetHACCEL(),
374 &msg) )
567da5c6
JS
375 {
376 // Have processed the message
377 }
0a54c4a8 378 else if ( !wxTheApp->ProcessMessage((WXMSG *)&msg) )
2bda0e17
KB
379 {
380 TranslateMessage(&msg);
381 DispatchMessage(&msg);
382 }
9838df2c
JS
383
384 // If we get crashes (as per George Tasker's message) with nested modal dialogs,
385 // we should try removing the m_modalShowing test
386
2bda0e17 387 if (m_modalShowing && !::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE))
dc1c4b62
VZ
388 // dfgg: NB MUST test m_modalShowing again as the message loop could have triggered
389 // a Show(FALSE) in the mean time!!!
390 // Without the test, we might delete the dialog before the end of modal showing.
2bda0e17
KB
391 {
392 while (wxTheApp->ProcessIdle() && m_modalShowing)
393 {
394 // Keep going until we decide we've done enough
395 }
396 }
397 }
398 // dfgg: now must specifically re-enable all other app windows that we disabled earlier
9c9cff0b 399 node=disabledWindows.First();
2bda0e17 400 while(node) {
dc1c4b62 401 wxWindow* win = (wxWindow*) node->Data();
a23fd0e1 402 if (wxModalDialogs.Find(win) || wxModelessWindows.Find(win))
9838df2c
JS
403 {
404 HWND hWnd = (HWND) win->GetHWND();
405 if (::IsWindow(hWnd))
406 ::EnableWindow(hWnd,TRUE);
407 }
2bda0e17
KB
408 node=node->Next();
409 }
410 }
dc1c4b62 411 else // !show
2bda0e17 412 {
dc1c4b62
VZ
413 ::SetFocus((HWND)m_hwndOldFocus);
414
2bda0e17
KB
415 wxModalDialogs.DeleteObject(this);
416
417 wxNode *last = wxModalDialogs.Last();
418
419 // If there's still a modal dialog active, we
420 // enable it, else we enable all modeless windows
421 if (last)
422 {
cc2b7472
VZ
423 // VZ: I don't understand what this is supposed to do, so I'll leave
424 // it out for now and look for horrible consequences
2bda0e17
KB
425 wxDialog *box = (wxDialog *)last->Data();
426 HWND hwnd = (HWND) box->GetHWND();
cc2b7472
VZ
427#if 0
428 if (box->IsUserEnabled())
429#endif // 0
2bda0e17
KB
430 EnableWindow(hwnd, TRUE);
431 BringWindowToTop(hwnd);
432 }
433 else
434 {
435 wxNode *node = wxModelessWindows.First();
436 while (node)
437 {
438 wxWindow *win = (wxWindow *)node->Data();
439 HWND hwnd = (HWND) win->GetHWND();
440 // Only enable again if not user-disabled.
cc2b7472 441#if 0
2bda0e17 442 if (win->IsUserEnabled())
cc2b7472 443#endif // 0
2bda0e17
KB
444 EnableWindow(hwnd, TRUE);
445 node = node->Next();
446 }
447 }
448 // Try to highlight the correct window (the parent)
449 HWND hWndParent = 0;
450 if (GetParent())
451 {
452 hWndParent = (HWND) GetParent()->GetHWND();
453 if (hWndParent)
454 ::BringWindowToTop(hWndParent);
455 }
456 ShowWindow((HWND) GetHWND(), SW_HIDE);
457 m_modalShowing = FALSE;
458 }
459 }
dc1c4b62 460 else // !modal
2bda0e17
KB
461 {
462 if (show)
463 {
464 ShowWindow((HWND) GetHWND(), SW_SHOW);
465 BringWindowToTop((HWND) GetHWND());
466 }
467 else
468 {
469 // Try to highlight the correct window (the parent)
470 HWND hWndParent = 0;
471 if (GetParent())
472 {
473 hWndParent = (HWND) GetParent()->GetHWND();
474 if (hWndParent)
475 ::BringWindowToTop(hWndParent);
476 }
717a57c2
VZ
477
478 if ( m_hWnd )
479 ShowWindow((HWND) GetHWND(), SW_HIDE);
2bda0e17
KB
480 }
481 }
482 return TRUE;
483}
484
485void wxDialog::SetTitle(const wxString& title)
486{
837e5743 487 SetWindowText((HWND) GetHWND(), title.c_str());
2bda0e17
KB
488}
489
a23fd0e1 490wxString wxDialog::GetTitle() const
2bda0e17
KB
491{
492 GetWindowText((HWND) GetHWND(), wxBuffer, 1000);
493 return wxString(wxBuffer);
494}
495
debe6624 496void wxDialog::Centre(int direction)
2bda0e17
KB
497{
498 int x_offset,y_offset ;
499 int display_width, display_height;
500 int width, height, x, y;
dfc54541
JS
501 wxWindow *parent = GetParent();
502 if ((direction & wxCENTER_FRAME) && parent)
2bda0e17 503 {
dfc54541
JS
504 parent->GetPosition(&x_offset,&y_offset) ;
505 parent->GetSize(&display_width,&display_height) ;
2bda0e17
KB
506 }
507 else
2bda0e17
KB
508 {
509 wxDisplaySize(&display_width, &display_height);
510 x_offset = 0 ;
511 y_offset = 0 ;
512 }
513
2bda0e17
KB
514 GetSize(&width, &height);
515 GetPosition(&x, &y);
516
517 if (direction & wxHORIZONTAL)
518 x = (int)((display_width - width)/2);
519 if (direction & wxVERTICAL)
520 y = (int)((display_height - height)/2);
521
522 SetSize(x+x_offset, y+y_offset, width, height);
523}
524
525// Replacement for Show(TRUE) for modal dialogs - returns return code
a23fd0e1 526int wxDialog::ShowModal()
2bda0e17 527{
dc1c4b62
VZ
528 m_windowStyle |= wxDIALOG_MODAL;
529 Show(TRUE);
530 return GetReturnCode();
2bda0e17
KB
531}
532
533void wxDialog::EndModal(int retCode)
534{
dc1c4b62
VZ
535 SetReturnCode(retCode);
536 Show(FALSE);
2bda0e17
KB
537}
538
539// Define for each class of dialog and control
debe6624 540WXHBRUSH wxDialog::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
dc1c4b62 541 WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
2bda0e17 542{
1f112209 543#if wxUSE_CTL3D
2bda0e17
KB
544 HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
545 return (WXHBRUSH) hbrush;
546#else
547 return 0;
548#endif
549}
550
551// Standard buttons
552void wxDialog::OnOK(wxCommandEvent& event)
553{
dc1c4b62
VZ
554 if ( Validate() && TransferDataFromWindow() )
555 {
2bda0e17
KB
556 if ( IsModal() )
557 EndModal(wxID_OK);
558 else
559 {
387a3b02
JS
560 SetReturnCode(wxID_OK);
561 this->Show(FALSE);
2bda0e17 562 }
dc1c4b62 563 }
2bda0e17
KB
564}
565
566void wxDialog::OnApply(wxCommandEvent& event)
567{
dc1c4b62
VZ
568 if (Validate())
569 TransferDataFromWindow();
570 // TODO probably need to disable the Apply button until things change again
2bda0e17
KB
571}
572
573void wxDialog::OnCancel(wxCommandEvent& event)
574{
575 if ( IsModal() )
576 EndModal(wxID_CANCEL);
577 else
578 {
579 SetReturnCode(wxID_CANCEL);
2a47d3c1 580 this->Show(FALSE);
2bda0e17
KB
581 }
582}
583
e3065973 584void wxDialog::OnCloseWindow(wxCloseEvent& event)
2bda0e17 585{
e3065973 586 // We'll send a Cancel message by default,
2bda0e17 587 // which may close the dialog.
e3065973
JS
588 // Check for looping if the Cancel event handler calls Close().
589
590 // Note that if a cancel button and handler aren't present in the dialog,
591 // nothing will happen when you close the dialog via the window manager, or
592 // via Close().
593 // We wouldn't want to destroy the dialog by default, since the dialog may have been
594 // created on the stack.
595 // However, this does mean that calling dialog->Close() won't delete the dialog
596 // unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
597 // sure to destroy the dialog.
598 // The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
2bda0e17
KB
599
600 static wxList closing;
bd9d76cb 601
2bda0e17 602 if ( closing.Member(this) )
e3065973 603 return;
bd9d76cb 604
2bda0e17 605 closing.Append(this);
bd9d76cb 606
387a3b02
JS
607 wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
608 cancelEvent.SetEventObject( this );
e3065973 609 GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
2bda0e17
KB
610
611 closing.DeleteObject(this);
e3065973 612}
2bda0e17 613
e3065973 614// Destroy the window (delayed, if a managed window)
a23fd0e1 615bool wxDialog::Destroy()
e3065973
JS
616{
617 if (!wxPendingDelete.Member(this))
618 wxPendingDelete.Append(this);
619 return TRUE;
2bda0e17
KB
620}
621
94b49b93
JS
622void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
623{
624 // if we're using constraints - do use them
625 #if wxUSE_CONSTRAINTS
a23fd0e1
VZ
626 if ( GetAutoLayout() )
627 {
94b49b93
JS
628 Layout();
629 }
630 #endif
631}
632
2bda0e17
KB
633void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
634{
1f112209 635#if wxUSE_CTL3D
2bda0e17
KB
636 Ctl3dColorChange();
637#else
638 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
2bda0e17
KB
639 Refresh();
640#endif
68ad65f8 641}
42e69d6b
VZ
642
643// ---------------------------------------------------------------------------
644// dialog window proc
645// ---------------------------------------------------------------------------
646
647long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
648{
649 long rc = 0;
650 bool processed = FALSE;
651
652 switch ( message )
653 {
654 case WM_CLOSE:
655 // if we can't close, tell the system that we processed the
656 // message - otherwise it would close us
657 processed = !Close();
658 break;
659 }
660
661 if ( !processed )
662 rc = wxWindow::MSWWindowProc(message, wParam, lParam);
663
664 return rc;
665}