diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2002-02-24 17:52:18 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2002-02-24 17:52:18 +0000 |
| commit | 4603756ed1284dfc9d71a556976f4f5b898abd24 (patch) | |
| tree | 4a6305d9017b0dc0c34ae97b3ed44f3266a1c1be /src/Fl.cxx | |
| parent | 0372675ee12e54acd993f6d25a9489c1373caf75 (diff) | |
- added Win32 native drag'n'drop code
- added dnd support for Fl_Group (not tested with X!)
- added dnd support for Fl_Input (not tested with X!)
- no Mac implementation yet!
Go ahead: drag text or a file from the explorer into
a text widget! Tadaa!
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1971 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl.cxx')
| -rw-r--r-- | src/Fl.cxx | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index d3f10af9c..f7aa5b027 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl.cxx,v 1.24.2.41.2.19 2002/02/20 19:29:57 easysw Exp $" +// "$Id: Fl.cxx,v 1.24.2.41.2.20 2002/02/24 17:52:17 matthiaswm Exp $" // // Main event handling code for the Fast Light Tool Kit (FLTK). // @@ -416,13 +416,17 @@ void Fl::focus(Fl_Widget *o) { } } +static char dnd_flag = 0; // make 'belowmouse' send DND_LEAVE instead of LEAVE + void Fl::belowmouse(Fl_Widget *o) { if (grab()) return; // don't do anything while grab is on Fl_Widget *p = belowmouse_; if (o != p) { - Fl_Tooltip::enter(o); + if (!dnd_flag) Fl_Tooltip::enter(o); belowmouse_ = o; - for (; p && !p->contains(o); p = p->parent()) p->handle(FL_LEAVE); + for (; p && !p->contains(o); p = p->parent()) { + p->handle(dnd_flag ? FL_DND_LEAVE : FL_LEAVE); + } } } @@ -555,6 +559,21 @@ int Fl::handle(int event, Fl_Window* window) window->show(); return 1; + case FL_DND_ENTER: + case FL_DND_DRAG: + dnd_flag = 1; + break; + + case FL_DND_LEAVE: + dnd_flag = 1; + belowmouse(0); + dnd_flag = 0; + return true; + + case FL_DND_RELEASE: + w = belowmouse(); + break; + case FL_MOVE: case FL_DRAG: fl_xmousewin = window; // this should already be set, but just in case. @@ -643,7 +662,9 @@ int Fl::handle(int event, Fl_Window* window) break; } if (w && send(event, w, window)) return 1; - return send_handlers(event); + int ret = send_handlers(event); + dnd_flag = 0; + return ret; } //////////////////////////////////////////////////////////////// @@ -855,5 +876,5 @@ void Fl_Window::flush() { } // -// End of "$Id: Fl.cxx,v 1.24.2.41.2.19 2002/02/20 19:29:57 easysw Exp $". +// End of "$Id: Fl.cxx,v 1.24.2.41.2.20 2002/02/24 17:52:17 matthiaswm Exp $". // |
