1 /*
2  *  This file is part of the XForms library package.
3  *
4  *  XForms is free software; you can redistribute it and/or modify it
5  *  under the terms of the GNU Lesser General Public License as
6  *  published by the Free Software Foundation; either version 2.1, or
7  *  (at your option) any later version.
8  *
9  *  XForms is distributed in the hope that it will be useful, but
10  *  WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public License
15  *  along with XForms.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /********************** crop here for forms.h **********************/
19 
20 /**
21  * \file slider.h
22  *
23  * Object Class: Slider
24  */
25 
26 #ifndef FL_SLIDER_H
27 #define FL_SLIDER_H
28 
29 
30 #define FL_HOR_FLAG     1
31 #define FL_SCROLL_FLAG  16
32 
33 typedef enum {
34     FL_VERT_SLIDER           = 0,
35     FL_HOR_SLIDER            = FL_VERT_SLIDER          | FL_HOR_FLAG,
36 
37     FL_VERT_FILL_SLIDER      = 2,
38     FL_HOR_FILL_SLIDER       = FL_VERT_FILL_SLIDER     | FL_HOR_FLAG,
39 
40     FL_VERT_NICE_SLIDER      = 4,
41     FL_HOR_NICE_SLIDER       = FL_VERT_NICE_SLIDER     | FL_HOR_FLAG,
42 
43     FL_VERT_BROWSER_SLIDER   = 6,
44     FL_HOR_BROWSER_SLIDER    = FL_VERT_BROWSER_SLIDER  | FL_HOR_FLAG,
45 
46 	FL_VERT_PROGRESS_BAR     = 8,
47 	FL_HOR_PROGRESS_BAR      = FL_VERT_PROGRESS_BAR    | FL_HOR_FLAG,
48 
49     /* The following are for use with scrollbars only! */
50 
51     /* For FL_VERT_SCROLLBAR and FL_HOR_SCROLLBAR */
52 
53     FL_VERT_BROWSER_SLIDER2   = FL_VERT_SLIDER         | FL_SCROLL_FLAG,
54     FL_HOR_BROWSER_SLIDER2    = FL_HOR_SLIDER          | FL_SCROLL_FLAG,
55 
56     /* for FL_VERT_THIN_SCROLLBAR and FL_VERT_THIN_SCROLLBAR */
57 
58     FL_VERT_THIN_SLIDER       = FL_VERT_FILL_SLIDER    | FL_SCROLL_FLAG,
59     FL_HOR_THIN_SLIDER        = FL_HOR_FILL_SLIDER     | FL_SCROLL_FLAG,
60 
61     /* For FL_VERT_NICE_SCROLLBAR and FL_HOR_NICE_SCROLLBAR */
62 
63     FL_VERT_NICE_SLIDER2      = FL_VERT_NICE_SLIDER    | FL_SCROLL_FLAG,
64     FL_HOR_NICE_SLIDER2       = FL_HOR_NICE_SLIDER     | FL_SCROLL_FLAG,
65 
66     /* for use as FL_VERT_PLAIN_SCROLLBAR and FL_VERT_PLAIN_SCROLLBAR */
67 
68     FL_VERT_BASIC_SLIDER      = FL_VERT_BROWSER_SLIDER | FL_SCROLL_FLAG,
69     FL_HOR_BASIC_SLIDER       = FL_HOR_BROWSER_SLIDER  | FL_SCROLL_FLAG
70 } FL_SLIDER_TYPE;
71 
72 /***** Defaults *****/
73 
74 #define FL_SLIDER_BW1       FL_BOUND_WIDTH
75 #define FL_SLIDER_BW2       FL_abs( FL_BOUND_WIDTH )
76 #define FL_SLIDER_BOXTYPE   FL_DOWN_BOX
77 #define FL_SLIDER_COL1      FL_COL1
78 #define FL_SLIDER_COL2      FL_COL1
79 #define FL_SLIDER_LCOL      FL_LCOL
80 #define FL_SLIDER_ALIGN     FL_ALIGN_BOTTOM
81 
82 /***** Others   *****/
83 
84 #define FL_SLIDER_FINE      0.25
85 #define FL_SLIDER_WIDTH     0.10
86 
87 #define FL_SLIDER_MAX_PREC  10
88 
89 /***** Routines *****/
90 
91 FL_EXPORT FL_OBJECT * fl_create_slider( int          type,
92                                         FL_Coord     x,
93                                         FL_Coord     y,
94                                         FL_Coord     w,
95                                         FL_Coord     h,
96                                         const char * label );
97 
98 FL_EXPORT FL_OBJECT * fl_add_slider( int          type,
99                                      FL_Coord     x,
100                                      FL_Coord     y,
101                                      FL_Coord     w,
102                                      FL_Coord     h,
103                                      const char * label );
104 
105 FL_EXPORT FL_OBJECT * fl_create_valslider( int          type,
106                                            FL_Coord     x,
107                                            FL_Coord     y,
108                                            FL_Coord     w,
109                                            FL_Coord     h,
110                                            const char * label );
111 
112 FL_EXPORT FL_OBJECT * fl_add_valslider( int          type,
113                                         FL_Coord     x,
114                                         FL_Coord     y,
115                                         FL_Coord     w,
116                                         FL_Coord     h,
117                                         const char * label );
118 
119 FL_EXPORT void fl_set_slider_value( FL_OBJECT * ob,
120                                     double      val );
121 
122 FL_EXPORT double fl_get_slider_value( FL_OBJECT * ob );
123 
124 FL_EXPORT void fl_set_slider_bounds( FL_OBJECT * ob,
125                                      double      min,
126                                      double      max );
127 
128 FL_EXPORT void fl_get_slider_bounds( FL_OBJECT * ob,
129                                      double    * min,
130                                      double    * max );
131 
132 FL_EXPORT void fl_set_slider_return( FL_OBJECT    * ob,
133                                      unsigned int   value );
134 
135 FL_EXPORT void fl_set_slider_step( FL_OBJECT * ob,
136                                    double      value );
137 
138 FL_EXPORT void fl_set_slider_increment( FL_OBJECT * ob,
139                                         double      l,
140                                         double      r );
141 
142 FL_EXPORT void fl_get_slider_increment( FL_OBJECT * ob,
143                                         double    * l,
144                                         double    * r );
145 
146 FL_EXPORT void fl_set_slider_size( FL_OBJECT * ob,
147                                    double      size );
148 
149 FL_EXPORT double fl_get_slider_size( FL_OBJECT * obj );
150 
151 FL_EXPORT void fl_set_slider_precision( FL_OBJECT * ob,
152                                         int         prec );
153 
154 FL_EXPORT void fl_set_slider_filter( FL_OBJECT     * ob,
155                                      FL_VAL_FILTER   filter );
156 
157 FL_EXPORT int fl_get_slider_repeat( FL_OBJECT * obj );
158 
159 FL_EXPORT void fl_set_slider_repeat( FL_OBJECT * obj,
160 									 int         millisec );
161 
162 FL_EXPORT void fl_set_slider_mouse_buttons( FL_OBJECT    * obj,
163 											unsigned int   mouse_buttons );
164 FL_EXPORT void fl_get_slider_mouse_buttons( FL_OBJECT    * obj,
165 											unsigned int * mouse_buttons );
166 
167 
168 #endif /* ! defined FL_SLIDER_H */
169