/**
    File        : Dialogs.h
    Description : Common Dialogs
    Author      : Raymond Marsh
    Created     : 08/01/2009
    Copyright 2009, 2010 Raymond Marsh

    This program is distributed under the terms of the GNU General Public License.
    To view a copy of the license see the file 'copying.txt'

    This file is part of the Ace Personal Finance Assistant Suite.

    Ace Personal Finance Assistant is free software: you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free Software Foundation, either
    version 3 of the License, or (at your option) any later version.

    Ace Personal Finance Assistant is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with Ace Personal Finance Assistant.
    If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef DIALOGS_H_INCLUDED
#define DIALOGS_H_INCLUDED

#include <wx/dialog.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/checkbox.h>
#include <wx/xrc/xmlres.h>
#include <fstream>
#include "version.h"

#define ERRORCODE __FILE__,__LINE__
#define aceMSGBOX(pParent,Type,Msg,pChecked) ace::MsgBox(pParent,Type,Msg,pChecked,ERRORCODE)
#define aceLOGERROR(Msg,IsFatal) ace::LogError(Msg,ERRORCODE,IsFatal)

namespace ace
{

typedef int MB_TYPE;

enum
{
    MB_WARNING  = 8500,
    MB_INFO,
    MB_ERROR,
    MB_QUESTION,
    MB_FAIL,
};

inline wxString GetTimeStamp() { return (wxDateTime::Now() ).Format("%x %X"); }
int MsgBox(wxWindow* pParent, ace::MB_TYPE Type, wxString Msg, bool* pChecked = NULL, wxString FileName = __FILE__, int LineNumber = __LINE__);
void LogError(wxString msg, wxString FileName, int LineNumber, bool IsFatal = false);


class CMsgDlg : public wxDialog
{
public:
    CMsgDlg();
    ~CMsgDlg();
    bool Create(wxWindow* pParent, ace::MB_TYPE Type, wxString& Msg, bool* pChecked);

private:
    // ID's
    int idCheckBox;

    // event handlers
    void OnRadioButtonSelect(wxCommandEvent &event);
    void OnOK(wxCommandEvent &event);
    void OnCancel(wxCommandEvent &event);
    void OnYes(wxCommandEvent &event);
    void OnNo(wxCommandEvent &event);

    // private data
    bool*        m_pIsChecked;
    wxCheckBox*  m_pCheckBox;
    int          m_idCheckBox;
};

}; // namespace ace

#endif // DIALOGS_H_INCLUDED
