]> git.sesse.net Git - vlc/commitdiff
* SkinManage is called by a timer
authorEmmanuel Puig <karibu@videolan.org>
Thu, 17 Apr 2003 13:08:02 +0000 (13:08 +0000)
committerEmmanuel Puig <karibu@videolan.org>
Thu, 17 Apr 2003 13:08:02 +0000 (13:08 +0000)
* Timer for text control are working badly but it's the first step

modules/gui/skins/controls/button.cpp
modules/gui/skins/controls/text.cpp
modules/gui/skins/controls/text.h
modules/gui/skins/gtk2/gtk2_run.cpp

index 81d29ddc82ba5fc5eaff0982847cc87448025217..5a7dacd04c264dafaaa76c79f9441cae7cb601cd 100644 (file)
@@ -2,7 +2,7 @@
  * button.cpp: Button control
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: button.cpp,v 1.9 2003/04/16 21:40:07 ipkiss Exp $
+ * $Id: button.cpp,v 1.10 2003/04/17 13:08:02 karibu Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -135,6 +135,8 @@ void ControlButton::Draw( int x, int y, int w, int h, Graphics *dest )
 bool ControlButton::MouseUp( int x, int y, int button )
 {
     // If hit in the button
+
+
     if( Img[1]->Hit( x - Left, y - Top ) )
     {
         if( !Enabled )
index 79dacd68484cab522953698bcd13d664c60fcb42..401ee8ea218cc7404e6319e77daa317a5892613b 100644 (file)
@@ -2,7 +2,7 @@
  * text.cpp: Text control
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: text.cpp,v 1.3 2003/04/16 21:40:07 ipkiss Exp $
+ * $Id: text.cpp,v 1.4 2003/04/17 13:08:02 karibu Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
     //-----------------------------------------------------------------------
 
     #else
+
     //-----------------------------------------------------------------------
     // Gtk2 methods
     //-----------------------------------------------------------------------
+    gboolean ScrollingTextTimer( gpointer data )
+    {
+        if( (ControlText *)data != NULL )
+        {
+            if( !( (ControlText *)data )->IsScrolling() )
+                return false;
+
+            /* FIXME
+            if( !( (ControlText *)data )->GetSelected() )
+               ( (ControlText *)data )->DoScroll();
+            */
+
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+    //-----------------------------------------------------------------------
     void ControlText::StartScrolling()
     {
-/* FIXME: kluge */
- /*       SetTimer( ( (Win32Window *)ParentWindow )->GetHandle(), (UINT_PTR)this,
-                  100, (TIMERPROC)ScrollingTextTimer );*/
+        g_timeout_add( 100, (GSourceFunc)ScrollingTextTimer, (gpointer)this );
     }
     //-----------------------------------------------------------------------
     void ControlText::StopScrolling()
     {
-/*        KillTimer( ( (Win32Window *)ParentWindow )->GetHandle(),
-                   (UINT_PTR)this );*/
     }
     //-----------------------------------------------------------------------
 
@@ -173,8 +190,8 @@ void ControlText::SetScrolling()
     }
     else if( Scroll && TextWidth <= Width )
     {
-        StopScrolling();
         Scroll = false;
+        StopScrolling();
     }
 }
 //---------------------------------------------------------------------------
index ec4d4b1c6ec15b770bbd1f4d6be247ad0f8cc29c..06d7c75f197f00f311a5b186eaeeb2f6a361aa46 100644 (file)
@@ -2,7 +2,7 @@
  * text.h: Text control
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: text.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
+ * $Id: text.h,v 1.2 2003/04/17 13:08:02 karibu Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -106,8 +106,9 @@ class ControlText : public GenericControl
         // Keep on scrolling
         void DoScroll();
 
-        // To avoid auto scrolling when manual scrolling
+        // Getters
         bool GetSelected() { return Selected; };
+        bool IsScrolling() { return Scroll; };
 };
 //---------------------------------------------------------------------------
 
index 7d3f5f4720b90eeb42f227be0a103f73e2a6459f..cdd063f04b49ff7ac24d1ed360e488f60b356862 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_run.cpp,v 1.11 2003/04/16 21:40:07 ipkiss Exp $
+ * $Id: gtk2_run.cpp,v 1.12 2003/04/17 13:08:02 karibu Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -63,12 +63,12 @@ int  SkinManage( intf_thread_t *p_intf );
 //---------------------------------------------------------------------------
 // REFRESH TIMER CALLBACK
 //---------------------------------------------------------------------------
-/*void CALLBACK RefreshTimer( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime )
+gboolean RefreshTimer( gpointer data )
 {
-    intf_thread_t *p_intf = (intf_thread_t *)GetWindowLongPtr( hwnd,
-        GWLP_USERDATA );
+    intf_thread_t *p_intf = (intf_thread_t *)data;
     SkinManage( p_intf );
-}*/
+    return true;
+}
 //---------------------------------------------------------------------------
 
 //---------------------------------------------------------------------------
@@ -191,7 +191,6 @@ void GTK2Proc( GdkEvent *event, gpointer data )
 //---------------------------------------------------------------------------
 
 
-
 //---------------------------------------------------------------------------
 // GTK2 interface
 //---------------------------------------------------------------------------
@@ -205,6 +204,9 @@ void OSRun( intf_thread_t *p_intf )
     // Set event callback
     gdk_event_handler_set( GTK2Proc, (gpointer)callbackobj, NULL );
 
+    // Add timer
+    g_timeout_add( 200, (GSourceFunc)RefreshTimer, (gpointer)p_intf );
+
     // Main event loop
     g_main_loop_run( callbackobj->Loop );