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

stringset_b.h

Go to the documentation of this file.
00001 /*
00002     File        : stringset_b.h
00003     Date        : 19-Sep-02
00004     Description : Base class to represent a string set 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 stringset_b_h
00025 #define stringset_b_h
00026 
00027 // Include cpplib header files
00028 #include "list.h"
00029 
00030 // Include oslib header files
00031 #include "oslib/stringset.h"
00032 
00033 // Include alexlib header files
00034 #ifndef gadget_b_h
00035 #include "gadget_b.h"
00036 #endif
00037 #ifndef gadget_w_allowable_h
00038 #include "gadget_w_allowable.h"
00039 #endif
00040 #ifndef gadget_w_justification_h
00041 #include "gadget_w_justification.h"
00042 #endif
00043 #ifndef gadget_w_number_h
00044 #include "gadget_w_number.h"
00045 #endif
00046 #ifndef gadget_w_string_h
00047 #include "gadget_w_string.h"
00048 #endif
00049 
00050 // A base class to represent a string set gadget
00051 class stringset_b : public virtual gadget_b,
00052                     public gadget_w_allowable,
00053                     public gadget_w_justification,
00054                     public gadget_w_number,
00055                     public gadget_w_string
00056 {
00057 public:
00058 
00059     /*
00060         Parameters  : generate  - The generate event status.
00061         Returns     : void
00062         Description : Set the StringSet_ValueChanged event status.
00063     */
00064     void set_generate_value_changed(bool generate = TRUE);
00065 
00066     /*
00067         Parameters  : void
00068         Returns     : bool  - The generate event status.
00069         Description : Get the StringSet_ValueChanged event status.
00070     */
00071     bool get_generate_value_changed() const;
00072 
00073     /*
00074         Parameters  : generate  - The generate event status.
00075         Returns     : void
00076         Description : Set the StringSet_SetValueChanged event status.
00077     */
00078     void set_generate_set_value_changed(bool generate = TRUE);
00079 
00080     /*
00081         Parameters  : void
00082         Returns     : bool  - The generate event status.
00083         Description : Get the StringSet_SetValueChanged event status.
00084     */
00085     bool get_generate_set_value_changed() const;
00086 
00087     /*
00088         Parameters  : writable  - Is the field writable.
00089         Returns     : void
00090         Description : Set whether the numeric field is writable.
00091     */
00092     void set_writable(bool writable = TRUE);
00093 
00094     /*
00095         Parameters  : void
00096         Returns     : bool  - Is the field writable.
00097         Description : Get whether the numeric field is writable.
00098     */
00099     bool get_writable() const;
00100 
00101     /*
00102         Parameters  : generate  - The generate event status.
00103         Returns     : void
00104         Description : Set the StringSet_AboutToBeShown event status.
00105     */
00106     void set_generate_about_to_be_shown(bool generate = TRUE);
00107 
00108     /*
00109         Parameters  : void
00110         Returns     : bool  - The generate event status.
00111         Description : Get the StringSet_AboutToBeShown event status.
00112     */
00113     bool get_generate_about_to_be_shown() const;
00114 
00115     /*
00116         Parameters  : display   - Is there a display area.
00117         Returns     : void
00118         Description : Set whether there is a diplay area.
00119     */
00120     void set_has_display(bool display = TRUE);
00121 
00122     /*
00123         Parameters  : void
00124         Returns     : bool  - Is there a display area.
00125         Description : Get whether there is a diplay area.
00126     */
00127     bool get_has_display() const;
00128 
00129     /*
00130         Parameters  : available - The new list of available strings.
00131         Returns     : void
00132         Description : Define the available set of strings.
00133     */
00134     void set_available(const char *available);
00135 
00136     /*
00137         Parameters  : available - The new list of available strings.
00138         Returns     : void
00139         Description : Define the available set of strings.
00140     */
00141     void set_available(const string &available);
00142 
00143     /*
00144         Parameters  : available - The new list of available strings.
00145         Returns     : void
00146         Description : Define the available set of strings.
00147     */
00148     void set_available(const list<string> &available);
00149 
00150     /*
00151         Parameters  : value         - The number to set.
00152         Returns     : stringset_b   - This object.
00153         Description : Set the value of this gadget. To reduce flicker the value
00154                       is not updated unless it has changed.
00155     */
00156     stringset_b &operator=(int value);
00157 
00158     /*
00159         Parameters  : value         - The text string to set.
00160         Returns     : stringset_b   - This object.
00161         Description : Set the value of this gadget. To reduce flicker the value
00162                       is not updated unless it has changed.
00163     */
00164     stringset_b &operator=(const char *value);
00165 
00166     /*
00167         Parameters  : value         - The text string to set.
00168         Returns     : stringset_b   - This object.
00169         Description : Set the value of this gadget. To reduce flicker the value
00170                       is not updated unless it has changed.
00171     */
00172     stringset_b &operator=(const string &value);
00173 
00174 protected:
00175 
00176     /*
00177         Parameters  : position  - The field justification.
00178         Returns     : void
00179         Description : Gadget specific function to set the justification.
00180     */
00181     virtual void _set_justification(justification position);
00182 
00183     /*
00184         Parameters  : void
00185         Returns     : bool  - The field justification.
00186         Description : Gadget specific function to Get the justification.
00187     */
00188     virtual justification _get_justification() const;
00189 
00190     /*
00191         Parameters  : available - The new list of available strings.
00192         Returns     : void
00193         Description : Representation specific function to define the available
00194                       set of strings.
00195     */
00196     virtual void _set_available(const char *available) = 0;
00197 };
00198 
00199 /*
00200     Parameters  : generate  - The generate event status.
00201     Returns     : void
00202     Description : Set the StringSet_ValueChanged event status.
00203 */
00204 inline void stringset_b::set_generate_value_changed(bool generate)
00205 {
00206     gadget_flags flags = _get_flags();
00207     _set_flags(generate
00208                ? flags | stringset_GENERATE_USER_VALUE_CHANGED
00209                : flags & ~stringset_GENERATE_USER_VALUE_CHANGED);
00210 }
00211 
00212 /*
00213     Parameters  : void
00214     Returns     : bool  - The generate event status.
00215     Description : Get the StringSet_ValueChanged event status.
00216 */
00217 inline bool stringset_b::get_generate_value_changed() const
00218 {
00219     return BOOL(_get_flags() & stringset_GENERATE_USER_VALUE_CHANGED);
00220 }
00221 
00222 /*
00223     Parameters  : generate  - The generate event status.
00224     Returns     : void
00225     Description : Set the StringSet_SetValueChanged event status.
00226 */
00227 inline void stringset_b::set_generate_set_value_changed(bool generate)
00228 {
00229     gadget_flags flags = _get_flags();
00230     _set_flags(generate
00231                ? flags | stringset_GENERATE_SET_VALUE_CHANGED
00232                : flags & ~stringset_GENERATE_SET_VALUE_CHANGED);
00233 }
00234 
00235 /*
00236     Parameters  : void
00237     Returns     : bool  - The generate event status.
00238     Description : Get the StringSet_SetValueChanged event status.
00239 */
00240 inline bool stringset_b::get_generate_set_value_changed() const
00241 {
00242     return BOOL(_get_flags() & stringset_GENERATE_SET_VALUE_CHANGED);
00243 }
00244 
00245 /*
00246     Parameters  : writable  - Is the field writable.
00247     Returns     : void
00248     Description : Set whether the numeric field is writable.
00249 */
00250 inline void stringset_b::set_writable(bool writable)
00251 {
00252     gadget_flags flags = _get_flags();
00253     _set_flags(writable
00254                ? flags | stringset_WRITABLE
00255                : flags & ~stringset_WRITABLE);
00256 }
00257 
00258 /*
00259     Parameters  : void
00260     Returns     : bool  - Is the field writable.
00261     Description : Get whether the numeric field is writable.
00262 */
00263 inline bool stringset_b::get_writable() const
00264 {
00265     return BOOL(_get_flags() & stringset_WRITABLE);
00266 }
00267 
00268 /*
00269     Parameters  : generate  - The generate event status.
00270     Returns     : void
00271     Description : Set the StringSet_AboutToBeShown event status.
00272 */
00273 inline void stringset_b::set_generate_about_to_be_shown(bool generate)
00274 {
00275     gadget_flags flags = _get_flags();
00276     _set_flags(generate
00277                ? flags | stringset_GENERATE_ABOUT_TO_BE_SHOWN
00278                : flags & ~stringset_GENERATE_ABOUT_TO_BE_SHOWN);
00279 }
00280 
00281 /*
00282     Parameters  : void
00283     Returns     : bool  - The generate event status.
00284     Description : Get the StringSet_AboutToBeShown event status.
00285 */
00286 inline bool stringset_b::get_generate_about_to_be_shown() const
00287 {
00288     return BOOL(_get_flags() & stringset_GENERATE_ABOUT_TO_BE_SHOWN);
00289 }
00290 
00291 /*
00292     Parameters  : display   - Is there a display area.
00293     Returns     : void
00294     Description : Set whether there is a diplay area.
00295 */
00296 inline void stringset_b::set_has_display(bool display)
00297 {
00298     gadget_flags flags = _get_flags();
00299     _set_flags(display
00300                ? flags & ~stringset_NO_DISPLAY
00301                : flags | stringset_NO_DISPLAY);
00302 }
00303 
00304 /*
00305     Parameters  : void
00306     Returns     : bool  - Is there a display area.
00307     Description : Get whether there is a diplay area.
00308 */
00309 inline bool stringset_b::get_has_display() const
00310 {
00311     return BOOL(!(_get_flags() & stringset_NO_DISPLAY));
00312 }
00313 
00314 /*
00315     Parameters  : available - The new list of available strings.
00316     Returns     : void
00317     Description : Define the available set of strings.
00318 */
00319 inline void stringset_b::set_available(const char *available)
00320 {
00321     _set_available(available);
00322 }
00323 
00324 /*
00325     Parameters  : available - The new list of available strings.
00326     Returns     : void
00327     Description : Define the available set of strings.
00328 */
00329 inline void stringset_b::set_available(const string &available)
00330 {
00331     _set_available(available.c_str());
00332 }
00333 
00334 #endif

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