Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:33

0001 // @(#)root/gui:$Id$
0002 // Author: Valeriy Onuchin   12/08/04
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TVirtualDragManager
0013 #define ROOT_TVirtualDragManager
0014 
0015 
0016 #include "TGFrame.h"
0017 
0018 enum EDragType { kDragNone, kDragMove, kDragCopy,
0019                  kDragLink, kDragLasso, kDragResize };
0020 
0021 
0022 class TVirtualDragManager  {
0023 
0024 protected:
0025    Bool_t         fMoveWaiting;  ///< kTRUE if source is clicked but not moved
0026    Bool_t         fDragging;     ///< in dragging mode?
0027    Bool_t         fDropping;     ///< drop is in progress
0028    Bool_t         fPasting;      ///< paste action is in progress
0029    EDragType      fDragType;     ///< dragging type
0030    TGFrame       *fSource;       ///< frame being dragged
0031    TGFrame       *fFrameUnder;   ///< frame under drag
0032    TGFrame       *fTarget;       ///< drop target
0033    TGFrame       *fPasteFrame;   ///<
0034 
0035 protected:
0036    virtual void  Init();
0037 
0038 public:
0039    TVirtualDragManager();
0040    virtual          ~TVirtualDragManager() {}
0041 
0042    EDragType         GetEDragType() const { return fDragType; }
0043    Bool_t            IsMoveWaiting() const { return fMoveWaiting; }
0044    Bool_t            IsDragging() const { return fDragging; }
0045    Bool_t            IsDropping() const { return fDropping; }
0046    Bool_t            IsPasting() const { return fPasting; }
0047    TGFrame          *GetTarget() const { return fTarget; }
0048    TGFrame          *GetSource() const { return fSource; }
0049    TGFrame          *GetFrameUnder() const { return fFrameUnder; }
0050    TGFrame          *GetPasteFrame() const { return fPasteFrame; }
0051 
0052    virtual void      SetTarget(TGFrame *f) { fTarget = f; }
0053    virtual void      SetSource(TGFrame *f) { fSource = f; }
0054    virtual void      SetPasteFrame(TGFrame *f) { fPasteFrame = f; }
0055 
0056    virtual Bool_t    StartDrag(TGFrame * = nullptr, Int_t = 0, Int_t = 0) { return kFALSE; }
0057    virtual Bool_t    EndDrag() { return kFALSE; }
0058    virtual Bool_t    Drop() { return kFALSE; }
0059    virtual Bool_t    Cancel(Bool_t = kTRUE) { return kFALSE; }
0060 
0061    virtual Bool_t    HandleEvent(Event_t *) { return kFALSE; }
0062    virtual Bool_t    HandleTimerEvent(Event_t *, TTimer *) { return kFALSE; }
0063    virtual Bool_t    IgnoreEvent(Event_t *) { return kTRUE; }
0064    virtual void      SetEditable(Bool_t) {}
0065 
0066    virtual Int_t     GetStrartDragX() const { return 0; }
0067    virtual Int_t     GetStrartDragY() const { return 0; }
0068    virtual Int_t     GetEndDragX() const { return 0; }
0069    virtual Int_t     GetEndDragY() const { return 0; }
0070 
0071    static  TVirtualDragManager  *Instance();
0072 
0073    ClassDef(TVirtualDragManager,0)  // drag and drop manager
0074 };
0075 
0076 R__EXTERN TVirtualDragManager *gDragManager; // global drag manager
0077 
0078 #endif