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 // This is the GTK implementation of InfoBubbles. InfoBubbles are like | 5 // This is the GTK implementation of InfoBubbles. InfoBubbles are like |
6 // dialogs, but they point to a given element on the screen. You should call | 6 // dialogs, but they point to a given element on the screen. You should call |
7 // InfoBubbleGtk::Show, which will create and display a bubble. The object is | 7 // InfoBubbleGtk::Show, which will create and display a bubble. The object is |
8 // self deleting, when the bubble is closed, you will be notified via | 8 // self deleting, when the bubble is closed, you will be notified via |
9 // InfoBubbleGtkDelegate::InfoBubbleClosing(). Then the widgets and the | 9 // InfoBubbleGtkDelegate::InfoBubbleClosing(). Then the widgets and the |
10 // underlying object will be destroyed. You can also close and destroy the | 10 // underlying object will be destroyed. You can also close and destroy the |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 class InfoBubbleGtkDelegate { | 28 class InfoBubbleGtkDelegate { |
29 public: | 29 public: |
30 // Called when the InfoBubble is closing and is about to be deleted. | 30 // Called when the InfoBubble is closing and is about to be deleted. |
31 // |closed_by_escape| is true if the close is the result of pressing escape. | 31 // |closed_by_escape| is true if the close is the result of pressing escape. |
32 virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble, | 32 virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble, |
33 bool closed_by_escape) = 0; | 33 bool closed_by_escape) = 0; |
34 | 34 |
35 // NOTE: The Views interface has CloseOnEscape, except I can't find a place | 35 // NOTE: The Views interface has CloseOnEscape, except I can't find a place |
36 // where it ever returns false, so we always allow you to close via escape. | 36 // where it ever returns false, so we always allow you to close via escape. |
37 | |
38 protected: | |
39 ~InfoBubbleGtkDelegate() {} | |
40 }; | 37 }; |
41 | 38 |
42 class InfoBubbleGtk : public NotificationObserver { | 39 class InfoBubbleGtk : public NotificationObserver { |
43 public: | 40 public: |
44 // Show an InfoBubble, pointing at the area |rect| (in screen coordinates). | 41 // Show an InfoBubble, pointing at the area |rect| (in screen coordinates). |
45 // An infobubble will try to fit on the screen, so it can point to any edge | 42 // An infobubble will try to fit on the screen, so it can point to any edge |
46 // of |rect|. The bubble will host the |content| widget. The |delegate| | 43 // of |rect|. The bubble will host the |content| widget. The |delegate| |
47 // will be notified when things like closing are happening. | 44 // will be notified when things like closing are happening. |
48 static InfoBubbleGtk* Show(GtkWindow* transient_toplevel, | 45 static InfoBubbleGtk* Show(GtkWindow* transient_toplevel, |
49 const gfx::Rect& rect, | 46 const gfx::Rect& rect, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Where we want our window to be positioned on the screen. | 146 // Where we want our window to be positioned on the screen. |
150 int screen_x_; | 147 int screen_x_; |
151 int screen_y_; | 148 int screen_y_; |
152 | 149 |
153 NotificationRegistrar registrar_; | 150 NotificationRegistrar registrar_; |
154 | 151 |
155 DISALLOW_COPY_AND_ASSIGN(InfoBubbleGtk); | 152 DISALLOW_COPY_AND_ASSIGN(InfoBubbleGtk); |
156 }; | 153 }; |
157 | 154 |
158 #endif // CHROME_BROWSER_GTK_INFO_BUBBLE_GTK_H_ | 155 #endif // CHROME_BROWSER_GTK_INFO_BUBBLE_GTK_H_ |
OLD | NEW |