00001 /* 00002 File : displayfield_c.h 00003 Date : 19-Sep-02 00004 Description : Class to represent a display field 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 displayfield_c_h 00025 #define displayfield_c_h 00026 00027 // Include alexlib header files 00028 #ifndef displayfield_b_h 00029 #include "displayfield_b.h" 00030 #endif 00031 #ifndef gadget_c_h 00032 #include "gadget_c.h" 00033 #endif 00034 #ifndef gadget_w_font_h 00035 #include "gadget_w_font.h" 00036 #endif 00037 00038 // A class to represent a display field gadget 00039 class displayfield_c : public virtual gadget_b, 00040 public gadget_c, 00041 public displayfield_b, 00042 public gadget_w_font 00043 { 00044 public: 00045 00046 /* 00047 Parameters : component - The component ID of this display field. 00048 object - The object ID of this display field's parent 00049 window. 00050 Returns : - 00051 Description : Constructor function. This does not create a 00052 display field; it merely creates an object to represent 00053 the display field. 00054 */ 00055 displayfield_c(toolbox_c component = toolbox_NULL_COMPONENT, 00056 toolbox_o object = toolbox_NULL_OBJECT); 00057 00058 /* 00059 Parameters : value - The text string to set. 00060 Returns : displayfield_c - This object. 00061 Description : Set the value of this gadget. To reduce flicker the value 00062 is not updated unless it has changed. 00063 */ 00064 displayfield_c &operator=(const char *value); 00065 00066 /* 00067 Parameters : value - The text string to set. 00068 Returns : displayfield_c - This object. 00069 Description : Set the value of this gadget. To reduce flicker the value 00070 is not updated unless it has changed. 00071 */ 00072 displayfield_c &operator=(const string &value); 00073 00074 protected: 00075 00076 /* 00077 Parameters : value - The text string to set. 00078 Returns : void 00079 Description : Gadget specific function to set the value. 00080 */ 00081 virtual void _set_value(const char *value); 00082 00083 /* 00084 Parameters : value - Pointer to buffer to hold the value, or NULL 00085 to read the size of buffer required. 00086 size - The size of the buffer. 00087 Returns : size_t - Number of bytes written to the buffer, or 00088 the buffer size required if NULL passed. 00089 Description : Gadget specific function to get the value or the buffer 00090 size required. 00091 */ 00092 virtual size_t _get_value(char *value, size_t size) const; 00093 00094 /* 00095 Parameters : font - The name of the font to use, or NULL to use the 00096 system font. 00097 xsize - The width in 16ths of a point. 00098 ysize - The height in 16ths of a point. 00099 Returns : void 00100 Description : Gadget specific function to set the font. 00101 */ 00102 virtual void _set_font(const char *font, int xsize, int ysize); 00103 }; 00104 00105 /* 00106 Parameters : component - The component ID of this display field. 00107 object - The object ID of this display field's parent 00108 window. 00109 Returns : - 00110 Description : Constructor function. This does not create a 00111 display field; it merely creates an object to represent 00112 the display field. 00113 */ 00114 inline displayfield_c::displayfield_c(toolbox_c component, toolbox_o object) 00115 : gadget_c(component, object) {} 00116 00117 #endif
1.3.3