12 #ifndef ROOT_TDNDManager
13 #define ROOT_TDNDManager
23 class TGDragWindow :
public TGFrame {
26 static Cursor_t fgDefaultCursor;
29 virtual void DoRedraw();
36 TGDragWindow(
const TGWindow *p, Pixmap_t pic, Pixmap_t mask,
37 UInt_t options = kChildFrame, Pixel_t back = GetWhitePixel());
38 virtual ~TGDragWindow();
40 virtual TGDimension GetDefaultSize()
const {
return TGDimension(fPw, fPh); }
42 virtual void MapWindow();
43 virtual void UnmapWindow();
44 virtual void RaiseWindow();
45 virtual void LowerWindow();
46 virtual void MapRaised();
48 virtual void Layout();
50 Window_t GetInputId()
const {
return fInput; }
51 Bool_t HasWindow(Window_t w)
const {
return (w == fId || w == fInput); }
53 ClassDef(TGDragWindow, 0)
65 class TDNDData :
public TObject {
67 TDNDData(
const TDNDData&);
68 TDNDData& operator=(
const TDNDData&);
71 TDNDData(Atom_t dt = kNone,
void *d = 0, Int_t len = 0, Atom_t act = kNone) :
72 fDataType(dt), fAction(act), fData(d), fDataLength(len) {}
85 class TGDNDManager :
public TObject {
88 TGDNDManager(
const TGDNDManager&);
89 TGDNDManager& operator=(
const TGDNDManager&);
94 Atom_t *fTypelist, *fDraggerTypes;
96 Atom_t fAcceptedAction, fLocalAction;
100 Bool_t fStatusPending;
103 Window_t fSource, fTarget;
104 Bool_t fTargetIsDNDAware;
105 UInt_t fGrabEventMask;
106 TGFrame *fLocalSource, *fLocalTarget;
108 TTimer *fDropTimeout;
109 TGDragWindow *fDragWin;
111 Pixmap_t fPic, fMask;
113 Cursor_t fDNDNoDropCursor;
116 static Atom_t fgDNDAware, fgDNDSelection, fgDNDProxy;
117 static Atom_t fgDNDEnter, fgDNDLeave, fgDNDPosition, fgDNDStatus;
118 static Atom_t fgDNDDrop, fgDNDFinished;
119 static Atom_t fgDNDVersion;
120 static Atom_t fgDNDActionCopy, fgDNDActionMove, fgDNDActionLink;
121 static Atom_t fgDNDActionAsk, fgDNDActionPrivate;
122 static Atom_t fgDNDTypeList, fgDNDActionList, fgDNDActionDescrip;
123 static Atom_t fgXCDNDData;
125 static Bool_t fgInit;
126 static Atom_t fgXAWMState;
130 Window_t GetRootProxy();
131 Window_t FindWindow(Window_t root, Int_t x, Int_t y, Int_t maxd);
132 Bool_t IsDNDAware(Window_t win, Atom_t *typelist = 0);
133 Bool_t IsTopLevel(Window_t win);
135 void SendDNDEnter(Window_t target);
136 void SendDNDLeave(Window_t target);
137 void SendDNDPosition(Window_t target,
int x,
int y,
138 Atom_t action, Time_t timestamp);
139 void SendDNDStatus(Window_t target, Atom_t action);
140 void SendDNDDrop(Window_t target);
141 void SendDNDFinished(Window_t src);
143 Bool_t HandleDNDEnter(Window_t src,
long vers, Atom_t dataTypes[3]);
144 Bool_t HandleDNDLeave(Window_t src);
145 Bool_t HandleDNDPosition(Window_t src,
int x_root,
int y_root, Atom_t action, Time_t timestamp);
146 Bool_t HandleDNDStatus(Window_t from,
int accepted,
147 Rectangle_t skip, Atom_t action);
148 Bool_t HandleDNDDrop(Window_t src, Time_t timestamp);
149 Bool_t HandleDNDFinished(Window_t target);
152 TGDNDManager(TGFrame *toplevel, Atom_t *typelist);
153 virtual ~TGDNDManager();
155 Bool_t HandleClientMessage(Event_t *event);
156 Bool_t HandleSelectionRequest(Event_t *event);
157 Bool_t HandleSelection(Event_t *event);
159 Bool_t HandleTimer(TTimer *t);
163 TGFrame *GetMainFrame()
const {
return fMain; }
164 void SetMainFrame(TGFrame *main) { fMain = main; }
165 void SetDragPixmap(Pixmap_t pic, Pixmap_t mask, Int_t hot_x, Int_t hot_y);
166 Bool_t SetRootProxy();
167 Bool_t RemoveRootProxy();
169 Bool_t StartDrag(TGFrame *src, Int_t x_root, Int_t y_root,
170 Window_t grabWin = kNone);
171 Bool_t Drag(Int_t x_root, Int_t y_root, Atom_t action, Time_t timestamp);
175 Bool_t IsDragging()
const {
return fDragging; }
176 Window_t GetSource()
const {
return fSource; }
177 Window_t GetTarget()
const {
return fTarget; }
178 Atom_t *GetTypeList()
const {
return fTypelist; }
180 static Atom_t GetDNDAware();
181 static Atom_t GetDNDSelection();
182 static Atom_t GetDNDProxy();
183 static Atom_t GetDNDEnter();
184 static Atom_t GetDNDLeave();
185 static Atom_t GetDNDPosition();
186 static Atom_t GetDNDStatus();
187 static Atom_t GetDNDDrop();
188 static Atom_t GetDNDFinished();
189 static Atom_t GetDNDVersion();
190 static Atom_t GetDNDActionCopy();
191 static Atom_t GetDNDActionMove();
192 static Atom_t GetDNDActionLink();
193 static Atom_t GetDNDActionAsk();
194 static Atom_t GetDNDActionPrivate();
195 static Atom_t GetDNDTypeList();
196 static Atom_t GetDNDActionList();
197 static Atom_t GetDNDActionDescrip();
198 static Atom_t GetXCDNDData();
200 ClassDef(TGDNDManager, 0)
203 R__EXTERN TGDNDManager *gDNDManager;
205 #endif // ROOT_TDNDManager