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 CHROME_COMMON_GTK_UTIL_H_ | 5 #ifndef CHROME_COMMON_GTK_UTIL_H_ |
6 #define CHROME_COMMON_GTK_UTIL_H_ | 6 #define CHROME_COMMON_GTK_UTIL_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
| 10 #include "base/gfx/point.h" |
| 11 #include "base/gfx/rect.h" |
10 #include "webkit/glue/window_open_disposition.h" | 12 #include "webkit/glue/window_open_disposition.h" |
11 | 13 |
12 typedef struct _GtkWidget GtkWidget; | 14 typedef struct _GtkWidget GtkWidget; |
13 | 15 |
14 namespace event_utils { | 16 namespace event_utils { |
15 | 17 |
16 // Translates event flags into what kind of disposition they represent. | 18 // Translates event flags into what kind of disposition they represent. |
17 // For example, a middle click would mean to open a background tab. | 19 // For example, a middle click would mean to open a background tab. |
18 // event_flags are the state in the GdkEvent structure. | 20 // event_flags are the state in the GdkEvent structure. |
19 WindowOpenDisposition DispositionFromEventFlags(guint state); | 21 WindowOpenDisposition DispositionFromEventFlags(guint state); |
20 | 22 |
21 } // namespace event_utils | 23 } // namespace event_utils |
22 | 24 |
23 namespace gtk_util { | 25 namespace gtk_util { |
24 | 26 |
25 // Create a GtkBin with |child| as its child widget. This bin will paint a | 27 // Create a GtkBin with |child| as its child widget. This bin will paint a |
26 // border of color |color| with the sizes specified in pixels. | 28 // border of color |color| with the sizes specified in pixels. |
27 GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, | 29 GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, |
28 int top, int bottom, int left, int right); | 30 int top, int bottom, int left, int right); |
29 | 31 |
30 // Remove all children from this container. | 32 // Remove all children from this container. |
31 void RemoveAllChildren(GtkWidget* container); | 33 void RemoveAllChildren(GtkWidget* container); |
32 | 34 |
| 35 // Gets the position of a gtk widget in screen coordinates. |
| 36 gfx::Point GetWidgetScreenPosition(GtkWidget* widget); |
| 37 |
| 38 // Returns the bounds of the specified widget in screen coordinates. |
| 39 gfx::Rect GetWidgetScreenBounds(GtkWidget* widget); |
| 40 |
33 } // namespace gtk_util | 41 } // namespace gtk_util |
34 | 42 |
35 #endif // CHROME_COMMON_GTK_UTIL_H_ | 43 #endif // CHROME_COMMON_GTK_UTIL_H_ |
OLD | NEW |