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

Side by Side Diff: chrome/browser/ui/gtk/custom_drag.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/gtk/custom_drag.h"
6
7 #include "ui/base/dragdrop/gtk_dnd_util.h"
8 #include "ui/gfx/image/image.h"
9
10 CustomDrag::CustomDrag(gfx::Image* icon, int code_mask, GdkDragAction action)
11 : drag_widget_(gtk_invisible_new()),
12 image_(icon) {
13 g_signal_connect(drag_widget_, "drag-data-get",
14 G_CALLBACK(OnDragDataGetThunk), this);
15 g_signal_connect(drag_widget_, "drag-begin",
16 G_CALLBACK(OnDragBeginThunk), this);
17 g_signal_connect(drag_widget_, "drag-end",
18 G_CALLBACK(OnDragEndThunk), this);
19
20 GtkTargetList* list = ui::GetTargetListFromCodeMask(code_mask);
21 GdkEvent* event = gtk_get_current_event();
22 gtk_drag_begin(drag_widget_, list, action, 1, event);
23 if (event)
24 gdk_event_free(event);
25 gtk_target_list_unref(list);
26 }
27
28 CustomDrag::~CustomDrag() {
29 gtk_widget_destroy(drag_widget_);
30 }
31
32 void CustomDrag::OnDragBegin(GtkWidget* widget, GdkDragContext* drag_context) {
33 if (image_)
34 gtk_drag_set_icon_pixbuf(drag_context, image_->ToGdkPixbuf(), 0, 0);
35 }
36
37 void CustomDrag::OnDragEnd(GtkWidget* widget, GdkDragContext* drag_context) {
38 delete this;
39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698