1 // Copyright (c) 2009-2010 Satoshi Nakamoto
\r
2 // Distributed under the MIT/X11 software license, see the accompanying
\r
3 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
\r
8 DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
\r
9 DECLARE_EVENT_TYPE(wxEVT_REPLY1, -1)
\r
10 DECLARE_EVENT_TYPE(wxEVT_REPLY2, -1)
\r
11 DECLARE_EVENT_TYPE(wxEVT_REPLY3, -1)
\r
16 extern map<string, string> mapArgs;
\r
19 extern int fShowGenerated;
\r
20 extern int fMinimizeToTray;
\r
21 extern int fMinimizeOnClose;
\r
25 extern void HandleCtrlA(wxKeyEvent& event);
\r
26 extern string FormatTxStatus(const CWalletTx& wtx);
\r
27 extern void UIThreadCall(boost::function0<void>);
\r
28 extern void MainFrameRepaint();
\r
29 extern void Shutdown(void* parg);
\r
30 extern int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
\r
37 class CMainFrame : public CMainFrameBase
\r
41 void OnClose(wxCloseEvent& event);
\r
42 void OnIconize(wxIconizeEvent& event);
\r
43 void OnMouseEvents(wxMouseEvent& event);
\r
44 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
45 void OnIdle(wxIdleEvent& event);
\r
46 void OnPaint(wxPaintEvent& event);
\r
47 void OnPaintListCtrl(wxPaintEvent& event);
\r
48 void OnMenuFileExit(wxCommandEvent& event);
\r
49 void OnMenuViewShowGenerated(wxCommandEvent& event);
\r
50 void OnUpdateUIViewShowGenerated(wxUpdateUIEvent& event);
\r
51 void OnMenuOptionsGenerate(wxCommandEvent& event);
\r
52 void OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event);
\r
53 void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
\r
54 void OnMenuOptionsOptions(wxCommandEvent& event);
\r
55 void OnMenuHelpAbout(wxCommandEvent& event);
\r
56 void OnButtonSend(wxCommandEvent& event);
\r
57 void OnButtonAddressBook(wxCommandEvent& event);
\r
58 void OnSetFocusAddress(wxFocusEvent& event);
\r
59 void OnMouseEventsAddress(wxMouseEvent& event);
\r
60 void OnButtonCopy(wxCommandEvent& event);
\r
61 void OnButtonChange(wxCommandEvent& event);
\r
62 void OnListColBeginDrag(wxListEvent& event);
\r
63 void OnListItemActivated(wxListEvent& event);
\r
64 void OnListItemActivatedProductsSent(wxListEvent& event);
\r
65 void OnListItemActivatedOrdersSent(wxListEvent& event);
\r
66 void OnListItemActivatedOrdersReceived(wxListEvent& event);
\r
70 CMainFrame(wxWindow* parent);
\r
74 bool fRefreshListCtrl;
\r
75 bool fRefreshListCtrlRunning;
\r
76 bool fOnSetFocusAddress;
\r
77 unsigned int nListViewUpdated;
\r
80 void OnUIThreadCall(wxCommandEvent& event);
\r
81 int GetSortIndex(const string& strSort);
\r
82 void InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5);
\r
83 bool DeleteLine(uint256 hashKey);
\r
84 bool InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
\r
85 void RefreshListCtrl();
\r
86 void RefreshStatusColumn();
\r
92 class CTxDetailsDialog : public CTxDetailsDialogBase
\r
96 void OnButtonOK(wxCommandEvent& event);
\r
100 CTxDetailsDialog(wxWindow* parent, CWalletTx wtx);
\r
108 class COptionsDialog : public COptionsDialogBase
\r
112 void OnListBox(wxCommandEvent& event);
\r
113 void OnKillFocusTransactionFee(wxFocusEvent& event);
\r
114 void OnCheckBoxLimitProcessors(wxCommandEvent& event);
\r
115 void OnCheckBoxUseProxy(wxCommandEvent& event);
\r
116 void OnKillFocusProxy(wxFocusEvent& event);
\r
118 void OnButtonOK(wxCommandEvent& event);
\r
119 void OnButtonCancel(wxCommandEvent& event);
\r
120 void OnButtonApply(wxCommandEvent& event);
\r
124 COptionsDialog(wxWindow* parent);
\r
127 bool fTmpStartOnSystemStartup;
\r
128 bool fTmpMinimizeOnClose;
\r
129 void SelectPage(int nPage);
\r
130 CAddress GetProxyAddr();
\r
135 class CAboutDialog : public CAboutDialogBase
\r
139 void OnButtonOK(wxCommandEvent& event);
\r
143 CAboutDialog(wxWindow* parent);
\r
148 class CSendDialog : public CSendDialogBase
\r
152 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
153 void OnTextAddress(wxCommandEvent& event);
\r
154 void OnKillFocusAmount(wxFocusEvent& event);
\r
155 void OnButtonAddressBook(wxCommandEvent& event);
\r
156 void OnButtonPaste(wxCommandEvent& event);
\r
157 void OnButtonSend(wxCommandEvent& event);
\r
158 void OnButtonCancel(wxCommandEvent& event);
\r
162 CSendDialog(wxWindow* parent, const wxString& strAddress="");
\r
166 string strFromSave;
\r
167 string strMessageSave;
\r
172 class CSendingDialog : public CSendingDialogBase
\r
176 void OnClose(wxCloseEvent& event);
\r
177 void OnButtonOK(wxCommandEvent& event);
\r
178 void OnButtonCancel(wxCommandEvent& event);
\r
179 void OnPaint(wxPaintEvent& event);
\r
183 CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn);
\r
191 char pszStatus[10000];
\r
201 bool Status(const string& str);
\r
202 bool Error(const string& str);
\r
203 void StartTransfer();
\r
204 void OnReply2(CDataStream& vRecv);
\r
205 void OnReply3(CDataStream& vRecv);
\r
208 void SendingDialogStartTransfer(void* parg);
\r
209 void SendingDialogOnReply2(void* parg, CDataStream& vRecv);
\r
210 void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
\r
214 class CYourAddressDialog : public CYourAddressDialogBase
\r
218 void OnListEndLabelEdit(wxListEvent& event);
\r
219 void OnListItemSelected(wxListEvent& event);
\r
220 void OnListItemActivated(wxListEvent& event);
\r
221 void OnButtonRename(wxCommandEvent& event);
\r
222 void OnButtonNew(wxCommandEvent& event);
\r
223 void OnButtonCopy(wxCommandEvent& event);
\r
224 void OnButtonOK(wxCommandEvent& event);
\r
225 void OnButtonCancel(wxCommandEvent& event);
\r
226 void OnClose(wxCloseEvent& event);
\r
230 CYourAddressDialog(wxWindow* parent);
\r
231 CYourAddressDialog(wxWindow* parent, const string& strInitSelected);
\r
234 wxString GetAddress();
\r
239 class CAddressBookDialog : public CAddressBookDialogBase
\r
243 void OnListEndLabelEdit(wxListEvent& event);
\r
244 void OnListItemSelected(wxListEvent& event);
\r
245 void OnListItemActivated(wxListEvent& event);
\r
246 void OnButtonEdit(wxCommandEvent& event);
\r
247 void OnButtonDelete(wxCommandEvent& event);
\r
248 void OnButtonNew(wxCommandEvent& event);
\r
249 void OnButtonCopy(wxCommandEvent& event);
\r
250 void OnButtonOK(wxCommandEvent& event);
\r
251 void OnButtonCancel(wxCommandEvent& event);
\r
252 void OnClose(wxCloseEvent& event);
\r
256 CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);
\r
260 wxString GetAddress();
\r
261 bool CheckIfMine(const string& strAddress, const string& strTitle);
\r
266 class CProductsDialog : public CProductsDialogBase
\r
270 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
271 void OnCombobox(wxCommandEvent& event);
\r
272 void OnButtonSearch(wxCommandEvent& event);
\r
273 void OnListItemActivated(wxListEvent& event);
\r
277 CProductsDialog(wxWindow* parent);
\r
280 vector<CProduct> m_vProduct;
\r
285 class CEditProductDialog : public CEditProductDialogBase
\r
289 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
290 void OnButtonDel0(wxCommandEvent& event);
\r
291 void OnButtonDel1(wxCommandEvent& event);
\r
292 void OnButtonDel2(wxCommandEvent& event);
\r
293 void OnButtonDel3(wxCommandEvent& event);
\r
294 void OnButtonDel4(wxCommandEvent& event);
\r
295 void OnButtonDel5(wxCommandEvent& event);
\r
296 void OnButtonDel6(wxCommandEvent& event);
\r
297 void OnButtonDel7(wxCommandEvent& event);
\r
298 void OnButtonDel8(wxCommandEvent& event);
\r
299 void OnButtonDel9(wxCommandEvent& event);
\r
300 void OnButtonDel10(wxCommandEvent& event);
\r
301 void OnButtonDel11(wxCommandEvent& event);
\r
302 void OnButtonDel12(wxCommandEvent& event);
\r
303 void OnButtonDel13(wxCommandEvent& event);
\r
304 void OnButtonDel14(wxCommandEvent& event);
\r
305 void OnButtonDel15(wxCommandEvent& event);
\r
306 void OnButtonDel16(wxCommandEvent& event);
\r
307 void OnButtonDel17(wxCommandEvent& event);
\r
308 void OnButtonDel18(wxCommandEvent& event);
\r
309 void OnButtonDel19(wxCommandEvent& event);
\r
310 void OnButtonAddField(wxCommandEvent& event);
\r
311 void OnButtonSend(wxCommandEvent& event);
\r
312 void OnButtonPreview(wxCommandEvent& event);
\r
313 void OnButtonCancel(wxCommandEvent& event);
\r
317 CEditProductDialog(wxWindow* parent);
\r
320 enum { FIELDS_MAX = 20 };
\r
321 wxTextCtrl* m_textCtrlLabel[FIELDS_MAX];
\r
322 wxTextCtrl* m_textCtrlField[FIELDS_MAX];
\r
323 wxButton* m_buttonDel[FIELDS_MAX];
\r
326 void ShowLine(int i, bool fShow=true);
\r
327 void OnButtonDel(wxCommandEvent& event, int n);
\r
328 void SetProduct(const CProduct& productIn);
\r
329 void GetProduct(CProduct& product);
\r
335 class CViewProductDialog : public CViewProductDialogBase
\r
339 void OnButtonSubmitForm(wxCommandEvent& event);
\r
340 void OnButtonCancelForm(wxCommandEvent& event);
\r
341 void OnButtonBack(wxCommandEvent& event);
\r
342 void OnButtonNext(wxCommandEvent& event);
\r
343 void OnButtonCancel(wxCommandEvent& event);
\r
347 CViewProductDialog(wxWindow* parent, const CProduct& productIn);
\r
348 ~CViewProductDialog();
\r
352 enum { FIELDS_MAX = 20 };
\r
353 wxStaticText* m_staticTextLabel[FIELDS_MAX];
\r
354 wxTextCtrl* m_textCtrlField[FIELDS_MAX];
\r
355 wxChoice* m_choiceField[FIELDS_MAX];
\r
357 void GetOrder(CWalletTx& order);
\r
358 void UpdateProductDisplay(bool fDetails);
\r
359 void OnReply1(wxCommandEvent& event);
\r
364 class CViewOrderDialog : public CViewOrderDialogBase
\r
368 void OnButtonOK(wxCommandEvent& event);
\r
372 CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived);
\r
380 class CEditReviewDialog : public CEditReviewDialogBase
\r
384 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
385 void OnButtonSubmit(wxCommandEvent& event);
\r
386 void OnButtonCancel(wxCommandEvent& event);
\r
390 CEditReviewDialog(wxWindow* parent);
\r
393 void GetReview(CReview& review);
\r
398 class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
\r
402 void OnButtonOK(wxCommandEvent& event) { EndModal(true); }
\r
403 void OnButtonCancel(wxCommandEvent& event) { EndModal(false); }
\r
404 void OnClose(wxCloseEvent& event) { EndModal(false); }
\r
406 void OnKeyDown(wxKeyEvent& event)
\r
408 if (event.GetKeyCode() == '\r' || event.GetKeyCode() == WXK_NUMPAD_ENTER)
\r
411 HandleCtrlA(event);
\r
416 CGetTextFromUserDialog(wxWindow* parent,
\r
417 const string& strCaption,
\r
418 const string& strMessage1,
\r
419 const string& strValue1="",
\r
420 const string& strMessage2="",
\r
421 const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
\r
423 m_staticTextMessage1->SetLabel(strMessage1);
\r
424 m_textCtrl1->SetValue(strValue1);
\r
425 if (!strMessage2.empty())
\r
427 m_staticTextMessage2->Show(true);
\r
428 m_staticTextMessage2->SetLabel(strMessage2);
\r
429 m_textCtrl2->Show(true);
\r
430 m_textCtrl2->SetValue(strValue2);
\r
431 SetSize(wxDefaultCoord, 180);
\r
436 string GetValue() { return (string)m_textCtrl1->GetValue(); }
\r
437 string GetValue1() { return (string)m_textCtrl1->GetValue(); }
\r
438 string GetValue2() { return (string)m_textCtrl2->GetValue(); }
\r
443 class CMyTaskBarIcon : public wxTaskBarIcon
\r
447 void OnLeftButtonDClick(wxTaskBarIconEvent& event);
\r
448 void OnMenuRestore(wxCommandEvent& event);
\r
449 void OnMenuOptions(wxCommandEvent& event);
\r
450 void OnUpdateUIGenerate(wxUpdateUIEvent& event);
\r
451 void OnMenuGenerate(wxCommandEvent& event);
\r
452 void OnMenuExit(wxCommandEvent& event);
\r
455 CMyTaskBarIcon() : wxTaskBarIcon()
\r
460 void Show(bool fShow=true);
\r
463 void UpdateTooltip();
\r
464 virtual wxMenu* CreatePopupMenu();
\r
466 DECLARE_EVENT_TABLE()
\r