OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LIBGTKUI_GTK_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 GdkModifierType GetGdkModifierForAccelerator( | 59 GdkModifierType GetGdkModifierForAccelerator( |
60 const ui::Accelerator& accelerator); | 60 const ui::Accelerator& accelerator); |
61 | 61 |
62 // Translates event flags into plaform independent event flags. | 62 // Translates event flags into plaform independent event flags. |
63 int EventFlagsFromGdkState(guint state); | 63 int EventFlagsFromGdkState(guint state); |
64 | 64 |
65 // Style a GTK button as a BlueButton | 65 // Style a GTK button as a BlueButton |
66 void TurnButtonBlue(GtkWidget* button); | 66 void TurnButtonBlue(GtkWidget* button); |
67 | 67 |
68 // Sets |dialog| as transient for |parent|, which will keep it on top and center | 68 // Sets |dialog| as transient for |parent|, which will keep it on top and center |
69 // it above |parent|. Do nothing if |parent| is NULL. | 69 // it above |parent|. Do nothing if |parent| is nullptr. |
70 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); | 70 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); |
71 | 71 |
72 // Gets the transient parent aura window for |dialog|. | 72 // Gets the transient parent aura window for |dialog|. |
73 aura::Window* GetAuraTransientParent(GtkWidget* dialog); | 73 aura::Window* GetAuraTransientParent(GtkWidget* dialog); |
74 | 74 |
75 // Clears the transient parent for |dialog|. | 75 // Clears the transient parent for |dialog|. |
76 void ClearAuraTransientParent(GtkWidget* dialog); | 76 void ClearAuraTransientParent(GtkWidget* dialog); |
77 | 77 |
78 #if GTK_MAJOR_VERSION > 2 | 78 #if GTK_MAJOR_VERSION > 2 |
79 // These constants are defined in gtk/gtkenums.h in Gtk3.12 or later. | 79 // These constants are defined in gtk/gtkenums.h in Gtk3.12 or later. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 g_object_unref(context); | 170 g_object_unref(context); |
171 return; | 171 return; |
172 } | 172 } |
173 context = parent; | 173 context = parent; |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; | 177 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; |
178 typedef ScopedGObject<GtkCssProvider> ScopedCssProvider; | 178 typedef ScopedGObject<GtkCssProvider> ScopedCssProvider; |
179 | 179 |
180 // If |context| is NULL, creates a new top-level style context | 180 // If |context| is nullptr, creates a new top-level style context |
181 // specified by parsing |css_node|. Otherwise, creates the child | 181 // specified by parsing |css_node|. Otherwise, creates the child |
182 // context with |context| as the parent. | 182 // context with |context| as the parent. |
183 ScopedStyleContext AppendCssNodeToStyleContext(GtkStyleContext* context, | 183 ScopedStyleContext AppendCssNodeToStyleContext(GtkStyleContext* context, |
184 const std::string& css_node); | 184 const std::string& css_node); |
185 | 185 |
186 // Parses |css_selector| into a GtkStyleContext. The format is a | 186 // Parses |css_selector| into a GtkStyleContext. The format is a |
187 // sequence of whitespace-separated objects. Each object may have at | 187 // sequence of whitespace-separated objects. Each object may have at |
188 // most one object name at the beginning of the string, and any number | 188 // most one object name at the beginning of the string, and any number |
189 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example | 189 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example |
190 // is "GtkButton.button.suggested-action:hover:active". The caller | 190 // is "GtkButton.button.suggested-action:hover:active". The caller |
(...skipping 29 matching lines...) Expand all Loading... |
220 SkColor GetSelectedTextColor(const char* css_selector); | 220 SkColor GetSelectedTextColor(const char* css_selector); |
221 SkColor GetSelectedBgColor(const char* css_selector); | 221 SkColor GetSelectedBgColor(const char* css_selector); |
222 | 222 |
223 // Get the color of the GtkSeparator specified by |css_selector|. | 223 // Get the color of the GtkSeparator specified by |css_selector|. |
224 SkColor GetSeparatorColor(const char* css_selector); | 224 SkColor GetSeparatorColor(const char* css_selector); |
225 #endif | 225 #endif |
226 | 226 |
227 } // namespace libgtkui | 227 } // namespace libgtkui |
228 | 228 |
229 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 229 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
OLD | NEW |