1
// "$Id: FreqControl.cpp,v 2006/02/26"
3
// Frequency Control Widget for the Fast Light Tool Kit (Fltk)
5
// Copyright 2005-2006, Dave Freese W1HKJ
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
// Library General Public License for more details.
17
// You should have received a copy of the GNU Library General Public
18
// License along with this library; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22
// Please report all bugs and problems to "w1hkj@w1hkj.com".
25
// Create a multi-digit receiver / transceiver frequency control widget
27
// label used to pass # digits & decimal position to control
28
// the widget can be used in Fluid & initialized with the
29
// number of digits as the label string
30
// default is 7; min number is 1, max number is 9 as in
32
// cFreqControl myFreqConrol(x0, y0, w0, h0, "N"); where N is # digits
33
// cFreqControl *pMyFreqControl = new cFreqControl(x0,y0,w0,h0,"N");
35
#ifndef _FREQCONTROL_H_
36
#define _FREQCONTROL_H_
39
#include <FL/Fl_Widget.H>
40
#include <FL/Fl_Repeat_Button.H>
41
#include <FL/Fl_Group.H>
42
#include <FL/Enumerations.H>
57
class cFreqControl : public Fl_Group {
58
friend void cbSelectDigit (Fl_Widget *btn, void * nbr);
60
cFreqControl(int x, int y, int w, int h, const char *lbl = "7");
64
long value(){return val;};
65
void font(Fl_Font fnt);
66
void SetONCOLOR (uchar r, uchar g, uchar b);
67
void SetOFFCOLOR (uchar r, uchar g, uchar b);
68
void GetONCOLOR (uchar &r, uchar &g, uchar &b) {
69
Fl::get_color(ONCOLOR, r, g, b);
71
void GetOFFCOLOR (uchar &r, uchar &g, uchar &b) {
72
Fl::get_color(OFFCOLOR, r, g, b);
74
void SetONOFFCOLOR( Fl_Color, Fl_Color);
75
void setCallBack (int (*cbf)() ){ cbFunc = cbf;};
76
void do_callback() { if (cbFunc) cbFunc(); }
77
int handle(int event);
80
void resize (int X, int Y, int W, int H);
82
void set_precision(int val) {
85
dpoint = 1; precision = 100; break;
87
dpoint = 2; precision = 10; break;
89
dpoint = 3; precision = 1; break;
93
void set_ndigits(int val);
96
Fl_Repeat_Button *Digit[MAX_DIGITS];
98
static const char *Label[];
113
int pw; // decimal width
124
static void freq_input_cb(Fl_Widget* input, void* arg);