00001 /* 00002 File : numberrange_c.h 00003 Date : 19-Sep-02 00004 Description : Class to represent a number range toolbox gadget. 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 numberrange_c_h 00025 #define numberrange_c_h 00026 00027 // Include alexlib header files 00028 #ifndef gadget_c_h 00029 #include "gadget_c.h" 00030 #endif 00031 #ifndef numberrange_b_h 00032 #include "numberrange_b.h" 00033 #endif 00034 00035 // A class to represent a number range gadget 00036 class numberrange_c : public virtual gadget_b, 00037 public gadget_c, 00038 public numberrange_b 00039 { 00040 public: 00041 00042 /* 00043 Parameters : component - The component ID of this number range. 00044 object - The object ID of this number range's parent 00045 window. 00046 Returns : - 00047 Description : Constructor function. This does not create a number 00048 range; it merely creates an object to represent the number 00049 range. 00050 */ 00051 numberrange_c(toolbox_c component = toolbox_NULL_COMPONENT, 00052 toolbox_o object = toolbox_NULL_OBJECT); 00053 00054 /* 00055 Parameters : void 00056 Returns : toolbox_c - The component ID. 00057 Description : Get the component ID of the numerical component. 00058 */ 00059 toolbox_c get_numerical_component() const; 00060 00061 /* 00062 Parameters : void 00063 Returns : toolbox_c - The component ID. 00064 Description : Get the component ID of the left adjuster component. 00065 */ 00066 toolbox_c get_left_adjuster_component() const; 00067 00068 /* 00069 Parameters : void 00070 Returns : toolbox_c - The component ID. 00071 Description : Get the component ID of the right adjuster component. 00072 */ 00073 toolbox_c get_right_adjuster_component() const; 00074 00075 /* 00076 Parameters : void 00077 Returns : toolbox_c - The component ID. 00078 Description : Get the component ID of the slider component. 00079 */ 00080 toolbox_c get_slider_component() const; 00081 00082 /* 00083 Parameters : value - The number to set. 00084 Returns : numberrange_c - This object. 00085 Description : Set the value of this gadget. To reduce flicker the value 00086 is not updated unless it has changed. 00087 */ 00088 numberrange_c &operator=(int value); 00089 00090 protected: 00091 00092 /* 00093 Parameters : value - The number to set. 00094 Returns : void 00095 Description : Gadget specific function to set the value. 00096 */ 00097 virtual void _set_value(int value); 00098 00099 /* 00100 Parameters : void 00101 Returns : int - The value 00102 Description : Gadget specific function to get the value. 00103 */ 00104 virtual int _get_value() const; 00105 00106 /* 00107 Parameters : lower - The lower bound. 00108 Returns : void 00109 Description : Gadget specific function to set the lower bound. 00110 */ 00111 virtual void _set_lower_bound(int lower); 00112 00113 /* 00114 Parameters : void 00115 Returns : int - The lower bound. 00116 Description : Gadget specific function to get the lower bound. 00117 */ 00118 virtual int _get_lower_bound() const; 00119 00120 /* 00121 Parameters : upper - The upper bound. 00122 Returns : void 00123 Description : Gadget specific function to set the upper bound. 00124 */ 00125 virtual void _set_upper_bound(int upper); 00126 00127 /* 00128 Parameters : void 00129 Returns : int - The upper bound. 00130 Description : Gadget specific function to get the upper bound. 00131 */ 00132 virtual int _get_upper_bound() const; 00133 00134 /* 00135 Parameters : step - The step size. 00136 Returns : void 00137 Description : Gadget specific function to set the step size. 00138 */ 00139 virtual void _set_step_size(int step); 00140 00141 /* 00142 Parameters : void 00143 Returns : int - The step size. 00144 Description : Gadget specific function to get the step size. 00145 */ 00146 virtual int _get_step_size() const; 00147 00148 /* 00149 Parameters : precision - The precision. 00150 Returns : void 00151 Description : Set the precision. 00152 */ 00153 virtual void _set_precision(int precision); 00154 00155 /* 00156 Parameters : void 00157 Returns : int - The precision. 00158 Description : Get the precision. 00159 */ 00160 virtual int _get_precision() const; 00161 }; 00162 00163 /* 00164 Parameters : component - The component ID of this number range. 00165 object - The object ID of this number range's parent 00166 window. 00167 Returns : - 00168 Description : Constructor function. This does not create a number 00169 range; it merely creates an object to represent the number 00170 range. 00171 */ 00172 inline numberrange_c::numberrange_c(toolbox_c component, toolbox_o object) 00173 : gadget_c(component, object) {} 00174 00175 /* 00176 Parameters : void 00177 Returns : toolbox_c - The component ID. 00178 Description : Get the component ID of the numerical component. 00179 */ 00180 inline toolbox_c numberrange_c::get_numerical_component() const 00181 { 00182 toolbox_c numerical; 00183 numberrange_get_components(numberrange_GET_NUMERICAL_FIELD, 00184 object, component, 00185 &numerical, NULL, NULL, NULL); 00186 return numerical; 00187 } 00188 00189 /* 00190 Parameters : void 00191 Returns : toolbox_c - The component ID. 00192 Description : Get the component ID of the left adjuster component. 00193 */ 00194 inline toolbox_c numberrange_c::get_left_adjuster_component() const 00195 { 00196 toolbox_c left_adjuster; 00197 numberrange_get_components(numberrange_GET_LEFT_ADJUSTER, object, component, 00198 NULL, &left_adjuster, NULL, NULL); 00199 return left_adjuster; 00200 } 00201 00202 /* 00203 Parameters : void 00204 Returns : toolbox_c - The component ID. 00205 Description : Get the component ID of the right adjuster component. 00206 */ 00207 inline toolbox_c numberrange_c::get_right_adjuster_component() const 00208 { 00209 toolbox_c right_adjuster; 00210 numberrange_get_components(numberrange_GET_RIGHT_ADJUSTER, 00211 object, component, 00212 NULL, NULL, &right_adjuster, NULL); 00213 return right_adjuster; 00214 } 00215 00216 /* 00217 Parameters : void 00218 Returns : toolbox_c - The component ID. 00219 Description : Get the component ID of the slider component. 00220 */ 00221 inline toolbox_c numberrange_c::get_slider_component() const 00222 { 00223 toolbox_c slider; 00224 numberrange_get_components(numberrange_GET_SLIDER, object, component, 00225 NULL, NULL, NULL, &slider); 00226 return slider; 00227 } 00228 00229 #endif
1.3.3