From 23efdd028e98cd90dc888043d573f45795dc5f43 Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Wed, 29 Dec 1999 11:52:51 +0000
Subject: [PATCH]   Added wxWindow::DoMoveWindow(..)   Changed dnd and
 clipboard overviews.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/clipbrd.tex  |  2 ++
 docs/latex/wx/dropsrc.tex  |  7 +++---
 docs/latex/wx/droptrgt.tex |  7 +++---
 docs/latex/wx/tclipbrd.tex | 15 +-----------
 docs/latex/wx/tdnd.tex     | 50 ++++++++++++++++++--------------------
 include/wx/gtk/dialog.h    |  5 ++++
 include/wx/gtk/frame.h     |  4 +++
 include/wx/gtk/window.h    |  4 +++
 include/wx/gtk1/dialog.h   |  5 ++++
 include/wx/gtk1/frame.h    |  4 +++
 include/wx/gtk1/window.h   |  4 +++
 src/gtk/dialog.cpp         |  5 ++++
 src/gtk/frame.cpp          |  5 ++++
 src/gtk/window.cpp         | 15 +++++++-----
 src/gtk1/dialog.cpp        |  5 ++++
 src/gtk1/frame.cpp         |  5 ++++
 src/gtk1/window.cpp        | 15 +++++++-----
 17 files changed, 99 insertions(+), 58 deletions(-)

diff --git a/docs/latex/wx/clipbrd.tex b/docs/latex/wx/clipbrd.tex
index f8a22e8352..38f873a6b3 100644
--- a/docs/latex/wx/clipbrd.tex
+++ b/docs/latex/wx/clipbrd.tex
@@ -5,6 +5,8 @@ clipboard class from wxWindows 1.xx, which has the same name but a different imp
 
 To use the clipboard, you call member functions of the global {\bf wxTheClipboard} object.
 
+See also the \helpref{wxDataObject overview}{wxdataobjectoverview} for further information.
+
 Call \helpref{wxClipboard::Open}{wxclipboardopen} to get ownership of the clipboard. If this operation returns TRUE, you
 now own the clipboard. Call \helpref{wxClipboard::SetData}{wxclipboardsetdata} to put data
 on the clipboard, or \helpref{wxClipboard::GetData}{wxclipboardgetdata} to
diff --git a/docs/latex/wx/dropsrc.tex b/docs/latex/wx/dropsrc.tex
index 4f122c5c4b..1711e603ec 100644
--- a/docs/latex/wx/dropsrc.tex
+++ b/docs/latex/wx/dropsrc.tex
@@ -1,9 +1,10 @@
 \section{\class{wxDropSource}}\label{wxdropsource}
 
-\overview{Overview}{wxdndoverview}
-
 This class represents a source for a drag and drop operation.
 
+See \helpref{Drag'n'Drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview}
+for more information.
+
 \wxheading{Derived from}
 
 None
@@ -30,7 +31,7 @@ enum wxDragResult
 
 \wxheading{See also}
 
-\helpref{Drag and drop overview}{wxdndoverview}, \helpref{wxDropTarget}{wxdroptarget}, 
+\helpref{wxDropTarget}{wxdroptarget}, 
 \helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget}
 
 \latexignore{\rtfignore{\wxheading{Members}}}
diff --git a/docs/latex/wx/droptrgt.tex b/docs/latex/wx/droptrgt.tex
index db5b38d78a..a65c0a03a5 100644
--- a/docs/latex/wx/droptrgt.tex
+++ b/docs/latex/wx/droptrgt.tex
@@ -1,7 +1,5 @@
 \section{\class{wxDropTarget}}\label{wxdroptarget}
 
-\overview{Overview}{wxdndoverview}
-
 This class represents a target for a drag and drop operation. A \helpref{wxDataObject}{wxdataobject}
 can be associated with it and by default, this object will be filled with the data from the
 drag source, if the data formats supported by the data object match the drag source data 
@@ -13,6 +11,9 @@ the whole window area, but only a small portion of it. The normal sequence of ca
 \helpref{OnEnter}{wxdroptargetonenter}, possibly many times \helpref{OnDragOver}{wxdroptargetondragover},
 \helpref{OnDrop}{wxdroptargetondrop} and finally \helpref{OnData}{wxdroptargetondata}.
 
+See \helpref{Drag'n'Drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview}
+for more information.
+
 \wxheading{Derived from}
 
 None
