OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_UI_GTK_GTK_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_GTK_UTIL_H_ |
6 #define CHROME_BROWSER_UI_GTK_GTK_UTIL_H_ | 6 #define CHROME_BROWSER_UI_GTK_GTK_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "ui/base/x/x11_util.h" | 14 #include "ui/base/x/x11_util.h" |
15 #include "ui/gfx/point.h" | 15 #include "ui/gfx/point.h" |
16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
17 #include "webkit/glue/window_open_disposition.h" | 17 #include "webkit/glue/window_open_disposition.h" |
18 | 18 |
19 typedef struct _cairo cairo_t; | 19 typedef struct _cairo cairo_t; |
20 typedef struct _GdkColor GdkColor; | 20 typedef struct _GdkColor GdkColor; |
21 typedef struct _GtkWidget GtkWidget; | 21 typedef struct _GtkWidget GtkWidget; |
22 | 22 |
23 class BrowserWindow; | 23 class BrowserWindow; |
24 class GtkThemeService; | 24 class GtkThemeService; |
25 class GURL; | 25 class GURL; |
26 class Profile; | 26 class Profile; |
27 struct RendererPreferences; // from common/renderer_preferences.h | 27 |
| 28 namespace content { |
| 29 struct RendererPreferences; |
| 30 } |
28 | 31 |
29 namespace event_utils { | 32 namespace event_utils { |
30 | 33 |
31 // Translates GdkEvent state into what kind of disposition they represent. | 34 // Translates GdkEvent state into what kind of disposition they represent. |
32 // For example, a middle click would mean to open a background tab. | 35 // For example, a middle click would mean to open a background tab. |
33 WindowOpenDisposition DispositionFromGdkState(guint state); | 36 WindowOpenDisposition DispositionFromGdkState(guint state); |
34 | 37 |
35 // Translates event flags into plaform independent event flags. | 38 // Translates event flags into plaform independent event flags. |
36 int EventFlagsFromGdkState(guint state); | 39 int EventFlagsFromGdkState(guint state); |
37 | 40 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 GtkWidget* CreateEntryImageHBox(GtkWidget* entry, GtkWidget* image); | 187 GtkWidget* CreateEntryImageHBox(GtkWidget* entry, GtkWidget* image); |
185 | 188 |
186 // Sets all the foreground color states of |label| to |color|. | 189 // Sets all the foreground color states of |label| to |color|. |
187 void SetLabelColor(GtkWidget* label, const GdkColor* color); | 190 void SetLabelColor(GtkWidget* label, const GdkColor* color); |
188 | 191 |
189 // Adds the given widget to an alignment identing it by |kGroupIndent|. | 192 // Adds the given widget to an alignment identing it by |kGroupIndent|. |
190 GtkWidget* IndentWidget(GtkWidget* content); | 193 GtkWidget* IndentWidget(GtkWidget* content); |
191 | 194 |
192 // Sets (or resets) the font settings in |prefs| (used when creating new | 195 // Sets (or resets) the font settings in |prefs| (used when creating new |
193 // renderers) based on GtkSettings (which itself comes from XSETTINGS). | 196 // renderers) based on GtkSettings (which itself comes from XSETTINGS). |
194 void UpdateGtkFontSettings(RendererPreferences* prefs); | 197 void UpdateGtkFontSettings(content::RendererPreferences* prefs); |
195 | 198 |
196 // Reverses a point in RTL mode. Used in making vectors of GdkPoints for window | 199 // Reverses a point in RTL mode. Used in making vectors of GdkPoints for window |
197 // shapes. | 200 // shapes. |
198 GdkPoint MakeBidiGdkPoint(gint x, gint y, gint width, bool ltr); | 201 GdkPoint MakeBidiGdkPoint(gint x, gint y, gint width, bool ltr); |
199 | 202 |
200 // Creates a tooltip string to be passed to gtk_widget_set_tooltip_markup from | 203 // Creates a tooltip string to be passed to gtk_widget_set_tooltip_markup from |
201 // the title and URL. | 204 // the title and URL. |
202 std::string BuildTooltipTitleFor(string16 title, const GURL& url); | 205 std::string BuildTooltipTitleFor(string16 title, const GURL& url); |
203 | 206 |
204 // Draws a GTK text entry with the style parameters of GtkEntry | 207 // Draws a GTK text entry with the style parameters of GtkEntry |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 void ApplyMessageDialogQuirks(GtkWidget* dialog); | 328 void ApplyMessageDialogQuirks(GtkWidget* dialog); |
326 | 329 |
327 // Performs Cut/Copy/Paste operation on the |window|. | 330 // Performs Cut/Copy/Paste operation on the |window|. |
328 void DoCut(BrowserWindow* window); | 331 void DoCut(BrowserWindow* window); |
329 void DoCopy(BrowserWindow* window); | 332 void DoCopy(BrowserWindow* window); |
330 void DoPaste(BrowserWindow* window); | 333 void DoPaste(BrowserWindow* window); |
331 | 334 |
332 } // namespace gtk_util | 335 } // namespace gtk_util |
333 | 336 |
334 #endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_ | 337 #endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_ |
OLD | NEW |