1 //
2 // status_box.h
3 //
4 //  status_box bar widget routines.
5 // ----------------------------------------------------------------------------
6 // Copyright (C) 2014
7 //              David Freese, W1HKJ
8 //
9 // This file is part of fldigi
10 //
11 // fldigi is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // fldigi is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 // ----------------------------------------------------------------------------
24 
25 
26 #ifndef _status_box_H
27 #define _status_box_H
28 
29 //
30 // Include necessary headers.
31 //
32 
33 #include <FL/Fl.H>
34 #include <FL/Fl_Box.H>
35 #include <FL/Fl_Group.H>
36 
37 //
38 // status_box class...
39 //
40 
41 class status_box : public Fl_Box {
42 private:
43 	void (*cbFunc)(Fl_Widget *, void *);
44 protected:
45 public:
46 	status_box(int x, int y, int w, int h, const char *label = "")
Fl_Box(x,y,w,h,label)47 		: Fl_Box(x,y,w,h,label)
48 		{ };
handle(int e)49 	int		handle(int e) {
50 		if (Fl::event_inside( this )) {
51 			if (e == FL_RELEASE) {
52 				do_callback();
53 				return 1;
54 			}
55 		}
56 		return 0;
57 	}
callback(void (* cbf)(Fl_Widget *,void *))58 	void callback (void (*cbf)(Fl_Widget *, void *) ){ cbFunc = cbf;}
do_callback()59 	void do_callback() {
60 		if (cbFunc) cbFunc(this, (void*)0);
61 	}
62 };
63 
64 #endif // !status_box
65 
66