Let tracks recieve DND events.

This commit is contained in:
Jonathan Moore Liles 2008-02-16 00:47:46 -06:00
parent 41ac62e2cd
commit 477e1f5b40
1 changed files with 36 additions and 8 deletions

44
Track.H
View File

@ -20,10 +20,9 @@
#pragma once
#include <FL/Fl_Group.H>
#include <FL/Fl.H>
#include "Region.H"
#include <stdio.h>
#include <list>
@ -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 );
}
}
};