* text.cpp: Text control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: text.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
+ * $Id: text.cpp,v 1.10 2003/06/05 22:16:15 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
+ * Cyril Deguet <asmax@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------
-#include "os_api.h"
-#include "bitmap.h"
-#include "banks.h"
-#include "graphics.h"
-#include "os_graphics.h"
-#include "font.h"
+#include "../os_api.h"
+#include "../src/bitmap.h"
+#include "../src/banks.h"
+#include "../src/graphics.h"
+#include "../os_graphics.h"
+#include "../src/font.h"
+#include "../os_font.h"
#include "generic.h"
#include "text.h"
-#include "event.h"
-#include "theme.h"
-#include "window.h"
-#include "os_window.h"
-#include "skin_common.h"
+#include "../src/event.h"
+#include "../src/theme.h"
+#include "../src/window.h"
+#include "../os_window.h"
+#include "../src/skin_common.h"
+
+#ifdef X11_SKINS
+#include "../x11/x11_timer.h"
+extern intf_thread_t *g_pIntf;
+#endif
// Scrolling : one for each OS
//---------------------------------------------------------------------------
+ #if defined( WIN32 )
//-----------------------------------------------------------------------
// Win32 methods
//-----------------------------------------------------------------------
- #if defined( WIN32 )
void CALLBACK ScrollingTextTimer( HWND hwnd, UINT uMsg, UINT_PTR idEvent,
DWORD dwTime )
{
}
//-----------------------------------------------------------------------
+ #elif defined GTK2_SKINS
+
+ //-----------------------------------------------------------------------
+ // Gtk2 methods
+ //-----------------------------------------------------------------------
+ gboolean ScrollingTextTimer( gpointer data )
+ {
+ if( (ControlText *)data != NULL )
+ {
+ if( !( (ControlText *)data )->IsScrolling() )
+ return false;
+
+ if( !( (ControlText *)data )->GetSelected() )
+ ( (ControlText *)data )->DoScroll();
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ //-----------------------------------------------------------------------
+ void ControlText::StartScrolling()
+ {
+ g_timeout_add( 100, (GSourceFunc)ScrollingTextTimer, (gpointer)this );
+ }
+ //-----------------------------------------------------------------------
+ void ControlText::StopScrolling()
+ {
+ }
+ //-----------------------------------------------------------------------
+
+ #elif defined X11_SKINS
+
+ //-----------------------------------------------------------------------
+ // X11 methods
+ //-----------------------------------------------------------------------
+ void ScrollingTextTimer( void *data )
+ {
+ if( (ControlText *)data != NULL
+ && !( (ControlText *)data )->GetSelected() )
+ {
+ ( (ControlText *)data )->DoScroll();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ void ControlText::StartScrolling()
+ {
+ X11Timer *timer = new X11Timer( g_pIntf, 100000, ScrollingTextTimer,
+ (void*)this );
+ X11TimerManager *timerManager = X11TimerManager::Instance( g_pIntf );
+ timerManager->addTimer( timer );
+ }
+ //-----------------------------------------------------------------------
+ void ControlText::StopScrolling()
+ {
+ }
+ //-----------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
ControlText::ControlText( string id, bool visible, int x, int y, string text,
string font, int align, int width, string display, bool scroll,
- int scrollspace, string help, Window *Parent )
+ int scrollspace, string help, SkinWindow *Parent )
: GenericControl( id, visible, help, Parent )
{
InitLeft = x;
}
else if( Scroll && TextWidth <= Width )
{
- StopScrolling();
Scroll = false;
+ StopScrolling();
}
}
//---------------------------------------------------------------------------
Height = h;
// Set position wether alignment
- if( Align == DT_CENTER )
+ if( Align == VLC_FONT_ALIGN_CENTER )
{
Left = InitLeft - Width / 2;
TextLeft = InitLeft - TextWidth / 2;
}
- else if( Align == DT_RIGHT )
+ else if( Align == VLC_FONT_ALIGN_RIGHT )
{
Left = InitLeft - Width;
TextLeft = InitLeft - TextWidth;
if( TextClipRgn != NULL )
delete TextClipRgn;
- TextClipRgn = (Region *)new OSRegion( Left, Top, Width, Height );
+ TextClipRgn = (SkinRegion *)new OSRegion( Left, Top, Width, Height );
}
//---------------------------------------------------------------------------
}
// Reset clipping region to old region
- Region *destClipRgn = (Region *)new OSRegion( 0, 0, w, h );
+ SkinRegion *destClipRgn = (SkinRegion *)new OSRegion( 0, 0, w, h );
dest->SetClipRegion( destClipRgn );
delete destClipRgn;
TextClipRgn->Move( x, y );