1 // =====================================================================
2 //
3 // drop_button.cxx
4 //
5 // Author:    David Freese, W1HKJ
6 // Copyright: 2020
7 //
8 // This file is part of flmsg.
9 //
10 // This is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // This software is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  It is
18 // copyright under the GNU General Public License.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 //
23 // =====================================================================
24 //
25 // extends normal button to allow drop events
26 // ---------------------------------------------------------------------
27 
28 #include <iostream>
29 #include <string>
30 #include <FL/names.h>
31 
32 #include "config.h"
33 
34 #include "drop_button.h"
35 
Fl_Drop_Button(int x,int y,int w,int h,const char * l)36 Fl_Drop_Button::Fl_Drop_Button(int x, int y, int w, int h, const char* l)
37 : Fl_Button(x, y, w, h, l)
38 {
39 	last_event = -1;
40 }
41 
handle(int event)42 int Fl_Drop_Button::handle(int event)
43 {
44 	if (event == FL_DND_ENTER || event == FL_DND_DRAG || event == FL_DND_RELEASE) {
45 		last_event = event;
46 		return 1;
47 	}
48 	if (event == FL_PASTE) {
49 		do_callback();
50 		return 1;
51 	}
52 	return Fl_Button::handle(event);
53 }
54