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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // NOTE: Make sure to realize |widget| before using this method, or a | 74 // NOTE: Make sure to realize |widget| before using this method, or a |
75 // default font size will be used instead of the actual font size. | 75 // default font size will be used instead of the actual font size. |
76 void GetWidgetSizeFromResources(GtkWidget* widget, int width_chars, | 76 void GetWidgetSizeFromResources(GtkWidget* widget, int width_chars, |
77 int height_lines, int* width, int* height); | 77 int height_lines, int* width, int* height); |
78 | 78 |
79 // As above, but uses number of characters/lines directly rather than looking | 79 // As above, but uses number of characters/lines directly rather than looking |
80 // up a resource. | 80 // up a resource. |
81 void GetWidgetSizeFromCharacters(GtkWidget* widget, double width_chars, | 81 void GetWidgetSizeFromCharacters(GtkWidget* widget, double width_chars, |
82 double height_lines, int* width, int* height); | 82 double height_lines, int* width, int* height); |
83 | 83 |
| 84 // As above, but a convenience method for configuring dialog width. |
| 85 // |resizable| also controls whether the dialog will be resizable |
| 86 // (this info is also necessary for getting the width-setting code |
| 87 // right). |
| 88 void SetWindowWidthFromResources(GtkWindow* window, int resource_id, |
| 89 bool resizable); |
| 90 |
84 // Remove all children from this container. | 91 // Remove all children from this container. |
85 void RemoveAllChildren(GtkWidget* container); | 92 void RemoveAllChildren(GtkWidget* container); |
86 | 93 |
87 // Force the font size of the widget to |size_pixels|. | 94 // Force the font size of the widget to |size_pixels|. |
88 void ForceFontSizePixels(GtkWidget* widget, double size_pixels); | 95 void ForceFontSizePixels(GtkWidget* widget, double size_pixels); |
89 | 96 |
90 // Gets the position of a gtk widget in screen coordinates. | 97 // Gets the position of a gtk widget in screen coordinates. |
91 gfx::Point GetWidgetScreenPosition(GtkWidget* widget); | 98 gfx::Point GetWidgetScreenPosition(GtkWidget* widget); |
92 | 99 |
93 // Returns the bounds of the specified widget in screen coordinates. | 100 // Returns the bounds of the specified widget in screen coordinates. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // at the default width. | 224 // at the default width. |
218 // This is called a hack because the gtk docs state that it is logically | 225 // This is called a hack because the gtk docs state that it is logically |
219 // inconsistent for a widget to make its size request depend on its allocation. | 226 // inconsistent for a widget to make its size request depend on its allocation. |
220 // It does, however, have the intended effect of wrapping the label at the | 227 // It does, however, have the intended effect of wrapping the label at the |
221 // proper width. | 228 // proper width. |
222 void WrapLabelAtAllocationHack(GtkWidget* label); | 229 void WrapLabelAtAllocationHack(GtkWidget* label); |
223 | 230 |
224 } // namespace gtk_util | 231 } // namespace gtk_util |
225 | 232 |
226 #endif // CHROME_COMMON_GTK_UTIL_H_ | 233 #endif // CHROME_COMMON_GTK_UTIL_H_ |
OLD | NEW |