gui/algobox.h
author hegyi
Tue, 03 Jan 2006 17:30:22 +0000
changeset 1871 3905d347112c
child 1876 5ad84ad1b68f
permissions -rw-r--r--
Coding of Algorithms has begun, but code is really-really ugly yet.
hegyi@1871
     1
// -*- C++ -*- //
hegyi@1871
     2
hegyi@1871
     3
#ifndef ALGOBOX_H
hegyi@1871
     4
#define ALGOBOX_H
hegyi@1871
     5
hegyi@1871
     6
class AlgoBox;
hegyi@1871
     7
hegyi@1871
     8
#include <all_include.h>
hegyi@1871
     9
#include <libgnomecanvasmm.h>
hegyi@1871
    10
#include <libgnomecanvasmm/polygon.h>
hegyi@1871
    11
hegyi@1871
    12
class AlgoBox : public Gtk::VBox
hegyi@1871
    13
{
hegyi@1871
    14
  
hegyi@1871
    15
  Gtk::Label * label;
hegyi@1871
    16
  Gtk::ComboBoxText cbt;
hegyi@1871
    17
  
hegyi@1871
    18
 public:
hegyi@1871
    19
  AlgoBox(std::vector<std::string> tabnames)
hegyi@1871
    20
    {
hegyi@1871
    21
      update_tablist(tabnames);
hegyi@1871
    22
hegyi@1871
    23
      label=new Gtk::Label("Haliho");
hegyi@1871
    24
      
hegyi@1871
    25
      pack_start(*label);
hegyi@1871
    26
      pack_start(cbt);
hegyi@1871
    27
hegyi@1871
    28
      show_all_children();
hegyi@1871
    29
    };
hegyi@1871
    30
hegyi@1871
    31
  void update_tablist( std::vector< std::string > tl )
hegyi@1871
    32
    {
hegyi@1871
    33
      std::string actname=cbt.get_active_text();
hegyi@1871
    34
      int prev_act=-1;
hegyi@1871
    35
hegyi@1871
    36
      cbt.clear();
hegyi@1871
    37
      int actptr=0;
hegyi@1871
    38
hegyi@1871
    39
      std::vector< std::string >::iterator emsi=tl.begin();
hegyi@1871
    40
      for(;emsi!=tl.end();emsi++)
hegyi@1871
    41
	{
hegyi@1871
    42
	  if(actname==*emsi)
hegyi@1871
    43
	    {
hegyi@1871
    44
	      prev_act=actptr;
hegyi@1871
    45
	    }
hegyi@1871
    46
hegyi@1871
    47
	  cbt.append_text(*emsi);
hegyi@1871
    48
	  actptr++;
hegyi@1871
    49
	}
hegyi@1871
    50
hegyi@1871
    51
      if(prev_act!=-1)
hegyi@1871
    52
	{
hegyi@1871
    53
	  cbt.set_active(prev_act);
hegyi@1871
    54
	}
hegyi@1871
    55
      else if(actptr>0) //so there is item in the list
hegyi@1871
    56
	{
hegyi@1871
    57
	  cbt.set_active(0);
hegyi@1871
    58
	}
hegyi@1871
    59
    }
hegyi@1871
    60
hegyi@1871
    61
};
hegyi@1871
    62
#endif //ALGOBOX_H