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

radiobutton_c.h

Go to the documentation of this file.
00001 /*
00002     File        : radiobutton_c.h
00003     Date        : 19-Sep-02
00004     Description : Class to represent a radio 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 radiobutton_c_h
00025 #define radiobutton_c_h
00026 
00027 // Include alexlib header files
00028 #ifndef gadget_c_h
00029 #include "gadget_c.h"
00030 #endif
00031 #ifndef radiobutton_b_h
00032 #include "radiobutton_b.h"
00033 #endif
00034 
00035 // A class to represent a radio button gadget
00036 class radiobutton_c : public virtual gadget_b,
00037                       public gadget_c,
00038                       public radiobutton_b
00039 {
00040 public:
00041 
00042     /*
00043         Parameters  : component - The component ID of this option button.
00044                       object    - The object ID of this radio button's parent
00045                                   window.
00046         Returns     : -
00047         Description : Constructor function. This does not create a radio
00048                       button; it merely creates an object to represent the
00049                       radio button.
00050     */
00051     radiobutton_c(toolbox_c component = toolbox_NULL_COMPONENT,
00052                   toolbox_o object = toolbox_NULL_OBJECT);
00053 
00054     /*
00055         Parameters  : void
00056         Returns     : toolbox_c - The component ID.
00057         Description : Get the component ID of the radio button which is on in
00058                       the group.
00059     */
00060     toolbox_c get_on() const;
00061 
00062     /*
00063         Parameters  : value         - The value to set.
00064         Returns     : radiobutton_c - This object.
00065         Description : Set the value of this gadget. To reduce flicker the value
00066                       is not updated unless it has changed.
00067     */
00068     radiobutton_c &operator=(bool value);
00069 
00070 protected:
00071 
00072     /*
00073         Parameters  : value - The value to set.
00074         Returns     : void
00075         Description : Gadget specific function to set the value.
00076     */
00077     virtual void _set_value(bool value);
00078 
00079     /*
00080         Parameters  : void
00081         Returns     : bool  - The value
00082         Description : Gadget specific function to get the value.
00083     */
00084     virtual bool _get_value() const;
00085 
00086     /*
00087         Parameters  : event      - The toolbox event code.
00088         Returns     : void
00089         Description : Gadget specific function to set the toolbox event code
00090                       which will be raised for this gadget.
00091     */
00092     virtual void _set_event(bits event);
00093 
00094     /*
00095         Parameters  : void
00096         Returns     : bits  - The toolbox event code.
00097         Description : Gadget specific function to get the toolbox event code
00098                       which will be raised for this gadget.
00099     */
00100     virtual bits _get_event() const;
00101 
00102     /*
00103         Parameters  : text  - The text string to set.
00104         Returns     : void
00105         Description : Gadget specific function to set the text.
00106     */
00107     virtual void _set_text(const char *text);
00108 
00109     /*
00110         Parameters  : text      - Pointer to buffer to hold the text, 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 text or the buffer
00116                       size required.
00117     */
00118     virtual size_t _get_text(char *text, size_t size) const;
00119 };
00120 
00121 /*
00122     Parameters  : component - The component ID of this radio button.
00123                   object    - The object ID of this radio button's parent
00124                               window.
00125     Returns     : -
00126     Description : Constructor function. This does not create a radio
00127                   button; it merely creates an object to represent the
00128                   radio button.
00129 */
00130 inline radiobutton_c::radiobutton_c(toolbox_c component, toolbox_o object)
00131 : gadget_c(component, object) {}
00132 
00133 /*
00134     Parameters  : void
00135     Returns     : toolbox_c - The component ID.
00136     Description : Get the component ID of the radio button which is on in
00137                   the group.
00138 */
00139 inline toolbox_c radiobutton_c::get_on() const
00140 {
00141     toolbox_c on;
00142     radiobutton_get_state(0, object, component, &on);
00143     return on;
00144 }
00145 
00146 #endif

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