2 /*******************************************************************************/
3 /* Copyright (C) 2008 Jonathan Moore Liles */
5 /* This program is free software; you can redistribute it and/or modify it */
6 /* under the terms of the GNU General Public License as published by the */
7 /* Free Software Foundation; either version 2 of the License, or (at your */
8 /* option) any later version. */
10 /* This program is distributed in the hope that it will be useful, but WITHOUT */
11 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
12 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
15 /* You should have received a copy of the GNU General Public License along */
16 /* with This program; see the file COPYING. If not,write to the Free Software */
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /*******************************************************************************/
20 /* simple stylistic variation on Fl_Dial */
24 #include <FL/Fl_Dial_Base.H>
25 #include <FL/Fl_Image.H>
26 #include <FL/Fl_Group.H>
27 #include <FL/Fl_Window.H>
29 class Fl_Dial : public Fl_Dial_Base
31 static int _default_style;
32 static Fl_Image *_default_image;
37 int _last_pixmap_index;
39 void draw_knob ( int type );
40 void draw_scale ( int ox, int oy, int side );
41 void draw_cursor ( int ox, int oy, int sidei );
43 void get_knob_dimensions ( int *X, int *Y, int *S );
47 virtual int handle ( int );
48 virtual void draw ( void );
49 virtual void draw_box ( void );
53 void scaleticks ( int tck );
58 if ( Fl_Dial_Base::type() == DEFAULT )
59 return Fl_Dial::_default_style;
61 return Fl_Dial_Base::type();
66 Fl_Dial_Base::type( n );
69 /* virtual void value_damage ( void ) */
72 /* window()->damage( FL_DAMAGE_ALL, x(), y(), w(), h() ); */
75 static void default_style ( int n ) { Fl_Dial::_default_style = n; }
76 static void default_image ( Fl_Image *i ) { Fl_Dial::_default_image = i; }
78 void pixmap ( Fl_Image *i ) { _pixmap = i; }
80 Fl_Image* pixmap ( void ) { return _pixmap; }
92 Fl_Dial ( int X, int Y, int W, int H, const char *L = 0 ) :
93 Fl_Dial_Base( X, Y, W, H, L )
98 _last_pixmap_index = -1;