]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins/controls/slider.cpp
* ./modules/gui/skins/gtk2/gtk2_run.cpp: fixed compilation of the
[vlc] / modules / gui / skins / controls / slider.cpp
index 1aabad4370ecfc39c78bc958887814ceb4865750..75663268968d7e0a1a1396a2bd03c531eaf6bc42 100644 (file)
@@ -2,7 +2,7 @@
  * slider.cpp: Slider control
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: slider.cpp,v 1.4 2003/04/16 21:40:07 ipkiss Exp $
+ * $Id: slider.cpp,v 1.9 2003/04/28 12:25:34 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -52,7 +52,7 @@
 //---------------------------------------------------------------------------
 ControlSlider::ControlSlider( string id, bool visible, string type,
     string cursorUp, string cursorDown, double *ptx, double *pty, int nb,
-    string tooltiptext, string help, Window *Parent )
+    string tooltiptext, string help, SkinWindow *Parent )
     : GenericControl( id, visible, help, Parent )
 {
     Type             = type;
@@ -78,12 +78,7 @@ ControlSlider::~ControlSlider()
 {
     delete[] CursorX;
     delete[] CursorY;
-/* FIXME: kludge */
-#ifdef WIN32    
-    DeleteObject( HitRgn );
-#else
-  fprintf(stderr, "WARNING: fixme in slider.cpp!!!!!");
-#endif
+    delete (OSRegion *)HitRgn;
 }
 //---------------------------------------------------------------------------
 void ControlSlider::Init()
@@ -126,7 +121,7 @@ void ControlSlider::Init()
         delete Curve;
 
     // Create Hit Region
-    HitRgn = (Region *)new OSRegion;
+    HitRgn = (SkinRegion *)new OSRegion;
 
     // Create slider hit region and move cursor inside control
     for( i = 0; i <= MaxValue; i++ )
@@ -320,6 +315,30 @@ bool ControlSlider::MouseOver( int x, int y )
         return false;
 }
 //---------------------------------------------------------------------------
+bool ControlSlider::MouseScroll( int x, int y, int direction )
+{
+    if( !Enabled || !MouseOver( x, y ) )
+        return false;
+
+    int val = Value;
+    switch( direction )
+    {
+        case MOUSE_SCROLL_DOWN:
+            if( val > 0 ) val--;
+            break;
+
+        case MOUSE_SCROLL_UP:
+            if( val < MaxValue ) val++;
+            break;
+    }
+
+    MoveCursor( val );
+    UpdateEvent->SetParam2( GetCursorPosition() );
+    UpdateEvent->SendEvent();
+
+    return true;
+}
+//---------------------------------------------------------------------------
 bool ControlSlider::ToolTipTest( int x, int y )
 {
     if( MouseOver( x, y ) )