+void wxScrollBar::ChangeFont(bool WXUNUSED(keepOriginalSize))
+{
+ // TODO
+ // Do anything for a scrollbar? A font will never be seen.
+}
+
+void wxScrollBar::ChangeBackgroundColour()
+{
+ wxWindow::ChangeBackgroundColour();
+
+ XtVaSetValues ((Widget) GetMainWidget(),
+ XmNtroughColor, m_backgroundColour.AllocColour(XtDisplay((Widget) GetMainWidget())),
+ NULL);
+}
+
+static void wxScrollBarCallback(Widget widget, XtPointer clientData,
+ XmScaleCallbackStruct *cbs)
+{
+ wxScrollBar *scrollBar = (wxScrollBar*)wxGetWindowFromTable(widget);
+ wxCHECK_RET( scrollBar, wxT("invalid widget in scrollbar callback") );
+
+ wxOrientation orientation = (wxOrientation)wxPtrToUInt(clientData);
+ wxEventType eventType = wxEVT_NULL;
+
+ switch (cbs->reason)
+ {
+ case XmCR_INCREMENT:
+ {
+ eventType = wxEVT_SCROLL_LINEDOWN;
+ break;
+ }
+ case XmCR_DECREMENT:
+ {
+ eventType = wxEVT_SCROLL_LINEUP;
+ break;
+ }
+ case XmCR_DRAG:
+ {
+ eventType = wxEVT_SCROLL_THUMBTRACK;
+ break;
+ }
+ case XmCR_VALUE_CHANGED:
+ {
+ eventType = wxEVT_SCROLL_THUMBRELEASE;
+ break;
+ }
+ case XmCR_PAGE_INCREMENT:
+ {
+ eventType = wxEVT_SCROLL_PAGEDOWN;
+ break;
+ }
+ case XmCR_PAGE_DECREMENT:
+ {
+ eventType = wxEVT_SCROLL_PAGEUP;
+ break;
+ }
+ case XmCR_TO_TOP:
+ {
+ eventType = wxEVT_SCROLL_TOP;
+ break;
+ }
+ case XmCR_TO_BOTTOM:
+ {
+ eventType = wxEVT_SCROLL_BOTTOM;
+ break;
+ }
+ default:
+ {
+ // Should never get here
+ wxFAIL_MSG("Unknown scroll event.");
+ break;
+ }
+ }
+
+ wxScrollEvent event(eventType, scrollBar->GetId(),
+ cbs->value, orientation);
+ event.SetEventObject(scrollBar);
+ scrollBar->HandleWindowEvent(event);
+}