map_win.h
changeset 3 2cc5ed6e6255
equal deleted inserted replaced
-1:000000000000 0:d098102b6bd3
       
     1 /* -*- C++ -*-
       
     2  *
       
     3  * This file is a part of LEMON, a generic C++ optimization library
       
     4  *
       
     5  * Copyright (C) 2003-2006
       
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
       
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
       
     8  *
       
     9  * Permission to use, modify and distribute this software is granted
       
    10  * provided that this copyright notice appears in all copies. For
       
    11  * precise terms see the accompanying LICENSE file.
       
    12  *
       
    13  * This software is provided "AS IS" with no warranty of any kind,
       
    14  * express or implied, and with no claim as to its suitability for any
       
    15  * purpose.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef MAP_WIN_H
       
    20 #define MAP_WIN_H
       
    21 
       
    22 class NoteBookTab;
       
    23 class MapSelector;
       
    24 
       
    25 #include <all_include.h>
       
    26 #include <libgnomecanvasmm.h>
       
    27 #include <libgnomecanvasmm/polygon.h>
       
    28 #include "map_value.h"
       
    29 
       
    30 ///Digraph visualization setup window.
       
    31 
       
    32 ///This class is responsible for creating a window,
       
    33 ///on which the visualization attributes can be
       
    34 ///assigned to maps.
       
    35 class MapWin : public Gtk::Window
       
    36 {
       
    37 protected:
       
    38   ///\ref NoteBookTab to that the \ref MapWin belongs to.
       
    39   NoteBookTab & mytab;
       
    40 
       
    41   ///Designing element
       
    42   Gtk::Table * table;
       
    43   
       
    44   ///\ref MapSelectors for each property
       
    45 
       
    46   ///Each property has an own \ref MapSelector through which
       
    47   ///the map to visualize by the property van be set.
       
    48   MapSelector ** e_combo_array;
       
    49 
       
    50   ///\ref MapSelectors for each property
       
    51 
       
    52   ///Each property has an own \ref MapSelector through which
       
    53   ///the map to visualize by the property van be set.
       
    54   MapSelector ** n_combo_array;
       
    55 
       
    56   ///Information holder
       
    57   Gtk::Label * label;
       
    58 
       
    59   ///Container in which elements are organized.
       
    60   Gtk::VBox vbox;
       
    61 
       
    62 public:
       
    63   ///Constructor
       
    64 
       
    65   ///It creates the widgets shown in \ref MapWin and
       
    66   ///binds the needed signal to the correct place.
       
    67   ///\param title title of window
       
    68   ///\param mw the owner \ref NoteBookTab (\ref mytab)
       
    69   MapWin(const std::string& title, 
       
    70       std::vector<std::string> n_eml,
       
    71       std::vector<std::string> s_eml,
       
    72       std::vector<std::string> n_nml,
       
    73       std::vector<std::string> s_nml,
       
    74       NoteBookTab & mw);
       
    75 
       
    76   ///Deregistrates \ref MapWin in its \ref NoteBookTab (\ref mytab)
       
    77   virtual bool on_delete_event(GdkEventAny *);
       
    78 
       
    79   ///Handles changement in nodemap selection
       
    80 
       
    81   ///If \ref MapSelector emits a signal that indicates
       
    82   ///changement in nodemap selection this function will
       
    83   ///be called. It calls the appropriate handler function,
       
    84   ///\ref NoteBookTab::propertyChange with parameters describing the changement.
       
    85   ///\param mapname the recently selected map
       
    86   ///\param prop the changed property
       
    87   void nodeMapChanged(std::string mapname, int prop);
       
    88 
       
    89   ///Handles changement in arcmap selection
       
    90 
       
    91   ///If \ref MapSelector emits a signal that indicates
       
    92   ///changement in arcmap selection this function will
       
    93   ///be called. It calls the appropriate handler function,
       
    94   ///\ref NoteBookTab::propertyChange with parameters describing the changement.
       
    95   ///\param mapname the recently selected map
       
    96   ///\param prop the changed property
       
    97   void arcMapChanged(std::string mapname, int prop);
       
    98 
       
    99   ///Indicates to the owner \ref NoteBookTab that a \ref NewMapWin should be opened.
       
   100 
       
   101   ///This function is bound to the
       
   102   ///signal emitted by the \ref MapSelector in case of
       
   103   ///the user wants to create a new map. It only pass the
       
   104   ///information further to the tab owning this \ref MapWin that is needed to open the
       
   105   ///\ref NewMapWin. (\ref NoteBookTab::popupNewMapWin)
       
   106   ///\param itisarc should the new map will be an arcmap? (or nodemap)
       
   107   void newMapWinNeeded(bool itisarc);
       
   108 
       
   109   ///This function inserts name of the new arcmap in the name list in \ref MapSelector s
       
   110 
       
   111   ///\param new_name
       
   112   ///name of new map
       
   113   void registerNewArcMap(std::string new_name, MapValue::Type type);
       
   114 
       
   115   ///This function inserts name of the new nodemap in the name list in \ref MapSelector s
       
   116 
       
   117   ///\param new_name
       
   118   ///name of new map
       
   119   void registerNewNodeMap(std::string new_name, MapValue::Type type);
       
   120 
       
   121   ///Close window if Esc key pressed.
       
   122   virtual bool closeIfEscapeIsPressed(GdkEventKey*);
       
   123 
       
   124   ///Updates list of maps in all \ref MapSelector
       
   125 
       
   126   ///This function is called by \ref NoteBookTab, when the file
       
   127   ///showed in it has changed, therefore the contained maps
       
   128   ///have changed as well. \ref NoteBookTab knows, whether it
       
   129   ///has to call this function or not from the \ref NoteBookTab::mapwinexists
       
   130   ///variable.
       
   131   void update(
       
   132     std::vector<std::string> n_eml,
       
   133     std::vector<std::string> s_eml,
       
   134     std::vector<std::string> n_nml,
       
   135     std::vector<std::string> s_nml);
       
   136 
       
   137   void changeEntry(bool, int, std::string);
       
   138 
       
   139   void set_title(std::string);
       
   140 };
       
   141 
       
   142 #endif //MAP_WIN_H