+// Helper function
+void wxWindow::CreateScrollbar(int orientation)
+{
+ if (!m_drawingArea)
+ return;
+
+ XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_NONE, NULL);
+
+ // Add scrollbars if required
+ if (orientation == wxHORIZONTAL)
+ {
+ Widget hScrollBar = XtVaCreateManagedWidget ("hsb",
+ xmScrollBarWidgetClass, (Widget) m_scrolledWindow,
+ XmNorientation, XmHORIZONTAL,
+ NULL);
+ // XtAddCallback (hScrollBar, XmNvalueChangedCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+ XtAddCallback (hScrollBar, XmNdragCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+ XtAddCallback (hScrollBar, XmNincrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+ XtAddCallback (hScrollBar, XmNdecrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+ XtAddCallback (hScrollBar, XmNpageIncrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+ XtAddCallback (hScrollBar, XmNpageDecrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+ XtAddCallback (hScrollBar, XmNtoTopCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+ XtAddCallback (hScrollBar, XmNtoBottomCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmHORIZONTAL);
+
+ XtVaSetValues (hScrollBar,
+ XmNincrement, 1,
+ XmNvalue, 0,
+ NULL);
+
+ m_hScrollBar = (WXWidget) hScrollBar;
+
+ wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ DoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
+
+ XtRealizeWidget(hScrollBar);
+
+ XtVaSetValues((Widget) m_scrolledWindow,
+ XmNhorizontalScrollBar, (Widget) m_hScrollBar,
+ NULL);
+
+ m_hScroll = TRUE;
+ }
+
+ if (orientation == wxVERTICAL)
+ {
+ Widget vScrollBar = XtVaCreateManagedWidget ("vsb",
+ xmScrollBarWidgetClass, (Widget) m_scrolledWindow,
+ XmNorientation, XmVERTICAL,
+ NULL);
+ // XtAddCallback (vScrollBar, XmNvalueChangedCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+ XtAddCallback (vScrollBar, XmNdragCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+ XtAddCallback (vScrollBar, XmNincrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+ XtAddCallback (vScrollBar, XmNdecrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+ XtAddCallback (vScrollBar, XmNpageIncrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+ XtAddCallback (vScrollBar, XmNpageDecrementCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+ XtAddCallback (vScrollBar, XmNtoTopCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+ XtAddCallback (vScrollBar, XmNtoBottomCallback, (XtCallbackProc) wxScrollBarCallback, (XtPointer) XmVERTICAL);
+
+ XtVaSetValues (vScrollBar,
+ XmNincrement, 1,
+ XmNvalue, 0,
+ NULL);
+
+ m_vScrollBar = (WXWidget) vScrollBar;
+ wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ DoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
+
+ XtRealizeWidget(vScrollBar);
+
+ XtVaSetValues((Widget) m_scrolledWindow,
+ XmNverticalScrollBar, (Widget) m_vScrollBar,
+ NULL);
+
+ m_vScroll = TRUE;
+ }
+
+ XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_ANY, NULL);
+}
+void wxWindow::DestroyScrollbar(int orientation)
+{
+ if (!m_drawingArea)
+ return;
+
+ XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_NONE, NULL);
+ // Add scrollbars if required
+ if (orientation == wxHORIZONTAL)
+ {
+ if (m_hScrollBar)
+ {
+ XtDestroyWidget((Widget) m_hScrollBar);
+ }
+ m_hScrollBar = (WXWidget) 0;
+ m_hScroll = FALSE;
+
+ XtVaSetValues((Widget) m_scrolledWindow,
+ XmNhorizontalScrollBar, (Widget) 0,
+ NULL);
+
+ }
+
+ if (orientation == wxVERTICAL)
+ {
+ if (m_vScrollBar)
+ {
+ XtDestroyWidget((Widget) m_vScrollBar);
+ }
+ m_vScrollBar = (WXWidget) 0;
+ m_vScroll = TRUE;
+
+ XtVaSetValues((Widget) m_scrolledWindow,
+ XmNverticalScrollBar, (Widget) 0,
+ NULL);
+
+ }
+ XtVaSetValues((Widget) m_scrolledWindow, XmNresizePolicy, XmRESIZE_ANY, NULL);