Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

sdlradiobutton.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: pipelka $
00023     Update Date:      $Date: 2001/01/31 17:23:16 $
00024     Source File:      $Source: /usr/local/CVSROOT/linux/paragui/doc/html/sdlradiobutton_h-source.html,v $
00025     CVS/RCS Revision: $Revision: 1.34 $
00026     Status:           $State: Exp $
00027 */
00028 
00029 #ifndef SDLRADIOBUTTON_H
00030 #define SDLRADIOBUTTON_H
00031 
00032 #ifdef SWIG
00033 %include "swigcommon.h"
00034 %module sdlradiobutton
00035 %{
00036 #include "sdlradiobutton.h"
00037 %}
00038 #endif
00039 
00040 #include "sdlgradientwidget.h"
00041 #include "sdlbutton.h"
00042 #include "sdllabel.h"
00043 
00052 /* Perhaps radio buttons should have a special SDLRadioButtonGroup parent class
00053  * to make things more clear and eliminate all the group stuff within the radio
00054  * button itself?
00055  *
00056  * NO :)
00057  * I think this kind of implementation is simple and easy to understand. 
00058  */
00059 class DECLSPEC SDLRadioButton : public SDLGradientWidget  {
00060 public:
00061 
00063     SDLRadioButton(SDLWidget* parent, int id, SDL_Rect& r, char* text, SDLRadioButton* firstOfGroup = NULL);
00064 
00066     ~SDLRadioButton();
00067 
00068     void LoadThemeStyle(const char* widgettype);
00069 
00071     bool GetPressed();
00072 
00074     void SetPressed();
00075 
00076 #ifndef SWIG
00077 
00078     void SetTextFormat(char* text, ...);
00079 #endif
00080 
00082     void SetText(char* text);
00083 
00085     char* GetText();
00086 
00087 protected:
00088 
00090     void AddToGroup(SDLRadioButton* w);
00091 
00093     void ReleaseButton();
00094 
00096     void eventMouseEnter();
00097 
00099     void eventMouseLeave();
00100 
00102     bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00103 
00105     bool eventButtonClick(int id, SDLWidget* widget);
00106 
00107     SDLRadioButton* my_groupFirst;
00108     SDLRadioButton* my_groupNext;
00109 
00110     SDLButton* my_widgetButton;
00111     SDLLabel* my_widgetLabel;
00112     bool my_isPressed;
00113 
00114 private:
00115     SDLRadioButton(const SDLRadioButton&);
00116     SDLRadioButton& operator=(const SDLRadioButton&);
00117 
00118     bool my_storeMarker;
00119 
00120 };
00121 
00122 #endif // SDLRADIOBUTTON_H