PageRenderTime 17ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Rainman2/exception_dialog.h

http://modstudio2.googlecode.com/
C++ Header | 71 lines | 38 code | 9 blank | 24 comment | 0 complexity | 3b3880bb12d60ed5930cb8f8dc60991b MD5 | raw file
 1/*
 2Copyright (c) 2008 Peter "Corsix" Cawley
 3
 4Permission is hereby granted, free of charge, to any person
 5obtaining a copy of this software and associated documentation
 6files (the "Software"), to deal in the Software without
 7restriction, including without limitation the rights to use,
 8copy, modify, merge, publish, distribute, sublicense, and/or sell
 9copies of the Software, and to permit persons to whom the
10Software is furnished to do so, subject to the following
11conditions:
12
13The above copyright notice and this permission notice shall be
14included in all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23OTHER DEALINGS IN THE SOFTWARE.
24*/
25#pragma once
26#include "exception.h"
27#ifdef RAINMAN2_USE_WX
28#include <wx/wx.h>
29#include <wx/dialog.h>
30#include <wx/button.h>
31#include <wx/listctrl.h>
32#include <wx/statline.h>
33#include "exception.h"
34#pragma warning(push)
35#pragma warning(disable: 4275) // non dll-interface class used as base
36
37class RAINMAN2_API RainExceptionDialog : public wxDialog
38{
39public:
40  RainExceptionDialog(wxWindow *parent, RainException *pException);
41
42  static void show(RainException* pE, bool bDeleteException = true);
43
44  void onOK(wxCommandEvent& e);
45  void onDetails(wxCommandEvent& e);
46  void onSave(wxCommandEvent& e);
47  void onListSelect(wxListEvent& e);
48
49private:
50  void _addExtraControls();
51
52  wxArrayString m_aMessages;
53  wxArrayString m_aFiles;
54  wxArrayLong   m_aLines;
55
56  wxButton *m_pDetailsBtn;
57  bool      m_bShowingDetails;
58
59  wxListCtrl   *m_pDetailList;
60  wxStaticLine *m_pStaticLine;
61  wxButton     *m_pSaveBtn;
62
63  DECLARE_EVENT_TABLE()
64};
65
66#define EXCEPTION_MESSAGE_BOX(message, e) RainExceptionDialog::show(new RainException(__WFILE__, __LINE__, message, e));
67#define EXCEPTION_MESSAGE_BOX_1(message, a1, e) RainExceptionDialog::show(new RainException(__WFILE__, __LINE__, e, message, a1));
68#define CATCH_MESSAGE_BOX(message, cleanup) catch (RainException *pRainError) { EXCEPTION_MESSAGE_BOX(message, pRainError); cleanup; }
69#define CATCH_MESSAGE_BOX_1(message, a1, cleanup) catch (RainException *pRainError) { EXCEPTION_MESSAGE_BOX_1(message, a1, pRainError); cleanup; }
70#pragma warning(pop)
71#endif