Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

x11_tooltip.cpp

00001 /*****************************************************************************
00002  * x11_tooltip.cpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: x11_tooltip.cpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
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
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #ifdef X11_SKINS
00026 
00027 #include "../src/generic_window.hpp"
00028 #include "x11_display.hpp"
00029 #include "x11_graphics.hpp"
00030 #include "x11_tooltip.hpp"
00031 
00032 X11Tooltip::X11Tooltip( intf_thread_t *pIntf,
00033                                    X11Display &rDisplay ):
00034     OSTooltip( pIntf ), m_rDisplay( rDisplay )
00035 {
00036     Window root = DefaultRootWindow( XDISPLAY );
00037     XSetWindowAttributes attr;
00038     // Bypass the window manager
00039     attr.override_redirect = True;
00040 
00041     // Create the window
00042     m_wnd = XCreateWindow( XDISPLAY, root, 0, 0, 1, 1, 0, 0,
00043                            InputOutput, CopyFromParent, CWOverrideRedirect,
00044                            &attr );
00045 
00046     // Set the colormap for 8bpp mode
00047     if( XPIXELSIZE == 1 )
00048     {
00049         XSetWindowColormap( XDISPLAY, m_wnd, m_rDisplay.getColormap() );
00050     }
00051 }
00052 
00053 
00054 X11Tooltip::~X11Tooltip()
00055 {
00056     XDestroyWindow( XDISPLAY, m_wnd );
00057 }
00058 
00059 
00060 void X11Tooltip::show( int left, int top, OSGraphics &rText )
00061 {
00062     // Source drawable
00063     Drawable src = ((X11Graphics&)rText).getDrawable();
00064     int width = rText.getWidth();
00065     int height = rText.getHeight();
00066 
00067     XMoveResizeWindow( XDISPLAY, m_wnd, left, top, width, height );
00068     // Show the window
00069     XMapRaised( XDISPLAY, m_wnd );
00070     // Move it again if the window manager forgets the position
00071     XMoveWindow( XDISPLAY, m_wnd, left, top );
00072     XCopyArea( XDISPLAY, src, m_wnd, XGC, 0, 0, width, height, 0, 0 );
00073 }
00074 
00075 
00076 void X11Tooltip::hide()
00077 {
00078     // Unmap the window
00079     XUnmapWindow( XDISPLAY, m_wnd );
00080 }
00081 
00082 
00083 #endif

Generated on Tue Dec 20 10:14:44 2005 for vlc-0.8.4a by  doxygen 1.4.2