If you have comments or questions concerning this source file, discuss them in the forum.
/*
Copyright (c) 2002 Nicolai Haehnle
See the license.txt for details. If that file was not included in the
source distributions, please email <prefect@rtts.org>
*/
// gui_radiobutton.h
#ifndef GUI_RADIOBUTTON_H
#define GUI_RADIOBUTTON_H
#include "gui_button.h"
/*
You should always use radio buttons through a GRadioButtonGroup.
Watch out, since it messes with the IDs and signals.
*/
class GRadioButtonGroup;
class GRadioButton : public GButton {
friend class GRadioButtonGroup;
public:
bool m_bOn;
public:
GRadioButton(GPanel *pParent, int x, int y, int w, int h, const char *szText = 0,
int iAlign = 0, int id = -1);
GRadioButton(GPanel *pParent, const char *szPic, int type, u32 colorkey,
int x, int y, int w, int h, int id = -1);
public:
virtual void GetIconSize(int *pw, int *ph);
virtual void DrawIcon(int x, int y, int r, int g, int b, int a);
private:
void SetOn(bool on) { m_bOn = on; }
};
class GRadioButtonGroup : public LObject {
public:
int numclients;
GRadioButton **clients;
int current;
public:
GRadioButtonGroup();
~GRadioButtonGroup();
int Add(GRadioButton *rb);
void Set(int id);
inline int Get() { return current; }
};
#endif
// GUI_RADIOBUTTON_H