/***************************************************************************
                          SIMPLY POWERFUL TOOLKIT (SPTK)
                          CRadioButtons.h  -  description
                             -------------------
    begin                : Thi Dec 12 2002
    copyright            : (C) 2000-2005 by Alexey S.Parshin
    email                : alexeyp@gmail.com
 ***************************************************************************/

/***************************************************************************
   This library is free software; you can redistribute it and/or modify it 
   under the terms of the GNU Library General Public License as published by
   the Free Software Foundation; either version 2 of the License, or (at 
   your option) any later version.

   This library is distributed in the hope that it will be useful, but 
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
   General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; if not, write to the Free Software Foundation, 
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

   Please report all bugs and problems to "alexeyp@gmail.com"
 ***************************************************************************/

#ifndef __CRadioButtons_H__
#define __CRadioButtons_H__

#include <sptk3/sptk.h>
#include <sptk3/CButtonGroup.h>
#include <string>

/// @addtogroup gui GUI Classes
/// @{

/// @brief Radio buttons widget.
///
/// A group of radio buttons with an optional
/// edit entry for the 'Other' choice.
class SP_EXPORT CRadioButtons : public CButtonGroup {
   /// Internal callback function
   static void radioButtonsCallback(Fl_Widget *,void *);
protected:
   /// Creates a radio button and adds it to the group
   virtual Fl_Button *createButton(const char *label,int sz=10,CLayoutAlign layoutAlignment=SP_ALIGN_TOP);
public:
   /** SPTK-style constructor
    * @param label const char *, the widget label
    * @param layoutSize int, the size of widget in layout
    * @param layoutAlignment CLayoutAlign, widget align in the layout
    */
   CRadioButtons(const char * label=0,int layoutSize=20,CLayoutAlign layoutAlignment=SP_ALIGN_TOP);
#ifdef __COMPATIBILITY_MODE__    
   /** FLTK-style constructor
    * @param x int, widget x-coordinate
    * @param y int, widget y-coordinate
    * @param w int, widget width
    * @param h int, widget height
    * @param label int, optional widget label
    */
   CRadioButtons(int,int,int,int,const char * = 0);
#endif
   /// SPTK internal control type
   virtual CControlKind kind() const { return DCV_RADIOBUTTONS; }

   /// SPTK internal class name
   virtual std::string className() const { return "CRadioButtons"; }

   /// Gets the selected button's ID
   long intValue() const;

   /// Sets the selected button by ID
   void intValue(long ID);
};

/// @}

#endif
