OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_VIEWS_COREWM_TOOLTIP_AURA_H_ | 5 #ifndef UI_VIEWS_COREWM_TOOLTIP_AURA_H_ |
6 #define UI_VIEWS_COREWM_TOOLTIP_AURA_H_ | 6 #define UI_VIEWS_COREWM_TOOLTIP_AURA_H_ |
7 | 7 |
8 #include "ui/gfx/screen_type_delegate.h" | 8 #include "ui/gfx/screen_type_delegate.h" |
9 #include "ui/views/controls/label.h" | 9 #include "ui/views/controls/label.h" |
10 #include "ui/views/corewm/tooltip.h" | 10 #include "ui/views/corewm/tooltip.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 static void TrimTooltipToFit(const gfx::FontList& font_list, | 33 static void TrimTooltipToFit(const gfx::FontList& font_list, |
34 int max_width, | 34 int max_width, |
35 base::string16* text, | 35 base::string16* text, |
36 int* width, | 36 int* width, |
37 int* line_count); | 37 int* line_count); |
38 | 38 |
39 private: | 39 private: |
40 // Returns the max width of the tooltip when shown at the specified location. | 40 // Returns the max width of the tooltip when shown at the specified location. |
41 int GetMaxWidth(const gfx::Point& location) const; | 41 int GetMaxWidth(const gfx::Point& location) const; |
42 | 42 |
43 // Returns the bounds to fit the tooltip in. | |
44 gfx::Rect GetBoundsForTooltip(const gfx::Point& origin) const; | |
45 | |
46 // Adjusts the bounds given by the arguments to fit inside the desktop | 43 // Adjusts the bounds given by the arguments to fit inside the desktop |
47 // and applies the adjusted bounds to the label_. | 44 // and applies the adjusted bounds to the label_. |
48 void SetTooltipBounds(const gfx::Point& mouse_pos, | 45 void SetTooltipBounds(const gfx::Point& mouse_pos, |
49 int tooltip_width, | 46 int tooltip_width, |
50 int tooltip_height); | 47 int tooltip_height); |
51 | 48 |
52 // Makes sure |widget_| is valid, creating as necessary. | |
53 void CreateWidget(); | |
54 | |
55 // Destroys |widget_|. | 49 // Destroys |widget_|. |
56 void DestroyWidget(); | 50 void DestroyWidget(); |
57 | 51 |
58 // Tooltip: | 52 // Tooltip: |
59 virtual void SetText(aura::Window* window, | 53 virtual void SetText(aura::Window* window, |
60 const base::string16& tooltip_text, | 54 const base::string16& tooltip_text, |
61 const gfx::Point& location) OVERRIDE; | 55 const gfx::Point& location) OVERRIDE; |
62 virtual void Show() OVERRIDE; | 56 virtual void Show() OVERRIDE; |
63 virtual void Hide() OVERRIDE; | 57 virtual void Hide() OVERRIDE; |
64 virtual bool IsVisible() OVERRIDE; | 58 virtual bool IsVisible() OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
78 // showing. | 72 // showing. |
79 aura::Window* tooltip_window_; | 73 aura::Window* tooltip_window_; |
80 | 74 |
81 DISALLOW_COPY_AND_ASSIGN(TooltipAura); | 75 DISALLOW_COPY_AND_ASSIGN(TooltipAura); |
82 }; | 76 }; |
83 | 77 |
84 } // namespace corewm | 78 } // namespace corewm |
85 } // namespace views | 79 } // namespace views |
86 | 80 |
87 #endif // UI_VIEWS_COREWM_TOOLTIP_AURA_H_ | 81 #endif // UI_VIEWS_COREWM_TOOLTIP_AURA_H_ |
OLD | NEW |