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;
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 );
#else // NEW_CODE
-GtkWidget *shape_create_icon (char **data,
+GtkWidget *shape_create_icon ( const wxIcon &shape,
gint x,
gint y,
gint px,
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;
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 );
}
}
-wxDropSource::wxDropSource( wxWindow *win )
+wxDropSource::wxDropSource( wxWindow *win, const wxIcon &go, const wxIcon &stop )
{
g_blockEventsOnDrag = TRUE;
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;
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 )
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",
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",
}
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);
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",
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);