map_win.h
author hegyi
Thu, 05 Jan 2006 12:30:09 +0000
branchgui
changeset 108 bf355fd6563e
parent 95 628c0b383d2f
child 112 3689cb170d3e
permissions -rw-r--r--
Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.
     1 // -*- C++ -*- //
     2 
     3 #ifndef MAP_WIN_H
     4 #define MAP_WIN_H
     5 
     6 class MapWin;
     7 
     8 #include <all_include.h>
     9 #include <nbtab.h>
    10 #include <libgnomecanvasmm.h>
    11 #include <libgnomecanvasmm/polygon.h>
    12 
    13 ///This class is responsible for creating a window,
    14 ///on which the visualization attributes can be
    15 ///assigned to maps.
    16 class MapWin : public Gtk::Window
    17 {
    18 
    19   class MapSelector : public Gtk::HBox
    20   {
    21   protected:
    22     sigc::signal<void, std::string> signal_cbt;
    23     sigc::signal<void, bool> signal_newmapwin;
    24 
    25     int id;
    26 
    27     bool itisedge;
    28 
    29     bool default_state;
    30 
    31     bool set_new_map;
    32 
    33     Gtk::ComboBoxText cbt;
    34 
    35     Gtk::Button * newbut, * defbut;
    36 
    37     Gtk::HBox hbox;
    38 
    39     Gtk::Label * label;
    40 
    41   public:
    42 
    43     MapSelector(std::vector<std::string>, std::string, int, bool);
    44 
    45     sigc::signal<void, std::string> signal_cbt_ch();
    46     sigc::signal<void, bool> signal_newmapwin_needed();
    47 
    48     void update_list( std::vector<std::string> );
    49 
    50     ///If a radiobutton is clicked, this function determines
    51     ///which button was that and after that calls the
    52     ///appropriate function of the \ref GraphDisplayerCanvas
    53     ///to change the visible values of that attribute.
    54     virtual void comboChanged();
    55 
    56     virtual void new_but_pressed();
    57 
    58     virtual void reset();
    59 
    60     Glib::ustring get_active_text();
    61     void set_active_text(Glib::ustring);
    62     void append_text(Glib::ustring);
    63   };
    64 
    65 
    66 
    67 protected:
    68   NoteBookTab & mytab;
    69 
    70   Gtk::Table * table;
    71   
    72   MapSelector ** e_combo_array, ** n_combo_array;
    73 
    74   Gtk::Label * label;
    75 
    76   Gtk::VBox vbox;
    77 
    78 public:
    79   ///Constructor of MapWin creates the widgets shown in MapWin.
    80   MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, NoteBookTab & mw);
    81 
    82   ~MapWin();
    83 
    84   virtual bool on_delete_event(GdkEventAny *);
    85 
    86   void nodeMapChanged(std::string, int);
    87 
    88   void edgeMapChanged(std::string, int);
    89 
    90   void newMapWinNeeded(bool, int);
    91 
    92   ///This function inserts name of the new edgemap in the list in the combo box
    93   void registerNewEdgeMap(std::string);
    94 
    95   ///This function inserts name of the new nodemap in the list in the combo box
    96   void registerNewNodeMap(std::string);
    97 
    98   virtual bool closeIfEscapeIsPressed(GdkEventKey*);
    99 
   100   void update(std::vector<std::string>, std::vector<std::string>);
   101 };
   102 
   103 #endif //MAP_WIN_H