CEGUIRadioButton.h

00001 /************************************************************************
00002         filename:       CEGUIRadioButton.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for RadioButton widget
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIRadioButton_h_
00027 #define _CEGUIRadioButton_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "elements/CEGUIButtonBase.h"
00031 #include "elements/CEGUIRadioButtonProperties.h"
00032 
00033 
00034 #if defined(_MSC_VER)
00035 #       pragma warning(push)
00036 #       pragma warning(disable : 4251)
00037 #endif
00038 
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00048 class CEGUIEXPORT RadioButton : public ButtonBase
00049 {
00050 public:
00051         static const String EventNamespace;                             
00052 
00053 
00054         /*************************************************************************
00055                 Event name constants
00056         *************************************************************************/
00057         // generated internally by Window
00058         static const String EventSelectStateChanged;                    
00059 
00060 
00061         /*************************************************************************
00062                 Accessor Functions
00063         *************************************************************************/ 
00071         bool    isSelected(void) const                          {return d_selected;}
00072 
00073         
00081         ulong   getGroupID(void) const                          {return d_groupID;}
00082 
00083 
00094         RadioButton*    getSelectedButtonInGroup(void) const;
00095 
00096 
00097         /*************************************************************************
00098                 Manipulator Functions
00099         *************************************************************************/
00112         void    setSelected(bool select);
00113 
00114         
00125         void    setGroupID(ulong group);
00126 
00127 
00128         /*************************************************************************
00129                 Construction / Destruction
00130         *************************************************************************/
00131         RadioButton(const String& type, const String& name);
00132         virtual ~RadioButton(void);
00133 
00134 
00135 protected:
00136         /*************************************************************************
00137                 Implementation Functions
00138         *************************************************************************/
00143         void    addRadioButtonEvents(void);
00144 
00145 
00151         void    deselectOtherButtonsInGroup(void) const;
00152 
00153 
00164         virtual bool    testClassName_impl(const String& class_name) const
00165         {
00166                 if (class_name==(const utf8*)"RadioButton")     return true;
00167                 return ButtonBase::testClassName_impl(class_name);
00168         }
00169 
00170 
00171         /*************************************************************************
00172                 New Radio Button Events
00173         *************************************************************************/
00178         virtual void    onSelectStateChanged(WindowEventArgs& e);
00179 
00180 
00181         /*************************************************************************
00182                 Overridden Event handlers
00183         *************************************************************************/
00184         virtual void    onMouseButtonUp(MouseEventArgs& e);
00185 
00186 
00187         /*************************************************************************
00188                 Implementation Data
00189         *************************************************************************/
00190         bool            d_selected;                             // true when radio button is selected (has checkmark)
00191         ulong           d_groupID;                              // radio button group ID
00192 
00193 
00194 private:
00195         /*************************************************************************
00196                 Static Properties for this class
00197         *************************************************************************/
00198         static RadioButtonProperties::Selected  d_selectedProperty;
00199         static RadioButtonProperties::GroupID   d_groupIDProperty;
00200 
00201 
00202         /*************************************************************************
00203                 Private methods
00204         *************************************************************************/
00205         void    addRadioButtonProperties(void);
00206 };
00207 
00208 
00209 } // End of  CEGUI namespace section
00210 
00211 #if defined(_MSC_VER)
00212 #       pragma warning(pop)
00213 #endif
00214 
00215 #endif  // end of guard _CEGUIRadioButton_h_

Generated on Sat Nov 26 09:34:49 2005 for Crazy Eddies GUI System by  doxygen 1.4.5