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