00001 /* 00002 File : stringset_c.h 00003 Date : 19-Sep-02 00004 Description : 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_c_h 00025 #define stringset_c_h 00026 00027 // Include alexlib header files 00028 #ifndef gadget_c_h 00029 #include "gadget_c.h" 00030 #endif 00031 #ifndef stringset_b_h 00032 #include "stringset_b.h" 00033 #endif 00034 00035 // A class to represent a string set gadget 00036 class stringset_c : public virtual gadget_b, 00037 public gadget_c, 00038 public stringset_b 00039 { 00040 public: 00041 00042 /* 00043 Parameters : component - The component ID of this string set. 00044 object - The object ID of this string set's parent 00045 window. 00046 Returns : - 00047 Description : Constructor function. This does not create a string set; 00048 it merely creates an object to represent the string set. 00049 */ 00050 stringset_c(toolbox_c component = toolbox_NULL_COMPONENT, 00051 toolbox_o object = toolbox_NULL_OBJECT); 00052 00053 /* 00054 Parameters : void 00055 Returns : toolbox_c - The component ID. 00056 Description : Get the component ID of the alphanumeric component. 00057 */ 00058 toolbox_c get_alphanumeric_component() const; 00059 00060 /* 00061 Parameters : void 00062 Returns : toolbox_c - The component ID. 00063 Description : Get the component ID of the popup component. 00064 */ 00065 toolbox_c get_popup_component() const; 00066 00067 /* 00068 Parameters : value - The number to set. 00069 Returns : stringset_c - This object. 00070 Description : Set the value of this gadget. To reduce flicker the value 00071 is not updated unless it has changed. 00072 */ 00073 stringset_c &operator=(int value); 00074 00075 /* 00076 Parameters : value - The text string to set. 00077 Returns : stringset_c - This object. 00078 Description : Set the value of this gadget. To reduce flicker the value 00079 is not updated unless it has changed. 00080 */ 00081 stringset_c &operator=(const char *value); 00082 00083 /* 00084 Parameters : value - The text string to set. 00085 Returns : stringset_c - This object. 00086 Description : Set the value of this gadget. To reduce flicker the value 00087 is not updated unless it has changed. 00088 */ 00089 stringset_c &operator=(const string &value); 00090 00091 protected: 00092 00093 /* 00094 Parameters : allowed - The new set of allowable characters, or NULL 00095 to allow all characters. 00096 Returns : void 00097 Description : Gadget specific function to define the set of allowable 00098 characters. 00099 */ 00100 virtual void _set_allowable(const char *allowed); 00101 00102 /* 00103 Parameters : value - The number to set. 00104 Returns : void 00105 Description : Gadget specific function to set the value. 00106 */ 00107 virtual void _set_value(int value); 00108 00109 /* 00110 Parameters : void 00111 Returns : int - The value 00112 Description : Gadget specific function to get the value. 00113 */ 00114 virtual int _get_value() const; 00115 00116 /* 00117 Parameters : value - The text string to set. 00118 Returns : void 00119 Description : Gadget specific function to set the value. 00120 */ 00121 virtual void _set_value(const char *value); 00122 00123 /* 00124 Parameters : value - Pointer to buffer to hold the value, or NULL 00125 to read the size of buffer required. 00126 size - The size of the buffer. 00127 Returns : size_t - Number of bytes written to the buffer, or 00128 the buffer size required if NULL passed. 00129 Description : Gadget specific function to get the value or the buffer 00130 size required. 00131 */ 00132 virtual size_t _get_value(char *value, size_t size) const; 00133 00134 /* 00135 Parameters : available - The new list of available strings. 00136 Returns : void 00137 Description : Representation specific function to define the available 00138 set of strings. 00139 */ 00140 virtual void _set_available(const char *available); 00141 }; 00142 00143 /* 00144 Parameters : component - The component ID of this string set. 00145 object - The object ID of this string set's parent 00146 window. 00147 Returns : - 00148 Description : Constructor function. This does not create a string set; 00149 it merely creates an object to represent the string set. 00150 */ 00151 inline stringset_c::stringset_c(toolbox_c component, toolbox_o object) 00152 : gadget_c(component, object) {} 00153 00154 /* 00155 Parameters : void 00156 Returns : toolbox_c - The component ID. 00157 Description : Get the component ID of the alphanumeric component. 00158 */ 00159 inline toolbox_c stringset_c::get_alphanumeric_component() const 00160 { 00161 toolbox_c alphanumeric; 00162 stringset_get_components(stringset_GET_ALPHANUMERIC_FIELD, 00163 object, component, 00164 &alphanumeric, NULL); 00165 return alphanumeric; 00166 } 00167 00168 /* 00169 Parameters : void 00170 Returns : toolbox_c - The component ID. 00171 Description : Get the component ID of the popup component. 00172 */ 00173 inline toolbox_c stringset_c::get_popup_component() const 00174 { 00175 toolbox_c popup; 00176 stringset_get_components(stringset_GET_POP_UP_MENU, object, component, 00177 NULL, &popup); 00178 return popup; 00179 } 00180 00181 #endif
1.3.3