-
- gtk_widget_dnd_drag_set( m_widget, FALSE, (gchar **) NULL, 0 );
-
- gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
-}
-
-
-/*
- * Shaped Windows
- */
-static GdkWindow *root_win = (GdkWindow*) NULL;
-
-typedef struct _cursoroffset {gint x,y;} CursorOffset;
-
-static void
-shape_pressed (GtkWidget *widget, GdkEventButton *event)
-{
- CursorOffset *p;
-
- /* ignore double and triple click */
- if (event->type != GDK_BUTTON_PRESS)
- return;
-
- p = (CursorOffset *)gtk_object_get_user_data (GTK_OBJECT(widget));
- p->x = (int) event->x;
- p->y = (int) event->y;
-
- gtk_grab_add (widget);
- gdk_pointer_grab (widget->window, TRUE,
- (GdkEventMask)
- (GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK),
- (GdkWindow*)NULL,
- (GdkCursor*) NULL, 0);
-}
-
-
-static void
-shape_released (GtkWidget *widget)
-{
- gtk_grab_remove (widget);
- gdk_pointer_ungrab (0);
-}
-
-static void
-shape_motion (GtkWidget *widget,
- GdkEventMotion * /*event*/ )
-{
- gint xp, yp;
- CursorOffset * p;
- GdkModifierType mask;
-
- p = (CursorOffset *)gtk_object_get_user_data (GTK_OBJECT (widget));
-
- /*
- * Can't use event->x / event->y here
- * because I need absolute coordinates.
- */
-
- gdk_window_get_pointer (root_win, &xp, &yp, &mask);
- gtk_widget_set_uposition (widget, xp - p->x, yp - p->y);
-
- if (gs_currentDropSource) gs_currentDropSource->GiveFeedback( wxDragCopy, FALSE );
-}
-
-GtkWidget *
-shape_create_icon (const wxIcon &shape,
- gint x,
- gint y,
- gint px,
- gint py,
- gint window_type)
-{
- /*
- * GDK_WINDOW_TOPLEVEL works also, giving you a title border
- */
- GtkWidget *window = gtk_window_new ((GtkWindowType)window_type);
-
- GtkWidget *fixed = gtk_fixed_new ();
- gtk_widget_set_usize (fixed, 100,100);
- gtk_container_add (GTK_CONTAINER (window), fixed);
- gtk_widget_show (fixed);
-
- gtk_widget_set_events (window,
- gtk_widget_get_events (window) |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_PRESS_MASK);
-
- gtk_widget_realize (window);
-
- GdkBitmap *mask = (GdkBitmap*) NULL;
- if (shape.GetMask()) mask = shape.GetMask()->GetBitmap();
-
- GtkWidget *pixmap = gtk_pixmap_new (shape.GetPixmap(), mask);
- gtk_fixed_put (GTK_FIXED (fixed), pixmap, px,py);
- gtk_widget_show (pixmap);
-
- gtk_widget_shape_combine_mask (window, mask, px,py);
-
-
- gtk_signal_connect (GTK_OBJECT (window), "button_press_event",
- GTK_SIGNAL_FUNC (shape_pressed),NULL);
- gtk_signal_connect (GTK_OBJECT (window), "button_release_event",
- GTK_SIGNAL_FUNC (shape_released),NULL);
- gtk_signal_connect (GTK_OBJECT (window), "motion_notify_event",
- GTK_SIGNAL_FUNC (shape_motion),NULL);
-
- CursorOffset*icon_pos = g_new (CursorOffset, 1);
- gtk_object_set_user_data(GTK_OBJECT(window), icon_pos);
-
- gtk_widget_set_uposition (window, x, y);
- gtk_widget_show (window);
-
- return window;