Commit eccd9348 authored by Cyril Deguet's avatar Cyril Deguet
Browse files

* beginning of tooltips (only in the console at the moment ;)

parent 77a466e3
......@@ -2,7 +2,7 @@
* text.cpp: Text control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: text.cpp,v 1.10 2003/06/05 22:16:15 asmax Exp $
* $Id: text.cpp,v 1.11 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -121,13 +121,14 @@ extern intf_thread_t *g_pIntf;
//-----------------------------------------------------------------------
// X11 methods
//-----------------------------------------------------------------------
void ScrollingTextTimer( void *data )
bool ScrollingTextTimer( void *data )
{
if( (ControlText *)data != NULL
&& !( (ControlText *)data )->GetSelected() )
{
( (ControlText *)data )->DoScroll();
}
return True;
}
//-----------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_run.cpp,v 1.16 2003/06/06 19:40:37 asmax Exp $
* $Id: x11_run.cpp,v 1.17 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -150,9 +150,10 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
}
void RefreshCallback( void *data )
bool RefreshCallback( void *data )
{
SkinManage( (intf_thread_t*)data );
return True;
}
......
......@@ -2,7 +2,7 @@
* x11_timer.cpp: helper class to implement timers
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_timer.cpp,v 1.1 2003/06/05 22:16:15 asmax Exp $
* $Id: x11_timer.cpp,v 1.2 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -55,9 +55,9 @@ mtime_t X11Timer::getNextDate( mtime_t current )
}
void X11Timer::Execute()
bool X11Timer::Execute()
{
(*_callback)( _data );
return (*_callback)( _data );
}
//---------------------------------------------------------------------------
......@@ -112,6 +112,7 @@ void X11TimerManager::Destroy()
void *X11TimerManager::Thread( void *p_timer )
{
vlc_thread_ready( (vlc_object_t*) p_timer );
while( !((timer_thread_t*)p_timer)->die )
{
list<X11Timer*>::iterator timer;
......@@ -119,11 +120,14 @@ void *X11TimerManager::Thread( void *p_timer )
for( timer = _instance->_timers.begin();
timer != _instance->_timers.end(); timer++ )
{
(*timer)->Execute();
bool ret = (*timer)->Execute();
if( !ret )
{ _instance->_timers.remove( *timer );
break;
}
}
msleep( 100000 );
}
}
#endif
......@@ -2,7 +2,7 @@
* x11_timer.h: helper class to implement timers
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_timer.h,v 1.1 2003/06/05 22:16:15 asmax Exp $
* $Id: x11_timer.h,v 1.2 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -36,7 +36,7 @@ typedef struct
class X11Timer; // forward declaration
typedef void(*callback_t)( void* );
typedef bool(*callback_t)( void* );
//---------------------------------------------------------------------------
class X11Timer
......@@ -53,7 +53,7 @@ class X11Timer
~X11Timer();
mtime_t getNextDate( mtime_t current );
void Execute();
bool Execute();
};
//---------------------------------------------------------------------------
class X11TimerManager
......@@ -74,6 +74,7 @@ class X11TimerManager
void Destroy();
void addTimer( X11Timer *timer ) { _timers.push_back( timer ); }
void removeTimer( X11Timer *timer ) { _timers.remove( timer ); }
};
//---------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_window.cpp,v 1.11 2003/06/07 00:36:28 asmax Exp $
* $Id: x11_window.cpp,v 1.12 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -47,6 +47,10 @@
#include "../src/skin_common.h"
#include "../src/theme.h"
#include "../os_theme.h"
#include "x11_timer.h"
bool ToolTipCallback( void *data );
//---------------------------------------------------------------------------
......@@ -78,24 +82,6 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
CursorPos = new POINT;
WindowPos = new POINT;
// Create Tool Tip Window
ToolTipWindow = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, 0, GetModuleHandle( NULL ), 0);
// Create Tool Tip infos
ToolTipInfo.cbSize = sizeof(TOOLINFO);
ToolTipInfo.uFlags = TTF_SUBCLASS|TTF_IDISHWND;
ToolTipInfo.hwnd = hWnd;
ToolTipInfo.hinst = GetModuleHandle( NULL );
ToolTipInfo.uId = (unsigned int)hWnd;
ToolTipInfo.lpszText = NULL;
ToolTipInfo.rect.left = ToolTipInfo.rect.top = 0;
ToolTipInfo.rect.right = ToolTipInfo.rect.bottom = 0;
SendMessage( ToolTipWindow, TTM_ADDTOOL, 0,
(LPARAM)(LPTOOLINFO) &ToolTipInfo );
*/
if( DragDrop )
......@@ -107,6 +93,9 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
// Create Tool Tip window
ToolTipWindow = XCreateSimpleWindow( display, wnd, 0, 0, 1, 1, 0, 0, 0 );
X11Timer *timer = new X11Timer( p_intf, 100, ToolTipCallback, &ToolTipInfo );
ToolTipInfo.p_intf = p_intf;
ToolTipInfo.timer = timer;
// Double-click handling
ClickedX = 0;
......@@ -369,6 +358,15 @@ void X11Window::Size( int width, int height )
XResizeWindow( display, Wnd, width, height );
}
//---------------------------------------------------------------------------
bool ToolTipCallback( void *data )
{
fprintf(stderr," TOOLTIP: %s\n", ((tooltip_t*)data)->text.c_str());
return False;
}
void X11Window::ChangeToolTipText( string text )
{
if( text == "none" )
......@@ -385,10 +383,10 @@ void X11Window::ChangeToolTipText( string text )
if( text != ToolTipText )
{
ToolTipText = text;
ToolTipInfo.text = text;
X11TimerManager *timerManager = X11TimerManager::Instance( p_intf );
timerManager->addTimer( ToolTipInfo.timer );
// ToolTipInfo.lpszText = (char *)ToolTipText.c_str();
/* SendMessage( ToolTipWindow, TTM_ACTIVATE, 1 , 0 );
SendMessage( ToolTipWindow, TTM_UPDATETIPTEXT, 0,
(LPARAM)(LPTOOLINFO)&ToolTipInfo );*/
}
}
}
......
......@@ -2,7 +2,7 @@
* x11_window.h: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_window.h,v 1.3 2003/06/07 00:36:28 asmax Exp $
* $Id: x11_window.h,v 1.4 2003/06/07 12:19:23 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -29,10 +29,21 @@
//--- X11 -------------------------------------------------------------------
#include <X11/Xlib.h>
#include "x11_timer.h"
//---------------------------------------------------------------------------
class Graphics;
class Event;
typedef struct
{
intf_thread_t *p_intf;
X11Timer *timer;
string text;
} tooltip_t;
//---------------------------------------------------------------------------
class X11Window : public SkinWindow
{
......@@ -52,7 +63,7 @@ class X11Window : public SkinWindow
// Tooltip texts
Window ToolTipWindow;
// TOOLINFO ToolTipInfo;
tooltip_t ToolTipInfo;
// Double-click handling
int ClickedX;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment