1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/algobox.h Tue Jan 03 17:30:22 2006 +0000
1.3 @@ -0,0 +1,62 @@
1.4 +// -*- C++ -*- //
1.5 +
1.6 +#ifndef ALGOBOX_H
1.7 +#define ALGOBOX_H
1.8 +
1.9 +class AlgoBox;
1.10 +
1.11 +#include <all_include.h>
1.12 +#include <libgnomecanvasmm.h>
1.13 +#include <libgnomecanvasmm/polygon.h>
1.14 +
1.15 +class AlgoBox : public Gtk::VBox
1.16 +{
1.17 +
1.18 + Gtk::Label * label;
1.19 + Gtk::ComboBoxText cbt;
1.20 +
1.21 + public:
1.22 + AlgoBox(std::vector<std::string> tabnames)
1.23 + {
1.24 + update_tablist(tabnames);
1.25 +
1.26 + label=new Gtk::Label("Haliho");
1.27 +
1.28 + pack_start(*label);
1.29 + pack_start(cbt);
1.30 +
1.31 + show_all_children();
1.32 + };
1.33 +
1.34 + void update_tablist( std::vector< std::string > tl )
1.35 + {
1.36 + std::string actname=cbt.get_active_text();
1.37 + int prev_act=-1;
1.38 +
1.39 + cbt.clear();
1.40 + int actptr=0;
1.41 +
1.42 + std::vector< std::string >::iterator emsi=tl.begin();
1.43 + for(;emsi!=tl.end();emsi++)
1.44 + {
1.45 + if(actname==*emsi)
1.46 + {
1.47 + prev_act=actptr;
1.48 + }
1.49 +
1.50 + cbt.append_text(*emsi);
1.51 + actptr++;
1.52 + }
1.53 +
1.54 + if(prev_act!=-1)
1.55 + {
1.56 + cbt.set_active(prev_act);
1.57 + }
1.58 + else if(actptr>0) //so there is item in the list
1.59 + {
1.60 + cbt.set_active(0);
1.61 + }
1.62 + }
1.63 +
1.64 +};
1.65 +#endif //ALGOBOX_H