-
- if (managed)
- XtManageChild (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow);
- XtVaSetValues((Widget) m_drawingArea, XmNresizePolicy, XmRESIZE_NONE, NULL);
-
- /*
- int ww, hh;
- GetClientSize (&ww, &hh);
- wxSizeEvent sizeEvent(wxSize(ww, hh), GetId());
- sizeEvent.SetEventObject(this);
-
- GetEventHandler()->ProcessEvent(sizeEvent);
- */
-
-}
-
-void wxWindow::CanvasSetClientSize (int w, int h)
-{
- Widget drawingArea = (Widget) m_drawingArea;
-
- XtVaSetValues((Widget) m_drawingArea, XmNresizePolicy, XmRESIZE_ANY, NULL);
-
- if (w > -1)
- XtVaSetValues ((Widget) m_drawingArea, XmNwidth, w, NULL);
- if (h > -1)
- XtVaSetValues ((Widget) m_drawingArea, XmNheight, h, NULL);
- /* TODO: is this necessary?
- allowRepainting = FALSE;
-
- XSync (XtDisplay (drawingArea), FALSE);
- XEvent event;
- while (XtAppPending (wxTheApp->appContext))
- {
- XFlush (XtDisplay (drawingArea));
- XtAppNextEvent (wxTheApp->appContext, &event);
- XtDispatchEvent (&event);
- }
- */
-
- XtVaSetValues((Widget) m_drawingArea, XmNresizePolicy, XmRESIZE_NONE, NULL);
-
- /* TODO
- allowRepainting = TRUE;
- DoRefresh ();
- */
-
- /*
- wxSizeEvent sizeEvent(wxSize(w, h), GetId());
- sizeEvent.SetEventObject(this);
-
- GetEventHandler()->ProcessEvent(sizeEvent);
- */
-}
-
-void wxWindow::CanvasGetClientSize (int *w, int *h) const
-{
- // Must return the same thing that was set via SetClientSize
- Dimension xx, yy;
- XtVaGetValues ((Widget) m_drawingArea, XmNwidth, &xx, XmNheight, &yy, NULL);
- *w = xx;
- *h = yy;
-}
-
-void wxWindow::CanvasGetSize (int *w, int *h) const
-{
- Dimension xx, yy;
- if ((Widget) m_borderWidget)
- XtVaGetValues ((Widget) m_borderWidget, XmNwidth, &xx, XmNheight, &yy, NULL);
- else if ((Widget) m_scrolledWindow)
- XtVaGetValues ((Widget) m_scrolledWindow, XmNwidth, &xx, XmNheight, &yy, NULL);
- else
- XtVaGetValues ((Widget) m_drawingArea, XmNwidth, &xx, XmNheight, &yy, NULL);
-
- *w = xx;
- *h = yy;
-}
-
-void wxWindow::CanvasGetPosition (int *x, int *y) const
-{
- Position xx, yy;
- XtVaGetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow, XmNx, &xx, XmNy, &yy, NULL);
-
- // We may be faking the client origin.
- // So a window that's really at (0, 30) may appear
- // (to wxWin apps) to be at (0, 0).
- if (GetParent())
- {
- wxPoint pt(GetParent()->GetClientAreaOrigin());
- xx -= pt.x;
- yy -= pt.y;
- }
-
- *x = xx;
- *y = yy;
-}
-
-// Add to hash table, add event handler
-bool wxWindow::AttachWidget (wxWindow* parent, WXWidget mainWidget,
- WXWidget formWidget, int x, int y, int width, int height)
-{
- wxAddWindowToTable((Widget) mainWidget, this);
- if (CanAddEventHandler())
- {
- XtAddEventHandler((Widget) mainWidget,
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask, // | KeyPressMask,
- False,
- wxPanelItemEventHandler,
- (XtPointer) this);
- }
-
- if (!formWidget)
- {
- XtTranslations ptr;
- XtOverrideTranslations ((Widget) mainWidget,
- ptr = XtParseTranslationTable ("<Configure>: resize()"));
- XtFree ((char *) ptr);
- }
-
- // Some widgets have a parent form widget, e.g. wxRadioBox
- if (formWidget)
- {
- if (!wxAddWindowToTable((Widget) formWidget, this))
- return FALSE;
-
- XtTranslations ptr;
- XtOverrideTranslations ((Widget) formWidget,
- ptr = XtParseTranslationTable ("<Configure>: resize()"));
- XtFree ((char *) ptr);
- }
-
- if (x == -1)
- x = 0;
- if (y == -1)
- y = 0;
- SetSize (x, y, width, height);
-
- return TRUE;
-}
-
-// Remove event handler, remove from hash table
-bool wxWindow::DetachWidget(WXWidget widget)
-{
- if (CanAddEventHandler())
- {
- XtRemoveEventHandler((Widget) widget,
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask, // | KeyPressMask,
- False,
- wxPanelItemEventHandler,
- (XtPointer)this);
- }
-
- wxDeleteWindowFromTable((Widget) widget);
- return TRUE;