@@ -39,7 +40,7 @@ enum wxDragResult
 
 \wxheading{See also}
 
-\helpref{Drag and drop overview}{wxdndoverview}, \helpref{wxDropSource}{wxdropsource}, 
+\helpref{wxDropSource}{wxdropsource}, 
 \helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget},
 \helpref{wxDataFormat}{wxdataformat}, \helpref{wxDataObject}{wxdataobject}
 
diff --git a/docs/latex/wx/tclipbrd.tex b/docs/latex/wx/tclipbrd.tex
index 5074b21219..acdf8cac9e 100644
--- a/docs/latex/wx/tclipbrd.tex
+++ b/docs/latex/wx/tclipbrd.tex
@@ -1,15 +1,4 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Name:        tclipbrd.tex
-%% Purpose:     Data transfer (clipboard and drag and drop) overview
-%% Author:      Vadim Zeitlin
-%% Modified by:
-%% Created:     18.10.99
-%% RCS-ID:      $Id$
-%% Copyright:   (c) Vadim Zeitlin
-%% Licence:     wxWindows licence
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\section{Clipboard and drag and drop overview}\label{wxdndoverview}
+\section{wxDataObject overview}\label{wxdataobjectoverview}
 
 Classes: \helpref{wxDataObject}{wxdataobject},
  \helpref{wxClipboard}{wxclipboard},
@@ -17,8 +6,6 @@ Classes: \helpref{wxDataObject}{wxdataobject},
  \helpref{wxDropSource}{wxdropsource},
  \helpref{wxDropTarget}{wxdroptarget}
 
-See also: \helpref{DnD sample}{samplednd}
-
 This overview discusses data transfer through clipboard or drag and drop. In
 wxWindows, these two ways to transfer data (either between different
 applications or inside one and the same) are very similar which allows to
diff --git a/docs/latex/wx/tdnd.tex b/docs/latex/wx/tdnd.tex
index a2a970a951..0e1837d51b 100644
--- a/docs/latex/wx/tdnd.tex
+++ b/docs/latex/wx/tdnd.tex
@@ -1,4 +1,4 @@
-\section{Drag-and-drop and clipboard overview}\label{wxdndoverview}
+\section{Drag'n'Drop overview}\label{wxdndoverview}
 
 Classes: \helpref{wxDataObject}{wxdataobject}, 
 \helpref{wxTextDataObject}{wxtextdataobject}, 
@@ -10,53 +10,51 @@ Classes: \helpref{wxDataObject}{wxdataobject},
 Note that wxUSE\_DRAG\_AND\_DROP must be defined in setup.h in order
 to use Drag'n'Drop in wxWindows.
 
-This overview describes wxWindows support for drag and drop and clipboard
-operations. Both of these topics are discussed here because, in fact, they're
-quite related. Drag and drop and clipboard are just two ways of passing the
-data around and so the code required to implement both types of the operations
-is almost the same.
+See also: \helpref{wxDataObject overview}{wxdataobjectoverview} and \helpref{DnD sample}{samplednd}
 
-Both operations involve passing some data from one program to another,
-although the data can be received in the same program as the source. In the case
-of clipboard transfer, the data is first placed on the clipboard and then
-pasted into the destination program, while for a drag-and-drop operation the
-data object is not stored anywhere but is created when the user starts
-dragging and is destroyed as soon as he ends it, whether the operation was
-ended successfully or cancelled.
+It may be noted that data transfer to and from the clipboard is quite
+similar to data transfer with Drag'n'Drop and the code to implement
+these two types is almost the same. In particular, both data transfer
+mechanisms store data in some kind of \helpref{wxDataObject}{wxdataobject}
+and identify its format(s) using the \helpref{wxDataFormat}{wxdataformat}
+class.
 
 To be a {\it drag source}, i.e. to provide the data which may be dragged by
 user elsewhere, you should implement the following steps:
 
 \begin{itemize}\itemsep=0pt
-\item {\bf Preparation:} First of all, the data object must be created and
+\item {\bf Preparation:} First of all, a data object must be created and
 initialized with the data you wish to drag. For example:
 
 \begin{verbatim}
