]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxWindow::DoMoveWindow(..)
authorRobert Roebling <robert@roebling.de>
Wed, 29 Dec 1999 11:52:51 +0000 (11:52 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 29 Dec 1999 11:52:51 +0000 (11:52 +0000)
  Changed dnd and clipboard overviews.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
docs/latex/wx/clipbrd.tex
docs/latex/wx/dropsrc.tex
docs/latex/wx/droptrgt.tex
docs/latex/wx/tclipbrd.tex
docs/latex/wx/tdnd.tex
include/wx/gtk/dialog.h
include/wx/gtk/frame.h
include/wx/gtk/window.h
include/wx/gtk1/dialog.h
include/wx/gtk1/frame.h
include/wx/gtk1/window.h
src/gtk/dialog.cpp
src/gtk/frame.cpp
src/gtk/window.cpp
src/gtk1/dialog.cpp
src/gtk1/frame.cpp
src/gtk1/window.cpp

index f8a22e83529477a314208682f77f7f0344f82e05..38f873a6b3fc28c086d538ef4c0696c6378b6c2f 100644 (file)
@@ -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
index 4f122c5c4bda6f3d132d8af9f6b730b1b8eceb50..1711e603ec632f427b0bfa38adb1a84107bcb178 100644 (file)
@@ -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}}}
index db5b38d78a45beb96f64b12d279c2b9bd6d297c3..a65c0a03a5f805a9d84a3193760e4caa4cd06699 100644 (file)
@@ -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}
 
index 5074b2121905b37bc8946ea4645fcd26e36c13b7..acdf8cac9e70a169820981bf6bdcea62e7774445 100644 (file)
@@ -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
index a2a970a951e9d1eaa8c5fe86bf69d38fef579ea8..0e1837d51bd89b80e6f9e2ee73d7824ebfb88f2a 100644 (file)
@@ -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
index a90b7305f025080bbb13af798ed9d15027a72710..c9968337278b45a7bcdbec7b5343910d4c7ebac3 100644 (file)
@@ -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();
 
index bb8dd7b0d51e488709620a1dba54897a09d58913..210aa7b612a54cf92c1873dbcec92f242f0f6903 100644 (file)
@@ -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();
index 90a6cdeda52e5a148f08ab1edc906a845d54f3c4..2895efbb9ab5a045f77076bdbc01c2b19489d5e0 100644 (file)
@@ -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
index a90b7305f025080bbb13af798ed9d15027a72710..c9968337278b45a7bcdbec7b5343910d4c7ebac3 100644 (file)
@@ -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();
 
index bb8dd7b0d51e488709620a1dba54897a09d58913..210aa7b612a54cf92c1873dbcec92f242f0f6903 100644 (file)
@@ -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();
index 90a6cdeda52e5a148f08ab1edc906a845d54f3c4..2895efbb9ab5a045f77076bdbc01c2b19489d5e0 100644 (file)
@@ -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
index 1b68a287c7f4da9f07bbc917fc3bff8cc85541c2..6da4337b2e8e3060bc62ded2f4860e4b4605024b 100644 (file)
@@ -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") );
index ecefa29954cc4aa963f165240532016d6c9942c4..fe6aa5e445aa7f4bfc12bd2e179b83510e0fd848 100644 (file)
@@ -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") );
index a7ccbe712a7ce210eaa932b524be5639ba299a89..c7281b8230056025c78b8080191b8b2410dfa53c 100644 (file)
@@ -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 );
     }
 
 /*
index 1b68a287c7f4da9f07bbc917fc3bff8cc85541c2..6da4337b2e8e3060bc62ded2f4860e4b4605024b 100644 (file)
@@ -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") );
index ecefa29954cc4aa963f165240532016d6c9942c4..fe6aa5e445aa7f4bfc12bd2e179b83510e0fd848 100644 (file)
@@ -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") );
index a7ccbe712a7ce210eaa932b524be5639ba299a89..c7281b8230056025c78b8080191b8b2410dfa53c 100644 (file)
@@ -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 );
     }
 
 /*