00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GSTOCKCALC_H
00019 #define GSTOCKCALC_H
00020
00021
00022 #include <gtkmm.h>
00023
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include <math.h>
00028 #include <vector>
00029
00030 #include "config.h"
00031 #include "Observer.h"
00032 using namespace std;
00033
00034 class Stock;
00035 class StockGui;
00036 class StockMarketVector;
00037 class StockMarket;
00038 class Preferences;
00039
00044 class GStockCalc : public Gtk::Window , public Observer{
00045
00046 private:
00047 Gtk::Notebook *notebook;
00048 Gtk::VBox *vboxParentStockMarket[MAX_NUMBER_STOCKMARKETS];
00049 Gtk::VBox *vboxChildStockMarket[MAX_NUMBER_STOCKMARKETS];
00050 Gtk::Table *tableStockMarket[MAX_NUMBER_STOCKMARKETS];
00051 Gtk::HSeparator *hSep;
00052 Gtk::VSeparator *vSep;
00053 Gtk::VBox *vbox, *vboxNotebookParent, *vboxNotebookChild;
00054
00055
00056 Gtk::MenuBar m_MenuBar;
00057 Gtk::Menu m_Menu_File, m_Menu_Manage;
00058 Gtk::Menu m_Menu_Help;
00059
00060 Gtk::EventBox m_EventBox;
00061 Gtk::Menu m_Menu_Popup;
00062
00063 StockMarketVector *stockMarketVector;
00064 Preferences *preferences;
00065
00066 char stockmarketVectorFilename[256], preferencesFilename[256];
00067
00068 void fillMenu();
00069 void fillPopUpMenu();
00070 void beforeQuit();
00071 void quitAndSave();
00072 void quit();
00073
00074 void saveStockMarketVectorToFile();
00075 void writeOneStockToFile(FILE *file, Stock *s);
00076 int createFile(char *filename);
00077 int fileNotExists (char *filename);
00078 void savePreferencesToFile();
00079
00080 void eventButtonSaveToFile();
00081 void eventAddNewStock();
00082 void eventRemoveStock();
00083 void eventMoveStock();
00084 void eventAddMarket();
00085 void eventRemoveMarket();
00086 void eventEditStockMarketNames();
00087 void eventPreferences();
00088 void eventAboutDialog();
00089 void eventShowSummary();
00090 void eventChangePageOrder();
00091
00092 void fillTable(int tableStockMarketNumber);
00093 void fillTableWithLabels(Gtk::Table *table);
00094
00095 void updateStockMarketNotebookPage(StockMarket *stockMarket, int stockMarketNumber);
00096 void updateStockMarketAllNotebookPage();
00097
00098 public:
00099 GStockCalc();
00100 ~GStockCalc();
00101
00102 static GStockCalc *gStockCalcStatic;
00103
00104 void update(const Subject *const subject);
00105
00106 protected:
00107 virtual gint delete_event_impl(GdkEventAny *event);
00108 virtual bool on_button_press_event(GdkEventButton *event);
00109 };
00110
00111 #endif