skins2: add OS/2 support
[vlc.git] / modules / gui / skins2 / os2 / os2_tooltip.cpp
blob6b6e4c9b2aca5f9c14049404f68c74b7643c5b5e
1 /*****************************************************************************
2 * os2_tooltip.cpp
3 *****************************************************************************
4 * Copyright (C) 2003, 2013 the VideoLAN team
6 * Authors: Cyril Deguet <asmax@via.ecp.fr>
7 * Olivier Teulière <ipkiss@via.ecp.fr>
8 * KO Myung-Hun <komh@chollian.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifdef OS2_SKINS
27 #include "os2_tooltip.hpp"
28 #include "os2_graphics.hpp"
29 #include "../src/generic_window.hpp"
31 OS2Tooltip::OS2Tooltip( intf_thread_t *pIntf, HMODULE hInst,
32 HWND hParentWindow ):
33 OSTooltip( pIntf )
35 // Create the window
36 ULONG flFrame = FCF_SHELLPOSITION;
37 m_hWnd = WinCreateStdWindow( HWND_DESKTOP,
38 WS_DISABLED,
39 &flFrame,
40 "SkinWindowClass",
41 "tooltip",
43 hInst,
45 &m_hWndClient );
47 if( !m_hWnd )
49 msg_Err( getIntf(), "createWindow failed" );
54 OS2Tooltip::~OS2Tooltip()
56 if( m_hWnd )
57 WinDestroyWindow( m_hWnd );
61 void OS2Tooltip::show( int left, int top, OSGraphics &rText )
63 // Source drawable
64 HPS hpsSrc = ((OS2Graphics&)rText).getPS();
65 int width = rText.getWidth();
66 int height = rText.getHeight();
68 RECTL rclParent;
70 WinQueryWindowRect( WinQueryWindow( m_hWnd, QW_PARENT ), &rclParent );
72 // Find bottom and invert it
73 int bottom = ( rclParent.yTop - 1 ) - ( top + height - 1 );
75 // Set the window on top, resize it, and show it
76 WinSetWindowPos( m_hWnd, HWND_TOP, left, bottom, width, height,
77 SWP_ZORDER | SWP_MOVE | SWP_SIZE | SWP_SHOW );
79 HPS hps = WinGetPS( m_hWnd );
80 POINTL aptl[] = {{ 0, 0 }, { width, height }, { 0, 0 }};
81 GpiBitBlt( hps, hpsSrc, 3, aptl, ROP_SRCCOPY, BBO_IGNORE );
82 WinReleasePS( hps );
86 void OS2Tooltip::hide()
88 WinShowWindow( m_hWnd, FALSE );
92 #endif