algobox.h
branchgui
changeset 106 853dd852abc7
parent 103 3a263e57e1d9
child 108 bf355fd6563e
equal deleted inserted replaced
0:aeefef905051 1:cf07a68b348a
     9 #include <libgnomecanvasmm.h>
     9 #include <libgnomecanvasmm.h>
    10 #include <libgnomecanvasmm/polygon.h>
    10 #include <libgnomecanvasmm/polygon.h>
    11 
    11 
    12 class AlgoBox : public Gtk::VBox
    12 class AlgoBox : public Gtk::VBox
    13 {
    13 {
       
    14   sigc::signal<void, std::string> signal_maplist_need;  
    14   
    15   
       
    16   Gtk::ComboBoxText tabcbt;
       
    17 
       
    18 protected:
    15   Gtk::Label * label;
    19   Gtk::Label * label;
    16   Gtk::ComboBoxText cbt;
    20   std::vector<Gtk::ComboBoxText *> nodemapcbts;
       
    21   std::vector<Gtk::ComboBoxText *> edgemapcbts;
    17   
    22   
    18  public:
    23 public:
    19   AlgoBox(std::vector<std::string> tabnames)
    24   AlgoBox(){};
    20     {
    25   AlgoBox(std::vector<std::string>, std::vector<std::string>, std::vector<std::string>);
    21       update_tablist(tabnames);
       
    22 
    26 
    23       label=new Gtk::Label("Haliho");
    27   virtual void init(std::vector<std::string>, std::vector<std::string>, std::vector<std::string>);
    24       
       
    25       pack_start(*label);
       
    26       pack_start(cbt);
       
    27 
    28 
    28       show_all_children();
    29   sigc::signal<void, std::string> signal_maplist_needed();  
    29     };
    30   void emit_tab_change();
    30 
    31 
    31   void update_tablist( std::vector< std::string > tl )
    32   void update_tablist( std::vector< std::string > tl );
    32     {
    33   void update_maplist( std::vector< std::string >, std::vector< std::string >);
    33       std::string actname=cbt.get_active_text();
       
    34       int prev_act=-1;
       
    35 
    34 
    36       cbt.clear();
    35   void update_cbt( std::vector< std::string > tl, Gtk::ComboBoxText &);
    37       int actptr=0;
    36   
    38 
    37   virtual void run();
    39       std::vector< std::string >::iterator emsi=tl.begin();
    38   
    40       for(;emsi!=tl.end();emsi++)
    39   virtual void build_box();
    41 	{
       
    42 	  if(actname==*emsi)
       
    43 	    {
       
    44 	      prev_act=actptr;
       
    45 	    }
       
    46 
       
    47 	  cbt.append_text(*emsi);
       
    48 	  actptr++;
       
    49 	}
       
    50 
       
    51       if(prev_act!=-1)
       
    52 	{
       
    53 	  cbt.set_active(prev_act);
       
    54 	}
       
    55       else if(actptr>0) //so there is item in the list
       
    56 	{
       
    57 	  cbt.set_active(0);
       
    58 	}
       
    59     }
       
    60 
       
    61 };
    40 };
    62 #endif //ALGOBOX_H
    41 #endif //ALGOBOX_H