OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_WINDOW_GTK_H_ | 5 #ifndef VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_ |
6 #define VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_ | 6 #define VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "ui/base/gtk/gtk_integers.h" | 12 #include "ui/base/gtk/gtk_integers.h" |
13 #include "ui/base/gtk/gtk_signal.h" | 13 #include "ui/base/gtk/gtk_signal.h" |
14 | 14 |
15 typedef struct _GdkEventExpose GdkEventExpose; | 15 typedef struct _GdkEventExpose GdkEventExpose; |
16 typedef struct _GtkLabel GtkLabel; | 16 typedef struct _GtkLabel GtkLabel; |
17 typedef struct _GtkWidget GtkWidget; | 17 typedef struct _GtkWidget GtkWidget; |
18 typedef struct _GtkStyle GtkStyle; | 18 typedef struct _GtkStyle GtkStyle; |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 // TooltipWindowGtk provides a customized tooltip window and gives us a | 22 // TooltipWindowGtk provides a customized tooltip window and gives us a |
23 // chance to apply RGBA colormap on it. This enables the GTK theme engine to | 23 // chance to apply RGBA colormap on it. This enables the GTK theme engine to |
24 // draw tooltip with nice shadow and rounded corner on ChromeOS. | 24 // draw tooltip with nice shadow and rounded corner on ChromeOS. |
25 class TooltipWindowGtk { | 25 class TooltipWindowGtk { |
26 public: | 26 public: |
27 explicit TooltipWindowGtk(GtkWidget* widget); | 27 explicit TooltipWindowGtk(GtkWidget* widget); |
28 ~TooltipWindowGtk(); | 28 virtual ~TooltipWindowGtk(); |
29 | 29 |
30 // Sets tooltip text to display. | 30 // Sets tooltip text to display. |
31 void SetTooltipText(const std::wstring& text); | 31 void SetTooltipText(const std::wstring& text); |
32 | 32 |
33 GtkLabel* label(); | 33 GtkLabel* label(); |
34 | 34 |
35 protected: | 35 protected: |
36 CHROMEGTK_CALLBACK_1(TooltipWindowGtk, gboolean, OnPaint, GdkEventExpose*); | 36 CHROMEGTK_CALLBACK_1(TooltipWindowGtk, gboolean, OnPaint, GdkEventExpose*); |
37 CHROMEGTK_CALLBACK_1(TooltipWindowGtk, void, OnStyleSet, GtkStyle*); | 37 CHROMEGTK_CALLBACK_1(TooltipWindowGtk, void, OnStyleSet, GtkStyle*); |
38 | 38 |
39 private: | 39 private: |
40 void Init(); | 40 void Init(); |
41 | 41 |
42 // Underlying widget of this tooltip window. | 42 // Underlying widget of this tooltip window. |
43 GtkWidget* host_; | 43 GtkWidget* host_; |
44 | 44 |
45 // GtkWindow of this tooltip window. | 45 // GtkWindow of this tooltip window. |
46 GtkWidget* window_; | 46 GtkWidget* window_; |
47 | 47 |
48 // The alignment and label widgets contained of the tooltip window. | 48 // The alignment and label widgets contained of the tooltip window. |
49 GtkWidget* alignment_; | 49 GtkWidget* alignment_; |
50 GtkWidget* label_; | 50 GtkWidget* label_; |
51 | 51 |
52 DISALLOW_COPY_AND_ASSIGN(TooltipWindowGtk); | 52 DISALLOW_COPY_AND_ASSIGN(TooltipWindowGtk); |
53 }; | 53 }; |
54 | 54 |
55 } // namespace views | 55 } // namespace views |
56 | 56 |
57 #endif // VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_ | 57 #endif // VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_ |
OLD | NEW |