#include "wx/string.h"
#include "wx/dataobj.h"
#include "wx/cursor.h"
+#include "wx/icon.h"
+#include "wx/gdicmn.h"
//-------------------------------------------------------------------------
// conditional compilation
public:
/* constructor. set data later with SetData() */
- wxDropSource( wxWindow *win );
+ wxDropSource( wxWindow *win, const wxIcon &go = wxNullIcon, const wxIcon &stop = wxNullIcon );
/* constructor for setting one data object */
- wxDropSource( wxDataObject *data, wxWindow *win );
+ wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go = wxNullIcon, const wxIcon &stop = wxNullIcon );
/* constructor for setting several data objects via wxDataBroker */
wxDropSource( wxDataBroker *data, wxWindow *win );
wxCursor m_defaultCursor;
wxCursor m_goaheadCursor;
+
+ wxIcon m_goIcon;
+ wxIcon m_stopIcon;
};
#endif
#include "wx/string.h"
#include "wx/dataobj.h"
#include "wx/cursor.h"
+#include "wx/icon.h"
+#include "wx/gdicmn.h"
//-------------------------------------------------------------------------
// conditional compilation
public:
/* constructor. set data later with SetData() */
- wxDropSource( wxWindow *win );
+ wxDropSource( wxWindow *win, const wxIcon &go = wxNullIcon, const wxIcon &stop = wxNullIcon );
/* constructor for setting one data object */
- wxDropSource( wxDataObject *data, wxWindow *win );
+ wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go = wxNullIcon, const wxIcon &stop = wxNullIcon );
/* constructor for setting several data objects via wxDataBroker */
wxDropSource( wxDataBroker *data, wxWindow *win );
wxCursor m_defaultCursor;
wxCursor m_goaheadCursor;
+
+ wxIcon m_goIcon;
+ wxIcon m_stopIcon;
};
#endif
wxTextDataObject textData(m_strText);
wxDropSource dragSource( textData, this );
#else
- wxDropSource dragSource( new wxTextDataObject (m_strText), this );
+ wxDropSource dragSource( new wxTextDataObject (m_strText), this, wxIcon(mondrian_xpm) );
#endif
const char *pc;
#else // NEW_CODE
-GtkWidget *shape_create_icon (char **data,
+GtkWidget *shape_create_icon ( const wxIcon &shape,
gint x,
gint y,
gint px,
}
}
-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);
#else // NEW_CODE
-GtkWidget *shape_create_icon (char **data,
+GtkWidget *shape_create_icon ( const wxIcon &shape,
gint x,
gint y,
gint px,
}
}
-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);