diff -r b9c9b52f839e -r 3905d347112c gui/algobox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/algobox.h Tue Jan 03 17:30:22 2006 +0000 @@ -0,0 +1,62 @@ +// -*- C++ -*- // + +#ifndef ALGOBOX_H +#define ALGOBOX_H + +class AlgoBox; + +#include +#include +#include + +class AlgoBox : public Gtk::VBox +{ + + Gtk::Label * label; + Gtk::ComboBoxText cbt; + + public: + AlgoBox(std::vector tabnames) + { + update_tablist(tabnames); + + label=new Gtk::Label("Haliho"); + + pack_start(*label); + pack_start(cbt); + + show_all_children(); + }; + + void update_tablist( std::vector< std::string > tl ) + { + std::string actname=cbt.get_active_text(); + int prev_act=-1; + + cbt.clear(); + int actptr=0; + + std::vector< std::string >::iterator emsi=tl.begin(); + for(;emsi!=tl.end();emsi++) + { + if(actname==*emsi) + { + prev_act=actptr; + } + + cbt.append_text(*emsi); + actptr++; + } + + if(prev_act!=-1) + { + cbt.set_active(prev_act); + } + else if(actptr>0) //so there is item in the list + { + cbt.set_active(0); + } + } + +}; +#endif //ALGOBOX_H