Wirth’s law

Niklaus_Wirth,_UrGU

Software is getting slower more rapidly than hardware becomes faster.

Algorithms_Data_Structures

This book, written in 1976, emphasizes that algorithms and data structures are inherently related.

radiobuttonsrevisited

So what type of the data structures is best suited for these buttons?

class RadioButtons : public Gtk::Window
{
public:
  RadioButtons();
  virtual ~RadioButtons();

protected:
  void on_button_clicked ();
  void on_button_clicked9(Glib::ustring data);

  Gtk::Box         m_Box_Top, m_Box1, m_Box2; 
  Gtk::RadioButton m_RadioButton1, m_RadioButton2, m_RadioButton3, m_RadioButton4;
  Gtk::Separator   m_Separator;
  Gtk::Button      m_Button_Quit;
};
void RadioButtons::on_button_clicked9(Glib::ustring data)
{
  if(data == "1") {
    if(m_RadioButton1.get_active()) {
      std::cout << "button1 is active " << std::endl;
      myfunc(1);
    }
  }
  if(data == "2") {
    if(m_RadioButton2.get_active()) {
      std::cout << "button2 is active " << std::endl;
      myfunc(2);
    }
  }
  if(data == "3") {
    if(m_RadioButton3.get_active()) {
      std::cout << "button3 is active " << std::endl;
      myfunc(3);
    }
  }
  if(data == "4") {
    if(m_RadioButton4.get_active()) {
      std::cout << "button4 is active " << std::endl;
      myfunc(4);
    }
  }
}
  m_Button_Quit.signal_clicked().connect (sigc::mem_fun(*this, &RadioButtons::on_button_clicked ) );
  m_RadioButton1.signal_clicked().connect(sigc::bind<Glib::ustring>(mem_fun(*this, &RadioButtons::on_button_clicked9), "1" ));
  m_RadioButton2.signal_clicked().connect(sigc::bind<Glib::ustring>(mem_fun(*this, &RadioButtons::on_button_clicked9), "2" ));
  m_RadioButton3.signal_clicked().connect(sigc::bind<Glib::ustring>(mem_fun(*this, &RadioButtons::on_button_clicked9), "3" ));
  m_RadioButton4.signal_clicked().connect(sigc::bind<Glib::ustring>(mem_fun(*this, &RadioButtons::on_button_clicked9), "4" ));

Leave a Reply

Your email address will not be published. Required fields are marked *