00001 /* 00002 File : radiobutton_b.h 00003 Date : 19-Sep-02 00004 Description : Base 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_b_h 00025 #define radiobutton_b_h 00026 00027 // Include oslib header files 00028 #include "oslib/radiobutton.h" 00029 00030 // Include alexlib header files 00031 #ifndef gadget_b_h 00032 #include "gadget_b.h" 00033 #endif 00034 #ifndef gadget_w_boolean_h 00035 #include "gadget_w_boolean.h" 00036 #endif 00037 #ifndef gadget_w_event_h 00038 #include "gadget_w_event.h" 00039 #endif 00040 #ifndef gadget_w_text_h 00041 #include "gadget_w_text.h" 00042 #endif 00043 00044 // A base class to represent a radio button gadget 00045 class radiobutton_b : public virtual gadget_b, 00046 public gadget_w_boolean, 00047 public gadget_w_event, 00048 public gadget_w_text 00049 { 00050 public: 00051 00052 /* 00053 Parameters : generate - The generate event status. 00054 Returns : void 00055 Description : Set the RadioButton_StateChanged event status. 00056 */ 00057 void set_generate_state_changed(bool generate = TRUE); 00058 00059 /* 00060 Parameters : void 00061 Returns : bool - The generate event status. 00062 Description : Get the RadioButton_StateChanged event status. 00063 */ 00064 bool get_generate_state_changed() const; 00065 00066 /* 00067 Parameters : value - The value to set. 00068 Returns : radiobutton_b - 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 radiobutton_b &operator=(bool value); 00073 }; 00074 00075 /* 00076 Parameters : generate - The generate event status. 00077 Returns : void 00078 Description : Set the OptionButton_StateChanged event status. 00079 */ 00080 inline void radiobutton_b::set_generate_state_changed(bool generate) 00081 { 00082 gadget_flags flags = _get_flags(); 00083 _set_flags(generate 00084 ? flags | radiobutton_GENERATE_STATE_CHANGED 00085 : flags & ~radiobutton_GENERATE_STATE_CHANGED); 00086 } 00087 00088 /* 00089 Parameters : void 00090 Returns : bool - The generate event status. 00091 Description : Get the OptionButton_StateChanged event status. 00092 */ 00093 inline bool radiobutton_b::get_generate_state_changed() const 00094 { 00095 return BOOL(_get_flags() & radiobutton_GENERATE_STATE_CHANGED); 00096 } 00097 00098 #endif
1.3.3