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

Side by Side Diff: views/widget/widget_gtk.cc

Issue 270068: Implement dragging icon for dragging bookmarks in views/gtk. Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« app/os_exchange_data_provider_gtk.h ('K') | « views/drag_utils_gtk.cc ('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 "views/widget/widget_gtk.h" 5 #include "views/widget/widget_gtk.h"
6 6
7 #include "app/drag_drop_types.h" 7 #include "app/drag_drop_types.h"
8 #include "app/gfx/path.h" 8 #include "app/gfx/path.h"
9 #include "app/os_exchange_data.h" 9 #include "app/os_exchange_data.h"
10 #include "app/os_exchange_data_provider_gtk.h" 10 #include "app/os_exchange_data_provider_gtk.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 gtk_widget_set_size_request(child, w, h); 177 gtk_widget_set_size_request(child, w, h);
178 gtk_fixed_move(GTK_FIXED(window_contents_), child, x, y); 178 gtk_fixed_move(GTK_FIXED(window_contents_), child, x, y);
179 } 179 }
180 180
181 void WidgetGtk::DoDrag(const OSExchangeData& data, int operation) { 181 void WidgetGtk::DoDrag(const OSExchangeData& data, int operation) {
182 const OSExchangeDataProviderGtk& data_provider = 182 const OSExchangeDataProviderGtk& data_provider =
183 static_cast<const OSExchangeDataProviderGtk&>(data.provider()); 183 static_cast<const OSExchangeDataProviderGtk&>(data.provider());
184 GtkTargetList* targets = data_provider.GetTargetList(); 184 GtkTargetList* targets = data_provider.GetTargetList();
185 GdkEvent* current_event = gtk_get_current_event(); 185 GdkEvent* current_event = gtk_get_current_event();
186 DCHECK(current_event); 186 DCHECK(current_event);
187 gtk_drag_begin(window_contents_, targets, 187 const OSExchangeDataProviderGtk& provider(
188 static_cast<GdkDragAction>( 188 static_cast<const OSExchangeDataProviderGtk&>(data.provider()));
189 DragDropTypes::DragOperationToGdkDragAction(operation)), 189
190 1, current_event); 190 GdkDragContext* context = gtk_drag_begin(
191 window_contents_,
192 targets,
193 static_cast<GdkDragAction>(
194 DragDropTypes::DragOperationToGdkDragAction(operation)),
195 1,
196 current_event);
197
198 // Set the drag image if one was supplied.
199 if (provider.get_drag_image())
200 gtk_drag_set_icon_pixbuf(context,
201 provider.get_drag_image(),
202 provider.cursor_offset_x(),
203 provider.cursor_offset_y());
191 gdk_event_free(current_event); 204 gdk_event_free(current_event);
192 gtk_target_list_unref(targets); 205 gtk_target_list_unref(targets);
193 206
194 drag_data_ = &data_provider; 207 drag_data_ = &data_provider;
195 208
196 // Block the caller until drag is done by running a nested message loop. 209 // Block the caller until drag is done by running a nested message loop.
197 MessageLoopForUI::current()->Run(NULL); 210 MessageLoopForUI::current()->Run(NULL);
198 211
199 drag_data_ = NULL; 212 drag_data_ = NULL;
200 } 213 }
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 1209
1197 // static 1210 // static
1198 Widget* Widget::CreateTransparentPopupWidget(bool delete_on_destroy) { 1211 Widget* Widget::CreateTransparentPopupWidget(bool delete_on_destroy) {
1199 WidgetGtk* popup = new WidgetGtk(WidgetGtk::TYPE_POPUP); 1212 WidgetGtk* popup = new WidgetGtk(WidgetGtk::TYPE_POPUP);
1200 popup->set_delete_on_destroy(delete_on_destroy); 1213 popup->set_delete_on_destroy(delete_on_destroy);
1201 popup->MakeTransparent(); 1214 popup->MakeTransparent();
1202 return popup; 1215 return popup;
1203 } 1216 }
1204 1217
1205 } // namespace views 1218 } // namespace views
OLDNEW
« app/os_exchange_data_provider_gtk.h ('K') | « views/drag_utils_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698