00001 /* 00002 File : stringset_t.h 00003 Date : 19-Sep-02 00004 Description : Class to represent a string set toolbox gadget template. 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_t_h 00025 #define stringset_t_h 00026 00027 // Include alexlib header files 00028 #ifndef gadget_t_h 00029 #include "gadget_t.h" 00030 #endif 00031 #ifndef gadget_w_caret_h 00032 #include "gadget_w_caret.h" 00033 #endif 00034 #ifndef stringset_b_h 00035 #include "stringset_b.h" 00036 #endif 00037 00038 // A class to represent a string set gadget template 00039 class stringset_t : public virtual gadget_b, 00040 public gadget_t, 00041 public stringset_b, 00042 public gadget_w_caret 00043 { 00044 public: 00045 00046 /* 00047 Parameters : void 00048 Returns : - 00049 Description : Constructor function. 00050 */ 00051 stringset_t(); 00052 00053 /* 00054 Parameters : value - The number to set. 00055 Returns : stringset_t - This object. 00056 Description : Set the value of this gadget. To reduce flicker the value 00057 is not updated unless it has changed. 00058 */ 00059 stringset_t &operator=(int value); 00060 00061 /* 00062 Parameters : value - The text string to set. 00063 Returns : stringset_t - This object. 00064 Description : Set the value of this gadget. To reduce flicker the value 00065 is not updated unless it has changed. 00066 */ 00067 stringset_t &operator=(const char *value); 00068 00069 /* 00070 Parameters : value - The text string to set. 00071 Returns : stringset_t - This object. 00072 Description : Set the value of this gadget. To reduce flicker the value 00073 is not updated unless it has changed. 00074 */ 00075 stringset_t &operator=(const string &value); 00076 00077 protected: 00078 00079 /* 00080 Parameters : allowed - The new set of allowable characters, or NULL 00081 to allow all characters. 00082 Returns : void 00083 Description : Gadget specific function to define the set of allowable 00084 characters. 00085 */ 00086 virtual void _set_allowable(const char *allowed); 00087 00088 /* 00089 Parameters : value - The number to set. 00090 Returns : void 00091 Description : Gadget specific function to set the value. 00092 */ 00093 virtual void _set_value(int value); 00094 00095 /* 00096 Parameters : void 00097 Returns : int - The value 00098 Description : Gadget specific function to get the value. 00099 */ 00100 virtual int _get_value() const; 00101 00102 /* 00103 Parameters : value - The text string to set. 00104 Returns : void 00105 Description : Gadget specific function to set the value. 00106 */ 00107 virtual void _set_value(const char *value); 00108 00109 /* 00110 Parameters : value - Pointer to buffer to hold the value, or NULL 00111 to read the size of buffer required. 00112 size - The size of the buffer. 00113 Returns : size_t - Number of bytes written to the buffer, or 00114 the buffer size required if NULL passed. 00115 Description : Gadget specific function to get the value or the buffer 00116 size required. 00117 */ 00118 virtual size_t _get_value(char *value, size_t size) const; 00119 00120 /* 00121 Parameters : available - The new list of available strings. 00122 Returns : void 00123 Description : Representation specific function to define the available 00124 set of strings. 00125 */ 00126 virtual void _set_available(const char *available); 00127 00128 /* 00129 Parameters : component - The component ID of the previous field. 00130 Returns : void 00131 Description : Set the component ID of the writable field before this 00132 one. 00133 */ 00134 virtual void _set_before(toolbox_c component); 00135 00136 /* 00137 Parameters : void 00138 Returns : toolbox_c - The component ID of the previous field. 00139 Description : Get the component ID of the writable field before this 00140 one. 00141 */ 00142 virtual toolbox_c _get_before() const; 00143 00144 /* 00145 Parameters : component - The component ID of the next field. 00146 Returns : void 00147 Description : Set the component ID of the writable field after this 00148 one. 00149 */ 00150 virtual void _set_after(toolbox_c component); 00151 00152 /* 00153 Parameters : void 00154 Returns : toolbox_c - The component ID of the next field. 00155 Description : Get the component ID of the writable field after this 00156 one. 00157 */ 00158 virtual toolbox_c _get_after() const; 00159 }; 00160 00161 #endif
1.3.3