NTK 1.3.0
Fl_Dial.H
1
2/*******************************************************************************/
3/* Copyright (C) 2008 Jonathan Moore Liles */
4/* */
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. */
9/* */
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 */
13/* more details. */
14/* */
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/*******************************************************************************/
19
20/* simple stylistic variation on Fl_Dial */
21
22#pragma once
23
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>
28
29class Fl_Dial : public Fl_Dial_Base
30{
31 static int _default_style;
32 static Fl_Image *_default_image;
33
34 int _scaleticks;
35
36 Fl_Image *_pixmap;
37 int _last_pixmap_index;
38
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 );
42
43 void get_knob_dimensions ( int *X, int *Y, int *S );
44
45protected:
46
47 virtual int handle ( int );
48 virtual void draw ( void );
49 virtual void draw_box ( void );
50
51public:
52
53 void scaleticks ( int tck );
54
55 int
56 type ( void ) const
57 {
58 if ( Fl_Dial_Base::type() == DEFAULT )
59 return Fl_Dial::_default_style;
60 else
61 return Fl_Dial_Base::type();
62 }
63
64 void type ( int n )
65 {
67 }
68
69 /* virtual void value_damage ( void ) */
70 /* { */
71 /* if ( window() ) */
72 /* window()->damage( FL_DAMAGE_ALL, x(), y(), w(), h() ); */
73 /* } */
74
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; }
77
78 void pixmap ( Fl_Image *i ) { _pixmap = i; }
79
80 Fl_Image* pixmap ( void ) { return _pixmap; }
81
82 enum
83 {
84 DEFAULT,
85 BURNISHED_DIAL,
86 ARC_DIAL,
87 PLASTIC_DIAL,
88 PIXMAP_DIAL
89 };
90
91
92 Fl_Dial ( int X, int Y, int W, int H, const char *L = 0 ) :
93 Fl_Dial_Base( X, Y, W, H, L )
94 {
95 _scaleticks = 12;
96
97 _pixmap = 0;
98 _last_pixmap_index = -1;
99
100 box( FL_NO_BOX );
101 type( DEFAULT );
102 }
103
104};
@ FL_NO_BOX
nothing is drawn at all, this box is invisible
Definition Enumerations.H:474
Fl_Dial_Base(int x, int y, int w, int h, const char *l=0)
Creates a new Fl_Dial_Base widget using the given position, size, and label string.
Definition Fl_Dial_Base.cxx:152
virtual int handle(int)
Handles the specified event.
Definition Fl_Dial.cxx:95
virtual void draw(void)
Draws the widget.
Definition Fl_Dial.cxx:139
Fl_Image is the base class used for caching and drawing all kinds of images in FLTK.
Definition Fl_Image.H:51
Fl_Boxtype box() const
Gets the box type of the widget.
Definition Fl_Widget.H:362
uchar type() const
Gets the widget type.
Definition Fl_Widget.H:273