Main Page   Class Hierarchy   Data Structures   File List   Data Fields  

addmarket.cpp

00001 /***************************************************************************
00002                           addmarket.cpp  -  description
00003                              -------------------
00004     begin                : Fri Jan 17 2002
00005     copyright            : (C) 2002 by Michael Otto
00006     email                : Michael.Otto@saskathex.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "addmarket.h"
00019 
00020 #include "stockmarketvector.h"
00021 #include "stockmarket.h"
00022 #include "gstockcalc.h"
00023 
00024 #include <gtkmm/stock.h>
00025 #include <iostream>
00026 
00027 #include "config.h"
00028 
00032 AddMarket::AddMarket(StockMarketVector *stockMarketVector){
00033 
00034   AddMarket::stockMarketVector = stockMarketVector;
00035   
00036   set_title("adding makret");
00037   set_border_width(5);
00038   set_resizable(false);
00039   set_modal(true);
00040 
00041   // setting up the notebook and filling it with pages
00042   vbox = manage(new Gtk::VBox(false, 0));
00043   vbox->set_spacing(5);
00044   add(*vbox);
00045 
00046   
00047   tableEditStockValue = manage(new Gtk::Table(2, 1, false));
00048   tableEditStockValue->set_spacings(5);
00049   vbox->pack_start(*tableEditStockValue, Gtk::PACK_EXPAND_WIDGET, 0);
00050   label = manage (new Gtk::Label("name of new marketplace: ", 0));
00051   tableEditStockValue->attach(*label, 0, 1, 0, 1);
00052   entryName = manage (new Gtk::Entry());
00053   entryName->set_text("name");
00054   entryName->set_max_length(20);
00055   entryName->set_width_chars(20);
00056   tableEditStockValue->attach(*entryName, 1, 2, 0, 1);
00057 
00058   
00059   hSep = manage(new Gtk::HSeparator());
00060   vbox->pack_start(*hSep, Gtk::PACK_SHRINK, 0);
00061     
00062   hButtonBox = manage( new Gtk::HButtonBox());
00063   hButtonBox->set_spacing(5);
00064   vbox->pack_start(*hButtonBox, Gtk::PACK_SHRINK, 0);  
00065 
00066   buttonCancel = manage( new Gtk::Button(Gtk::Stock::CANCEL));
00067   buttonCancel->signal_clicked().connect(slot(*this,&AddMarket::quit));
00068   hButtonBox->pack_start(*buttonCancel, Gtk::PACK_SHRINK, 0);
00069   buttonFinish = manage( new Gtk::Button(Gtk::Stock::OK));
00070   buttonFinish->signal_clicked().connect(slot(*this,&AddMarket::finishAddMarket));
00071   hButtonBox->pack_start(*buttonFinish, Gtk::PACK_SHRINK, 0);
00072   show_all();
00073 }
00074 
00078 AddMarket::~AddMarket() {
00079 
00080 }
00081 
00085 void AddMarket::quit() {
00086   delete this;
00087 }
00088 
00095 void AddMarket::finishAddMarket() {
00096   Glib::ustring c1 = entryName->get_text();
00097   string name = locale_from_utf8 (c1);
00098   StockMarket *stockMarket = new StockMarket(name);
00099   stockMarket->attach(GStockCalc::gStockCalcStatic);
00100   stockMarketVector->addStockMarket(stockMarket);
00101   quit();
00102 }
00103 
00108 bool AddMarket::on_delete_event(GdkEventAny *event) {
00109   quit();
00110   return true;
00111 }

Generated on Tue May 27 21:24:01 2003 for gstockcalc by doxygen1.3-rc3