1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2006 - Stefan Kueng
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 * Helper class to show a tooltip for e.g. a scrollbar while it is dragged.
25 * In the OnVScroll() message handler
29 * case SB_THUMBPOSITION:
30 * m_ScrollTool.Clear();
33 * m_ScrollTool.Init(&thumbpoint);
34 * m_ScrollTool.SetText(&thumbpoint, _T("Line: %*ld"), maxchars, nTrackPos);
39 class CScrollTool
: public CWnd
46 * Initializes the tooltip control.
47 * \param pos the position in screen coordinates where the tooltip should be shown
48 * \param bRightAligned if set to true, the tooltip is right aligned with pos,
49 * depending on the text width shown in the tooltip
51 bool Init(LPPOINT pos
, bool bRightAligned
= false);
53 * Sets the text which should be shown in the tooltip.
54 * \param pos the position in screen coordinates where the tooltip should be shown
55 * \fmt a format string
57 void SetText(LPPOINT pos
, const TCHAR
* fmt
, ...);
59 * Removes the tooltip control.
63 * Returns the width of \c szText in pixels for the tooltip control
65 LONG
GetTextWidth(LPCTSTR szText
);
67 virtual ~CScrollTool();