1 /*************************************************************************** 2 tqslwiz.h - description 3 ------------------- 4 begin : Tue Nov 5 2002 5 copyright : (C) 2002 by ARRL 6 author : Jon Bloom 7 email : jbloom@arrl.org 8 revision : $Id$ 9 ***************************************************************************/ 10 11 #ifndef __tqslwiz_h 12 #define __tqslwiz_h 13 14 #ifdef HAVE_CONFIG_H 15 #include "sysconfig.h" 16 #endif 17 18 #include "wx/wxprec.h" 19 20 #ifdef __BORLANDC__ 21 #pragma hdrstop 22 #endif 23 24 #ifndef WX_PRECOMP 25 #include "wx/wx.h" 26 #endif 27 28 #include "extwizard.h" 29 #include "wx/radiobox.h" 30 31 #include "certtree.h" 32 33 #ifndef ADIF_BOOLEAN 34 #define ADIF_BOOLEAN // Hack! 35 #endif 36 #include "tqsllib.h" 37 38 #include <vector> 39 #include <map> 40 41 using std::map; 42 using std::vector; 43 44 #define TQSL_ID_LOW 6000 45 46 class TQSLWizPage; 47 48 class TQSLWizard : public ExtWizard { 49 public: 50 TQSLWizard(tQSL_Location locp, wxWindow *parent, wxHtmlHelpController *help = 0, const wxString& title = wxEmptyString, bool expired = false); 51 52 // TQSLWizard(tQSL_Location locp, wxWindow* parent, int id = -1, const wxString& title = wxEmptyString, 53 // const wxBitmap& bitmap = wxNullBitmap, const wxPoint& pos = wxDefaultPosition); 54 55 TQSLWizPage *GetPage(bool final = false); GetCurrentTQSLPage()56 TQSLWizPage *GetCurrentTQSLPage() { return reinterpret_cast<TQSLWizPage *>(GetCurrentPage()); } SetLocationName(wxString & s)57 void SetLocationName(wxString& s) { sl_name = s; } SetDefaultCallsign(wxString & c)58 void SetDefaultCallsign(wxString& c) {sl_call = c; } GetLocationName()59 wxString GetLocationName() { return sl_name; } GetDefaultCallsign()60 wxString GetDefaultCallsign() {return sl_call; } GetFinalPage()61 TQSLWizPage *GetFinalPage() { return (_pages.size() > 0) ? _pages[0] : 0; } 62 bool expired; 63 64 private: 65 void OnPageChanged(wxWizardEvent&); 66 wxString sl_name; 67 wxString sl_call; 68 tQSL_Location loc; 69 int _curpage; 70 map<int, TQSLWizPage *> _pages; 71 TQSLWizPage *final; 72 73 DECLARE_EVENT_TABLE() 74 }; 75 76 class TQSLWizPage : public ExtWizard_Page { 77 public: TQSLWizPage(TQSLWizard * parent,tQSL_Location locp)78 TQSLWizPage(TQSLWizard *parent, tQSL_Location locp) : ExtWizard_Page(parent) { loc = locp; } GetParent()79 virtual TQSLWizard *GetParent() const { return reinterpret_cast<TQSLWizard *>(wxWindow::GetParent()); } 80 81 tQSL_Location loc; 82 bool initialized; 83 wxString valMsg; 84 }; 85 86 class TQSLWizCertPage : public TQSLWizPage { 87 public: 88 TQSLWizCertPage(TQSLWizard *parent, tQSL_Location locp); 89 ~TQSLWizCertPage(); 90 virtual bool TransferDataFromWindow(); 91 void OnComboBoxEvent(wxCommandEvent&); 92 void OnCheckBoxEvent(wxCommandEvent&); 93 int loc_page; 94 bool invalidGrid; 95 bool allowBadGrid; 96 void UpdateFields(int noupdate_field = -1); 97 virtual const char *validate(); 98 virtual TQSLWizPage *GetPrev() const; 99 virtual TQSLWizPage *GetNext() const; 100 void OnSize(wxSizeEvent&); 101 void OnPageChanging(wxWizardEvent &); 102 private: 103 vector<void *> controls; 104 typedef map <std::string, std::string> ForcedMap; 105 ForcedMap forced; 106 wxStaticText *errlbl; 107 wxCheckBox *okEmptyCB; 108 DECLARE_EVENT_TABLE() 109 }; 110 111 class TQSLWizFinalPage : public TQSLWizPage { 112 public: 113 TQSLWizFinalPage(TQSLWizard *parent, tQSL_Location locp, TQSLWizPage *i_prev); 114 ~TQSLWizFinalPage(); GetPrev()115 TQSLWizPage *GetPrev() const { return prev; } GetNext()116 TQSLWizPage *GetNext() const { return 0; } 117 void OnPageChanged(wxWizardEvent &); 118 TQSLWizPage *prev; 119 virtual bool TransferDataFromWindow(); 120 void OnListbox(wxCommandEvent &); 121 virtual const char *validate(); 122 void OnPageChanging(wxWizardEvent &); 123 private: 124 wxListBox *namelist; 125 wxTextCtrl *newname; 126 wxStaticText *errlbl; 127 wxBoxSizer *sizer; 128 vector<char *> item_data; 129 130 DECLARE_EVENT_TABLE() 131 }; 132 133 #endif // __tqslwiz_h 134