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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_
6 #define CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_
10 #include "base/basictypes.h"
11 #include "ui/base/gtk/gtk_signal.h"
17 // Base class for programatically generated drags.
20 CustomDrag(gfx::Image* icon, int code_mask, GdkDragAction action);
21 virtual ~CustomDrag();
23 virtual void OnDragDataGet(GtkWidget* widget,
24 GdkDragContext* context,
25 GtkSelectionData* selection_data,
30 CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragBegin, GdkDragContext*);
31 CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragEnd, GdkDragContext*);
33 // Since this uses a virtual function, we can't use a macro.
34 static void OnDragDataGetThunk(GtkWidget* widget, GdkDragContext* context,
35 GtkSelectionData* selection_data,
36 guint target_type, guint time,
37 CustomDrag* custom_drag) {
38 return custom_drag->OnDragDataGet(widget, context, selection_data,
42 // Can't use a OwnedWidgetGtk because the initialization of GtkInvisible
43 // sinks the reference.
44 GtkWidget* drag_widget_;
46 // The image for the drag. The lifetime of the image should be managed outside
47 // this object. Most icons are owned by the IconManager.
50 DISALLOW_COPY_AND_ASSIGN(CustomDrag);
53 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_