COIN-OR::LEMON - Graph Library

source: lemon-0.x/gui/algobox.h @ 1871:3905d347112c

Last change on this file since 1871:3905d347112c was 1871:3905d347112c, checked in by Hegyi Péter, 15 years ago

Coding of Algorithms has begun, but code is really-really ugly yet.

File size: 1023 bytes
Line 
1// -*- C++ -*- //
2
3#ifndef ALGOBOX_H
4#define ALGOBOX_H
5
6class AlgoBox;
7
8#include <all_include.h>
9#include <libgnomecanvasmm.h>
10#include <libgnomecanvasmm/polygon.h>
11
12class AlgoBox : public Gtk::VBox
13{
14 
15  Gtk::Label * label;
16  Gtk::ComboBoxText cbt;
17 
18 public:
19  AlgoBox(std::vector<std::string> tabnames)
20    {
21      update_tablist(tabnames);
22
23      label=new Gtk::Label("Haliho");
24     
25      pack_start(*label);
26      pack_start(cbt);
27
28      show_all_children();
29    };
30
31  void update_tablist( std::vector< std::string > tl )
32    {
33      std::string actname=cbt.get_active_text();
34      int prev_act=-1;
35
36      cbt.clear();
37      int actptr=0;
38
39      std::vector< std::string >::iterator emsi=tl.begin();
40      for(;emsi!=tl.end();emsi++)
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};
62#endif //ALGOBOX_H
Note: See TracBrowser for help on using the repository browser.