COIN-OR::LEMON - Graph Library

source: glemon-0.x/eps_win.cc @ 197:c1084e2bff10

Last change on this file since 197:c1084e2bff10 was 196:c220f9de6545, checked in by Hegyi Péter, 17 years ago

EpsWin? and DesignWin? does not need to know NoteBookTab?.

File size: 2.2 KB
Line 
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#include <eps_win.h>
20#include <set>
21
22bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
23{
24  if(e->keyval==GDK_Escape)
25  {
26    hide();
27  }
28  return true;
29}
30
31EpsWin::EpsWin(const std::string& title):Gtk::Dialog(title, true, true)
32{
33  set_default_size(200, 50);
34
35  set_resizable(false);
36
37  signal_key_press_event().connect(sigc::mem_fun(*this, &EpsWin::closeIfEscapeIsPressed));
38
39  table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false);
40
41  std::vector<std::string> labels;
42  labels.resize(EPS_PROPERTY_NUM);
43
44  labels[N_MAPS]="Dump visualized nodemaps";
45  labels[E_MAPS]="Dump visualizes edgemaps";
46  labels[ARROWS]="Show arrows in directed graphs";
47  labels[PAR]="Indicate parallel edges";
48
49  options.resize(EPS_PROPERTY_NUM);
50
51  for(int i=0;i<EPS_PROPERTY_NUM;i++)
52    {
53      options[i]=new Gtk::CheckButton(labels[i]);
54      (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
55    }
56
57  hbox.pack_start(*(new Gtk::Label("Filename")));
58  hbox.pack_start(name);
59
60  Gtk::VBox * vbox=get_vbox();
61
62  vbox->pack_start(*table);
63  vbox->pack_start(hbox);
64
65  //OK button
66  add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
67  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
68
69  show_all_children();
70
71}
72
73bool EpsWin::on_delete_event(GdkEventAny * event)
74{
75  event=event;
76  signal_eps_close.emit();
77  return true;
78}
79
80void EpsWin::on_response(int response_id)
81{
82  if(response_id==Gtk::RESPONSE_OK)
83    {
84      std::vector <bool> values;
85      values.resize(EPS_PROPERTY_NUM);
86      for(int i=0;i<EPS_PROPERTY_NUM;i++)
87        {
88          values[i]=options[i]->get_active();
89        }
90      signal_eps_details.emit(values, name.get_text());
91    }
92  on_delete_event(NULL);
93}
Note: See TracBrowser for help on using the repository browser.