dragtrgt.h

Go to the documentation of this file.
00001 // $Id: dragtrgt.h 1272 2006-06-08 17:01:06Z 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 
00099 // dragtrgt.h - Definitions for global dragging system DragTarget class
00100 
00101 #ifndef INC_DRAGTRGT
00102 #define INC_DRAGTRGT
00103 
00104 #include "dlgtypes.h"       // Sorry! ;-)
00105 #include "ops.h"            // For base class
00106 
00107 class DialogOp;
00108 class DragManagerOp;
00109 class DragInformation;
00110 class KeyPress;
00111 class OilCoord;
00112 
00113 enum ObjectDragTarget
00114 {
00115     NO_TARGET,
00116     FILL_TARGET,
00117     LINE_TARGET,
00118     STARTCOL_TARGET,
00119     ENDCOL_TARGET,
00120     ENDCOL2_TARGET,
00121     ENDCOL3_TARGET,
00122     MANY_TARGET
00123 };
00124 
00125 
00126 /*********************************************************************************************
00127 
00128 <   DragEventType
00129 
00130     Comment:        This enumerated type specifies all the drag event types that can be
00131                     passed to a DragTarget during a global drag operation.
00132                     The possible events are (prefix with 'DRAGEVENT_'):
00133                     MonoOn
00134                         INITIALISE      Given to all Targets once all targets have been
00135                                         registered with the drag manager
00136                         DEINITIALISE    Given to all Targets immediately prior to the drag
00137                                         manager closing down
00138 
00139                         ABORT           Sent when the drag is aborted
00140                         COMPLETED       Sent when the drag is successfully completed
00141                         MOUSEMOVED      Sent whenever the mouse pointer moves
00142                         MOUSESTOPPED    Sent whenever the mouse pointer stops moving
00143                         MOUSEIDLE       Sent whenever the mouse pointer stays stationary
00144                         KEYPRESS        Sent whenever a key is pressed
00145                     MonoOff
00146 
00147     Notes:          INITIALISE, ABORT, COMPLETED, MOUSEMOVED should never be claimed
00148                     by any DragTarget, so that all DragTargets know about the event.
00149 
00150     Documentation:  Docs\Specs\DragMan.doc
00151 
00152     SeeAlso:        DragManagerOp; DragTarget;
00153                     DragManagerOp::ProcessEvent; DragTarget::ProcessEvent
00154 
00155 *********************************************************************************************/
00156 
00157 typedef enum
00158 {
00159     DRAGEVENT_INITIALISE,
00160     DRAGEVENT_ABORT,
00161     DRAGEVENT_COMPLETED,
00162     DRAGEVENT_MOUSEMOVED,
00163     DRAGEVENT_MOUSESTOPPED,
00164     DRAGEVENT_MOUSEIDLE,
00165     DRAGEVENT_KEYPRESS,
00166     DRAGEVENT_DEINITIALISE
00167 }   DragEventType;
00168 
00169 
00170 
00171 
00172 /*********************************************************************************************
00173 
00174 >   class DragTarget : public ListItem
00175 
00176     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00177     Created:    2/1/95
00178     Purpose:    An instantiation of this class is created by each entity which wishes to 
00179                 provide a 'destination' to which the mouse can go to complete a drag.
00180 
00181     Notes:      IMPORTANT! The DragTarget class is the abstract base from which
00182                 KernelDragTarget and OilDragTarget are derived. You should derive your
00183                 class from one of these classes, NOT from DragTarget itself.
00184 
00185                 This class would be properly abstract (pure virtual methods) execept that
00186                 IMPLEMENT_DYNAMIC screws that all up for us.
00187 
00188     SeeAlso:    DragManagerOp::StartDrag; DragInformation
00189 
00190     Documentation:  Docs\Specs\DragMan.doc
00191 
00192 *********************************************************************************************/
00193 
00194 class CCAPI DragTarget : public ListItem
00195 {
00196 friend class DragManagerOp;                 // Only DragManagerOp can call event handlers
00197 
00198     CC_DECLARE_DYNAMIC(DragTarget)
00199 
00200 
00201 protected:      // Default constructor/destructor
00202     DragTarget();       // Nobody should use the default constructor!
00203     ~DragTarget();      // Only DragTargets & DragManagers can delete us
00204 
00205 
00206 public:         // Interface
00207         // Determine if DragTarget is kernel/winoil entity
00208     virtual BOOL IsAKernelObject(void);
00209 
00210 protected:
00211         // Kernelly event processing (See KernelDragTarget)
00212     virtual BOOL ProcessEvent(DragEventType Event,
00213                                 DragInformation *pDragInfo,
00214                                 OilCoord *pMousePos, KeyPress* pKeyPress);
00215 
00216         // Winoily event processing (See OilDragTarget)
00217     virtual BOOL ProcessEvent(DragEventType Event,
00218                                 DragInformation *pDragInfo,
00219                                 wxPoint *pMousePos, KeyPress* pKeyPress);
00220 
00221     virtual void GetTargetAreaInfo(DialogOp **ReturnedDialog, CGadgetID *ReturnedGadget);
00222 
00223     virtual void GetTargetAreaInfo(wxWindow **ReturnedHWnd, wxRect *ReturnedTargetRect);
00224 
00225     virtual UINT32 GetCursorID();
00226 
00227     virtual BOOL GetStatusLineText(String_256 * TheText);
00228 
00229 
00230 public:
00231     inline BOOL WantsAllEvents(void);
00232 
00233 
00234 protected:
00235     BOOL IWantAllEvents;            // True if this target wants events even if the pointer
00236                                     // is outside the designated target area
00237 };
00238 
00239 
00240 
00241 /*********************************************************************************************
00242 
00243 >   inline BOOL DragTarget::WantsAllEvents(void)
00244 
00245     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00246     Created:    2/3/95
00247 
00248         
00249 
00250     Purpose:    To determine if a given dragtarget wants events to be passed to it if the
00251                 mouse pointer is outside the target area - This is only necessary for
00252                 targets which supply a target window area. It is also not necessary for
00253                 some events (e.g. INITIALISE, DEINITIALISE) which are always delivered,
00254                 regardless of the pointer position.
00255 
00256     Notes:      Targets which wish to recieve these events (e.g. scroll drags in galleries
00257                 like to continue scrolling even if the pointer moves out of the window - 
00258                 the drag is used to "capture" the mouse) should set their member variable
00259                 "IWantAllEvents" in their constructors.
00260 
00261                 If an event is claimed by another target, it will NOT be passed on to
00262                 other targets, even if this method returns TRUE.
00263 
00264 *********************************************************************************************/
00265 
00266 BOOL DragTarget::WantsAllEvents(void)
00267 {
00268     return(IWantAllEvents);
00269 }
00270 
00271 
00272 
00273 
00274 
00275 
00276 /*********************************************************************************************
00277 
00278 >   class KernelDragTarget public DragTarget
00279 
00280     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00281     Created:    2/1/95
00282 
00283     Purpose:    An instantiation of this class is created by each entity which wishes to 
00284                 provide a 'destination' to which the mouse can go to complete a drag.
00285                 KernelDragTargets are used as a base class from which to derive drag targets
00286                 for KERNEL entities (usually a DialogOp and optional Gadget ID)
00287 
00288     Notes:      Drag targets are destructed automatically when a drag finishes by the drag
00289                 manager with which they were registered.
00290 
00291                 To remove a drag target at any time, destruct it - it automatically deregisters
00292                 and cleans up.
00293                 
00294     SeeAlso:    DragManagerOp::StartDrag; DragInformation; DragTarget
00295 
00296     Documentation:  Docs\Specs\DragMan.doc
00297 
00298 *********************************************************************************************/
00299 
00300 class CCAPI KernelDragTarget : public DragTarget
00301 {
00302 friend class DragManagerOp;                 // Only DragManagerOp can call event handlers
00303 
00304     CC_DECLARE_DYNAMIC(KernelDragTarget)
00305 
00306 
00307 public:         // Construction/destruction
00308     KernelDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL);
00309 
00310 
00311 public:         // Public interface
00312         // Returns TRUE (this is a kernel object) - DO NOT OVERRIDE (derive from WinoilDT instead)
00313     virtual BOOL IsAKernelObject(void);
00314 
00315 
00316 protected:
00317         // Process a drag-related event
00318     virtual BOOL ProcessEvent(DragEventType Event,
00319                                 DragInformation *pDragInfo,
00320                                 OilCoord *pMousePos, KeyPress* pKeyPress);
00321 
00322         // Get the target area (dialogue) information for this target
00323     virtual void GetTargetAreaInfo(DialogOp **ReturnedDialog, CGadgetID *ReturnedGadget);
00324 
00325 
00326 protected:      // Internal data
00327     DialogOp    *TargetDialog;
00328     CGadgetID   TargetGadget;
00329 };
00330 
00331 
00332 
00333 
00334 /*********************************************************************************************
00335 
00336 >   class CCAPI OilDragTarget : public DragTarget
00337 
00338     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00339     Created:    2/1/95
00340 
00341     Purpose:    An instantiation of this class is created by each entity which wishes to 
00342                 provide a 'destination' to which the mouse can go to complete a drag.
00343                 OilDragTargets are used as a base class from which to derive drag targets
00344                 for WINOIL entities (an optional HWND)
00345 
00346     Notes:      Drag targets are destructed automatically when a drag finishes by the drag
00347                 manager with which they were registered.
00348 
00349                 To remove a drag target at any time, destruct it - it automatically deregisters
00350                 and cleans up.
00351                 
00352     SeeAlso:    DragManagerOp::StartDrag; DragInformation; DragTarget
00353 
00354     Documentation:  Docs\Specs\DragMan.doc
00355 
00356 *********************************************************************************************/
00357 
00358 class CCAPI OilDragTarget : public DragTarget
00359 {
00360 friend class DragManagerOp;                 // Only DragManagerOp can call event handlers
00361 
00362     CC_DECLARE_DYNAMIC(OilDragTarget)
00363 
00364 
00365 public:         // Construction/destruction
00366     OilDragTarget(wxWindow *TheWindow, wxRect *ClientArea = NULL);
00367         
00368 
00369 public:         // Public interface
00370         // Returns TRUE (this is a kernel object) - DO NOT OVERRIDE (derive from WinoilDT instead)
00371     virtual BOOL IsAKernelObject(void);
00372 
00373 
00374 protected:
00375         // Process a drag-related event
00376     virtual BOOL ProcessEvent(DragEventType Event,
00377                                 DragInformation *pDragInfo,
00378                                 wxPoint *pMousePos, KeyPress* pKeyPress);
00379 
00380         // Get the target area (window) information for this target
00381     virtual void GetTargetAreaInfo(wxWindow **ReturnedHWnd, wxRect *ReturnedTargetRect);
00382 
00383 
00384 protected:      // Internal data
00385     wxWindow*   TargetHWnd;
00386     wxRect      TargetClientArea;
00387 };
00388 
00389 
00390 #endif
00391 

Generated on Sat Nov 10 03:48:25 2007 for Camelot by  doxygen 1.4.4