-	wxDataObject *my_data = new wxTextDataObject data("This string will be dragged.");
+	wxTextDataObject my_data("This text will be dragged.");
 \end{verbatim}
 \item{\bf Drag start:} To start dragging process (typically in response to a
-mouse click) you must call \helpref{DoDragDrop}{wxdropsourcedodragdrop} function
-of wxDropSource object which should be constructed like this:
+mouse click) you must call \helpref{wxDropSource::DoDragDrop}{wxdropsourcedodragdrop}
+like this:
 
 \begin{verbatim}
 	wxDropSource dragSource( this );
 	dragSource.SetData( my_data );
+	wxDragResult result = dragSource.DoDragDrop( TRUE );
 \end{verbatim}
-\item {\bf Dragging:} The call to DoDragDrop() blocks until the user release the
+\item {\bf Dragging:} The call to DoDragDrop() blocks the program until the user release the
 mouse button (unless you override \helpref{GiveFeedback}{wxdropsourcegivefeedback} function
 to do something special). When the mouse moves in a window of a program which understands the
 same drag-and-drop protocol (any program under Windows or any program supporting the
 XDnD protocol under X Windows), the corresponding \helpref{wxDropTarget}{wxdroptarget} methods
 are called - see below.
 \item {\bf Processing the result:} DoDragDrop() returns an {\it effect code} which
-is one of the values of \helpref{wxDragResult}{wxdropsource} enum. Codes
-of wxDragError, wxDragNone and wxDragCancel have the obvious meaning and mean
-that there is nothing to do on the sending end (except of possibly logging the
-error in the first case). wxDragCopy means that the data has been successfully
-copied and doesn't require any specific actions neither. But wxDragMove is
-special because it means that the data must be deleted from where it was
-copied. If it doesn't make sense (dragging selected text from a read-only
-file) you should pass FALSE as parameter to DoDragDrop() in the previous step.
+is one of the values of {\tt wxDragResult} enum (explained \helpref{here}{wxdroptarget}):
+
+\begin{verbatim}
+	switch (result)
+	{
+	    case wxDragCopy: /* copy the data */ break;
+	    case wxDragMove: /* move the data */ break;
+	    default:         /* do nothing */ break;
+	}
+\end{verbatim}
 \end{itemize}
 
 To be a {\it drop target}, i.e. to receive the data dropped by user you should
diff --git a/include/wx/gtk/dialog.h b/include/wx/gtk/dialog.h
index a90b7305f0..c996833727 100644
--- a/include/wx/gtk/dialog.h
+++ b/include/wx/gtk/dialog.h
@@ -86,7 +86,12 @@ public:
     virtual bool IsTopLevel() const { return TRUE; }
     
     // implementation
+    // --------------
 
+    // move the window to the specified location and resize it: this is called
+    // from both DoSetSize() and DoSetClientSize()
+    virtual void DoMoveWindow(int x, int y, int width, int height);
+    
     virtual void GtkOnSize( int x, int y, int width, int height );
     virtual void OnInternalIdle();
 
diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h
index bb8dd7b0d5..210aa7b612 100644
--- a/include/wx/gtk/frame.h
+++ b/include/wx/gtk/frame.h
@@ -93,6 +93,10 @@ public:
     // implementation from now on
     // --------------------------
 
+    // move the window to the specified location and resize it: this is called
+    // from both DoSetSize() and DoSetClientSize() 
+    virtual void DoMoveWindow(int x, int y, int width, int height);
+    
     // GTK callbacks
     virtual void GtkOnSize( int x, int y, int width, int height );
     virtual void OnInternalIdle();
diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h
index 90a6cdeda5..2895efbb9a 100644
--- a/include/wx/gtk/window.h
+++ b/include/wx/gtk/window.h
@@ -104,6 +104,10 @@ public:
     // implementation
     // --------------
 
+    // move the window to the specified location and resize it: this is called
+    // from both DoSetSize() and DoSetClientSize()
+    virtual void DoMoveWindow(int x, int y, int width, int height);
+    
     virtual WXWidget GetHandle() const { return m_widget; }
 
     // also sets the global flag
diff --git a/include/wx/gtk1/dialog.h b/include/wx/gtk1/dialog.h
index a90b7305f0..c996833727 100644
--- a/include/wx/gtk1/dialog.h
+++ b/include/wx/gtk1/dialog.h
@@ -86,7 +86,12 @@ public:
     virtual bool IsTopLevel() const { return TRUE; }
     
     // implementation
+    // --------------
 
