tooltip.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * tooltip.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: b50f540c7d03161bc14c9ba59944858f7766b72b $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef TOOLTIP_HPP
00026 #define TOOLTIP_HPP
00027 
00028 #include "../utils/var_text.hpp"
00029 #include "../commands/cmd_generic.hpp"
00030 
00031 class GenericFont;
00032 class OSTooltip;
00033 class OSTimer;
00034 class OSGraphics;
00035 class UString;
00036 
00037 
00038 class Tooltip: public SkinObject, public Observer<VarText>
00039 {
00040 public:
00041     /// Create a tooltip with the given font and delay (in milliseconds)
00042     Tooltip( intf_thread_t *pIntf, const GenericFont &rFont, int delay );
00043 
00044     virtual ~Tooltip();
00045 
00046     /// Draw the tooltip and show it after the delay
00047     void show();
00048 
00049     /// Hide the tooltip and cancel the timer if a tooltip is waiting for
00050     /// display
00051     void hide();
00052 
00053 private:
00054     /// Font
00055     const GenericFont &m_rFont;
00056     /// Delay before popping the tooltip
00057     int m_delay;
00058     /// Timer to wait before showing the tooltip
00059     OSTimer *m_pTimer;
00060     /// OS specific tooltip window
00061     OSTooltip *m_pOsTooltip;
00062     /// Image of the tooltip
00063     OSGraphics *m_pImage;
00064     /// Position of the tooltip
00065     int m_xPos, m_yPos;
00066 
00067     /// Method called when the observed variable is modified
00068     virtual void onUpdate( Subject<VarText> &rVariable, void * );
00069 
00070     /// Display text of the tooltip
00071     void displayText( const UString &rText );
00072 
00073     /// Build m_pImage with the given text
00074     void makeImage( const UString &rText );
00075 
00076     /// Callback to show the tooltip window
00077     DEFINE_CALLBACK( Tooltip, Show );
00078 };
00079 
00080 
00081 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6