3 * \file RadioButtonGroup.h
4 * Copyright 2002 the LyX Team
5 * Copyright 2000 Baruch Even
6 * Read the file COPYING
8 * \author Baruch Even, baruch.even@writeme.com
12 #ifndef RADIOBUTTONGROUP_H
13 #define RADIOBUTTONGROUP_H
18 #include FORMS_H_LOCATION
25 /** This class simplifies the work with a group of radio buttons,
26 * the idea is that you register a bunch of radio buttons with the accompanying
27 * value for each radio button and then you get to query or set the active
28 * button in a single function call.
30 class RadioButtonGroup {
32 /// Constructor. Allocate space for 'n' items in the group.
33 RadioButtonGroup(unsigned n = 5) : map(n) {};
35 /// Register a radio button with it's corresponding value.
36 void registerRadioButton(FL_OBJECT * button, int value);
37 /// Reset registrations.
40 // Set the active button.
41 void setButton(int value);
43 // Get the active button.
48 typedef std::pair<FL_OBJECT *, int> ButtonValuePair;
50 typedef std::vector<ButtonValuePair> ButtonValueMap;