1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
21 #include "gradient.h"
\r
22 #include "htmlformatter.h"
\r
26 #define BALLOON_ANCHOR 0x0001
\r
27 #define BALLOON_SHADOW 0x0002
\r
28 #define BALLOON_ROUNDED 0x0004
\r
29 #define BALLOON_RSA 0x0007
\r
30 #define BALLOON_VCENTER_ALIGN 0x0008
\r
31 #define BALLOON_BOTTOM_ALIGN 0x0010
\r
32 #define BALLOON_CLOSEBUTTON 0x0020
\r
35 #define BALLOON_MULTIPLE_SHOW 0x0001 //Multiple show for single control
\r
36 #define BALLOON_TRACK_MOUSE 0x0002 //ToolTip follows the mouse cursor
\r
37 #define BALLOON_DIALOG 0x0004 //Shown as a dialog instead of a tooltip
\r
38 #define BALLOON_DIALOG_DESTROY 0x0008 //delete the object after window is destroyed. Use carefully!
\r
41 #define BALLOON_MASK_STYLES 0x0001 //The styles for the tooltip gets from the structures
\r
42 #define BALLOON_MASK_EFFECT 0x0002 //The background's type for the tooltip gets from the structures
\r
43 #define BALLOON_MASK_COLORS 0x0004 //The background's colors for the tooltip gets from the structures
\r
44 #define BALLOON_MASK_DIRECTION 0x0008 //The align for the tooltip gets from the structures
\r
45 #define BALLOON_MASK_BEHAVIOUR 0x0010 //The behavior for the tooltip gets from the structures
\r
49 * BALLOON_INFO structure.
\r
51 typedef struct tagBALLOON_INFO
\r
53 HICON hIcon; ///<The icon of the tooltip
\r
54 CString sBalloonTip; ///<The string of the tooltip
\r
55 UINT nMask; ///<The mask
\r
56 UINT nStyles; ///<The tool tip's styles
\r
57 UINT nDirection; ///<Direction display the tooltip relate cursor point
\r
58 UINT nEffect; ///<The color's type or effects
\r
59 UINT nBehaviour; ///<The tool tip's behavior
\r
60 COLORREF crBegin; ///<Begin Color
\r
61 COLORREF crMid; ///<Mid Color
\r
62 COLORREF crEnd; ///<End Color
\r
64 tagBALLOON_INFO(); ///<proper initialization of all members
\r
69 * This structure is sent to with the notify messages.
\r
71 typedef struct tagNM_BALLOON_DISPLAY {
\r
76 } NM_BALLOON_DISPLAY;
\r
78 #define BALLOON_CLASSNAME _T("CBalloon") // Window class name
\r
79 #define UDM_TOOLTIP_FIRST (WM_USER + 100)
\r
80 #define UDM_TOOLTIP_DISPLAY (UDM_TOOLTIP_FIRST) //User has changed the data
\r
84 * Shows Balloons with info text in it. Either as Tooltips or as modeless dialog boxes.
\r
85 * Several options are available to customize the look and behavior of the balloons.
\r
86 * Since this class inherits CHTMLFormatter you can use all the tags CHTMLFormatter
\r
87 * provides to format the text.
\r
88 * Please refer to the documentation of the methods for details.\n
\r
89 * \image html "balloon_box.jpg"
\r
90 * \image html "balloon_tooltip.jpg"
\r
92 * To use the dialog balloons just call the static methods:
\r
94 * CWnd* ctrl = GetDlgItem(IDC_EDITBOX);
\r
96 * ctrl->GetWindowRect(rt);
\r
97 * CPoint point = CPoint((rt.left+rt.right)/2, (rt.top+rt.bottom)/2);
\r
98 * CBalloon::ShowBalloon(NULL, point,
\r
99 * "this is a <b>Message Balloon</b>\n<hr=100%>\n<ct=0x0000FF>Warning! Warning!</ct>\nSomething unexpected happened",
\r
100 * TRUE, IDI_EXCLAMATION);
\r
103 * To use the tooltips, declare an object of CBalloon as a member of your dialog class:
\r
105 * CBalloon m_tooltips;
\r
107 * In your OnInitDialog() method add the tooltips and modify them as you like:
\r
109 * m_tooltips.Create(this); //initializes the tooltips
\r
110 * m_tooltips.AddTool(IDC_BUTTON, "this button does nothing");
\r
111 * m_tooltips.AddTool(IDC_EDITBOX, "enter a value here", IDI_ICON);
\r
112 * m_tooltips.SetEffectBk(GetDlgItem(IDC_EDITBOX), CBalloon::BALLOON_EFFECT_HGRADIENT); //only affects the edit box tooltip
\r
113 * m_tooltips.SetGradientColors(0x80ffff, 0x000000, 0xffff80);
\r
115 * and last you have to override the PreTranslateMessage() method of your dialog box:
\r
117 * BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
\r
119 * m_tooltips.RelayEvent(pMsg);
\r
120 * return CDialog::PreTranslateMessage(pMsg);
\r
124 class CBalloon : public CWnd, public CHTMLFormatter
\r
128 virtual BOOL Create(CWnd* pParentWnd);
\r
130 virtual ~CBalloon();
\r
134 enum { XBLSZ_ROUNDED_CX = 0,
\r
140 XBLSZ_WIDTH_ANCHOR,
\r
141 XBLSZ_HEIGHT_ANCHOR,
\r
142 XBLSZ_MARGIN_ANCHOR,
\r
145 XBLSZ_BUTTON_MARGIN_CX,
\r
146 XBLSZ_BUTTON_MARGIN_CY,
\r
151 enum { BALLOON_COLOR_FG = 0,
\r
152 BALLOON_COLOR_BK_BEGIN,
\r
153 BALLOON_COLOR_BK_MID,
\r
154 BALLOON_COLOR_BK_END,
\r
155 BALLOON_COLOR_SHADOW, // Color for the shadow
\r
156 BALLOON_COLOR_BORDER, // Color for border of the tooltip
\r
161 enum { BALLOON_LEFT_TOP = 0,
\r
163 BALLOON_LEFT_BOTTOM,
\r
164 BALLOON_RIGHT_BOTTOM,
\r
166 BALLOON_MAX_DIRECTIONS
\r
169 enum { BALLOON_EFFECT_SOLID = 0,
\r
170 BALLOON_EFFECT_HGRADIENT,
\r
171 BALLOON_EFFECT_VGRADIENT,
\r
172 BALLOON_EFFECT_HCGRADIENT,
\r
173 BALLOON_EFFECT_VCGRADIENT,
\r
174 BALLOON_EFFECT_3HGRADIENT,
\r
175 BALLOON_EFFECT_3VGRADIENT,
\r
177 BALLOON_MAX_EFFECTS
\r
185 // ClassWizard generated virtual function overrides
\r
186 //{{AFX_VIRTUAL(XToolTip)
\r
188 virtual BOOL PreTranslateMessage(MSG* pMsg);
\r
193 /** \name Balloon Dialogs
\r
194 * static methods to show a balloon like a modeless dialog
\r
198 * Pops up a balloon like a modeless dialog to inform the user in
\r
199 * a non disturbing way like with a normal MessageBox().
\r
200 * \image html "balloon_box.jpg"
\r
201 * An example of when to use such balloons is in a dialog box where
\r
202 * the user can enter values. If one or several values are outside
\r
203 * of valid ranges then just pop up a balloon. That way the user
\r
204 * knows exactly \b where the wrong value is (if the balloon is
\r
205 * placed so that the anchor points to the edit box) and also
\r
206 * doesn't have to press "OK" to close the box.
\r
208 * \param pWnd the parent window. Or NULL if no parent window is available.
\r
209 * \param pt the point where the anchor should point to. For example if you
\r
210 * want to point to an edit box the point would be:
\r
212 * CWnd* ctrl = GetDlgItem(IDC_EDITBOX);
\r
214 * ctrl->GetWindowRect(rt);
\r
215 * CPoint point = CPoint((rt.left+rt.right)/2, (rt.top+rt.bottom)/2);
\r
217 * \param nIdText the string ID of the text to show. The ID has to be in your resources.
\r
218 * \param sText the string to show.
\r
219 * \param showCloseButton If TRUE, then the balloon has a close button in the upper right corner. That also
\r
220 * makes the balloon to show up until the user presses the close button.\n
\r
221 * If FALSE, then the balloon will be closed after a timeout of 5 seconds or as soon as the user clicks anywhere
\r
223 * \param hIcon a handle of an icon.
\r
224 * \param nIdIcon an ID of an icon which has to be in your resources.
\r
225 * \param szIcon a name of an icon. Either a path to an icon file or one of
\r
226 * the following system icons:\n
\r
227 * - IDI_APPLICATION
\r
230 * - IDI_EXCLAMATION
\r
234 * - IDI_INFORMATION
\r
238 * \param nDirection the direction to where the dialog should be drawn. Defaults to BALLOON_RIGHT_TOP.
\r
239 * - BALLOON_LEFT_TOP
\r
240 * - BALLOON_RIGHT_TOP
\r
241 * - BALLOON_LEFT_BOTTOM
\r
242 * - BALLOON_RIGHT_BOTTOM
\r
244 * \param nEffect specifies how to draw the background. Defaults to BALLOON_EFFECT_SOLID.
\r
245 * - BALLOON_EFFECT_SOLID one color for the background. The default is the standard windows color for tooltip backgrounds.
\r
246 * - BALLOON_EFFECT_HGRADIENT draws a horizontal gradient from crStart to crEnd
\r
247 * - BALLOON_EFFECT_VGRADIENT draws a vertical gradient from crStart to crEnd
\r
248 * - BALLOON_EFFECT_HCGRADIENT draws a horizontal gradient from crStart to crEnd to crStart
\r
249 * - BALLOON_EFFECT_VCGRADIENT draws a vertical gradient from crStart to crEnd to crStart
\r
250 * - BALLOON_EFFECT_3HGRADIENT draws a horizontal gradient from crStart to crMid to crEnd
\r
251 * - BALLOON_EFFECT_3VGRADIENT draws a vertical gradient from crStart to crMid to crEnd
\r
253 * \param crStart the starting color for gradients
\r
254 * \param crMid the middle color for three colored gradients
\r
255 * \param crEnd the end color for gradients
\r
258 * \overload ShowBalloon(CWnd * pWnd, CPoint pt, UINT nIdText, BOOL showCloseButton, UINT nIdIcon, UINT nDirection = BALLOON_RIGHT_TOP, UINT nEffect = BALLOON_EFFECT_SOLID, COLORREF crStart = NULL, COLORREF crMid = NULL, COLORREF crEnd = NULL);
\r
260 static void ShowBalloon(
\r
261 CWnd * pWnd, CPoint pt, const CString& sText, BOOL showCloseButton, HICON hIcon,
\r
262 UINT nDirection = BALLOON_RIGHT_TOP, UINT nEffect = BALLOON_EFFECT_SOLID,
\r
263 COLORREF crStart = NULL, COLORREF crMid = NULL, COLORREF crEnd = NULL);
\r
265 * \overload ShowBalloon(CWnd * pWnd, CPoint pt, UINT nIdText, BOOL showCloseButton, LPCTSTR szIcon);
\r
267 static void ShowBalloon(CWnd * pWnd, CPoint pt, UINT nIdText, BOOL showCloseButton, LPCTSTR szIcon);
\r
271 * Helper function to return the center point of a dialog control
\r
272 * Useful for passing to ShowBalloon
\r
274 static CPoint GetCtrlCentre(CWnd* pDlgWnd, UINT ctrlId);
\r
276 /** \name ToolTips
\r
277 * handling of tooltips.
\r
282 * Adds a tooltip for a windows element to the internal list.
\r
283 * \param pWnd pointer to a windows element.
\r
284 * \param nIdWnd an ID of a dialog resource.
\r
285 * \param nIdText an ID of a string dialog resource to use as the tooltip text.
\r
286 * \param sBalloontipText string for the tooltip.
\r
287 * \param hIcon handle for an icon to show on the tooltip.
\r
288 * \param nIdIcon a resource ID for an icon to show on the tooltip.
\r
289 * \param bi pointer to a BALLOON_IFNO structure.
\r
291 void AddTool(CWnd * pWnd, UINT nIdText, HICON hIcon = NULL); //Adds tool
\r
292 void AddTool(CWnd * pWnd, UINT nIdText, UINT nIdIcon); //Adds tool
\r
293 void AddTool(CWnd * pWnd, const CString& sBalloonTipText, HICON hIcon = NULL); //Adds tool
\r
294 void AddTool(CWnd * pWnd, const CString& sBalloonTipText, UINT nIdIcon); //Adds tool
\r
295 void AddTool(int nIdWnd, UINT nIdText, HICON hIcon = NULL); //Adds tool
\r
296 void AddTool(int nIdWnd, UINT nIdText, UINT nIdIcon); //Adds tool
\r
297 void AddTool(int nIdWnd, const CString& sBalloonTipText, HICON hIcon = NULL); //Adds tool
\r
298 void AddTool(int nIdWnd, const CString& sBalloonTipText, UINT nIdIcon); //Adds tool
\r
299 void AddTool(CWnd * pWnd, BALLOON_INFO & bi); //Adds tool
\r
303 * Gets the text and the icon handle of a specific tooltip.
\r
304 * \param pWnd pointer to the tooltip window
\r
305 * \param sBalloonTipText the returned tooltip text
\r
306 * \param hIcon the returned icon handle
\r
307 * \param bi pointer to the returned BALLOON_INFO structure.
\r
308 * \return TRUE if the tooltip exists.
\r
310 BOOL GetTool(CWnd * pWnd, CString & sBalloonTipText, HICON & hIcon) const; //Gets the tool tip's text
\r
311 BOOL GetTool(CWnd * pWnd, BALLOON_INFO & bi) const; //Gets tool
\r
314 * Removes a specific tooltip from the internal list.
\r
315 * \param pWnd pointer to the tooltip window
\r
317 void RemoveTool(CWnd * pWnd); //Removes specified tool
\r
320 * Removes all tooltips from the internal list.
\r
322 void RemoveAllTools(); // Removes all tools
\r
326 * handling of tooltip appearance styles.
\r
327 * The following styles are available:
\r
328 * - BALLOON_ANCHOR the balloon is drawn with an anchor
\r
329 * - BALLOON_SHADOW the balloon is drawn with a SE shadow
\r
330 * - BALLOON_ROUNDED the balloon has round corners. For tooltips like the standard windows ones disable this style.
\r
331 * - BALLOON_RSA combines BALLOON_ANCHOR, BALLOON_SHADOW and BALLOON_ROUNDED. This is the default.
\r
332 * - BALLOON_VCENTER_ALIGN
\r
333 * - BALLOON_BOTTOM_ALIGN
\r
334 * - BALLOON_CLOSEBUTTON the balloon has a close button in the upper right corner.
\r
338 * sets styles for either all tooltips or specific ones.
\r
339 * \param nStyles the styles to set.
\r
340 * \param pWnd pointer to the tooltip window or NULL if the styles should affect all tooltips.
\r
342 void SetStyles(DWORD nStyles, CWnd * pWnd = NULL); //Sets New Style
\r
344 * Modifies existing styles.
\r
345 * \param nAddStyles the styles to add.
\r
346 * \param nRemoveStyles the styles to remove
\r
347 * \param pWnd pointer to the tooltip window or NULL if the styles should affect all tooltips.
\r
349 void ModifyStyles(DWORD nAddStyles, DWORD nRemoveStyles, CWnd * pWnd = NULL); //Modifies styles
\r
351 * returns the current styles for the tooltip.
\r
352 * \param pWnd pointer to the tooltip window or NULL if the global styles are needed.
\r
354 DWORD GetStyles(CWnd * pWnd = NULL) const; //Gets current Styles
\r
356 * Resets the styles to the default values.
\r
357 * \param pWnd pointer to the tooltip window or NULL if the styles should affect all tooltips.
\r
359 void SetDefaultStyles(CWnd * pWnd = NULL); //Sets default styles
\r
363 * different color settings. The following elements have colors:
\r
364 * - BALLOON_COLOR_FG the foreground text color. Default is black.
\r
365 * - BALLOON_COLOR_BK_BEGIN the background color and the first color in gradients.
\r
366 * - BALLOON_COLOR_BK_MID the middle color for gradients.
\r
367 * - BALLOON_COLOR_BK_END the end color for gradients.
\r
368 * - BALLOON_COLOR_SHADOW the color of the shadow
\r
369 * - BALLOON_COLOR_BORDER the color for the balloon border
\r
373 * Sets the color for a balloon element.
\r
374 * \param nIndex the element to set the color.
\r
375 * \param crColor the color.
\r
377 void SetColor(int nIndex, COLORREF crColor); //Sets the color
\r
379 * Returns the color of a balloon element.
\r
381 COLORREF GetColor(int nIndex) const; //Gets the color
\r
383 * Resets all colors to default values.
\r
385 void SetDefaultColors(); //Sets default colors
\r
387 * Sets the colors used in the background gradients.
\r
388 * \param crBegin first color
\r
389 * \param crMid middle color
\r
390 * \param crEnd end color
\r
391 * \param pWnd pointer to the tooltip window or NULL if the settings are global.
\r
393 void SetGradientColors(COLORREF crBegin, COLORREF crMid, COLORREF crEnd, CWnd * pWnd = NULL); //Sets the gradient's colors
\r
395 * Returns the colors used in the background gradients.
\r
396 * \param pWnd pointer to the tooltip window or NULL if the global settings are needed.
\r
398 void GetGradientColors(COLORREF & crBegin, COLORREF & crMid, COLORREF & crEnd, CWnd * pWnd = NULL) const; //Gets the gradient's colors
\r
403 * Manipulate masks of tooltips. Masks are used to define styles, effects, colors and the like for single
\r
404 * tooltips and not only for all tooltips.
\r
405 * Whatever mask is set for a specific tooltip means that this tooltip has its own version of those settings
\r
406 * and ignores the global settings.\n
\r
407 * The following masks are available:
\r
408 * - BALLOON_MASK_STYLES masks out the styles
\r
409 * - BALLOON_MASK_EFFECT masks out the effects
\r
410 * - BALLOON_MASK_COLORS masks out the colors
\r
411 * - BALLOON_MASK_DIRECTION masks out the direction
\r
412 * - BALLOON_MASK_BEHAVIOUR masks out the behavior
\r
414 * The functions either set, modify or read out the masks for specific tooltip windows.
\r
417 void SetMaskTool(CWnd * pWnd, UINT nMask = 0);
\r
418 void ModifyMaskTool(CWnd * pWnd, UINT nAddMask, UINT nRemoveMask);
\r
419 UINT GetMaskTool(CWnd * pWnd) const;
\r
423 * Use these methods to manipulate background effects of the tooltip. The following
\r
424 * effects are available.
\r
425 * - BALLOON_EFFECT_SOLID one color for the background. The default is the standard windows color for tooltip backgrounds.
\r
426 * - BALLOON_EFFECT_HGRADIENT draws a horizontal gradient from crStart to crEnd
\r
427 * - BALLOON_EFFECT_VGRADIENT draws a vertical gradient from crStart to crEnd
\r
428 * - BALLOON_EFFECT_HCGRADIENT draws a horizontal gradient from crStart to crEnd to crStart
\r
429 * - BALLOON_EFFECT_VCGRADIENT draws a vertical gradient from crStart to crEnd to crStart
\r
430 * - BALLOON_EFFECT_3HGRADIENT draws a horizontal gradient from crStart to crMid to crEnd
\r
431 * - BALLOON_EFFECT_3VGRADIENT draws a vertical gradient from crStart to crMid to crEnd
\r
434 void SetEffectBk(UINT nEffect, CWnd * pWnd = NULL);
\r
435 UINT GetEffectBk(CWnd * pWnd = NULL) const;
\r
438 /** \name Notification
\r
439 * Gets or sets if the parent or any other window should get notification messages from
\r
443 void SetNotify(HWND hWnd);
\r
444 void SetNotify(BOOL bParentNotify = TRUE);
\r
445 BOOL GetNotify() const; //Is enabled notification
\r
448 /** \name Delaytimes
\r
449 * Gets or sets the delay times for the tooltips.
\r
450 * - TTDT_AUTOPOP time in milliseconds until the tooltip automatically closes.
\r
451 * - TTDT_INITIAL time in milliseconds until the tooltip appears when the mouse pointer is over a control.
\r
454 void SetDelayTime(DWORD dwDuration, UINT nTime);
\r
455 UINT GetDelayTime(DWORD dwDuration) const;
\r
459 /** \name Direction
\r
460 * Gets or sets the direction of the balloons.
\r
461 * - BALLOON_LEFT_TOP
\r
462 * - BALLOON_RIGHT_TOP
\r
463 * - BALLOON_LEFT_BOTTOM
\r
464 * - BALLOON_RIGHT_BOTTOM
\r
467 void SetDirection(UINT nDirection = BALLOON_RIGHT_TOP, CWnd * pWnd = NULL);
\r
468 UINT GetDirection(CWnd * pWnd = NULL) const;
\r
472 * Gets or sets the behavior of the balloons.
\r
473 * - BALLOON_MULTIPLE_SHOW if this is set then the tooltip will appear again if the mouse pointer is still over the same control.
\r
474 * - BALLOON_TRACK_MOUSE if set then the tooltip will follow the mouse pointer
\r
475 * - BALLOON_DIALOG the balloon is shown as a dialog instead of a tooltip, i.e. it won't close when the mouse pointer leaves the control.
\r
476 * - BALLOON_DIALOG_DESTROY the object itself is destroyed when the balloon is closed. Use this \b very carefully!
\r
479 void SetBehaviour(UINT nBehaviour = 0, CWnd * pWnd = NULL);
\r
480 UINT GetBehaviour(CWnd * pWnd = NULL) const;
\r
484 * Font settings for the balloon text.
\r
487 BOOL SetFont(CFont & font); //set font
\r
488 BOOL SetFont(LPLOGFONT lf); //set font
\r
489 BOOL SetFont(LPCTSTR lpszFaceName, int nSizePoints = 8,
\r
490 BOOL bUnderline = FALSE, BOOL bBold = FALSE,
\r
491 BOOL bStrikeOut = FALSE, BOOL bItalic = FALSE); //set font
\r
492 void SetDefaultFont(); //set default fonts
\r
493 void GetFont(CFont & font) const;
\r
494 void GetFont(LPLOGFONT lf) const;
\r
498 * Call this method from CDialog::PreTranslateMessage(pMsg).
\r
500 void RelayEvent(MSG* pMsg);
\r
503 * Hide tooltip immediately.
\r
508 * Shows a tooltip immediately.
\r
510 void DisplayToolTip(CPoint * pt = NULL);
\r
511 void DisplayToolTip(CPoint * pt, CRect * rect);
\r
513 // Generated message map functions
\r
515 void SetSize(int nSizeIndex, UINT nValue);
\r
516 UINT GetSize(int nSizeIndex) const;
\r
517 void SetDefaultSizes();
\r
519 void Redraw(BOOL bRedraw = TRUE);
\r
520 void KillTimers(UINT nIDTimer = NULL);
\r
522 void SetNewToolTip(CWnd * pWnd);
\r
523 void GetMonitorWorkArea(const CPoint& sourcePoint, CRect& monitorRect) const;
\r
526 * Finds the child window to which the point belongs
\r
527 * \param point the point to look for the child window
\r
528 * \return the pointer to the child window, or NULL if there is now window
\r
530 HWND GetChildWindowFromPoint(CPoint & point) const;
\r
531 BOOL IsCursorInToolTip() const;
\r
532 inline BOOL IsVisible() const { return ((GetStyle() & WS_VISIBLE) == WS_VISIBLE); }
\r
534 CSize GetTooltipSize(const CString& str); //Gets max rectangle for display tooltip text
\r
535 CSize GetSizeIcon(HICON hIcon) const;
\r
536 void CalculateInfoBoxRect(CPoint * pt, CRect * rect);
\r
538 LPLOGFONT GetSystemToolTipFont() const;
\r
540 int GetNextHorizDirection(int nDirection) const;
\r
541 int GetNextVertDirection(int nDirection) const;
\r
542 BOOL TestHorizDirection(int x, int cx, const CRect& monitorRect, int nDirection, LPRECT rect);
\r
543 BOOL TestVertDirection(int y, int cy, const CRect& monitorRect, int nDirection, LPRECT rect);
\r
545 CRect GetWindowRegion(CRgn * rgn, CSize sz, CPoint pt) const;
\r
547 LRESULT SendNotify(CWnd * pWnd, CPoint * pt, BALLOON_INFO & bi);
\r
549 void OnDraw(CDC * pDC, CRect rect);
\r
550 void OnDrawBackground(CDC * pDC, CRect * pRect);
\r
552 virtual void PostNcDestroy();
\r
553 afx_msg void OnPaint();
\r
554 afx_msg void OnTimer(UINT_PTR nIDEvent);
\r
555 afx_msg void OnDestroy();
\r
556 afx_msg void OnKillFocus(CWnd* pNewWnd);
\r
557 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
\r
558 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
\r
559 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
\r
560 DECLARE_MESSAGE_MAP()
\r
562 enum { BALLOON_SHOW = 0x100, //the identifier of the timer for show the tooltip
\r
563 BALLOON_HIDE = 0x101 //the identifier of the timer for hide the tooltip
\r
566 CMap<HWND, HWND, BALLOON_INFO, BALLOON_INFO> m_ToolMap; //Tool Maps
\r
568 HWND m_hNotifyWnd; // Handle to window for notification about change data
\r
569 CWnd * m_pParentWnd; // The pointer to the parent window
\r
570 HWND m_hCurrentWnd;
\r
571 HWND m_hDisplayedWnd;
\r
572 UINT m_nLastDirection;
\r
575 LOGFONT m_LogFont; // Current font in use
\r
578 COLORREF m_crColor [BALLOON_MAX_COLORS]; //The indexing colors
\r
579 UINT m_nSizes [XBLSZ_MAX_SIZES]; //All sizes
\r
583 UINT m_nBehaviour; //The tool tip's behavior
\r
585 UINT m_nTimeAutoPop;
\r
586 UINT m_nTimeInitial;
\r
588 //The properties of the current tooltip
\r
589 CPoint m_ptOriginal;
\r
594 CSize m_szBalloonIcon; //the size of the current icon
\r
595 CSize m_szBalloonText; //the size of the tool tip's text
\r
596 CSize m_szCloseButton;
\r
598 CRect m_rtCloseButton; //the rect for the close button
\r
599 BOOL m_bButtonPushed;
\r
603 BALLOON_INFO m_pToolInfo; //info of the current tooltip
\r