2 /* This file is part of
3 * =================================================
5 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich.
7 * Copyright 1995-2001 The LyX Team.
9 * This file Copyright 2000 Baruch Even
10 * ================================================= */
13 #ifndef RADIOBUTTONGROUP_H
14 #define RADIOBUTTONGROUP_H
19 #include FORMS_H_LOCATION
26 /** This class simplifies the work with a group of radio buttons,
27 * the idea is that you register a bunch of radio buttons with the accompanying
28 * value for each radio button and then you get to query or set the active
29 * button in a single function call.
32 class RadioButtonGroup {
34 /// Constructor. Allocate space for 'n' items in the group.
35 RadioButtonGroup(unsigned n = 5) : map(n) {};
37 /// Register a radio button with it's corresponding value.
38 void registerRadioButton(FL_OBJECT * button, int value);
39 /// Reset registrations.
42 // Set the active button.
43 void setButton(int value);
45 // Get the active button.
50 typedef std::pair<FL_OBJECT *, int> ButtonValuePair;
52 typedef std::vector<ButtonValuePair> ButtonValueMap;