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

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

Issue 10546116: gtk: Extract event functions into event_utils module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
« no previous file with comments | « chrome/browser/ui/gtk/global_history_menu.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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>
(...skipping 15 matching lines...) Expand all
26 class Profile; 26 class Profile;
27 27
28 namespace content { 28 namespace content {
29 struct RendererPreferences; 29 struct RendererPreferences;
30 } 30 }
31 31
32 namespace gfx { 32 namespace gfx {
33 class Image; 33 class Image;
34 } 34 }
35 35
36 namespace event_utils {
37
38 // Translates GdkEvent state into what kind of disposition they represent.
39 // For example, a middle click would mean to open a background tab.
40 WindowOpenDisposition DispositionFromGdkState(guint state);
41
42 // Translates event flags into plaform independent event flags.
43 int EventFlagsFromGdkState(guint state);
44
45 } // namespace event_utils
46
47 namespace gtk_util { 36 namespace gtk_util {
48 37
49 // Create a table of labeled controls, using proper spacing and alignment. 38 // Create a table of labeled controls, using proper spacing and alignment.
50 // Arguments should be pairs of const char*, GtkWidget*, concluding with a 39 // Arguments should be pairs of const char*, GtkWidget*, concluding with a
51 // NULL. The first argument is a vector in which to place all labels 40 // NULL. The first argument is a vector in which to place all labels
52 // produced. It can be NULL if you don't need to keep track of the label 41 // produced. It can be NULL if you don't need to keep track of the label
53 // widgets. The second argument is a color to force the label text to. It can 42 // widgets. The second argument is a color to force the label text to. It can
54 // be NULL to get the system default. 43 // be NULL to get the system default.
55 // 44 //
56 // For example: 45 // For example:
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 237
249 // Don't allow the widget to paint anything, and instead propagate the expose 238 // Don't allow the widget to paint anything, and instead propagate the expose
250 // to its children. This is similar to calling 239 // to its children. This is similar to calling
251 // 240 //
252 // gtk_widget_set_app_paintable(container, TRUE); 241 // gtk_widget_set_app_paintable(container, TRUE);
253 // 242 //
254 // except that it will always work, and it should be called after any custom 243 // except that it will always work, and it should be called after any custom
255 // expose events are connected. 244 // expose events are connected.
256 void SuppressDefaultPainting(GtkWidget* container); 245 void SuppressDefaultPainting(GtkWidget* container);
257 246
258 // Get the window open disposition from the state in gtk_get_current_event().
259 // This is designed to be called inside a "clicked" event handler. It is an
260 // error to call it when gtk_get_current_event() won't return a GdkEventButton*.
261 WindowOpenDisposition DispositionForCurrentButtonPressEvent();
262
263 // Safely grabs all input (with X grabs and an application grab), returning true 247 // Safely grabs all input (with X grabs and an application grab), returning true
264 // for success. 248 // for success.
265 bool GrabAllInput(GtkWidget* widget); 249 bool GrabAllInput(GtkWidget* widget);
266 250
267 // Returns a rectangle that represents the widget's bounds. The rectangle it 251 // Returns a rectangle that represents the widget's bounds. The rectangle it
268 // returns is the same as gtk_widget_get_allocation, but anchored at (0, 0). 252 // returns is the same as gtk_widget_get_allocation, but anchored at (0, 0).
269 gfx::Rect WidgetBounds(GtkWidget* widget); 253 gfx::Rect WidgetBounds(GtkWidget* widget);
270 254
271 // Update the timestamp for the given window. This is usually the time of the 255 // Update the timestamp for the given window. This is usually the time of the
272 // last user event, but on rare occasions we wish to update it despite not 256 // last user event, but on rare occasions we wish to update it despite not
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 void ApplyMessageDialogQuirks(GtkWidget* dialog); 321 void ApplyMessageDialogQuirks(GtkWidget* dialog);
338 322
339 // Performs Cut/Copy/Paste operation on the |window|. 323 // Performs Cut/Copy/Paste operation on the |window|.
340 void DoCut(BrowserWindow* window); 324 void DoCut(BrowserWindow* window);
341 void DoCopy(BrowserWindow* window); 325 void DoCopy(BrowserWindow* window);
342 void DoPaste(BrowserWindow* window); 326 void DoPaste(BrowserWindow* window);
343 327
344 } // namespace gtk_util 328 } // namespace gtk_util
345 329
346 #endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_ 330 #endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/global_history_menu.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698