| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_H_ | 5 #ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_H_ |
| 6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_H_ | 6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Returns the height of tooltips. This should only be invoked from within | 25 // Returns the height of tooltips. This should only be invoked from within |
| 26 // GetTooltipTextOrigin. | 26 // GetTooltipTextOrigin. |
| 27 static int GetTooltipHeight(); | 27 static int GetTooltipHeight(); |
| 28 | 28 |
| 29 // Returns the default font used by tooltips. | 29 // Returns the default font used by tooltips. |
| 30 static gfx::Font GetDefaultFont(); | 30 static gfx::Font GetDefaultFont(); |
| 31 | 31 |
| 32 // Returns the separator for lines of text in a tooltip. | 32 // Returns the separator for lines of text in a tooltip. |
| 33 static const std::wstring& GetLineSeparator(); | 33 static const std::wstring& GetLineSeparator(); |
| 34 | 34 |
| 35 // Returns the maximum width of the tooltip. |x| and |y| give the location |
| 36 // the tooltip is to be displayed on in screen coordinates. |
| 37 static int GetMaxWidth(int x, int y); |
| 38 |
| 35 TooltipManager() {} | 39 TooltipManager() {} |
| 36 virtual ~TooltipManager() {} | 40 virtual ~TooltipManager() {} |
| 37 | 41 |
| 38 // Notification that the view hierarchy has changed in some way. | 42 // Notification that the view hierarchy has changed in some way. |
| 39 virtual void UpdateTooltip() = 0; | 43 virtual void UpdateTooltip() = 0; |
| 40 | 44 |
| 41 // Invoked when the tooltip text changes for the specified views. | 45 // Invoked when the tooltip text changes for the specified views. |
| 42 virtual void TooltipTextChanged(View* view) = 0; | 46 virtual void TooltipTextChanged(View* view) = 0; |
| 43 | 47 |
| 44 // Invoked when toolbar icon gets focus. | 48 // Invoked when toolbar icon gets focus. |
| 45 virtual void ShowKeyboardTooltip(View* view) = 0; | 49 virtual void ShowKeyboardTooltip(View* view) = 0; |
| 46 | 50 |
| 47 // Invoked when toolbar loses focus. | 51 // Invoked when toolbar loses focus. |
| 48 virtual void HideKeyboardTooltip() = 0; | 52 virtual void HideKeyboardTooltip() = 0; |
| 53 |
| 54 protected: |
| 55 // Trims the tooltip to fit, setting |text| to the clipped result, |
| 56 // |max_width| to the width (in pixels) of the clipped text and |line_count| |
| 57 // to the number of lines of text in the tooltip. |x| and |y| give the |
| 58 // location of the tooltip in screen coordinates. |
| 59 static void TrimTooltipToFit(std::wstring* text, |
| 60 int* max_width, |
| 61 int* line_count, |
| 62 int x, |
| 63 int y); |
| 49 }; | 64 }; |
| 50 | 65 |
| 51 } // namespace views | 66 } // namespace views |
| 52 | 67 |
| 53 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_H_ | 68 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_H_ |
| OLD | NEW |