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

button_c.h

Go to the documentation of this file.
00001 /*
00002     File        : button_c.h
00003     Date        : 19-Sep-02
00004     Description : Class to represent a button 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 button_c_h
00025 #define button_c_h
00026 
00027 // Include alexlib header files
00028 #ifndef button_b_h
00029 #include "button_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 button gadget
00039 class button_c : public virtual gadget_b,
00040                  public gadget_c,
00041                  public button_b,
00042                  public gadget_w_font
00043 {
00044 public:
00045 
00046     /*
00047         Parameters  : component - The component ID of this button.
00048                       object    - The object ID of this button's parent
00049                                   window.
00050         Returns     : -
00051         Description : Constructor function. This does not create a button;
00052                       it merely creates an object to represent the button.
00053     */
00054     button_c(toolbox_c component = toolbox_NULL_COMPONENT,
00055              toolbox_o object = toolbox_NULL_OBJECT);
00056 
00057     /*
00058         Parameters  : value     - The text string to set.
00059         Returns     : button_c  - This object.
00060         Description : Set the value of this gadget. To reduce flicker the value
00061                       is not updated unless it has changed.
00062     */
00063     button_c &operator=(const char *value);
00064 
00065     /*
00066         Parameters  : value     - The text string to set.
00067         Returns     : button_c  - This object.
00068         Description : Set the value of this gadget. To reduce flicker the value
00069                       is not updated unless it has changed.
00070     */
00071     button_c &operator=(const string &value);
00072 
00073 protected:
00074 
00075     /*
00076         Parameters  : clear - Icon flags to clear.
00077                       eor   - Icon flags to toggle.
00078         Returns     : void
00079         Description : Representation specific function to set the icon flags
00080                       for this button.
00081     */
00082     virtual void _set_icon_flags(wimp_icon_flags clear, wimp_icon_flags eor);
00083 
00084     /*
00085         Parameters  : void
00086         Returns     : wimp_icon_flags   - The current icon flags.
00087         Description : Representation specific function to get the icon flags
00088                       for this button.
00089     */
00090     virtual wimp_icon_flags _get_icon_flags() const;
00091 
00092     /*
00093         Parameters  : validation    - The text string to set.
00094         Returns     : void
00095         Description : Representation specific function to set the validation
00096                       string.
00097     */
00098     virtual void _set_validation(const char *validation);
00099 
00100     /*
00101         Parameters  : validation    - Pointer to buffer to hold the validation
00102                                       string, or NULL to read the size of
00103                                       buffer required.
00104                       size          - The size of the buffer.
00105         Returns     : size_t        - Number of bytes written to the buffer, or
00106                                       the buffer size required if NULL passed.
00107         Description : Representation specific function to get the validation
00108                       string or the buffer size required.
00109     */
00110     virtual size_t _get_validation(char *validation, size_t size) const;
00111 
00112     /*
00113         Parameters  : value - The text string to set.
00114         Returns     : void
00115         Description : Gadget specific function to set the value.
00116     */
00117     virtual void _set_value(const char *value);
00118 
00119     /*
00120         Parameters  : value     - Pointer to buffer to hold the value, or NULL
00121                                   to read the size of buffer required.
00122                       size      - The size of the buffer.
00123         Returns     : size_t    - Number of bytes written to the buffer, or
00124                                   the buffer size required if NULL passed.
00125         Description : Gadget specific function to get the value or the buffer
00126                       size required.
00127     */
00128     virtual size_t _get_value(char *value, size_t size) const;
00129 
00130     /*
00131         Parameters  : font  - The name of the font to use, or NULL to use the
00132                               system font.
00133                       xsize - The width in 16ths of a point.
00134                       ysize - The height in 16ths of a point.
00135         Returns     : void
00136         Description : Gadget specific function to set the font.
00137     */
00138     virtual void _set_font(const char *font, int xsize, int ysize);
00139 };
00140 
00141 /*
00142     Parameters  : component - The component ID of this button.
00143                   object    - The object ID of this button's parent
00144                               window.
00145     Returns     : -
00146     Description : Constructor function. This does not create a button;
00147                   it merely creates an object to represent the button.
00148 */
00149 inline button_c::button_c(toolbox_c component, toolbox_o object)
00150 : gadget_c(component, object) {}
00151 
00152 #endif

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