00001 /* 00002 File : gadget_w_slider.h 00003 Date : 19-Sep-02 00004 Description : Class to represent a toolbox gadget that has a slider. 00005 00006 Copyright © 1995-2002 Alexander Thoukydides 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00021 */ 00022 00023 // Only include header file once 00024 #ifndef gadget_w_slider_h 00025 #define gadget_w_slider_h 00026 00027 // Include oslib header files 00028 #include "oslib/wimp.h" 00029 00030 // Include alexlib header files 00031 #ifndef gadget_w_number_h 00032 #include "gadget_w_number.h" 00033 #endif 00034 00035 // A class to represent a gadget with a slider 00036 class gadget_w_slider : public gadget_w_number 00037 { 00038 public: 00039 00040 /* 00041 Parameters : colour - The slider colour. 00042 Returns : void 00043 Description : Set the colour of the slider. 00044 */ 00045 void set_slider_colour(wimp_colour colour = wimp_COLOUR_MID_DARK_GREY); 00046 00047 /* 00048 Parameters : void 00049 Returns : wimp_colour - The slider colour. 00050 Description : Get the colour of the slider. 00051 */ 00052 wimp_colour get_slider_colour() const; 00053 00054 /* 00055 Parameters : colour - The well colour. 00056 Returns : void 00057 Description : Set the colour of the well. 00058 */ 00059 void set_well_colour(wimp_colour colour = wimp_COLOUR_WHITE); 00060 00061 /* 00062 Parameters : void 00063 Returns : wimp_colour - The well colour. 00064 Description : Get the colour of the well. 00065 */ 00066 wimp_colour get_well_colour() const; 00067 00068 /* 00069 Parameters : lower - The lower bound. 00070 Returns : void 00071 Description : Set the lower bound. 00072 */ 00073 void set_lower_bound(int lower); 00074 00075 /* 00076 Parameters : void 00077 Returns : int - The lower bound. 00078 Description : Get the lower bound. 00079 */ 00080 int get_lower_bound() const; 00081 00082 /* 00083 Parameters : upper - The upper bound. 00084 Returns : void 00085 Description : Set the upper bound. 00086 */ 00087 void set_upper_bound(int upper); 00088 00089 /* 00090 Parameters : void 00091 Returns : int - The upper bound. 00092 Description : Get the upper bound. 00093 */ 00094 int get_upper_bound() const; 00095 00096 /* 00097 Parameters : step - The step size. 00098 Returns : void 00099 Description : Set the step size. 00100 */ 00101 void set_step_size(int step); 00102 00103 /* 00104 Parameters : void 00105 Returns : int - The step size. 00106 Description : Get the step size. 00107 */ 00108 int get_step_size() const; 00109 00110 /* 00111 Parameters : value - The number to set. 00112 Returns : gadget_w_slider - This object. 00113 Description : Set the value of this gadget. To reduce flicker the value 00114 is not updated unless it has changed. 00115 */ 00116 gadget_w_slider &operator=(int value); 00117 00118 protected: 00119 00120 /* 00121 Parameters : colour - The slider colour. 00122 Returns : void 00123 Description : Gadget specific function to set the colour of the slider. 00124 */ 00125 virtual void _set_slider_colour(wimp_colour colour) = 0; 00126 00127 /* 00128 Parameters : void 00129 Returns : wimp_colour - The slider colour. 00130 Description : Gadget specific function to get the colour of the slider. 00131 */ 00132 virtual wimp_colour _get_slider_colour() const = 0; 00133 00134 /* 00135 Parameters : colour - The well colour. 00136 Returns : void 00137 Description : Gadget specific function to set the colour of the well. 00138 */ 00139 virtual void _set_well_colour(wimp_colour colour) = 0; 00140 00141 /* 00142 Parameters : void 00143 Returns : wimp_colour - The well colour. 00144 Description : Gadget specific function to get the colour of the well. 00145 */ 00146 virtual wimp_colour _get_well_colour() const = 0; 00147 00148 /* 00149 Parameters : lower - The lower bound. 00150 Returns : void 00151 Description : Gadget specific function to set the lower bound. 00152 */ 00153 virtual void _set_lower_bound(int lower) = 0; 00154 00155 /* 00156 Parameters : void 00157 Returns : int - The lower bound. 00158 Description : Gadget specific function to get the lower bound. 00159 */ 00160 virtual int _get_lower_bound() const = 0; 00161 00162 /* 00163 Parameters : upper - The upper bound. 00164 Returns : void 00165 Description : Gadget specific function to set the upper bound. 00166 */ 00167 virtual void _set_upper_bound(int upper) = 0; 00168 00169 /* 00170 Parameters : void 00171 Returns : int - The upper bound. 00172 Description : Gadget specific function to get the upper bound. 00173 */ 00174 virtual int _get_upper_bound() const = 0; 00175 00176 /* 00177 Parameters : step - The step size. 00178 Returns : void 00179 Description : Gadget specific function to set the step size. 00180 */ 00181 virtual void _set_step_size(int step) = 0; 00182 00183 /* 00184 Parameters : void 00185 Returns : int - The step size. 00186 Description : Gadget specific function to get the step size. 00187 */ 00188 virtual int _get_step_size() const = 0; 00189 }; 00190 00191 /* 00192 Parameters : colour - The slider colour. 00193 Returns : void 00194 Description : Set the colour of the slider. 00195 */ 00196 inline void gadget_w_slider::set_slider_colour(wimp_colour colour) 00197 { 00198 _set_slider_colour(colour); 00199 } 00200 00201 /* 00202 Parameters : void 00203 Returns : wimp_colour - The slider colour. 00204 Description : Get the colour of the slider. 00205 */ 00206 inline wimp_colour gadget_w_slider::get_slider_colour() const 00207 { 00208 return _get_slider_colour(); 00209 } 00210 00211 /* 00212 Parameters : colour - The well colour. 00213 Returns : void 00214 Description : Set the colour of the well. 00215 */ 00216 inline void gadget_w_slider::set_well_colour(wimp_colour colour) 00217 { 00218 _set_well_colour(colour); 00219 } 00220 00221 /* 00222 Parameters : void 00223 Returns : wimp_colour - The well colour. 00224 Description : Get the colour of the well. 00225 */ 00226 inline wimp_colour gadget_w_slider::get_well_colour() const 00227 { 00228 return _get_well_colour(); 00229 } 00230 00231 /* 00232 Parameters : lower - The lower bound. 00233 Returns : void 00234 Description : Set the lower bound. 00235 */ 00236 inline void gadget_w_slider::set_lower_bound(int lower) 00237 { 00238 _set_lower_bound(lower); 00239 } 00240 00241 /* 00242 Parameters : void 00243 Returns : int - The lower bound. 00244 Description : Get the lower bound. 00245 */ 00246 inline int gadget_w_slider::get_lower_bound() const 00247 { 00248 return _get_lower_bound(); 00249 } 00250 00251 /* 00252 Parameters : upper - The upper bound. 00253 Returns : void 00254 Description : Set the upper bound. 00255 */ 00256 inline void gadget_w_slider::set_upper_bound(int upper) 00257 { 00258 _set_upper_bound(upper); 00259 } 00260 00261 /* 00262 Parameters : void 00263 Returns : int - The upper bound. 00264 Description : Get the upper bound. 00265 */ 00266 inline int gadget_w_slider::get_upper_bound() const 00267 { 00268 return _get_upper_bound(); 00269 } 00270 00271 /* 00272 Parameters : step - The step size. 00273 Returns : void 00274 Description : Set the step size. 00275 */ 00276 inline void gadget_w_slider::set_step_size(int step) 00277 { 00278 _set_step_size(step); 00279 } 00280 00281 /* 00282 Parameters : void 00283 Returns : int - The step size. 00284 Description : Get the step size. 00285 */ 00286 inline int gadget_w_slider::get_step_size() const 00287 { 00288 return _get_step_size(); 00289 } 00290 00291 #endif
1.3.3