Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

slider_b.h

Go to the documentation of this file.
00001 /*
00002     File        : slider_b.h
00003     Date        : 19-Sep-02
00004     Description : Base class to represent a slider 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 slider_b_h
00025 #define slider_b_h
00026 
00027 // Include oslib header files
00028 #include "oslib/slider.h"
00029 
00030 // Include alexlib header files
00031 #ifndef gadget_b_h
00032 #include "gadget_b.h"
00033 #endif
00034 #ifndef gadget_w_slider_h
00035 #include "gadget_w_slider.h"
00036 #endif
00037 
00038 // A base class to represent a slider gadget
00039 class slider_b : public virtual gadget_b,
00040                  public gadget_w_slider
00041 {
00042 public:
00043 
00044     /*
00045         Parameters  : generate  - The generate event status.
00046         Returns     : void
00047         Description : Set the Slider_ValueChanged event status.
00048     */
00049     void set_generate_value_changed(bool generate = TRUE);
00050 
00051     /*
00052         Parameters  : void
00053         Returns     : bool  - The generate event status.
00054         Description : Get the Slider_ValueChanged event status.
00055     */
00056     bool get_generate_value_changed() const;
00057 
00058     /*
00059         Parameters  : generate  - The generate event status.
00060         Returns     : void
00061         Description : Set the Slider_ValueChanged event while dragging status.
00062     */
00063     void set_generate_value_changed_by_dragging(bool generate = TRUE);
00064 
00065     /*
00066         Parameters  : void
00067         Returns     : bool  - The generate event status.
00068         Description : Get the Slider_ValueChanged event while dragging status.
00069     */
00070     bool get_generate_value_changed_by_dragging() const;
00071 
00072     /*
00073         Parameters  : vertical  - The vertical status.
00074         Returns     : void
00075         Description : Set the vertical/horizontal status for this slider.
00076     */
00077     void set_vertical(bool vertical = TRUE);
00078 
00079     /*
00080         Parameters  : void
00081         Returns     : bool  - The vertical status.
00082         Description : Get the vertical/horizontal status for this slider.
00083     */
00084     bool get_vertical() const;
00085 
00086     /*
00087         Parameters  : draggable - The draggable status.
00088         Returns     : void
00089         Description : Set the draggable status for this slider.
00090     */
00091     void set_draggable(bool draggable = TRUE);
00092 
00093     /*
00094         Parameters  : void
00095         Returns     : bool  - The draggable status.
00096         Description : Get the draggable status for this slider.
00097     */
00098     bool get_draggable() const;
00099 
00100     /*
00101         Parameters  : value     - The number to set.
00102         Returns     : slider_b  - This object.
00103         Description : Set the value of this gadget. To reduce flicker the value
00104                       is not updated unless it has changed.
00105     */
00106     slider_b &operator=(int value);
00107 
00108 protected:
00109 
00110     /*
00111         Parameters  : colour    - The slider colour.
00112         Returns     : void
00113         Description : Gadget specific function to set the colour of the slider.
00114     */
00115     virtual void _set_slider_colour(wimp_colour colour);
00116 
00117     /*
00118         Parameters  : void
00119         Returns     : wimp_colour   - The slider colour.
00120         Description : Gadget specific function to get the colour of the slider.
00121     */
00122     virtual wimp_colour _get_slider_colour() const;
00123 
00124     /*
00125         Parameters  : colour    - The well colour.
00126         Returns     : void
00127         Description : Gadget specific function to set the colour of the well.
00128     */
00129     virtual void _set_well_colour(wimp_colour colour);
00130 
00131     /*
00132         Parameters  : void
00133         Returns     : wimp_colour   - The well colour.
00134         Description : Gadget specific function to get the colour of the well.
00135     */
00136     virtual wimp_colour _get_well_colour() const;
00137 };
00138 
00139 /*
00140     Parameters  : generate  - The generate event status.
00141     Returns     : void
00142     Description : Set the Slider_ValueChanged event status.
00143 */
00144 inline void slider_b::set_generate_value_changed(bool generate)
00145 {
00146     gadget_flags flags = _get_flags();
00147     _set_flags(generate
00148                ? flags | slider_GENERATE_VALUE_CHANGED
00149                : flags & ~slider_GENERATE_VALUE_CHANGED);
00150 }
00151 
00152 /*
00153     Parameters  : void
00154     Returns     : bool  - The generate event status.
00155     Description : Get the Slider_ValueChanged event status.
00156 */
00157 inline bool slider_b::get_generate_value_changed() const
00158 {
00159     return BOOL(_get_flags() & slider_GENERATE_VALUE_CHANGED);
00160 }
00161 
00162 /*
00163     Parameters  : generate  - The generate event status.
00164     Returns     : void
00165     Description : Set the Slider_ValueChanged event while dragging status.
00166 */
00167 inline void slider_b::set_generate_value_changed_by_dragging(bool generate)
00168 {
00169     gadget_flags flags = _get_flags();
00170     _set_flags(generate
00171                ? flags | slider_GENERATE_VALUE_CHANGED_BY_DRAGGING
00172                : flags & ~slider_GENERATE_VALUE_CHANGED_BY_DRAGGING);
00173 }
00174 
00175 /*
00176     Parameters  : void
00177     Returns     : bool  - The generate event status.
00178     Description : Get the Slider_ValueChanged event while dragging status.
00179 */
00180 inline bool slider_b::get_generate_value_changed_by_dragging() const
00181 {
00182     return BOOL(_get_flags() & slider_GENERATE_VALUE_CHANGED_BY_DRAGGING);
00183 }
00184 
00185 /*
00186     Parameters  : vertical  - The vertical status.
00187     Returns     : void
00188     Description : Set the vertical/horizontal status for this slider.
00189 */
00190 inline void slider_b::set_vertical(bool vertical)
00191 {
00192     gadget_flags flags = _get_flags();
00193     _set_flags(vertical
00194                ? flags | slider_VERTICAL
00195                : flags & ~slider_VERTICAL);
00196 }
00197 
00198 /*
00199     Parameters  : void
00200     Returns     : bool  - The vertical status.
00201     Description : Get the vertical/horizontal status for this slider.
00202 */
00203 inline bool slider_b::get_vertical() const
00204 {
00205     return BOOL(_get_flags() & slider_VERTICAL);
00206 }
00207 
00208 /*
00209     Parameters  : draggable - The draggable status.
00210     Returns     : void
00211     Description : Set the draggable status for this slider.
00212 */
00213 inline void slider_b::set_draggable(bool draggable)
00214 {
00215     gadget_flags flags = _get_flags();
00216     _set_flags(draggable
00217                ? flags | slider_DRAGGABLE
00218                : flags & ~slider_DRAGGABLE);
00219 }
00220 
00221 /*
00222     Parameters  : void
00223     Returns     : bool  - The draggable status.
00224     Description : Get the draggable status for this slider.
00225 */
00226 inline bool slider_b::get_draggable() const
00227 {
00228     return BOOL(_get_flags() & slider_DRAGGABLE);
00229 }
00230 
00231 #endif

Generated on Sun Jan 26 10:18:44 2025 for NBLib by doxygen 1.3.3