X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0d2a2b601b1994333886dff8f53d82a714c4042f..1363811bb6338fb0dad6c16cfa47f46fb1eb3b99:/src/gtk1/dnd.cpp?ds=sidebyside diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index 17c1d18258..5ea4529238 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -246,8 +246,9 @@ bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * bool wxFileDropTarget::OnDrop(long x, long y, const void *data, size_t size ) { size_t number = 0; + size_t i; char *text = (char*) data; - for (size_t i = 0; i < size; i++) + for (i = 0; i < size; i++) if (text[i] == 0) number++; if (number == 0) return TRUE; @@ -255,7 +256,7 @@ bool wxFileDropTarget::OnDrop(long x, long y, const void *data, size_t size ) char **files = new char*[number]; text = (char*) data; - for (size_t i = 0; i < number; i++) + for (i = 0; i < number; i++) { files[i] = text; int len = strlen( text ); @@ -378,7 +379,7 @@ void wxDropSource::UnregisterWindow(void) #else // NEW_CODE -GtkWidget *shape_create_icon (char **data, +GtkWidget *shape_create_icon ( const wxIcon &shape, gint x, gint y, gint px, @@ -681,8 +682,9 @@ bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * bool wxFileDropTarget::OnDrop(long x, long y, const void *data, size_t size ) { size_t number = 0; + size_t i; char *text = (char*) data; - for (size_t i = 0; i < size; i++) + for ( i = 0; i < size; i++) if (text[i] == 0) number++; if (number == 0) return TRUE; @@ -690,7 +692,7 @@ bool wxFileDropTarget::OnDrop(long x, long y, const void *data, size_t size ) char **files = new char*[number]; text = (char*) data; - for (size_t i = 0; i < number; i++) + for (i = 0; i < number; i++) { files[i] = text; int len = strlen( text ); @@ -790,7 +792,7 @@ void gtk_drag_callback( GtkWidget *widget, GdkEventDragRequest *event, wxDropSou } } -wxDropSource::wxDropSource( wxWindow *win ) +wxDropSource::wxDropSource( wxWindow *win, const wxIcon &go, const wxIcon &stop ) { g_blockEventsOnDrag = TRUE; @@ -803,9 +805,14 @@ wxDropSource::wxDropSource( wxWindow *win ) m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY ); m_goaheadCursor = wxCursor( wxCURSOR_HAND ); + + m_goIcon = go; + if (wxNullIcon == go) m_goIcon = wxIcon( page_xpm ); + m_stopIcon = stop; + if (wxNullIcon == stop) m_stopIcon = wxIcon( gv_xpm ); } -wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win ) +wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go, const wxIcon &stop ) { g_blockEventsOnDrag = TRUE; @@ -826,6 +833,11 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win ) m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY ); m_goaheadCursor = wxCursor( wxCURSOR_HAND ); + + m_goIcon = go; + if (wxNullIcon == go) m_goIcon = wxIcon( page_xpm ); + m_stopIcon = stop; + if (wxNullIcon == stop) m_stopIcon = wxIcon( gv_xpm ); } wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win ) @@ -888,7 +900,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) if (!drag_icon) { - drag_icon = shape_create_icon ( gv_xpm, + drag_icon = shape_create_icon ( m_stopIcon, 440, 140, 0,0, GTK_WINDOW_POPUP); gtk_signal_connect (GTK_OBJECT (drag_icon), "destroy", @@ -902,7 +914,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) if (!drop_icon) { - drop_icon = shape_create_icon ( page_xpm, + drop_icon = shape_create_icon ( m_goIcon, 440, 140, 0,0, GTK_WINDOW_POPUP); gtk_signal_connect (GTK_OBJECT (drop_icon), "destroy", @@ -1091,31 +1103,19 @@ shape_motion (GtkWidget *widget, } GtkWidget * -shape_create_icon (char **data, +shape_create_icon (const wxIcon &shape, gint x, gint y, gint px, gint py, gint window_type) { - GtkWidget *window; - GtkWidget *pixmap; - GtkWidget *fixed; - CursorOffset* icon_pos; - GdkGC* gc; - GdkBitmap *gdk_pixmap_mask; - GdkPixmap *gdk_pixmap; - GtkStyle *style; - - style = gtk_widget_get_default_style (); - gc = style->black_gc; - /* * GDK_WINDOW_TOPLEVEL works also, giving you a title border */ - window = gtk_window_new ((GtkWindowType)window_type); + GtkWidget *window = gtk_window_new ((GtkWindowType)window_type); - fixed = gtk_fixed_new (); + GtkWidget *fixed = gtk_fixed_new (); gtk_widget_set_usize (fixed, 100,100); gtk_container_add (GTK_CONTAINER (window), fixed); gtk_widget_show (fixed); @@ -1128,15 +1128,14 @@ shape_create_icon (char **data, gtk_widget_realize (window); - gdk_pixmap = gdk_pixmap_create_from_xpm_d (window->window, &gdk_pixmap_mask, - &style->bg[GTK_STATE_NORMAL], - (gchar**) data ); + GdkBitmap *mask = (GdkBitmap*) NULL; + if (shape.GetMask()) mask = shape.GetMask()->GetBitmap(); - pixmap = gtk_pixmap_new (gdk_pixmap, gdk_pixmap_mask); + 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, gdk_pixmap_mask, px,py); + gtk_widget_shape_combine_mask (window, mask, px,py); gtk_signal_connect (GTK_OBJECT (window), "button_press_event", @@ -1146,7 +1145,7 @@ shape_create_icon (char **data, gtk_signal_connect (GTK_OBJECT (window), "motion_notify_event", GTK_SIGNAL_FUNC (shape_motion),NULL); - icon_pos = g_new (CursorOffset, 1); + CursorOffset*icon_pos = g_new (CursorOffset, 1); gtk_object_set_user_data(GTK_OBJECT(window), icon_pos); gtk_widget_set_uposition (window, x, y);