]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/scrolbar.cpp
added wxGetMultiChoice() (which refuses to work for some reason - will fix
[wxWidgets.git] / src / motif / scrolbar.cpp
index c1ab7edb9f876cbdfdf44fccfa9620c73ed5f171..655353e458cbe6eb037757b43620e49e6db85938 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     17/09/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 
 #include "wx/scrolbar.h"
 
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
 #include <X11/IntrinsicP.h>
 #include <Xm/Xm.h>
 #include <Xm/RowColumn.h>
 #include <Xm/ScrollBar.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
 
-#include <wx/motif/private.h>
+#include "wx/motif/private.h"
 
 static void wxScrollBarCallback(Widget widget, XtPointer clientData,
                         XmScaleCallbackStruct *cbs);
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
-#endif
 
 // Scrollbar
 bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
@@ -43,13 +47,13 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
     m_backgroundColour = parent->GetBackgroundColour();
     m_foregroundColour = parent->GetForegroundColour();
     SetValidator(validator);
-    
+
     m_windowStyle = style;
 
     if ( id == -1 )
-           m_windowId = (int)NewControlId();
+        m_windowId = (int)NewControlId();
     else
-           m_windowId = id;
+        m_windowId = id;
 
     int x = pos.x;
     int y = pos.y;
@@ -81,8 +85,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
 
     m_mainWidget = (Widget) scrollBarWidget;
 
-    // This will duplicate other events
-    //    XtAddCallback(scrollBarWidget, XmNvalueChangedCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
+    XtAddCallback(scrollBarWidget, XmNvalueChangedCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
     XtAddCallback(scrollBarWidget, XmNdragCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
     XtAddCallback(scrollBarWidget, XmNdecrementCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
     XtAddCallback(scrollBarWidget, XmNincrementCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
@@ -126,7 +129,7 @@ int wxScrollBar::GetThumbPosition() const
 }
 
 void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
-    bool refresh)
+    bool WXUNUSED(refresh))
 {
     m_viewSize = pageSize;
     m_pageSize = thumbSize;
@@ -152,7 +155,7 @@ void wxScrollBar::Command(wxCommandEvent& event)
     ProcessCommand(event);
 }
 
-void wxScrollBar::ChangeFont(bool keepOriginalSize)
+void wxScrollBar::ChangeFont(bool WXUNUSED(keepOriginalSize))
 {
     // TODO
     // Do anything for a scrollbar? A font will never be seen.
@@ -161,6 +164,10 @@ void wxScrollBar::ChangeFont(bool keepOriginalSize)
 void wxScrollBar::ChangeBackgroundColour()
 {
     wxWindow::ChangeBackgroundColour();
+
+    XtVaSetValues ((Widget) GetMainWidget(),
+        XmNtroughColor, m_backgroundColour.AllocColour(XtDisplay((Widget) GetMainWidget())),
+        NULL);
 }
 
 void wxScrollBar::ChangeForegroundColour()
@@ -168,12 +175,12 @@ void wxScrollBar::ChangeForegroundColour()
     wxWindow::ChangeForegroundColour();
 }
 
-static void wxScrollBarCallback(Widget widget, XtPointer clientData,
+static void wxScrollBarCallback(Widget WXUNUSED(widget), XtPointer clientData,
                         XmScaleCallbackStruct *cbs)
 {
     wxScrollBar *scrollBar = (wxScrollBar *)clientData;
-
     wxEventType eventType = wxEVT_NULL;
+
     switch (cbs->reason)
     {
         case XmCR_INCREMENT:
@@ -193,9 +200,7 @@ static void wxScrollBarCallback(Widget widget, XtPointer clientData,
         }
         case XmCR_VALUE_CHANGED:
         {
-            // TODO: Should this be intercepted too, or will it cause
-            // duplicate events?
-            eventType = wxEVT_SCROLL_THUMBTRACK;
+            eventType = wxEVT_SCROLL_THUMBRELEASE;
             break;
         }
         case XmCR_PAGE_INCREMENT: