Fixes for wxlist
improvements for DnD :-) moer dialog and frame fine tuning git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
* The most simple case
|
* The most simple case
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
If you compile wxWindows on Unix for the first time and don't like
|
If you compile wxWindows on Unix for the first time and don't
|
||||||
to read install instructions just do (in the base dir):
|
like to read install instructions just do (in the base dir):
|
||||||
|
|
||||||
./configure --without-threads
|
./configure --without-threads
|
||||||
make
|
make
|
||||||
@@ -11,33 +11,42 @@ and drink 10 coffees. Then you may log in as root and type
|
|||||||
|
|
||||||
make install
|
make install
|
||||||
|
|
||||||
You can leave out the --without-threads option if you have a NEW
|
You can leave out the --without-threads option if you have
|
||||||
Linux distribution based on glibc (e.g. RedHat 5.1 or Debian 2.0)
|
a NEW Linux distribution based on glibc (e.g. RedHat 5.1 or
|
||||||
or any other Unix that comes with Posix threads or SGI threads.
|
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
|
g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
|
||||||
|
|
||||||
* General
|
* General
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
The Unix variants of wxWindows use GNU configure. If you have problems
|
The Unix variants of wxWindows use GNU configure. If you have
|
||||||
with your make use GNU make instead.
|
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
|
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
|
* GUI libraries
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
wxWindows/GTK requires the GTK+ library to be installed on your system.
|
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
|
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
|
a version previous to 1.0.6 you'll get crashes here and there. Although
|
||||||
is certain to happen with colors in native widgets.
|
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
|
You can get the newest version of the GTK+ from the GTK homepage
|
||||||
at
|
at
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Welcome to wxWindows/Gtk,
|
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
|
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
|
all systems
|
||||||
|
|
||||||
configure --without-threads
|
configure --without-threads
|
||||||
@@ -11,8 +11,16 @@ make
|
|||||||
su (PASSWORD)
|
su (PASSWORD)
|
||||||
make install
|
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
|
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.
|
and - more important - before we can aim at binary compatibility.
|
||||||
|
|
||||||
More information is available from my homepage at
|
More information is available from my homepage at
|
||||||
|
@@ -10,14 +10,14 @@ wxClipboard
|
|||||||
Fix printing of bitmaps
|
Fix printing of bitmaps
|
||||||
-> No idea.
|
-> No idea.
|
||||||
|
|
||||||
|
-------------------- Low priority ---------------------
|
||||||
|
|
||||||
OwnerDraw for wxListCtrl and others
|
OwnerDraw for wxListCtrl and others
|
||||||
-> That is a big one.
|
-> Postponed.
|
||||||
|
|
||||||
DnD
|
DnD
|
||||||
-> Must be rewritten for GTK+ 1.1.3
|
-> Must be rewritten for GTK+ 1.1.3
|
||||||
|
|
||||||
-------------------- Low priority ---------------------
|
|
||||||
|
|
||||||
wxDebugContext <-> wxLogXXX functions
|
wxDebugContext <-> wxLogXXX functions
|
||||||
-> Remove either
|
-> Remove either
|
||||||
|
|
||||||
|
@@ -222,13 +222,13 @@ protected:
|
|||||||
|
|
||||||
// get the list item's data
|
// get the list item's data
|
||||||
void *operator[](size_t index) const
|
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
|
// operations
|
||||||
// append to end of list
|
// append to end of list
|
||||||
wxNodeBase *Append(void *object);
|
wxNodeBase *Append(void *object);
|
||||||
// insert a new item at the beginning of the list
|
// 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
|
// insert before given node or at front of list if prev == NULL
|
||||||
wxNodeBase *Insert(wxNodeBase *prev, void *object);
|
wxNodeBase *Insert(wxNodeBase *prev, void *object);
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ private:
|
|||||||
nodetype *Append(T *object) \
|
nodetype *Append(T *object) \
|
||||||
{ return (nodetype *)wxListBase::Append(object); } \
|
{ return (nodetype *)wxListBase::Append(object); } \
|
||||||
nodetype *Insert(T *object) \
|
nodetype *Insert(T *object) \
|
||||||
{ return (nodetype *)Insert(NULL, object); } \
|
{ return (nodetype *)Insert((nodetype*)NULL, object); } \
|
||||||
nodetype *Insert(nodetype *prev, T *object) \
|
nodetype *Insert(nodetype *prev, T *object) \
|
||||||
{ return (nodetype *)wxListBase::Insert(prev, object); } \
|
{ return (nodetype *)wxListBase::Insert(prev, object); } \
|
||||||
\
|
\
|
||||||
|
@@ -182,7 +182,6 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
|||||||
m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL);
|
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_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL);
|
||||||
|
|
||||||
/*
|
|
||||||
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
|
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
|
||||||
wxTE_MULTILINE | wxTE_READONLY |
|
wxTE_MULTILINE | wxTE_READONLY |
|
||||||
wxSUNKEN_BORDER| wxHSCROLL);
|
wxSUNKEN_BORDER| wxHSCROLL);
|
||||||
@@ -190,10 +189,6 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
|||||||
// redirect log messages to the text window (don't forget to delete it!)
|
// redirect log messages to the text window (don't forget to delete it!)
|
||||||
m_pLog = new wxLogTextCtrl(m_ctrlLog);
|
m_pLog = new wxLogTextCtrl(m_ctrlLog);
|
||||||
m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
|
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
|
// associate drop targets with 2 text controls
|
||||||
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
|
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
|
||||||
@@ -217,7 +212,6 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
|||||||
c->height.PercentOf(this, wxHeight, 40);
|
c->height.PercentOf(this, wxHeight, 40);
|
||||||
m_ctrlText->SetConstraints(c);
|
m_ctrlText->SetConstraints(c);
|
||||||
|
|
||||||
/*
|
|
||||||
// Lower text control
|
// Lower text control
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->left.SameAs (this, wxLeft);
|
c->left.SameAs (this, wxLeft);
|
||||||
@@ -225,17 +219,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
|||||||
c->height.PercentOf(this, wxHeight, 40);
|
c->height.PercentOf(this, wxHeight, 40);
|
||||||
c->top.SameAs(m_ctrlText, wxBottom);
|
c->top.SameAs(m_ctrlText, wxBottom);
|
||||||
m_ctrlLog->SetConstraints(c);
|
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);
|
SetAutoLayout(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ NONE =
|
|||||||
# define library name
|
# define library name
|
||||||
LIB_TARGET=wx_gtk
|
LIB_TARGET=wx_gtk
|
||||||
LIB_MAJOR=1
|
LIB_MAJOR=1
|
||||||
LIB_MINOR=96
|
LIB_MINOR=97
|
||||||
|
|
||||||
# define library sources
|
# define library sources
|
||||||
|
|
||||||
|
@@ -829,6 +829,7 @@ void wxPaintDC::SetBackground( const wxBrush &brush )
|
|||||||
|
|
||||||
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
|
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
|
||||||
gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
|
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_background( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
|
||||||
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
|
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
|
||||||
|
|
||||||
@@ -949,8 +950,13 @@ void wxPaintDC::SetUpDC(void)
|
|||||||
m_brushGC = gdk_gc_new( m_window );
|
m_brushGC = gdk_gc_new( m_window );
|
||||||
m_textGC = gdk_gc_new( m_window );
|
m_textGC = gdk_gc_new( m_window );
|
||||||
m_bgGC = 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 );
|
wxPen tmp_pen( m_pen );
|
||||||
m_pen = wxNullPen;
|
m_pen = wxNullPen;
|
||||||
@@ -968,8 +974,6 @@ void wxPaintDC::SetUpDC(void)
|
|||||||
m_backgroundBrush = wxNullBrush;
|
m_backgroundBrush = wxNullBrush;
|
||||||
SetBackground( tmp_brush );
|
SetBackground( tmp_brush );
|
||||||
|
|
||||||
gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
|
|
||||||
|
|
||||||
if (!hatch_bitmap)
|
if (!hatch_bitmap)
|
||||||
{
|
{
|
||||||
hatch_bitmap = hatches;
|
hatch_bitmap = hatches;
|
||||||
|
@@ -74,7 +74,6 @@ wxDialog::wxDialog()
|
|||||||
{
|
{
|
||||||
m_title = "";
|
m_title = "";
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDialog::wxDialog( wxWindow *parent,
|
wxDialog::wxDialog( wxWindow *parent,
|
||||||
@@ -83,7 +82,6 @@ wxDialog::wxDialog( wxWindow *parent,
|
|||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
Create( parent, id, title, pos, size, style, name );
|
Create( parent, id, title, pos, size, style, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +90,8 @@ bool wxDialog::Create( wxWindow *parent,
|
|||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
|
wxTopLevelWindows.Append( this );
|
||||||
|
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
|
||||||
PreCreation( parent, id, pos, size, style, name );
|
PreCreation( parent, id, pos, size, style, name );
|
||||||
|
257
src/gtk/dnd.cpp
257
src/gtk/dnd.cpp
@@ -366,8 +366,99 @@ void wxDropSource::UnregisterWindow(void)
|
|||||||
|
|
||||||
#else // NEW_CODE
|
#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"
|
// "drop_data_available_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -382,7 +473,7 @@ static void gtk_target_callback( GtkWidget *widget,
|
|||||||
int y = 0;
|
int y = 0;
|
||||||
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
|
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 );
|
target->OnDrop( x, y, (const void*)event->data, (size_t)event->data_numbytes );
|
||||||
}
|
}
|
||||||
@@ -536,8 +627,6 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
|||||||
|
|
||||||
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
|
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
|
||||||
{
|
{
|
||||||
printf( "Data requested for dropping.\n" );
|
|
||||||
|
|
||||||
wxDataObject *data = source->m_data;
|
wxDataObject *data = source->m_data;
|
||||||
|
|
||||||
size_t size = data->GetDataSize();
|
size_t size = data->GetDataSize();
|
||||||
@@ -603,6 +692,43 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
if (!m_data) return (wxDragResult) wxDragNone;
|
if (!m_data) return (wxDragResult) wxDragNone;
|
||||||
if (m_data->GetDataSize() == 0) 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;
|
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
|
||||||
|
|
||||||
RegisterWindow();
|
RegisterWindow();
|
||||||
@@ -695,6 +821,129 @@ void wxDropSource::UnregisterWindow(void)
|
|||||||
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
|
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
|
#endif
|
||||||
// NEW_GTK_DND_CODE
|
// NEW_GTK_DND_CODE
|
||||||
|
|
||||||
|
@@ -108,7 +108,6 @@ wxFrame::wxFrame()
|
|||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
@@ -120,13 +119,14 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
Create( parent, id, title, pos, size, style, name );
|
Create( parent, id, title, pos, size, style, name );
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
|
wxTopLevelWindows.Append( this );
|
||||||
|
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
|
||||||
PreCreation( parent, id, pos, size, style, name );
|
PreCreation( parent, id, pos, size, style, name );
|
||||||
|
@@ -829,6 +829,7 @@ void wxPaintDC::SetBackground( const wxBrush &brush )
|
|||||||
|
|
||||||
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
|
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
|
||||||
gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
|
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_background( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
|
||||||
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
|
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
|
||||||
|
|
||||||
@@ -949,8 +950,13 @@ void wxPaintDC::SetUpDC(void)
|
|||||||
m_brushGC = gdk_gc_new( m_window );
|
m_brushGC = gdk_gc_new( m_window );
|
||||||
m_textGC = gdk_gc_new( m_window );
|
m_textGC = gdk_gc_new( m_window );
|
||||||
m_bgGC = 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 );
|
wxPen tmp_pen( m_pen );
|
||||||
m_pen = wxNullPen;
|
m_pen = wxNullPen;
|
||||||
@@ -968,8 +974,6 @@ void wxPaintDC::SetUpDC(void)
|
|||||||
m_backgroundBrush = wxNullBrush;
|
m_backgroundBrush = wxNullBrush;
|
||||||
SetBackground( tmp_brush );
|
SetBackground( tmp_brush );
|
||||||
|
|
||||||
gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
|
|
||||||
|
|
||||||
if (!hatch_bitmap)
|
if (!hatch_bitmap)
|
||||||
{
|
{
|
||||||
hatch_bitmap = hatches;
|
hatch_bitmap = hatches;
|
||||||
|
@@ -74,7 +74,6 @@ wxDialog::wxDialog()
|
|||||||
{
|
{
|
||||||
m_title = "";
|
m_title = "";
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDialog::wxDialog( wxWindow *parent,
|
wxDialog::wxDialog( wxWindow *parent,
|
||||||
@@ -83,7 +82,6 @@ wxDialog::wxDialog( wxWindow *parent,
|
|||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
Create( parent, id, title, pos, size, style, name );
|
Create( parent, id, title, pos, size, style, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +90,8 @@ bool wxDialog::Create( wxWindow *parent,
|
|||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
|
wxTopLevelWindows.Append( this );
|
||||||
|
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
|
||||||
PreCreation( parent, id, pos, size, style, name );
|
PreCreation( parent, id, pos, size, style, name );
|
||||||
|
257
src/gtk1/dnd.cpp
257
src/gtk1/dnd.cpp
@@ -366,8 +366,99 @@ void wxDropSource::UnregisterWindow(void)
|
|||||||
|
|
||||||
#else // NEW_CODE
|
#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"
|
// "drop_data_available_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -382,7 +473,7 @@ static void gtk_target_callback( GtkWidget *widget,
|
|||||||
int y = 0;
|
int y = 0;
|
||||||
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
|
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 );
|
target->OnDrop( x, y, (const void*)event->data, (size_t)event->data_numbytes );
|
||||||
}
|
}
|
||||||
@@ -536,8 +627,6 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
|||||||
|
|
||||||
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
|
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
|
||||||
{
|
{
|
||||||
printf( "Data requested for dropping.\n" );
|
|
||||||
|
|
||||||
wxDataObject *data = source->m_data;
|
wxDataObject *data = source->m_data;
|
||||||
|
|
||||||
size_t size = data->GetDataSize();
|
size_t size = data->GetDataSize();
|
||||||
@@ -603,6 +692,43 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
if (!m_data) return (wxDragResult) wxDragNone;
|
if (!m_data) return (wxDragResult) wxDragNone;
|
||||||
if (m_data->GetDataSize() == 0) 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;
|
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
|
||||||
|
|
||||||
RegisterWindow();
|
RegisterWindow();
|
||||||
@@ -695,6 +821,129 @@ void wxDropSource::UnregisterWindow(void)
|
|||||||
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
|
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
|
#endif
|
||||||
// NEW_GTK_DND_CODE
|
// NEW_GTK_DND_CODE
|
||||||
|
|
||||||
|
@@ -108,7 +108,6 @@ wxFrame::wxFrame()
|
|||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
@@ -120,13 +119,14 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
Create( parent, id, title, pos, size, style, name );
|
Create( parent, id, title, pos, size, style, name );
|
||||||
wxTopLevelWindows.Insert( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
|
wxTopLevelWindows.Append( this );
|
||||||
|
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
|
||||||
PreCreation( parent, id, pos, size, style, name );
|
PreCreation( parent, id, pos, size, style, name );
|
||||||
|
@@ -36,7 +36,7 @@ while test $# -gt 0; do
|
|||||||
echo $exec_prefix
|
echo $exec_prefix
|
||||||
;;
|
;;
|
||||||
--version)
|
--version)
|
||||||
echo 1.94
|
echo 1.97
|
||||||
;;
|
;;
|
||||||
--cflags)
|
--cflags)
|
||||||
if test @includedir@ != /usr/include ; then
|
if test @includedir@ != /usr/include ; then
|
||||||
|
Reference in New Issue
Block a user