* The most simple case
-----------------------
-If you compile wxWindows on Unix for the first time and don't like
-to read install instructions just do (in the base dir):
+If you compile wxWindows on Unix for the first time and don't
+like to read install instructions just do (in the base dir):
./configure --without-threads
make
make install
-You can leave out the --without-threads option if you have a NEW
-Linux distribution based on glibc (e.g. RedHat 5.1 or Debian 2.0)
-or any other Unix that comes with Posix threads or SGI threads.
+You can leave out the --without-threads option if you have
+a NEW Linux distribution based on glibc (e.g. RedHat 5.1 or
+Debian 2.0) or any other Unix that comes with Posix threads
+or SGI threads.
-Now create your super-application myfoo.app and compile anywhere with
+Now create your super-application myfoo.app and compile anywhere
+with
g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
* General
-----------------------
-The Unix variants of wxWindows use GNU configure. If you have problems
-with your make use GNU make instead.
+The Unix variants of wxWindows use GNU configure. If you have
+problems with your make use GNU make instead.
-Read my homepage at
+If you have general problems with installation, read my
+homepage at
http://wesley.informatik.uni-freiburg.de/~wxxt
-for newest information.
+for newest information. If you still don't have any success,
+please send a bug report to one of our mailing lists (see
+my homepage) INCLUDING A DESCRIPTION OF YOUR SYSTEM AND
+YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT
+DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know
+this has no effect, but I tried...
* GUI libraries
-----------------------
wxWindows/GTK requires the GTK+ library to be installed on your system.
It has to be a stable version, preferebly version 1.0.6. When using
-a version previous to 1.0.6 you'll get crashes here and there. This
-is certain to happen with colors in native widgets.
+a version previous to 1.0.6 you'll get crashes here and there. Although
+wxWindows/GTK now compiles with GTK+ 1.1.3, it does not set work
+properly. Wait for a stable version GTK 1.2.
You can get the newest version of the GTK+ from the GTK homepage
at
Welcome to wxWindows/Gtk,
-you have downloaded version 1.96 of the GTK+ port of C++ library
+you have downloaded version 1.97 of the GTK+ port of C++ library
wxWindows. Information on how to install can be found in the
-file install.txt, but if you cannot wait, this should work on
+file INSTALL.txt, but if you cannot wait, this should work on
all systems
configure --without-threads
su (PASSWORD)
make install
+When you run into problems, please read the INSTALL.txt and
+follow those instructions. If you still don't have any success,
+please send a bug report to one of our mailing lists (see
+my homepage) INCLUDING A DESCRIPTION OF YOUR SYSTEM AND
+YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT
+DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know
+this has no effect, but I tried...
+
wxWindows/Gtk is still in development and you can have a look
-at the todo.txt to see what's missing before an official beta
+at the TODO.txt to see what's missing before an official beta
and - more important - before we can aim at binary compatibility.
More information is available from my homepage at
Fix printing of bitmaps
-> No idea.
+-------------------- Low priority ---------------------
+
OwnerDraw for wxListCtrl and others
- -> That is a big one.
+ -> Postponed.
DnD
-> Must be rewritten for GTK+ 1.1.3
--------------------- Low priority ---------------------
-
wxDebugContext <-> wxLogXXX functions
-> Remove either
// get the list item's data
void *operator[](size_t index) const
- { wxNodeBase *node = Item(index); return node ? node->GetData() : NULL; }
+ { wxNodeBase *node = Item(index); return node ? node->GetData() : (wxNodeBase*)NULL; }
// operations
// append to end of list
wxNodeBase *Append(void *object);
// insert a new item at the beginning of the list
- wxNodeBase *Insert(void *object) { return Insert(NULL, object); }
+ wxNodeBase *Insert(void *object) { return Insert( (wxNodeBase*)NULL, object); }
// insert before given node or at front of list if prev == NULL
wxNodeBase *Insert(wxNodeBase *prev, void *object);
nodetype *Append(T *object) \
{ return (nodetype *)wxListBase::Append(object); } \
nodetype *Insert(T *object) \
- { return (nodetype *)Insert(NULL, object); } \
+ { return (nodetype *)Insert((nodetype*)NULL, object); } \
nodetype *Insert(nodetype *prev, T *object) \
{ return (nodetype *)wxListBase::Insert(prev, object); } \
\
m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL);
m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL);
-/*
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
wxTE_MULTILINE | wxTE_READONLY |
wxSUNKEN_BORDER| wxHSCROLL);
// redirect log messages to the text window (don't forget to delete it!)
m_pLog = new wxLogTextCtrl(m_ctrlLog);
m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
-*/
-
- wxStaticText *m_testLabel = new wxStaticText( this, -1, "Hallo", pos, size );
- m_testLabel->SetDropTarget( new wxTextDropTarget() );
// associate drop targets with 2 text controls
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
c->height.PercentOf(this, wxHeight, 40);
m_ctrlText->SetConstraints(c);
-/*
// Lower text control
c = new wxLayoutConstraints;
c->left.SameAs (this, wxLeft);
c->height.PercentOf(this, wxHeight, 40);
c->top.SameAs(m_ctrlText, wxBottom);
m_ctrlLog->SetConstraints(c);
-*/
- // Lower label control
- c = new wxLayoutConstraints;
- c->left.SameAs (this, wxLeft);
- c->right.SameAs (this, wxRight);
- c->height.PercentOf(this, wxHeight, 40);
- c->top.SameAs(m_ctrlText, wxBottom);
- m_testLabel->SetConstraints(c);
-
-
SetAutoLayout(TRUE);
}
# define library name
LIB_TARGET=wx_gtk
LIB_MAJOR=1
-LIB_MINOR=96
+LIB_MINOR=97
# define library sources
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
+ gdk_gc_set_background( m_penGC, m_backgroundBrush.GetColour().GetColor() );
gdk_gc_set_background( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
m_brushGC = gdk_gc_new( m_window );
m_textGC = gdk_gc_new( m_window );
m_bgGC = gdk_gc_new( m_window );
- SetTextForeground( m_textForegroundColour );
- SetTextBackground( m_textBackgroundColour );
+
+ wxColour tmp_col( m_textForegroundColour );
+ m_textForegroundColour = wxNullColour;
+ SetTextForeground( tmp_col );
+ tmp_col = m_textBackgroundColour;
+ m_textBackgroundColour = wxNullColour;
+ SetTextBackground( tmp_col );
wxPen tmp_pen( m_pen );
m_pen = wxNullPen;
m_backgroundBrush = wxNullBrush;
SetBackground( tmp_brush );
- gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
-
if (!hatch_bitmap)
{
hatch_bitmap = hatches;
{
m_title = "";
m_modalShowing = FALSE;
- wxTopLevelWindows.Insert( this );
}
wxDialog::wxDialog( wxWindow *parent,
long style, const wxString &name )
{
m_modalShowing = FALSE;
- wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
}
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ wxTopLevelWindows.Append( this );
+
m_needParent = FALSE;
PreCreation( parent, id, pos, size, style, name );
#else // NEW_CODE
-
-
+GtkWidget *shape_create_icon (char **data,
+ gint x,
+ gint y,
+ gint px,
+ gint py,
+ gint window_type);
+
+/* XPM */
+static char * gv_xpm[] = {
+"40 34 3 1",
+" s None c None",
+". c black",
+"X c white",
+" ",
+" ",
+" ...... ",
+" ..XXXXXX.. ",
+" .XXXXXXXXXX. ",
+" .XXXXXXXXXXXX. ",
+" .XXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXX. ",
+" .XXX..XXXX..XXX. ",
+" ....XX....XX....XX. ",
+" .XXX.XXX..XXXX..XXX.... ",
+" .XXXXXXXXXXXXXXXXXXX.XXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXXX. ",
+" ..XXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXX... ",
+" ..XXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXX.XXXXXXX. ",
+" .XXXXXXX.XXXXXXX.XXXXXXX. ",
+" .XXXXXXXX.XXXXXXX.XXXXXXX. ",
+" .XXXXXXX...XXXXX...XXXXX. ",
+" .XXXXXXX. ..... ..... ",
+" ..XXXX.. ",
+" .... ",
+" ",
+" ",
+" "};
+
+/* XPM */
+static char * page_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 5 1",
+/* colors */
+" s None c None",
+". c black",
+"X c wheat",
+"o c tan",
+"O c #6699FF",
+/* pixels */
+" ................... ",
+" .XXXXXXXXXXXXXXXXX.. ",
+" .XXXXXXXXXXXXXXXXX.o. ",
+" .XXXXXXXXXXXXXXXXX.oo. ",
+" .XXXXXXXXXXXXXXXXX.ooo. ",
+" .XXXXXXXXXXXXXXXXX.oooo. ",
+" .XXXXXXXXXXXXXXXXX....... ",
+" .XXXXXOOOOOOOOOOXXXooooo. ",
+" .XXXXXXXXXXXXXXXXXXooooo. ",
+" .XXXXXOOOOOOOOOOXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXOOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXOOOOOOOOOOXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXOOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXOOOOOOOOOOXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXOOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXOOOOOOOXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" ......................... "};
+
+
//-----------------------------------------------------------------------------
// "drop_data_available_event"
//-----------------------------------------------------------------------------
int y = 0;
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
- printf( "Drop data is of type %s.\n", event->data_type );
+// printf( "Drop data is of type %s.\n", event->data_type );
target->OnDrop( x, y, (const void*)event->data, (size_t)event->data_numbytes );
}
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
{
- printf( "Data requested for dropping.\n" );
-
wxDataObject *data = source->m_data;
size_t size = data->GetDataSize();
if (!m_data) return (wxDragResult) wxDragNone;
if (m_data->GetDataSize() == 0) return (wxDragResult) wxDragNone;
+ static GtkWidget *drag_icon = NULL;
+ static GtkWidget *drop_icon = NULL;
+
+ GdkPoint hotspot_1 = {0,-5 };
+
+ if (!drag_icon)
+ {
+ drag_icon = shape_create_icon ( gv_xpm,
+ 440, 140, 0,0, GTK_WINDOW_POPUP);
+
+ gtk_signal_connect (GTK_OBJECT (drag_icon), "destroy",
+ GTK_SIGNAL_FUNC(gtk_widget_destroyed),
+ &drag_icon);
+
+ gtk_widget_hide (drag_icon);
+ }
+
+ GdkPoint hotspot_2 = {-5,-5};
+
+ if (!drop_icon)
+ {
+ drop_icon = shape_create_icon ( page_xpm,
+ 440, 140, 0,0, GTK_WINDOW_POPUP);
+
+ gtk_signal_connect (GTK_OBJECT (drop_icon), "destroy",
+ GTK_SIGNAL_FUNC(gtk_widget_destroyed),
+ &drop_icon);
+
+ gtk_widget_hide (drop_icon);
+ }
+
+ gdk_dnd_set_drag_shape(drag_icon->window,
+ &hotspot_1,
+ drop_icon->window,
+ &hotspot_2);
+
+
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
RegisterWindow();
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
}
+
+/*
+ * Shaped Windows
+ */
+static GdkWindow *root_win = 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 = 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,
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_BUTTON_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK,
+ NULL, 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 = 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);
+}
+
+GtkWidget *
+shape_create_icon (char **data,
+ 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 (window_type);
+
+ 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);
+
+ gdk_pixmap = gdk_pixmap_create_from_xpm_d (window->window, &gdk_pixmap_mask,
+ &style->bg[GTK_STATE_NORMAL],
+ (gchar**) data );
+
+ pixmap = gtk_pixmap_new (gdk_pixmap, gdk_pixmap_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_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);
+
+ 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;
+}
+
+
+
+
#endif
// NEW_GTK_DND_CODE
m_frameStatusBar = (wxStatusBar *) NULL;
m_frameToolBar = (wxToolBar *) NULL;
m_sizeSet = FALSE;
- wxTopLevelWindows.Insert( this );
}
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
m_frameToolBar = (wxToolBar *) NULL;
m_sizeSet = FALSE;
Create( parent, id, title, pos, size, style, name );
- wxTopLevelWindows.Insert( this );
}
bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ wxTopLevelWindows.Append( this );
+
m_needParent = FALSE;
PreCreation( parent, id, pos, size, style, name );
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
+ gdk_gc_set_background( m_penGC, m_backgroundBrush.GetColour().GetColor() );
gdk_gc_set_background( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
m_brushGC = gdk_gc_new( m_window );
m_textGC = gdk_gc_new( m_window );
m_bgGC = gdk_gc_new( m_window );
- SetTextForeground( m_textForegroundColour );
- SetTextBackground( m_textBackgroundColour );
+
+ wxColour tmp_col( m_textForegroundColour );
+ m_textForegroundColour = wxNullColour;
+ SetTextForeground( tmp_col );
+ tmp_col = m_textBackgroundColour;
+ m_textBackgroundColour = wxNullColour;
+ SetTextBackground( tmp_col );
wxPen tmp_pen( m_pen );
m_pen = wxNullPen;
m_backgroundBrush = wxNullBrush;
SetBackground( tmp_brush );
- gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
-
if (!hatch_bitmap)
{
hatch_bitmap = hatches;
{
m_title = "";
m_modalShowing = FALSE;
- wxTopLevelWindows.Insert( this );
}
wxDialog::wxDialog( wxWindow *parent,
long style, const wxString &name )
{
m_modalShowing = FALSE;
- wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
}
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ wxTopLevelWindows.Append( this );
+
m_needParent = FALSE;
PreCreation( parent, id, pos, size, style, name );
#else // NEW_CODE
-
-
+GtkWidget *shape_create_icon (char **data,
+ gint x,
+ gint y,
+ gint px,
+ gint py,
+ gint window_type);
+
+/* XPM */
+static char * gv_xpm[] = {
+"40 34 3 1",
+" s None c None",
+". c black",
+"X c white",
+" ",
+" ",
+" ...... ",
+" ..XXXXXX.. ",
+" .XXXXXXXXXX. ",
+" .XXXXXXXXXXXX. ",
+" .XXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXX. ",
+" .XXX..XXXX..XXX. ",
+" ....XX....XX....XX. ",
+" .XXX.XXX..XXXX..XXX.... ",
+" .XXXXXXXXXXXXXXXXXXX.XXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXXX. ",
+" ..XXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXX... ",
+" ..XXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXX.XXXXXXX. ",
+" .XXXXXXX.XXXXXXX.XXXXXXX. ",
+" .XXXXXXXX.XXXXXXX.XXXXXXX. ",
+" .XXXXXXX...XXXXX...XXXXX. ",
+" .XXXXXXX. ..... ..... ",
+" ..XXXX.. ",
+" .... ",
+" ",
+" ",
+" "};
+
+/* XPM */
+static char * page_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 5 1",
+/* colors */
+" s None c None",
+". c black",
+"X c wheat",
+"o c tan",
+"O c #6699FF",
+/* pixels */
+" ................... ",
+" .XXXXXXXXXXXXXXXXX.. ",
+" .XXXXXXXXXXXXXXXXX.o. ",
+" .XXXXXXXXXXXXXXXXX.oo. ",
+" .XXXXXXXXXXXXXXXXX.ooo. ",
+" .XXXXXXXXXXXXXXXXX.oooo. ",
+" .XXXXXXXXXXXXXXXXX....... ",
+" .XXXXXOOOOOOOOOOXXXooooo. ",
+" .XXXXXXXXXXXXXXXXXXooooo. ",
+" .XXXXXOOOOOOOOOOXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXOOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXOOOOOOOOOOXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXOOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXOOOOOOOOOOXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXOOOOOOOOOOXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXOOOOOOOXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" .XXXXXXXXXXXXXXXXXXXXXXX. ",
+" ......................... "};
+
+
//-----------------------------------------------------------------------------
// "drop_data_available_event"
//-----------------------------------------------------------------------------
int y = 0;
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
- printf( "Drop data is of type %s.\n", event->data_type );
+// printf( "Drop data is of type %s.\n", event->data_type );
target->OnDrop( x, y, (const void*)event->data, (size_t)event->data_numbytes );
}
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
{
- printf( "Data requested for dropping.\n" );
-
wxDataObject *data = source->m_data;
size_t size = data->GetDataSize();
if (!m_data) return (wxDragResult) wxDragNone;
if (m_data->GetDataSize() == 0) return (wxDragResult) wxDragNone;
+ static GtkWidget *drag_icon = NULL;
+ static GtkWidget *drop_icon = NULL;
+
+ GdkPoint hotspot_1 = {0,-5 };
+
+ if (!drag_icon)
+ {
+ drag_icon = shape_create_icon ( gv_xpm,
+ 440, 140, 0,0, GTK_WINDOW_POPUP);
+
+ gtk_signal_connect (GTK_OBJECT (drag_icon), "destroy",
+ GTK_SIGNAL_FUNC(gtk_widget_destroyed),
+ &drag_icon);
+
+ gtk_widget_hide (drag_icon);
+ }
+
+ GdkPoint hotspot_2 = {-5,-5};
+
+ if (!drop_icon)
+ {
+ drop_icon = shape_create_icon ( page_xpm,
+ 440, 140, 0,0, GTK_WINDOW_POPUP);
+
+ gtk_signal_connect (GTK_OBJECT (drop_icon), "destroy",
+ GTK_SIGNAL_FUNC(gtk_widget_destroyed),
+ &drop_icon);
+
+ gtk_widget_hide (drop_icon);
+ }
+
+ gdk_dnd_set_drag_shape(drag_icon->window,
+ &hotspot_1,
+ drop_icon->window,
+ &hotspot_2);
+
+
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
RegisterWindow();
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
}
+
+/*
+ * Shaped Windows
+ */
+static GdkWindow *root_win = 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 = 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,
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_BUTTON_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK,
+ NULL, 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 = 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);
+}
+
+GtkWidget *
+shape_create_icon (char **data,
+ 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 (window_type);
+
+ 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);
+
+ gdk_pixmap = gdk_pixmap_create_from_xpm_d (window->window, &gdk_pixmap_mask,
+ &style->bg[GTK_STATE_NORMAL],
+ (gchar**) data );
+
+ pixmap = gtk_pixmap_new (gdk_pixmap, gdk_pixmap_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_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);
+
+ 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;
+}
+
+
+
+
#endif
// NEW_GTK_DND_CODE
m_frameStatusBar = (wxStatusBar *) NULL;
m_frameToolBar = (wxToolBar *) NULL;
m_sizeSet = FALSE;
- wxTopLevelWindows.Insert( this );
}
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
m_frameToolBar = (wxToolBar *) NULL;
m_sizeSet = FALSE;
Create( parent, id, title, pos, size, style, name );
- wxTopLevelWindows.Insert( this );
}
bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ wxTopLevelWindows.Append( this );
+
m_needParent = FALSE;
PreCreation( parent, id, pos, size, style, name );
echo $exec_prefix
;;
--version)
- echo 1.94
+ echo 1.97
;;
--cflags)
if test @includedir@ != /usr/include ; then