1 /*****************************************************************************
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 *****************************************************************************/
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
,
36 ULONG flFrame
= FCF_SHELLPOSITION
;
37 m_hWnd
= WinCreateStdWindow( HWND_DESKTOP
,
49 msg_Err( getIntf(), "createWindow failed" );
54 OS2Tooltip::~OS2Tooltip()
57 WinDestroyWindow( m_hWnd
);
61 void OS2Tooltip::show( int left
, int top
, OSGraphics
&rText
)
64 HPS hpsSrc
= ((OS2Graphics
&)rText
).getPS();
65 int width
= rText
.getWidth();
66 int height
= rText
.getHeight();
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
);
86 void OS2Tooltip::hide()
88 WinShowWindow( m_hWnd
, FALSE
);