+    // move the window to the specified location and resize it: this is called
+    // from both DoSetSize() and DoSetClientSize()
+    virtual void DoMoveWindow(int x, int y, int width, int height);
+    
     virtual void GtkOnSize( int x, int y, int width, int height );
     virtual void OnInternalIdle();
 
diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h
index bb8dd7b0d5..210aa7b612 100644
--- a/include/wx/gtk1/frame.h
+++ b/include/wx/gtk1/frame.h
@@ -93,6 +93,10 @@ public:
     // implementation from now on
     // --------------------------
 
+    // move the window to the specified location and resize it: this is called
+    // from both DoSetSize() and DoSetClientSize() 
+    virtual void DoMoveWindow(int x, int y, int width, int height);
+    
     // GTK callbacks
     virtual void GtkOnSize( int x, int y, int width, int height );
     virtual void OnInternalIdle();
diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h
index 90a6cdeda5..2895efbb9a 100644
--- a/include/wx/gtk1/window.h
+++ b/include/wx/gtk1/window.h
@@ -104,6 +104,10 @@ public:
     // implementation
     // --------------
 
+    // move the window to the specified location and resize it: this is called
+    // from both DoSetSize() and DoSetClientSize()
+    virtual void DoMoveWindow(int x, int y, int width, int height);
+    
     virtual WXWidget GetHandle() const { return m_widget; }
 
     // also sets the global flag
diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp
index 1b68a287c7..6da4337b2e 100644
--- a/src/gtk/dialog.cpp
+++ b/src/gtk/dialog.cpp
@@ -470,6 +470,11 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
     }
 }
 
+void wxDialog::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
+{
+    wxFAIL_MSG( wxT("DoMoveWindow called for wxDialog") );
+}
+    
 void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") );
diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp
index ecefa29954..fe6aa5e445 100644
--- a/src/gtk/frame.cpp
+++ b/src/gtk/frame.cpp
@@ -532,6 +532,11 @@ bool wxFrame::Show( bool show )
     return wxWindow::Show( show );
 }
 
+void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
+{
+    wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") );
+}
+    
 void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index a7ccbe712a..c7281b8230 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -2203,6 +2203,11 @@ bool wxWindow::Destroy()
     return wxWindowBase::Destroy();
 }
 
+void wxWindow::DoMoveWindow(int x, int y, int width, int height)
+{
+    gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height );
+}
+    
 void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
@@ -2263,12 +2268,10 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
             bottom_border = 5;
         }
 
-        gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow),
-                              m_widget,
-                              m_x-border,
-                              m_y-border,
-                              m_width+2*border,
-                              m_height+border+bottom_border );
+        DoMoveWindow( m_x-border,
+                      m_y-border,
+                      m_width+2*border,
+                      m_height+border+bottom_border );
     }
 
 /*
diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp
index 1b68a287c7..6da4337b2e 100644
--- a/src/gtk1/dialog.cpp
+++ b/src/gtk1/dialog.cpp
@@ -470,6 +470,11 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
     }
 }
 
+void wxDialog::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
+{
+    wxFAIL_MSG( wxT("DoMoveWindow called for wxDialog") );
+}
+    
 void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") );
diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp
index ecefa29954..fe6aa5e445 100644
--- a/src/gtk1/frame.cpp
+++ b/src/gtk1/frame.cpp
@@ -532,6 +532,11 @@ bool wxFrame::Show( bool show )
     return wxWindow::Show( show );
 }
 
+void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
+{
+    wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") );
+}
+    
 void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp
index a7ccbe712a..c7281b8230 100644
--- a/src/gtk1/window.cpp
+++ b/src/gtk1/window.cpp
@@ -2203,6 +2203,11 @@ bool wxWindow::Destroy()
     return wxWindowBase::Destroy();
 }
 
+void wxWindow::DoMoveWindow(int x, int y, int width, int height)
+{
+    gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height );
+}
+    
 void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
@@ -2263,12 +2268,10 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
             bottom_border = 5;
         }
 
-        gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow),
-                              m_widget,
-                              m_x-border,
-                              m_y-border,
-                              m_width+2*border,
-                              m_height+border+bottom_border );
+        DoMoveWindow( m_x-border,
+                      m_y-border,
+                      m_width+2*border,
+                      m_height+border+bottom_border );
     }
 
 /*
-- 
2.50.0

