GetSize() and GetClientSize() changes
[wxWidgets.git] / src / motif / dialog.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialog.cpp
3 // Purpose: wxDialog class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "dialog.h"
14 #endif
15
16 #include "wx/dialog.h"
17 #include "wx/utils.h"
18 #include "wx/frame.h"
19 #include "wx/app.h"
20 #include "wx/settings.h"
21
22 #include <Xm/Xm.h>
23
24 #include <X11/Shell.h>
25 #if XmVersion >= 1002
26 #include <Xm/XmAll.h>
27 #endif
28 #include <Xm/MwmUtil.h>
29 #include <Xm/Label.h>
30 #include <Xm/BulletinB.h>
31 #include <Xm/Frame.h>
32 #include <Xm/Text.h>
33 #include <Xm/DialogS.h>
34 #include <Xm/FileSB.h>
35 #include <Xm/RowColumn.h>
36 #include <Xm/LabelG.h>
37 #include <Xm/AtomMgr.h>
38 #if XmVersion > 1000
39 #include <Xm/Protocols.h>
40 #endif
41
42 #include "wx/motif/private.h"
43
44 static void wxCloseDialogCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs);
45 static void wxDialogBoxEventHandler (Widget wid,
46 XtPointer client_data,
47 XEvent* event,
48 Boolean *continueToDispatch);
49
50 static void wxUnmapBulletinBoard(Widget dialog, wxDialog *client,XtPointer call);
51
52 // A stack of modal_showing flags, since we can't rely
53 // on accessing wxDialog::m_modalShowing within
54 // wxDialog::Show in case a callback has deleted the wxDialog.
55 static wxList wxModalShowingStack;
56
57 // Lists to keep track of windows, so we can disable/enable them
58 // for modal dialogs
59 wxList wxModalDialogs;
60 wxList wxModelessWindows; // Frames and modeless dialogs
61 extern wxList wxPendingDelete;
62
63 #define wxUSE_INVISIBLE_RESIZE 1
64
65 #if !USE_SHARED_LIBRARY
66 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
67
68 BEGIN_EVENT_TABLE(wxDialog, wxPanel)
69 EVT_BUTTON(wxID_OK, wxDialog::OnOK)
70 EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
71 EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
72 EVT_CHAR_HOOK(wxDialog::OnCharHook)
73 EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
74 EVT_CLOSE(wxDialog::OnCloseWindow)
75 END_EVENT_TABLE()
76
77 #endif
78
79 wxDialog::wxDialog()
80 {
81 m_modalShowing = FALSE;
82 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
83 }
84
85 bool wxDialog::Create(wxWindow *parent, wxWindowID id,
86 const wxString& title,
87 const wxPoint& pos,
88 const wxSize& size,
89 long style,
90 const wxString& name)
91 {
92 m_windowStyle = style;
93 m_modalShowing = FALSE;
94 m_dialogTitle = title;
95
96 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
97 m_foregroundColour = *wxBLACK;
98
99 SetName(name);
100
101 if (!parent)
102 wxTopLevelWindows.Append(this);
103
104 if (parent) parent->AddChild(this);
105
106 if ( id == -1 )
107 m_windowId = (int)NewControlId();
108 else
109 m_windowId = id;
110
111 Widget parentWidget = (Widget) 0;
112 if (parent)
113 parentWidget = (Widget) parent->GetTopWidget();
114 if (!parent)
115 parentWidget = (Widget) wxTheApp->GetTopLevelWidget();
116
117 wxASSERT_MSG( (parentWidget != (Widget) 0), "Could not find a suitable parent shell for dialog." );
118
119 Arg args[2];
120 XtSetArg (args[0], XmNdefaultPosition, False);
121 XtSetArg (args[1], XmNautoUnmanage, False);
122 Widget dialogShell = XmCreateBulletinBoardDialog(parentWidget, (char*) (const char*) name, args, 2);
123 m_mainWidget = (WXWidget) dialogShell;
124
125 // We don't want margins, since there is enough elsewhere.
126 XtVaSetValues(dialogShell,
127 XmNmarginHeight, 0,
128 XmNmarginWidth, 0,
129 XmNresizePolicy, XmRESIZE_NONE,
130 NULL) ;
131
132 Widget shell = XtParent(dialogShell) ;
133 if (!title.IsNull())
134 {
135 XmString str = XmStringCreateSimple((char*) (const char*)title);
136 XtVaSetValues(dialogShell,
137 XmNdialogTitle, str,
138 NULL);
139 XmStringFree(str);
140 }
141
142 m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
143 ChangeFont(FALSE);
144
145 wxAddWindowToTable(dialogShell, this);
146
147 // Intercept CLOSE messages from the window manager
148 Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False);
149
150 /* Remove and add WM_DELETE_WINDOW so ours is only handler */
151 /* Why do we have to do this for wxDialog, but not wxFrame? */
152 XmRemoveWMProtocols(shell, &WM_DELETE_WINDOW, 1);
153 XmAddWMProtocols(shell, &WM_DELETE_WINDOW, 1);
154 XmActivateWMProtocol(shell, WM_DELETE_WINDOW);
155
156 // Modified Steve Hammes for Motif 2.0
157 #if (XmREVISION > 1 || XmVERSION > 1)
158 XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseDialogCallback, (XtPointer)this);
159 #elif XmREVISION == 1
160 XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseDialogCallback, (caddr_t)this);
161 #else
162 XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (void (*)())wxCloseDialogCallback, (caddr_t)this);
163 #endif
164
165 XtTranslations ptr ;
166 XtOverrideTranslations(dialogShell,
167 ptr = XtParseTranslationTable("<Configure>: resize()"));
168 XtFree((char *)ptr);
169
170 // Can't remember what this was about... but I think it's necessary.
171
172 if (wxUSE_INVISIBLE_RESIZE)
173 {
174 if (pos.x > -1)
175 XtVaSetValues(dialogShell, XmNx, pos.x,
176 NULL);
177 if (pos.y > -1)
178 XtVaSetValues(dialogShell, XmNy, pos.y,
179 NULL);
180
181 if (size.x > -1)
182 XtVaSetValues(dialogShell, XmNwidth, size.x, NULL);
183 if (size.y > -1)
184 XtVaSetValues(dialogShell, XmNheight, size.y, NULL);
185 }
186
187 // This patch come from Torsten Liermann lier@lier1.muc.de
188 if (XmIsMotifWMRunning(shell))
189 {
190 int decor = 0 ;
191 if (m_windowStyle & wxRESIZE_BORDER)
192 decor |= MWM_DECOR_RESIZEH ;
193 if (m_windowStyle & wxSYSTEM_MENU)
194 decor |= MWM_DECOR_MENU;
195 if ((m_windowStyle & wxCAPTION) ||
196 (m_windowStyle & wxTINY_CAPTION_HORIZ) ||
197 (m_windowStyle & wxTINY_CAPTION_VERT))
198 decor |= MWM_DECOR_TITLE;
199 if (m_windowStyle & wxTHICK_FRAME)
200 decor |= MWM_DECOR_BORDER;
201 if (m_windowStyle & wxMINIMIZE_BOX)
202 decor |= MWM_DECOR_MINIMIZE;
203 if (m_windowStyle & wxMAXIMIZE_BOX)
204 decor |= MWM_DECOR_MAXIMIZE;
205
206 XtVaSetValues(shell,XmNmwmDecorations,decor,NULL) ;
207 }
208 // This allows non-Motif window managers to support at least the
209 // no-decorations case.
210 else
211 {
212 if ((m_windowStyle & wxCAPTION) != wxCAPTION)
213 XtVaSetValues((Widget) shell,XmNoverrideRedirect,TRUE,NULL);
214 }
215
216 XtRealizeWidget(dialogShell);
217
218 XtAddCallback(dialogShell,XmNunmapCallback,
219 (XtCallbackProc)wxUnmapBulletinBoard,this) ;
220
221 // Positioning of the dialog doesn't work properly unless the dialog
222 // is managed, so we manage without mapping to the screen.
223 // To show, we map the shell (actually it's parent).
224 if (!wxUSE_INVISIBLE_RESIZE)
225 XtVaSetValues(shell, XmNmappedWhenManaged, FALSE, NULL);
226
227 if (!wxUSE_INVISIBLE_RESIZE)
228 {
229 XtManageChild(dialogShell);
230 SetSize(pos.x, pos.y, size.x, size.y);
231 }
232 XtAddEventHandler(dialogShell,ExposureMask,FALSE,
233 wxUniversalRepaintProc, (XtPointer) this);
234
235 XtAddEventHandler(dialogShell,
236 ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask,
237 FALSE,
238 wxDialogBoxEventHandler,
239 (XtPointer)this);
240
241 ChangeBackgroundColour();
242
243 return TRUE;
244 }
245
246 void wxDialog::SetModal(bool flag)
247 {
248 if ( flag )
249 m_windowStyle |= wxDIALOG_MODAL ;
250 else
251 if ( m_windowStyle & wxDIALOG_MODAL )
252 m_windowStyle -= wxDIALOG_MODAL ;
253
254 wxModelessWindows.DeleteObject(this);
255 if (!flag)
256 wxModelessWindows.Append(this);
257 }
258
259 wxDialog::~wxDialog()
260 {
261 if (m_mainWidget)
262 XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask, FALSE,
263 wxUniversalRepaintProc, (XtPointer) this);
264
265 m_modalShowing = FALSE;
266 if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
267 {
268 XtUnmapWidget((Widget) m_mainWidget);
269 }
270
271 wxTopLevelWindows.DeleteObject(this);
272
273 if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
274 wxModelessWindows.DeleteObject(this);
275
276 // If this is the last top-level window, exit.
277 if (wxTheApp && (wxTopLevelWindows.Number() == 0))
278 {
279 wxTheApp->SetTopWindow(NULL);
280
281 if (wxTheApp->GetExitOnFrameDelete())
282 {
283 wxTheApp->ExitMainLoop();
284 }
285 }
286
287 // This event-flushing code used to be in wxWindow::PostDestroyChildren (wx_dialog.cpp)
288 // but I think this should work, if we destroy the children first.
289 // Note that this might need to be done for wxFrame also.
290 DestroyChildren();
291
292 // The idea about doing it here is that if you have to remove the
293 // XtDestroyWidget from ~wxWindow, at least top-level windows
294 // will still be deleted (and destroy children implicitly).
295 if (GetMainWidget())
296 {
297 DetachWidget(GetMainWidget()); // Removes event handlers
298 XtDestroyWidget((Widget) GetMainWidget());
299 SetMainWidget((WXWidget) NULL);
300 }
301 }
302
303 // By default, pressing escape cancels the dialog
304 void wxDialog::OnCharHook(wxKeyEvent& event)
305 {
306 if (event.m_keyCode == WXK_ESCAPE)
307 {
308 // Behaviour changed in 2.0: we'll send a Cancel message
309 // to the dialog instead of Close.
310 wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
311 cancelEvent.SetEventObject( this );
312 GetEventHandler()->ProcessEvent(cancelEvent);
313
314 return;
315 }
316 // We didn't process this event.
317 event.Skip();
318 }
319
320 void wxDialog::Iconize(bool WXUNUSED(iconize))
321 {
322 // Can't iconize a dialog in Motif, apparently
323 // TODO: try using the parent of m_mainShell.
324 // XtVaSetValues((Widget) m_mainWidget, XmNiconic, iconize, NULL);
325 }
326
327 bool wxDialog::IsIconized() const
328 {
329 /*
330 Boolean iconic;
331 XtVaGetValues((Widget) m_mainWidget, XmNiconic, &iconic, NULL);
332
333 return iconic;
334 */
335 return FALSE;
336 }
337
338 void wxDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags)
339 {
340 XtVaSetValues((Widget) m_mainWidget, XmNresizePolicy, XmRESIZE_ANY, NULL);
341 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
342 XtVaSetValues((Widget) m_mainWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
343 }
344
345 void wxDialog::SetTitle(const wxString& title)
346 {
347 m_dialogTitle = title;
348 if (!title.IsNull())
349 {
350 XmString str = XmStringCreateSimple((char*) (const char*) title);
351 XtVaSetValues((Widget) m_mainWidget,
352 XmNtitle, (char*) (const char*) title,
353 XmNdialogTitle, str, // Roberto Cocchi
354 XmNiconName, (char*) (const char*) title,
355 NULL);
356 XmStringFree(str);
357 }
358 }
359
360 wxString wxDialog::GetTitle() const
361 {
362 return m_dialogTitle;
363 }
364
365 void wxDialog::Centre(int direction)
366 {
367 int x_offset,y_offset ;
368 int display_width, display_height;
369 int width, height, x, y;
370 wxWindow *parent = GetParent();
371 if ((direction & wxCENTER_FRAME) && parent)
372 {
373 parent->GetPosition(&x_offset,&y_offset) ;
374 parent->GetSize(&display_width,&display_height) ;
375 }
376 else
377 {
378 wxDisplaySize(&display_width, &display_height);
379 x_offset = 0 ;
380 y_offset = 0 ;
381 }
382
383 GetSize(&width, &height);
384 GetPosition(&x, &y);
385
386 if (direction & wxHORIZONTAL)
387 x = (int)((display_width - width)/2);
388 if (direction & wxVERTICAL)
389 y = (int)((display_height - height)/2);
390
391 SetSize(x+x_offset, y+y_offset, width, height);
392 }
393
394 void wxDialog::Raise()
395 {
396 Window parent_window = XtWindow((Widget) m_mainWidget),
397 next_parent = XtWindow((Widget) m_mainWidget),
398 root = RootWindowOfScreen(XtScreen((Widget) m_mainWidget));
399 // search for the parent that is child of ROOT, because the WM may
400 // reparent twice and notify only the next parent (like FVWM)
401 while (next_parent != root) {
402 Window *theChildren; unsigned int n;
403 parent_window = next_parent;
404 XQueryTree(XtDisplay((Widget) m_mainWidget), parent_window, &root,
405 &next_parent, &theChildren, &n);
406 XFree(theChildren); // not needed
407 }
408 XRaiseWindow(XtDisplay((Widget) m_mainWidget), parent_window);
409 }
410
411 void wxDialog::Lower()
412 {
413 Window parent_window = XtWindow((Widget) m_mainWidget),
414 next_parent = XtWindow((Widget) m_mainWidget),
415 root = RootWindowOfScreen(XtScreen((Widget) m_mainWidget));
416 // search for the parent that is child of ROOT, because the WM may
417 // reparent twice and notify only the next parent (like FVWM)
418 while (next_parent != root) {
419 Window *theChildren; unsigned int n;
420 parent_window = next_parent;
421 XQueryTree(XtDisplay((Widget) m_mainWidget), parent_window, &root,
422 &next_parent, &theChildren, &n);
423 XFree(theChildren); // not needed
424 }
425 XLowerWindow(XtDisplay((Widget) m_mainWidget), parent_window);
426 }
427
428 bool wxDialog::Show(bool show)
429 {
430 m_isShown = show;
431
432 if (show)
433 {
434 if (!wxUSE_INVISIBLE_RESIZE)
435 XtMapWidget(XtParent((Widget) m_mainWidget));
436 else
437 XtManageChild((Widget) m_mainWidget) ;
438
439 XRaiseWindow(XtDisplay((Widget) m_mainWidget), XtWindow((Widget) m_mainWidget));
440
441 }
442 else
443 {
444 if (!wxUSE_INVISIBLE_RESIZE)
445 XtUnmapWidget(XtParent((Widget) m_mainWidget));
446 else
447 XtUnmanageChild((Widget) m_mainWidget) ;
448
449 XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
450 XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
451 }
452
453 return TRUE;
454 }
455
456 // Shows a dialog modally, returning a return code
457 int wxDialog::ShowModal()
458 {
459 m_windowStyle |= wxDIALOG_MODAL;
460
461 Show(TRUE);
462
463 if (m_modalShowing)
464 return 0;
465
466 wxModalShowingStack.Insert((wxObject *)TRUE);
467
468 m_modalShowing = TRUE;
469 XtAddGrab((Widget) m_mainWidget, TRUE, FALSE);
470
471 XEvent event;
472
473 // Loop until we signal that the dialog should be closed
474 while ((wxModalShowingStack.Number() > 0) && ((int)(wxModalShowingStack.First()->Data()) != 0))
475 {
476 // XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
477
478 XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
479 wxTheApp->ProcessXEvent((WXEvent*) &event);
480 }
481
482 // Remove modal dialog flag from stack
483 wxNode *node = wxModalShowingStack.First();
484 if (node)
485 delete node;
486
487 // Now process all events in case they get sent to a destroyed dialog
488 XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
489 while (XtAppPending((XtAppContext) wxTheApp->GetAppContext()))
490 {
491 XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
492 XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
493
494 wxTheApp->ProcessXEvent((WXEvent*) &event);
495 }
496
497 // TODO: is it safe to call this, if the dialog may have been deleted
498 // by now? Probably only if we're using delayed deletion of dialogs.
499 return GetReturnCode();
500 }
501
502 void wxDialog::EndModal(int retCode)
503 {
504 if (!m_modalShowing)
505 return;
506
507 SetReturnCode(retCode);
508
509 // Strangely, we don't seem to need this now.
510 // XtRemoveGrab((Widget) m_mainWidget);
511
512 Show(FALSE);
513
514 m_modalShowing = FALSE;
515
516 wxNode *node = wxModalShowingStack.First();
517 if (node)
518 node->SetData((wxObject *)FALSE);
519 }
520
521 // Standard buttons
522 void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
523 {
524 if ( Validate() && TransferDataFromWindow() )
525 {
526 if ( IsModal() )
527 EndModal(wxID_OK);
528 else
529 {
530 SetReturnCode(wxID_OK);
531 this->Show(FALSE);
532 }
533 }
534 }
535
536 void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
537 {
538 if (Validate())
539 TransferDataFromWindow();
540 // TODO probably need to disable the Apply button until things change again
541 }
542
543 void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
544 {
545 if ( IsModal() )
546 EndModal(wxID_CANCEL);
547 else
548 {
549 SetReturnCode(wxID_CANCEL);
550 this->Show(FALSE);
551 }
552 }
553
554 void wxDialog::OnCloseWindow(wxCloseEvent& event)
555 {
556 // We'll send a Cancel message by default,
557 // which may close the dialog.
558 // Check for looping if the Cancel event handler calls Close().
559
560 // Note that if a cancel button and handler aren't present in the dialog,
561 // nothing will happen when you close the dialog via the window manager, or
562 // via Close().
563 // We wouldn't want to destroy the dialog by default, since the dialog may have been
564 // created on the stack.
565 // However, this does mean that calling dialog->Close() won't delete the dialog
566 // unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
567 // sure to destroy the dialog.
568 // The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
569
570 static wxList closing;
571
572 if ( closing.Member(this) )
573 return;
574
575 closing.Append(this);
576
577 wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
578 cancelEvent.SetEventObject( this );
579 GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
580
581 closing.DeleteObject(this);
582 }
583
584 // Destroy the window (delayed, if a managed window)
585 bool wxDialog::Destroy()
586 {
587 if (!wxPendingDelete.Member(this))
588 wxPendingDelete.Append(this);
589 return TRUE;
590 }
591
592 void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
593 {
594 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
595 Refresh();
596 }
597
598 void wxDialog::Fit()
599 {
600 wxWindow::Fit();
601 }
602
603 // Handle a close event from the window manager
604 static void wxCloseDialogCallback( Widget WXUNUSED(widget), XtPointer client_data,
605 XmAnyCallbackStruct *WXUNUSED(cbs))
606 {
607 wxDialog *dialog = (wxDialog *)client_data;
608 wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, dialog->GetId());
609 closeEvent.SetEventObject(dialog);
610
611 // May delete the dialog (with delayed deletion)
612 dialog->GetEventHandler()->ProcessEvent(closeEvent);
613 }
614
615 void wxDialogBoxEventHandler (Widget wid,
616 XtPointer WXUNUSED(client_data),
617 XEvent* event,
618 Boolean *continueToDispatch)
619 {
620 wxDialog *dialog = (wxDialog *)wxWidgetHashTable->Get((long)wid);
621 if (dialog)
622 {
623 wxMouseEvent wxevent(wxEVT_NULL);
624 if (wxTranslateMouseEvent(wxevent, dialog, wid, event))
625 {
626 wxevent.SetEventObject(dialog);
627 wxevent.SetId(dialog->GetId());
628 dialog->GetEventHandler()->ProcessEvent(wxevent);
629 }
630 else
631 {
632 // An attempt to implement OnCharHook by calling OnCharHook first;
633 // if this returns TRUE, set continueToDispatch to False
634 // (don't continue processing).
635 // Otherwise set it to True and call OnChar.
636 wxKeyEvent keyEvent(wxEVT_CHAR);
637 if (wxTranslateKeyEvent(keyEvent, dialog, wid, event))
638 {
639 keyEvent.SetEventObject(dialog);
640 keyEvent.SetId(dialog->GetId());
641 keyEvent.SetEventType(wxEVT_CHAR_HOOK);
642 if (dialog->GetEventHandler()->ProcessEvent(keyEvent))
643 {
644 *continueToDispatch = False;
645 return;
646 }
647 else
648 {
649 // For simplicity, OnKeyDown is the same as OnChar
650 // TODO: filter modifier key presses from OnChar
651 keyEvent.SetEventType(wxEVT_KEY_DOWN);
652
653 // Only process OnChar if OnKeyDown didn't swallow it
654 if (!dialog->GetEventHandler()->ProcessEvent (keyEvent))
655 {
656 keyEvent.SetEventType(wxEVT_CHAR);
657 dialog->GetEventHandler()->ProcessEvent(keyEvent);
658 }
659 }
660 }
661 }
662 }
663 *continueToDispatch = True;
664 }
665
666 static void wxUnmapBulletinBoard(Widget WXUNUSED(dialog), wxDialog *WXUNUSED(client), XtPointer WXUNUSED(call) )
667 {
668 /* This gets called when the dialog is being shown, which
669 * defeats modal showing.
670 client->m_modalShowing = FALSE ;
671 client->m_isShown = FALSE;
672 */
673 }
674
675 void wxDialog::ChangeFont(bool keepOriginalSize)
676 {
677 wxWindow::ChangeFont(keepOriginalSize);
678 }
679
680 void wxDialog::ChangeBackgroundColour()
681 {
682 if (GetMainWidget())
683 DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
684 }
685
686 void wxDialog::ChangeForegroundColour()
687 {
688 if (GetMainWidget())
689 DoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
690 }
691