00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "chartdialog.h"
00019
00020 #include "stock.h"
00021 #include "chartdrawing.h"
00022 #include "config.h"
00023
00024 #include <gtkmm/stock.h>
00025
00029 ChartDialog::ChartDialog(const Stock * const stock) {
00030
00031 ChartDialog::stock = stock;
00032
00033 Gtk::VBox *vbox;
00034 Gtk::HButtonBox *hButtonBox;
00035 Gtk::Button *buttonClose;
00036 Gtk::HSeparator *hSep;
00037
00038 set_title(stock->getName());
00039 set_border_width(5);
00040
00041 set_modal(false);
00042
00043
00044 vbox = manage(new Gtk::VBox(false, 0));
00045 vbox->set_spacing(5);
00046 add(*vbox);
00047
00048 chart = new ChartDrawing(stock);
00049 vbox->pack_start(*chart, Gtk::PACK_SHRINK, 0);
00050
00051 hSep = manage(new Gtk::HSeparator());
00052 vbox->pack_start(*hSep, Gtk::PACK_SHRINK, 0);
00053
00054 hButtonBox = manage( new Gtk::HButtonBox());
00055 hButtonBox->set_spacing(5);
00056 vbox->pack_start(*hButtonBox, Gtk::PACK_SHRINK, 0);
00057
00058 buttonClose = manage(new Gtk::Button(Gtk::Stock::OK));
00059 buttonClose->signal_clicked().connect(slot(*this,&ChartDialog::quit));
00060 hButtonBox->pack_start(*buttonClose, Gtk::PACK_SHRINK, 0);
00061
00062 show_all();
00063 }
00064
00068 ChartDialog::~ChartDialog(){
00069 delete chart;
00070 }
00071
00075 void ChartDialog::quit() {
00076 delete this;
00077 }
00078
00083 bool ChartDialog::on_delete_event(GdkEventAny *event) {
00084 quit();
00085 return true;
00086 }