3 * \file RadioButtonGroup.h
4 * Copyright 2000 Baruch Even
5 * Read the file COPYING
9 * Full author contact details are available in file CREDITS
13 #ifndef RADIOBUTTONGROUP_H
14 #define RADIOBUTTONGROUP_H
20 #include "support/types.h"
23 #include "forms_fwd.h"
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 {
33 typedef lyx::size_type size_type;
35 /// Constructor. Allocate space for 'n' items in the group.
36 RadioButtonGroup(unsigned n = 5) : map(n) {};
38 /// Register a radio button with it's corresponding value.
39 void init(FL_OBJECT * button, size_type value);
40 /// Reset registrations.
43 // Set the active button.
44 void set(size_type value);
46 // Get the active button.
47 size_type get() const;
51 typedef std::pair<FL_OBJECT *, size_type> ButtonValuePair;
53 typedef std::vector<ButtonValuePair> ButtonValueMap;