| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_H_ | 5 #ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_GTK_H_ |
| 6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_GTK_H_ | 6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_GTK_H_ |
| 7 | 7 |
| 8 #include "views/widget/tooltip_manager.h" | 8 #include "views/widget/tooltip_manager.h" |
| 9 | 9 |
| 10 #include <gtk/gtk.h> |
| 11 |
| 10 namespace views { | 12 namespace views { |
| 11 | 13 |
| 12 class Widget; | 14 class WidgetGtk; |
| 13 | 15 |
| 14 // TooltipManager takes care of the wiring to support tooltips for Views. You | 16 // TooltipManager implementation for Gtk. |
| 15 // almost never need to interact directly with TooltipManager, rather look to | |
| 16 // the various tooltip methods on View. | |
| 17 class TooltipManagerGtk : public TooltipManager { | 17 class TooltipManagerGtk : public TooltipManager { |
| 18 public: | 18 public: |
| 19 explicit TooltipManagerGtk(Widget* widget); | 19 explicit TooltipManagerGtk(WidgetGtk* widget); |
| 20 virtual ~TooltipManagerGtk() {} | 20 virtual ~TooltipManagerGtk() {} |
| 21 | 21 |
| 22 // Shows the tooltip at the specified location. Returns true if the tooltip |
| 23 // should be shown, false otherwise. |
| 24 bool ShowTooltip(int x, int y, bool for_keyboard, GtkTooltip* gtk_tooltip); |
| 25 |
| 22 // TooltipManager. | 26 // TooltipManager. |
| 23 virtual void UpdateTooltip(); | 27 virtual void UpdateTooltip(); |
| 24 virtual void TooltipTextChanged(View* view); | 28 virtual void TooltipTextChanged(View* view); |
| 25 virtual void ShowKeyboardTooltip(View* view); | 29 virtual void ShowKeyboardTooltip(View* view); |
| 26 virtual void HideKeyboardTooltip(); | 30 virtual void HideKeyboardTooltip(); |
| 27 | 31 |
| 28 private: | 32 private: |
| 33 // Sends the show_help signal to widget_. This signal triggers showing the |
| 34 // keyboard tooltip if it isn't showing, or hides it if it is showing. |
| 35 bool SendShowHelpSignal(); |
| 36 |
| 29 // Our owner. | 37 // Our owner. |
| 30 Widget* widget_; | 38 WidgetGtk* widget_; |
| 39 |
| 40 // The view supplied to the last invocation of ShowKeyboardTooltip. |
| 41 View* keyboard_view_; |
| 31 | 42 |
| 32 DISALLOW_COPY_AND_ASSIGN(TooltipManagerGtk); | 43 DISALLOW_COPY_AND_ASSIGN(TooltipManagerGtk); |
| 33 }; | 44 }; |
| 34 | 45 |
| 35 } // namespace views | 46 } // namespace views |
| 36 | 47 |
| 37 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_GTK_H_ | 48 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_GTK_H_ |
| OLD | NEW |