1 // Copyright (c) 2009 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_CROSSTHREADCALL, -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
12 DECLARE_EVENT_TYPE(wxEVT_TABLEADDED, -1)
\r
13 DECLARE_EVENT_TYPE(wxEVT_TABLEUPDATED, -1)
\r
14 DECLARE_EVENT_TYPE(wxEVT_TABLEDELETED, -1)
\r
18 UICALL_ADDORDER = 1,
\r
24 extern void HandleCtrlA(wxKeyEvent& event);
\r
25 extern string DateTimeStr(int64 nTime);
\r
26 extern string FormatTxStatus(const CWalletTx& wtx);
\r
27 extern void CrossThreadCall(int nID, void* pdata);
\r
28 extern void MainFrameRepaint();
\r
29 extern void Shutdown(void* parg);
\r
36 class CMainFrame : public CMainFrameBase
\r
40 void OnClose(wxCloseEvent& event);
\r
41 void OnMouseEvents(wxMouseEvent& event);
\r
42 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
43 void OnIdle(wxIdleEvent& event);
\r
44 void OnPaint(wxPaintEvent& event);
\r
45 void OnPaintListCtrl(wxPaintEvent& event);
\r
46 void OnMenuFileExit(wxCommandEvent& event);
\r
47 void OnMenuOptionsGenerate(wxCommandEvent& event);
\r
48 void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
\r
49 void OnMenuOptionsOptions(wxCommandEvent& event);
\r
50 void OnMenuHelpAbout(wxCommandEvent& event);
\r
51 void OnButtonSend(wxCommandEvent& event);
\r
52 void OnButtonAddressBook(wxCommandEvent& event);
\r
53 void OnSetFocusAddress(wxFocusEvent& event);
\r
54 void OnMouseEventsAddress(wxMouseEvent& event);
\r
55 void OnButtonCopy(wxCommandEvent& event);
\r
56 void OnButtonChange(wxCommandEvent& event);
\r
57 void OnListColBeginDrag(wxListEvent& event);
\r
58 void OnListItemActivatedAllTransactions(wxListEvent& event);
\r
59 void OnListItemActivatedProductsSent(wxListEvent& event);
\r
60 void OnListItemActivatedOrdersSent(wxListEvent& event);
\r
61 void OnListItemActivatedOrdersReceived(wxListEvent& event);
\r
65 CMainFrame(wxWindow* parent);
\r
69 bool fRefreshListCtrl;
\r
70 bool fRefreshListCtrlRunning;
\r
71 bool fOnSetFocusAddress;
\r
72 CBlockIndex* pindexBestLast;
\r
73 set<uint256> setUnmaturedDisplayed;
\r
75 void OnCrossThreadCall(wxCommandEvent& event);
\r
76 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
77 void InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
\r
78 void RefreshListCtrl();
\r
79 void RefreshStatus();
\r
85 class CTxDetailsDialog : public CTxDetailsDialogBase
\r
89 void OnButtonOK(wxCommandEvent& event);
\r
93 CTxDetailsDialog(wxWindow* parent, CWalletTx wtx);
\r
101 class COptionsDialog : public COptionsDialogBase
\r
105 void OnKillFocusTransactionFee(wxFocusEvent& event);
\r
106 void OnButtonOK(wxCommandEvent& event);
\r
107 void OnButtonCancel(wxCommandEvent& event);
\r
111 COptionsDialog(wxWindow* parent);
\r
116 class CAboutDialog : public CAboutDialogBase
\r
120 void OnButtonOK(wxCommandEvent& event);
\r
124 CAboutDialog(wxWindow* parent);
\r
129 class CSendDialog : public CSendDialogBase
\r
133 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
134 void OnTextAddress(wxCommandEvent& event);
\r
135 void OnKillFocusAmount(wxFocusEvent& event);
\r
136 void OnButtonAddressBook(wxCommandEvent& event);
\r
137 void OnButtonPaste(wxCommandEvent& event);
\r
138 void OnButtonSend(wxCommandEvent& event);
\r
139 void OnButtonCancel(wxCommandEvent& event);
\r
143 CSendDialog(wxWindow* parent, const wxString& strAddress="");
\r
148 class CSendingDialog : public CSendingDialogBase
\r
152 void OnClose(wxCloseEvent& event);
\r
153 void OnButtonOK(wxCommandEvent& event);
\r
154 void OnButtonCancel(wxCommandEvent& event);
\r
155 void OnPaint(wxPaintEvent& event);
\r
159 CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn);
\r
177 bool Status(const string& str);
\r
178 bool Error(const string& str);
\r
179 void StartTransfer();
\r
180 void OnReply2(CDataStream& vRecv);
\r
181 void OnReply3(CDataStream& vRecv);
\r
184 void SendingDialogStartTransfer(void* parg);
\r
185 void SendingDialogOnReply2(void* parg, CDataStream& vRecv);
\r
186 void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
\r
190 class CYourAddressDialog : public CYourAddressDialogBase
\r
194 void OnListEndLabelEdit(wxListEvent& event);
\r
195 void OnListItemSelected(wxListEvent& event);
\r
196 void OnListItemActivated(wxListEvent& event);
\r
197 void OnButtonRename(wxCommandEvent& event);
\r
198 void OnButtonNew(wxCommandEvent& event);
\r
199 void OnButtonCopy(wxCommandEvent& event);
\r
200 void OnButtonOK(wxCommandEvent& event);
\r
201 void OnButtonCancel(wxCommandEvent& event);
\r
202 void OnClose(wxCloseEvent& event);
\r
206 CYourAddressDialog(wxWindow* parent);
\r
207 CYourAddressDialog(wxWindow* parent, const string& strInitSelected);
\r
210 wxString GetAddress();
\r
215 class CAddressBookDialog : public CAddressBookDialogBase
\r
219 void OnListEndLabelEdit(wxListEvent& event);
\r
220 void OnListItemSelected(wxListEvent& event);
\r
221 void OnListItemActivated(wxListEvent& event);
\r
222 void OnButtonEdit(wxCommandEvent& event);
\r
223 void OnButtonDelete(wxCommandEvent& event);
\r
224 void OnButtonNew(wxCommandEvent& event);
\r
225 void OnButtonCopy(wxCommandEvent& event);
\r
226 void OnButtonOK(wxCommandEvent& event);
\r
227 void OnButtonCancel(wxCommandEvent& event);
\r
228 void OnClose(wxCloseEvent& event);
\r
232 CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);
\r
236 wxString GetAddress();
\r
237 bool CheckIfMine(const string& strAddress, const string& strTitle);
\r
242 class CProductsDialog : public CProductsDialogBase
\r
246 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
247 void OnCombobox(wxCommandEvent& event);
\r
248 void OnButtonSearch(wxCommandEvent& event);
\r
249 void OnListItemActivated(wxListEvent& event);
\r
253 CProductsDialog(wxWindow* parent);
\r
256 vector<CProduct> m_vProduct;
\r
261 class CEditProductDialog : public CEditProductDialogBase
\r
265 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
266 void OnButtonDel0(wxCommandEvent& event);
\r
267 void OnButtonDel1(wxCommandEvent& event);
\r
268 void OnButtonDel2(wxCommandEvent& event);
\r
269 void OnButtonDel3(wxCommandEvent& event);
\r
270 void OnButtonDel4(wxCommandEvent& event);
\r
271 void OnButtonDel5(wxCommandEvent& event);
\r
272 void OnButtonDel6(wxCommandEvent& event);
\r
273 void OnButtonDel7(wxCommandEvent& event);
\r
274 void OnButtonDel8(wxCommandEvent& event);
\r
275 void OnButtonDel9(wxCommandEvent& event);
\r
276 void OnButtonDel10(wxCommandEvent& event);
\r
277 void OnButtonDel11(wxCommandEvent& event);
\r
278 void OnButtonDel12(wxCommandEvent& event);
\r
279 void OnButtonDel13(wxCommandEvent& event);
\r
280 void OnButtonDel14(wxCommandEvent& event);
\r
281 void OnButtonDel15(wxCommandEvent& event);
\r
282 void OnButtonDel16(wxCommandEvent& event);
\r
283 void OnButtonDel17(wxCommandEvent& event);
\r
284 void OnButtonDel18(wxCommandEvent& event);
\r
285 void OnButtonDel19(wxCommandEvent& event);
\r
286 void OnButtonAddField(wxCommandEvent& event);
\r
287 void OnButtonSend(wxCommandEvent& event);
\r
288 void OnButtonPreview(wxCommandEvent& event);
\r
289 void OnButtonCancel(wxCommandEvent& event);
\r
293 CEditProductDialog(wxWindow* parent);
\r
296 enum { FIELDS_MAX = 20 };
\r
297 wxTextCtrl* m_textCtrlLabel[FIELDS_MAX];
\r
298 wxTextCtrl* m_textCtrlField[FIELDS_MAX];
\r
299 wxButton* m_buttonDel[FIELDS_MAX];
\r
302 void ShowLine(int i, bool fShow=true);
\r
303 void OnButtonDel(wxCommandEvent& event, int n);
\r
304 void SetProduct(const CProduct& productIn);
\r
305 void GetProduct(CProduct& product);
\r
311 class CViewProductDialog : public CViewProductDialogBase
\r
315 void OnButtonSubmitForm(wxCommandEvent& event);
\r
316 void OnButtonCancelForm(wxCommandEvent& event);
\r
317 void OnButtonBack(wxCommandEvent& event);
\r
318 void OnButtonNext(wxCommandEvent& event);
\r
319 void OnButtonCancel(wxCommandEvent& event);
\r
323 CViewProductDialog(wxWindow* parent, const CProduct& productIn);
\r
324 ~CViewProductDialog();
\r
328 enum { FIELDS_MAX = 20 };
\r
329 wxStaticText* m_staticTextLabel[FIELDS_MAX];
\r
330 wxTextCtrl* m_textCtrlField[FIELDS_MAX];
\r
331 wxChoice* m_choiceField[FIELDS_MAX];
\r
333 void GetOrder(CWalletTx& order);
\r
334 void UpdateProductDisplay(bool fDetails);
\r
335 void OnReply1(wxCommandEvent& event);
\r
340 class CViewOrderDialog : public CViewOrderDialogBase
\r
344 void OnButtonOK(wxCommandEvent& event);
\r
348 CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived);
\r
356 class CEditReviewDialog : public CEditReviewDialogBase
\r
360 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
361 void OnButtonSubmit(wxCommandEvent& event);
\r
362 void OnButtonCancel(wxCommandEvent& event);
\r
366 CEditReviewDialog(wxWindow* parent);
\r
369 void GetReview(CReview& review);
\r
374 class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
\r
378 void OnButtonOK(wxCommandEvent& event) { EndModal(true); }
\r
379 void OnButtonCancel(wxCommandEvent& event) { EndModal(false); }
\r
380 void OnClose(wxCloseEvent& event) { EndModal(false); }
\r
382 void OnKeyDown(wxKeyEvent& event)
\r
384 if (event.GetKeyCode() == '\r' || event.GetKeyCode() == WXK_NUMPAD_ENTER)
\r
387 HandleCtrlA(event);
\r
392 CGetTextFromUserDialog(wxWindow* parent,
\r
393 const string& strCaption,
\r
394 const string& strMessage1,
\r
395 const string& strValue1="",
\r
396 const string& strMessage2="",
\r
397 const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
\r
399 m_staticTextMessage1->SetLabel(strMessage1);
\r
400 m_textCtrl1->SetValue(strValue1);
\r
401 if (!strMessage2.empty())
\r
403 m_staticTextMessage2->Show(true);
\r
404 m_staticTextMessage2->SetLabel(strMessage2);
\r
405 m_textCtrl2->Show(true);
\r
406 m_textCtrl2->SetValue(strValue2);
\r
407 SetSize(wxDefaultCoord, 180);
\r
412 string GetValue() { return (string)m_textCtrl1->GetValue(); }
\r
413 string GetValue1() { return (string)m_textCtrl1->GetValue(); }
\r
414 string GetValue2() { return (string)m_textCtrl2->GetValue(); }
\r