#ifndef PMMAINFRAME_H
#define PMMAINFRAME_H

#include <wx/wx.h>
#include <fstream>
#include <string>
#include <wx/filedlg.h>
#include <wx/fontdlg.h>
#include <wx/colour.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/utils.h>
#include <wx/list.h>
#include <wx/listctrl.h>
#include "tqsql.h"
#include "pmSQLdlg.h"
#include "pmGrid.h"
#include "pmSRCdlg.h"

class pmMainframe : public wxFrame
{
  public:
        pmMainframe(wxWindow * parent,
                const wxChar *title,
                int xpos,
                int ypos,
                int width,
                int height
                );
        ~pmMainframe();

    wxTextCtrl *theText;
        wxMenuBar  *menuBar;
        wxMenu     *fileMenu, *editMenu, *dataMenu, *helpMenu;
        wxString DATABASE;
        wxString logFile;

        void OnExit             (wxCommandEvent & event);
        void OnAbout            (wxCommandEvent & event);
        void OnChooseFont       (wxCommandEvent & event);
        void OnNewFrame         (wxCommandEvent & event);
        void OnNewCanvas        (wxCommandEvent & event);
        void OnCloseWindow      (wxCloseEvent& event);
        void ChildMessage       (wxString);
        void OnDBStart          (wxCommandEvent & event);
        SQLRETURN OnDBConnect   (wxCommandEvent & event);
        SQLRETURN OnDBDisconnect(wxCommandEvent & event);
        SQLRETURN OnExecSQL     (wxCommandEvent & event);
        SQLRETURN OnExecSQLGrid (wxCommandEvent & event);
        bool GetConnectStatus   (void);
        void SetConnectStatus   (bool);
        void OnSaveLog();

  private:
        TQConnect       theDatabase;
        Table           theTable;
        RESULTATTR      attribs;
        bool            connectStatus;
        SQLRETURN       dbConnect(wxString),dbDisconnect(void);
        wxString        lastCmd;

  DECLARE_EVENT_TABLE()
};

enum
{ MAIN_EXIT = 400,
  MAIN_FONT,
  MAIN_NEWFRAME,
  MAIN_ABOUT,
  MAIN_TEXT,
  MAIN_CONNECT,
  MAIN_DISCONNECT,
  MAIN_QUERY,
  MAIN_SAVE,
  MAIN_NEWCANVAS
};

#endif