- if (!wxPendingDelete.Member(this))
- wxPendingDelete.Append(this);
- return TRUE;
-}
-
-void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
-{
- SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- Refresh();
-}
-
-void wxDialog::Fit()
-{
-}
-
-// Handle a close event from the window manager
-static void wxCloseDialogCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs)
-{
- wxDialog *dialog = (wxDialog *)client_data;
- wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, dialog->GetId());
- closeEvent.SetEventObject(dialog);
-
- // May delete the dialog (with delayed deletion)
- dialog->GetEventHandler()->ProcessEvent(closeEvent);
-}
-
-// TODO: Preferably, we should have a universal repaint proc.
-// Meanwhile, use a special one for dialogs.
-static void wxDialogBoxRepaintProc(Widget w, XtPointer c_data, XEvent *event, char *)
- {
- Window window;
- static XRectangle *xrect;
- Display *display;
- GC gc;
- int llp = 0;
- static int last_count = 0;
- static int draw_count = 0;
-
- wxWindow* win = (wxWindow *)wxWidgetHashTable->Get((long)w);
- if (!win)
- return;
-
- switch(event -> type)
- {
- case Expose :
- window = (Window) win -> GetXWindow();
- display = (Display *) win -> GetXDisplay();
- /* TODO
- gc = (GC) panel -> GetDC() -> gc;
-
- llp = event -> xexpose.count;
-
- if ((last_count == 0) && (llp == 0))
- {
- xrect = new XRectangle[1];
- xrect[0].x = event -> xexpose.x;
- xrect[0].y = event -> xexpose.y;
- xrect[0].width = event -> xexpose.width;
- xrect[0].height = event -> xexpose.height;
-
- XSetClipRectangles(display,gc,0,0,xrect,1,Unsorted);
-// panel->DoPaint(xrect, 1);
- panel->GetEventHandler()->OnPaint();
-
- delete xrect;
- }
-
- if ((last_count == 0) && (llp != 0))
- {
- xrect = new XRectangle[llp + 1];
- draw_count = llp + 1;
-
- xrect[draw_count - llp - 1].x = event -> xexpose.x;
- xrect[draw_count - llp - 1].y = event -> xexpose.y;
- xrect[draw_count - llp - 1].width = event -> xexpose.width;
- xrect[draw_count - llp - 1].height = event -> xexpose.height;
- }
-
- if ((last_count != 0) && (llp != 0))
- {
- xrect[draw_count - llp - 1].x = event -> xexpose.x;
- xrect[draw_count - llp - 1].y = event -> xexpose.y;
- xrect[draw_count - llp - 1].width = event -> xexpose.width;
- xrect[draw_count - llp - 1].height = event -> xexpose.height;
- }
-
- if ((last_count != 0) && (llp == 0))
- {
- xrect[draw_count - llp - 1].x = event -> xexpose.x;
- xrect[draw_count - llp - 1].y = event -> xexpose.y;
- xrect[draw_count - llp - 1].width = event -> xexpose.width;
- xrect[draw_count - llp - 1].height = event -> xexpose.height;
-
- XSetClipRectangles(display,gc,0,0,xrect,draw_count,Unsorted);
-// panel->DoPaint(xrect,draw_count);
- panel->GetEventHandler()->OnPaint();
-
- delete xrect;
- }
- last_count = event -> xexpose.count;
- */
- break;
- default :
- cout << "\n\nNew Event ! is = " << event -> type << "\n";
- break;
- }
- }
-
-static void wxDialogBoxEventHandler (Widget wid,
- XtPointer client_data,
- XEvent* event,
- Boolean *continueToDispatch)
-{
- wxDialog *dialog = (wxDialog *)wxWidgetHashTable->Get((long)wid);
- if (dialog)
- {
- wxMouseEvent wxevent(wxEVT_NULL);
- if (wxTranslateMouseEvent(wxevent, dialog, wid, event))
- {
- wxevent.SetEventObject(dialog);
- wxevent.SetId(dialog->GetId());
- dialog->GetEventHandler()->ProcessEvent(wxevent);
- }
- else
- {
- // An attempt to implement OnCharHook by calling OnCharHook first;
- // if this returns TRUE, set continueToDispatch to False
- // (don't continue processing).
- // Otherwise set it to True and call OnChar.
- wxKeyEvent keyEvent(wxEVENT_TYPE_CHAR);
- if (wxTranslateKeyEvent(keyEvent, dialog, wid, event))
- {
- keyEvent.SetEventObject(dialog);
- keyEvent.SetId(dialog->GetId());
- keyEvent.SetEventType(wxEVT_CHAR_HOOK);
- if (dialog->GetEventHandler()->ProcessEvent(keyEvent))
- {
- *continueToDispatch = False;
- return;
- }
- else
- {
- keyEvent.SetEventType(wxEVT_CHAR);
- dialog->GetEventHandler()->ProcessEvent(keyEvent);
- }
- }
- }
- }
- *continueToDispatch = True;
-}
-
-static void wxUnmapBulletinBoard(Widget dialog, wxDialog *client,XtPointer call)
-{
- /* This gets called when the dialog is being shown, which
- * defeats modal showing.
- client->m_modalShowing = FALSE ;
- client->m_isShown = FALSE;
- */