Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/ui/gtk/gtk_util.h

Issue 8196001: content: Split web_drag_dest_gtk.cc into chrome/ and content/ parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix viewgtk compile Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
15 #include "ui/base/x/x11_util.h" 14 #include "ui/base/x/x11_util.h"
16 #include "ui/gfx/point.h" 15 #include "ui/gfx/point.h"
17 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
18 #include "webkit/glue/window_open_disposition.h" 17 #include "webkit/glue/window_open_disposition.h"
19 18
20 typedef struct _cairo cairo_t; 19 typedef struct _cairo cairo_t;
21 typedef struct _GdkColor GdkColor; 20 typedef struct _GdkColor GdkColor;
22 typedef struct _GtkWidget GtkWidget; 21 typedef struct _GtkWidget GtkWidget;
23 22
24 class BrowserWindow; 23 class BrowserWindow;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // relative to the widget's top-left origin. 126 // relative to the widget's top-left origin.
128 void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p); 127 void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p);
129 128
130 // Stick the widget in the given hbox without expanding vertically. The widget 129 // Stick the widget in the given hbox without expanding vertically. The widget
131 // is packed at the start of the hbox. This is useful for widgets that would 130 // is packed at the start of the hbox. This is useful for widgets that would
132 // otherwise expand to fill the vertical space of the hbox 131 // otherwise expand to fill the vertical space of the hbox
133 // (e.g. buttons). Returns the vbox that widget was packed in. 132 // (e.g. buttons). Returns the vbox that widget was packed in.
134 GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget, 133 GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget,
135 bool pack_at_end, int padding); 134 bool pack_at_end, int padding);
136 135
137 // Returns true if the screen is composited, false otherwise.
138 bool IsScreenComposited();
139
140 // Enumerates the top-level gdk windows of the current display. 136 // Enumerates the top-level gdk windows of the current display.
141 void EnumerateTopLevelWindows(ui::EnumerateWindowsDelegate* delegate); 137 void EnumerateTopLevelWindows(ui::EnumerateWindowsDelegate* delegate);
142 138
143 // Set that clicking the button with the given mouse buttons will cause a click 139 // Set that clicking the button with the given mouse buttons will cause a click
144 // event. 140 // event.
145 // NOTE: If you need to connect to the button-press-event or 141 // NOTE: If you need to connect to the button-press-event or
146 // button-release-event signals, do so before calling this function. 142 // button-release-event signals, do so before calling this function.
147 void SetButtonClickableByMouseButtons(GtkWidget* button, 143 void SetButtonClickableByMouseButtons(GtkWidget* button,
148 bool left, bool middle, bool right); 144 bool left, bool middle, bool right);
149 145
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Sets all the foreground color states of |label| to |color|. 186 // Sets all the foreground color states of |label| to |color|.
191 void SetLabelColor(GtkWidget* label, const GdkColor* color); 187 void SetLabelColor(GtkWidget* label, const GdkColor* color);
192 188
193 // Adds the given widget to an alignment identing it by |kGroupIndent|. 189 // Adds the given widget to an alignment identing it by |kGroupIndent|.
194 GtkWidget* IndentWidget(GtkWidget* content); 190 GtkWidget* IndentWidget(GtkWidget* content);
195 191
196 // Sets (or resets) the font settings in |prefs| (used when creating new 192 // Sets (or resets) the font settings in |prefs| (used when creating new
197 // renderers) based on GtkSettings (which itself comes from XSETTINGS). 193 // renderers) based on GtkSettings (which itself comes from XSETTINGS).
198 void UpdateGtkFontSettings(RendererPreferences* prefs); 194 void UpdateGtkFontSettings(RendererPreferences* prefs);
199 195
200 // Get the current location of the mouse cursor relative to the screen.
201 gfx::Point ScreenPoint(GtkWidget* widget);
202
203 // Get the current location of the mouse cursor relative to the widget.
204 gfx::Point ClientPoint(GtkWidget* widget);
205
206 // Reverses a point in RTL mode. Used in making vectors of GdkPoints for window 196 // Reverses a point in RTL mode. Used in making vectors of GdkPoints for window
207 // shapes. 197 // shapes.
208 GdkPoint MakeBidiGdkPoint(gint x, gint y, gint width, bool ltr); 198 GdkPoint MakeBidiGdkPoint(gint x, gint y, gint width, bool ltr);
209 199
210 // Creates a tooltip string to be passed to gtk_widget_set_tooltip_markup from 200 // Creates a tooltip string to be passed to gtk_widget_set_tooltip_markup from
211 // the title and URL. 201 // the title and URL.
212 std::string BuildTooltipTitleFor(string16 title, const GURL& url); 202 std::string BuildTooltipTitleFor(string16 title, const GURL& url);
213 203
214 // Draws a GTK text entry with the style parameters of GtkEntry 204 // Draws a GTK text entry with the style parameters of GtkEntry
215 // |offscreen_entry| onto |widget_to_draw_on| in the rectangle |rec|. Drawing 205 // |offscreen_entry| onto |widget_to_draw_on| in the rectangle |rec|. Drawing
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // and this function hides the complexity of the workaround. 312 // and this function hides the complexity of the workaround.
323 void SetLabelWidth(GtkWidget* label, int pixel_width); 313 void SetLabelWidth(GtkWidget* label, int pixel_width);
324 314
325 // Make the |label| shrinkable within a GthChromeShrinkableHBox 315 // Make the |label| shrinkable within a GthChromeShrinkableHBox
326 // It calculates the real size request of a label and set its ellipsize mode to 316 // It calculates the real size request of a label and set its ellipsize mode to
327 // PANGO_ELLIPSIZE_END. 317 // PANGO_ELLIPSIZE_END.
328 // It must be done when the label is mapped (become visible on the screen), 318 // It must be done when the label is mapped (become visible on the screen),
329 // to make sure the pango can get correct font information for the calculation. 319 // to make sure the pango can get correct font information for the calculation.
330 void InitLabelSizeRequestAndEllipsizeMode(GtkWidget* label); 320 void InitLabelSizeRequestAndEllipsizeMode(GtkWidget* label);
331 321
332 // Convenience methods for converting between web drag operations and the GDK
333 // equivalent.
334 GdkDragAction WebDragOpToGdkDragAction(WebKit::WebDragOperationsMask op);
335 WebKit::WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action);
336
337 // A helper function for gtk_message_dialog_new() to work around a few KDE 3 322 // A helper function for gtk_message_dialog_new() to work around a few KDE 3
338 // window manager bugs. You should always call it after creating a dialog with 323 // window manager bugs. You should always call it after creating a dialog with
339 // gtk_message_dialog_new. 324 // gtk_message_dialog_new.
340 void ApplyMessageDialogQuirks(GtkWidget* dialog); 325 void ApplyMessageDialogQuirks(GtkWidget* dialog);
341 326
342 // Performs Cut/Copy/Paste operation on the |window|. 327 // Performs Cut/Copy/Paste operation on the |window|.
343 void DoCut(BrowserWindow* window); 328 void DoCut(BrowserWindow* window);
344 void DoCopy(BrowserWindow* window); 329 void DoCopy(BrowserWindow* window);
345 void DoPaste(BrowserWindow* window); 330 void DoPaste(BrowserWindow* window);
346 331
347 } // namespace gtk_util 332 } // namespace gtk_util
348 333
349 #endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_ 334 #endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698