From 477e1f5b40298c8d05deefa5c0fc6009cde650f0 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 16 Feb 2008 00:47:46 -0600 Subject: [PATCH] Let tracks recieve DND events. --- Track.H | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/Track.H b/Track.H index 8693ec0..f7e5ca4 100644 --- a/Track.H +++ b/Track.H @@ -20,10 +20,9 @@ #pragma once #include - +#include #include "Region.H" - #include #include @@ -41,13 +40,13 @@ class Track : public Fl_Group public: Track ( int X, int Y, int W, int H ) : Fl_Group( X, Y, W, H ) - { - _next = _prev = NULL; - _name = NULL; + { + _next = _prev = NULL; + _name = NULL; - box( FL_DOWN_BOX ); - color( fl_darker( FL_GRAY ) ); - } + box( FL_DOWN_BOX ); + color( fl_darker( FL_GRAY ) ); + } Track *next ( void ) { return _next; } Track *prev ( void ) { return _prev; } @@ -80,4 +79,33 @@ public: r->position( r->x(), y() ); r->redraw(); } + + int handle ( int m ) + { + switch ( m ) + { + case FL_DND_DRAG: + case FL_DND_RELEASE: + case FL_DND_ENTER: + case FL_DND_LEAVE: + case FL_ENTER: + return 1; + case FL_PASTE: + { + const char *file, *text = Fl::event_text(); + + if ( ! strncmp( text, "file://", 7 ) ) + file = text + 7; + else + // error? + file = text; + + printf( "pasted file \"%s\"\n", file ); + + return 1; + } + default: + return Fl_Group::handle( m ); + } + } };