No Data Structures (4)

datastructure4

Now, it is a little bit better using the C++ STL (Standard Template Library).

  vector< vector<string> > label
  { {"CW", "CW-R", "LSB", "USB"},
	{"DSP FIL 1", "DSP FIL 2", "DSP FIL 3"},
	{"DSP SHARP", "DSP SOFT"},
	{"IF FIL 1", "IF FIL 2", "IF FIL 3"},
	{"PRE-AMP1", "PRE-AMP2", "ATT 20dB", "BOTH OFF"},
	{"AGC FAST", "AGC MID", "AGC SLOW"},
	{"ANT 1", "ANT 2"},
	{"BKIN OFF", "BKIN ON", "BKIN FULL"},
  };

  int index = 0;
  for(unsigned int i=0;i<label.size();i++) {
	m_Box10[i].set_orientation(Gtk::ORIENTATION_VERTICAL);
    m_Box10[i].set_border_width(3);
	for(unsigned int j=0;j<label.at(i).size();j++) {
      m_RadioButton[index].set_label(label[i][j]);
      if(j==0) {
        m_RadioButton[index].set_active();
        m_group[i] = m_RadioButton[index].get_group();
      } else {
        m_RadioButton[index].set_group(m_group[i]);
      }
      m_Box10[i].pack_start(m_RadioButton[index], FALSE, FALSE, 0);
      m_RadioButton[index].signal_clicked().connect(sigc::bind<gint> (mem_fun(*this, &RadioButtons::on_button_clicked9), index));
      index++;
    }
    m_Box1.pack_start(m_Box10[i]);
    m_Box1.pack_start(m_VSeparator[i]);
  }
  m_Box1.pack_start(m_Button_Quit);

You see that initializing a vector label conveys all the information necessary for placing the radio buttons on the screen, and there is no additional information in the source code concerning the layout.