00001 /* 00002 File : writablefield_t.h 00003 Date : 19-Sep-02 00004 Description : Class to represent a writable field 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 writablefield_t_h 00025 #define writablefield_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 writablefield_b_h 00035 #include "writablefield_b.h" 00036 #endif 00037 00038 // A class to represent a writable field gadget template 00039 class writablefield_t : public virtual gadget_b, 00040 public gadget_t, 00041 public writablefield_b, 00042 public gadget_w_caret 00043 { 00044 public: 00045 00046 /* 00047 Parameters : void 00048 Returns : - 00049 Description : Constructor function. 00050 */ 00051 writablefield_t(); 00052 00053 /* 00054 Parameters : value - The text string to set. 00055 Returns : writablefield_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 writablefield_t &operator=(const char *value); 00060 00061 /* 00062 Parameters : value - The text string to set. 00063 Returns : writablefield_b - 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 writablefield_t &operator=(const string &value); 00068 00069 protected: 00070 00071 /* 00072 Parameters : allowed - The new set of allowable characters, or NULL 00073 to allow all characters. 00074 Returns : void 00075 Description : Gadget specific function to define the set of allowable 00076 characters. 00077 */ 00078 virtual void _set_allowable(const char *allowed); 00079 00080 /* 00081 Parameters : value - The text string to set. 00082 Returns : void 00083 Description : Gadget specific function to set the value. 00084 */ 00085 virtual void _set_value(const char *value); 00086 00087 /* 00088 Parameters : value - Pointer to buffer to hold the value, or NULL 00089 to read the size of buffer required. 00090 size - The size of the buffer. 00091 Returns : size_t - Number of bytes written to the buffer, or 00092 the buffer size required if NULL passed. 00093 Description : Gadget specific function to get the value or the buffer 00094 size required. 00095 */ 00096 virtual size_t _get_value(char *value, size_t size) const; 00097 00098 /* 00099 Parameters : component - The component ID of the previous field. 00100 Returns : void 00101 Description : Set the component ID of the writable field before this 00102 one. 00103 */ 00104 virtual void _set_before(toolbox_c component); 00105 00106 /* 00107 Parameters : void 00108 Returns : toolbox_c - The component ID of the previous field. 00109 Description : Get the component ID of the writable field before this 00110 one. 00111 */ 00112 virtual toolbox_c _get_before() const; 00113 00114 /* 00115 Parameters : component - The component ID of the next field. 00116 Returns : void 00117 Description : Set the component ID of the writable field after this 00118 one. 00119 */ 00120 virtual void _set_after(toolbox_c component); 00121 00122 /* 00123 Parameters : void 00124 Returns : toolbox_c - The component ID of the next field. 00125 Description : Get the component ID of the writable field after this 00126 one. 00127 */ 00128 virtual toolbox_c _get_after() const; 00129 }; 00130 00131 #endif
1.3.3