sgdrag.h

Go to the documentation of this file.
00001 // $Id: sgdrag.h 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // sgdrag.h - Drag Manager classes (information, targets) for supergallery scollbars
00099 //            and generic supergallery item dragging (for rearrangement only)
00100 
00101 #ifndef INC_SGDRAG
00102 #define INC_SGDRAG
00103 
00104 
00105 #include "draginfo.h"
00106 //#include "dragtrgt.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 //#include "monotime.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "sgallery.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 
00110 
00111 class SGDisplayRootScroll;
00112 class SGDisplayItem;
00113 class DocCoord;
00114 
00115 
00116 /*********************************************************************************************
00117 
00118 >   class   SGScrollDragTarget : public KernelDragTarget
00119 
00120     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00121     Created:    26/2/95
00122 
00123     Purpose:    An instantiation of this class is created by each entity which wishes to 
00124                 provide a 'destination' to which the mouse can go to complete a drag.
00125 
00126                 This particular target is used for handling drags of supergallery scroll
00127                 bars, and for providing auto-repeat on scroll buttons.
00128 
00129     Notes:      Drag targets are destructed automatically when a drag finishes by the drag
00130                 manager with which they were registered.
00131 
00132                 To remove a drag target at any time, destruct it - it automatically deregisters
00133                 and cleans up.
00134                 
00135     SeeAlso:    DragManagerOp::StartDrag; DragInformation; DragTarget
00136 
00137     Documentation:  Docs\Specs\DragMan.doc
00138 
00139 *********************************************************************************************/
00140 
00141 class SGScrollDragTarget : public KernelDragTarget
00142 {
00143 friend class DragManagerOp;
00144     
00145 CC_DECLARE_DYNAMIC(SGScrollDragTarget)
00146 
00147 
00148 public: // Public interface
00149     SGScrollDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL);
00150     
00151     virtual UINT32 GetCursorID();
00152     virtual BOOL GetStatusLineText(String_256 * TheText);
00153 
00154 protected:
00155         // Process a drag-related event
00156     virtual BOOL ProcessEvent(DragEventType Event,
00157                                 DragInformation *pDragInfo,
00158                                 OilCoord *pMousePos, KeyPress* pKeyPress);
00159 
00160 protected:
00161     MonotonicTime Timer;
00162 };
00163 
00164 
00165 
00166 typedef enum
00167 {
00168     SGDRAG_NONE = 0,                // Used to notate when no drag is active/valid
00169     SGDRAG_SCROLLUP,                // Up   } - click scroll arrow
00170     SGDRAG_SCROLLDOWN,              // Down }
00171     SGDRAG_PAGEUP,                  // Up   } - click page-scroll areas
00172     SGDRAG_PAGEDOWN,                // Down }
00173     SGDRAG_SAUSAGE                  // Drag of scroll sausage
00174 } SGDragType;
00175 
00176 
00177 
00178 /********************************************************************************************
00179 
00180 >   class SGScrollDragInfo : public DragInformation
00181 
00182     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00183     Created:    26/2/95
00184     Purpose:    Describes a supergallery scroll drag
00185                 
00186 ********************************************************************************************/
00187 
00188 class SGScrollDragInfo : public DragInformation
00189 { 
00190 CC_DECLARE_DYNCREATE(SGScrollDragInfo)
00191  
00192 public:
00193     SGScrollDragInfo();
00194     SGScrollDragInfo(SGDisplayRootScroll *ParentRootNode, SGDragType TheDragType,
00195                         SGMiscInfo *MiscInfo, INT32 DragAnchorOffset,
00196                         BOOL IsAdjust = FALSE);
00197     
00198     void OnClick(INT32 Flags, POINT Point);
00199     
00200     virtual UINT32 GetCursorID(void);
00201     virtual BOOL GetStatusLineText(String_256 * TheText);
00202 
00203     SGDisplayRootScroll *GetDragRootNode(void)  { return(DragRootNode); }
00204     SGDragType GetDragType(void)                { return(DragType); }
00205     SGMiscInfo *GetDragMiscInfo(void)           { return(&DragMiscInfo); }
00206     INT32 GetDragAnchorOffset(void)             { return(DragAnchor); }
00207     BOOL IsAdjustDrag(void)                     { return(DragAdjust); }
00208 
00209 private:
00210     SGDisplayRootScroll *DragRootNode;      // The node which started the drag
00211     SGDragType  DragType;                   // The type of drag (see SGDragType, above)
00212     SGMiscInfo  DragMiscInfo;               // Copy of MiscInfo for the event causing the drag
00213     INT32       DragAnchor;                 // Offset from top of sausage rect to the point
00214                                             //   which was dragged.
00215     BOOL        DragAdjust;                 // TRUE if this is an 'adjust' drag
00216 };
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 typedef enum                                // Where an item can be inserted...
00225 {
00226     SGDRAGINSERT_NONE,                      // No valid target
00227     SGDRAGINSERT_ADD,                       // Add an item into a group
00228     SGDRAGINSERT_BEFORE,                    // Insert before target
00229     SGDRAGINSERT_AFTER                      // Insert after target
00230 } SGDragInsertType;
00231 
00232 /*********************************************************************************************
00233 
00234 >   class   SGListDragTarget : public KernelDragTarget
00235 
00236     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00237     Created:    14/3/95
00238 
00239     Purpose:    An instantiation of this class is created by each entity which wishes to 
00240                 provide a 'destination' to which the mouse can go to complete a drag.
00241 
00242                 This particular target is used for handling drags of supergallery items
00243                 within their displayed list. It automatically handles drags with draginfo
00244                 derived from SGListDragInfo. If you wish to handle drags of other
00245                 more specialised types, then you should derive a class from this one, and
00246                 simply override the ProcessEvent method in order to correctly divine
00247                 information such as parent gallery and dragged gallery item from the
00248                 current DragInfo object. (c.f. sgcolour.cpp -the SGColourDragTarget)
00249 
00250     Notes:      Drag targets are destructed automatically when a drag finishes by the drag
00251                 manager with which they were registered.
00252 
00253                 To remove a drag target at any time, destruct it - it automatically deregisters
00254                 and cleans up.
00255                 
00256     SeeAlso:    DragManagerOp::StartDrag; DragInformation; DragTarget;
00257                 SGColourDragTarget::ProcessEvent
00258 
00259     Documentation:  Docs\Specs\DragMan.doc; Docs\HowToUse\SGallery.doc
00260 
00261 *********************************************************************************************/
00262 
00263 class SGListDragInfo;
00264 
00265 class SGListDragTarget : public KernelDragTarget
00266 {
00267 friend class DragManagerOp;
00268     
00269 CC_DECLARE_DYNAMIC(SGListDragTarget)
00270 
00271 
00272 public: // Public interface
00273     SGListDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL);
00274     
00275     virtual UINT32 GetCursorID();
00276     virtual BOOL GetStatusLineText(String_256 * TheText);
00277 
00278 protected:
00279         // Process a drag-related event
00280     virtual BOOL ProcessEvent(DragEventType Event,
00281                                 DragInformation *pDragInfo,
00282                                 OilCoord *pMousePos, KeyPress* pKeyPress);
00283 
00284         // Subroutine to determine whether we will try to insert above or below an item
00285     SGDragInsertType GetDragInsertType(SuperGallery *ParentGallery,
00286                                 SGDisplayNode *DraggedNode,
00287                                 OilCoord *pMousePos,
00288                                 SGDisplayNode *DestNode);
00289 
00290         // Subroutine for handling a successful drag completion
00291     void HandleDragCompleted(SuperGallery *ParentGallery,
00292                                 SGDisplayNode *DraggedNode,
00293                                 OilCoord *pMousePos,
00294                                 BOOL DragThisItemOnly = FALSE);
00295 
00296         // Determines a cursor shape appropriate to the current mouse position
00297     virtual BOOL DetermineCursorShape(SuperGallery *ParentGallery,
00298                                 SGDisplayNode *DraggedNode,
00299                                 OilCoord *pMousePos);
00300 
00301         // Determines (by comparing format rects) if the given node takes up an
00302         // entire 'line' of the dislay list.
00303     BOOL OwnsEntireLine(SGDisplayNode *TheNode);
00304 
00305 protected:
00306     UINT32 CurrentCursorID;
00307 };
00308 
00309 
00310 
00311 
00312 
00313 
00314 /********************************************************************************************
00315 
00316 >   class SGListDragInfo : public DragInformation
00317 
00318     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00319     Created:    14/3/95
00320     Purpose:    Describes a generic supergallery item drag
00321 
00322     Documentation:  Docs\Specs\DragMan.doc; Docs\HowToUse\SGallery.doc
00323 
00324     SeeAlso:    SGListDragTarget; SuperGallery; SGDisplayNode::HandleEvent
00325                 
00326 ********************************************************************************************/
00327 
00328 class SGListDragInfo : public DragInformation
00329 { 
00330 CC_DECLARE_DYNCREATE(SGListDragInfo)
00331  
00332 public:
00333     SGListDragInfo();
00334     SGListDragInfo(SuperGallery *ParentGal, SGDisplayNode *DraggedNode,
00335                     SGMouseInfo *TheMouseInfo, BOOL IsAdjust = FALSE);
00336     
00337     void OnClick(INT32 Flags, POINT Point);
00338     
00339     virtual UINT32 GetCursorID(void);
00340     virtual BOOL GetStatusLineText(String_256 * TheText);
00341 
00342     SuperGallery  *GetParentGallery(void)   { return(ParentGallery); }
00343     SGDisplayNode *GetDraggedNode(void)     { return(DragNode); }
00344     SGMouseInfo   *GetMouseInfo(void)       { return(&MouseInfo); }
00345 
00346 private:
00347     SuperGallery  *ParentGallery;           // The gallery from which this drag originated
00348     SGDisplayNode *DragNode;                // The node which is being dragged                                          //   which was dragged.
00349     SGMouseInfo   MouseInfo;                // A COPY of the original MouseInfo for the click
00350 };
00351 
00352 
00353 #endif
00354 
00355 
00356 
00357 

Generated on Sat Nov 10 03:46:52 2007 for Camelot by  doxygen 1.4.4