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

Side by Side Diff: chrome/common/gtk_util.cc

Issue 113532: Implement DraggedTabGtk, the object that handles rendering either a dragged t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/common/gtk_util.h ('k') | no next file » | 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) 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 #include "chrome/common/gtk_util.h" 5 #include "chrome/common/gtk_util.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/linux_util.h" 9 #include "base/linux_util.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right); 47 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right);
48 gtk_container_add(GTK_CONTAINER(alignment), child); 48 gtk_container_add(GTK_CONTAINER(alignment), child);
49 gtk_container_add(GTK_CONTAINER(ebox), alignment); 49 gtk_container_add(GTK_CONTAINER(ebox), alignment);
50 return ebox; 50 return ebox;
51 } 51 }
52 52
53 void RemoveAllChildren(GtkWidget* container) { 53 void RemoveAllChildren(GtkWidget* container) {
54 gtk_container_foreach(GTK_CONTAINER(container), RemoveWidget, container); 54 gtk_container_foreach(GTK_CONTAINER(container), RemoveWidget, container);
55 } 55 }
56 56
57 gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
58 int x = 0, y = 0;
59
60 GtkWidget* parent = widget;
61 while (parent) {
62 if (GTK_IS_WINDOW(parent)) {
63 int window_x, window_y;
64 gtk_window_get_position(GTK_WINDOW(parent), &window_x, &window_y);
65 x += window_x;
66 y += window_y;
67 return gfx::Point(x, y);
68 }
69
70 x += parent->allocation.x;
71 y += parent->allocation.y;
72 parent = gtk_widget_get_parent(parent);
73 }
74
75 return gfx::Point(x, y);
76 }
77
78 gfx::Rect GetWidgetScreenBounds(GtkWidget* widget) {
79 gfx::Point position = GetWidgetScreenPosition(widget);
80 return gfx::Rect(position.x(), position.y(),
81 widget->allocation.width, widget->allocation.height);
82 }
83
57 } // namespace gtk_util 84 } // namespace gtk_util
OLDNEW
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698