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
30 void ApplyUISettings();
\r
33 extern int minimizeToTray;
\r
34 extern int closeToTray;
\r
35 extern int startOnSysBoot;
\r
36 extern int askBeforeClosing;
\r
37 extern int alwaysShowTrayIcon;
\r
41 class CMainFrame : public CMainFrameBase
\r
45 void OnClose(wxCloseEvent& event);
\r
46 void OnIconize( wxIconizeEvent& event );
\r
47 void OnMouseEvents(wxMouseEvent& event);
\r
48 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
49 void OnIdle(wxIdleEvent& event);
\r
50 void OnPaint(wxPaintEvent& event);
\r
51 void OnPaintListCtrl(wxPaintEvent& event);
\r
52 void OnMenuFileExit(wxCommandEvent& event);
\r
53 void OnMenuOptionsGenerate(wxCommandEvent& event);
\r
54 void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
\r
55 void OnMenuOptionsOptions(wxCommandEvent& event);
\r
56 void OnMenuHelpAbout(wxCommandEvent& event);
\r
57 void OnButtonSend(wxCommandEvent& event);
\r
58 void OnButtonAddressBook(wxCommandEvent& event);
\r
59 void OnSetFocusAddress(wxFocusEvent& event);
\r
60 void OnMouseEventsAddress(wxMouseEvent& event);
\r
61 void OnButtonCopy(wxCommandEvent& event);
\r
62 void OnButtonChange(wxCommandEvent& event);
\r
63 void OnListColBeginDrag(wxListEvent& event);
\r
64 void OnListItemActivatedAllTransactions(wxListEvent& event);
\r
65 void OnListItemActivatedProductsSent(wxListEvent& event);
\r
66 void OnListItemActivatedOrdersSent(wxListEvent& event);
\r
67 void OnListItemActivatedOrdersReceived(wxListEvent& event);
\r
68 void OnUpdateMenuGenerate( wxUpdateUIEvent& event );
\r
72 CMainFrame(wxWindow* parent);
\r
76 bool fRefreshListCtrl;
\r
77 bool fRefreshListCtrlRunning;
\r
78 bool fOnSetFocusAddress;
\r
79 CBlockIndex* pindexBestLast;
\r
80 set<uint256> setUnmaturedDisplayed;
\r
82 void OnCrossThreadCall(wxCommandEvent& event);
\r
83 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
84 void InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
\r
85 void RefreshListCtrl();
\r
86 void RefreshStatus();
\r
93 class CTxDetailsDialog : public CTxDetailsDialogBase
\r
97 void OnButtonOK(wxCommandEvent& event);
\r
101 CTxDetailsDialog(wxWindow* parent, CWalletTx wtx);
\r
109 class COptionsPanelBitcoin : public COptionsPanelBitcoinBase
\r
113 void OnKillFocusTransactionFee( wxFocusEvent& event );
\r
117 COptionsPanelBitcoin(wxWindow* parent);
\r
122 class COptionsPanelUI : public COptionsPanelUIBase
\r
126 void OnOptionsChanged( wxCommandEvent& event );
\r
130 COptionsPanelUI(wxWindow* parent);
\r
135 class COptionsDialog : public COptionsDialogBase
\r
139 void MenuSelChanged( wxTreeEvent& event );
\r
140 void OnButtonOK(wxCommandEvent& event);
\r
141 void OnButtonCancel(wxCommandEvent& event);
\r
144 COptionsPanelBitcoin* panelBitcoin;
\r
145 COptionsPanelUI* panelUI;
\r
146 wxPanel* currentPanel;
\r
149 COptionsDialog(wxWindow* parent);
\r
154 class CAboutDialog : public CAboutDialogBase
\r
158 void OnButtonOK(wxCommandEvent& event);
\r
162 CAboutDialog(wxWindow* parent);
\r
167 class CSendDialog : public CSendDialogBase
\r
171 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
172 void OnTextAddress(wxCommandEvent& event);
\r
173 void OnKillFocusAmount(wxFocusEvent& event);
\r
174 void OnButtonAddressBook(wxCommandEvent& event);
\r
175 void OnButtonPaste(wxCommandEvent& event);
\r
176 void OnButtonSend(wxCommandEvent& event);
\r
177 void OnButtonCancel(wxCommandEvent& event);
\r
181 CSendDialog(wxWindow* parent, const wxString& strAddress="");
\r
186 class CSendingDialog : public CSendingDialogBase
\r
190 void OnClose(wxCloseEvent& event);
\r
191 void OnButtonOK(wxCommandEvent& event);
\r
192 void OnButtonCancel(wxCommandEvent& event);
\r
193 void OnPaint(wxPaintEvent& event);
\r
197 CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn);
\r
215 bool Status(const string& str);
\r
216 bool Error(const string& str);
\r
217 void StartTransfer();
\r
218 void OnReply2(CDataStream& vRecv);
\r
219 void OnReply3(CDataStream& vRecv);
\r
222 void SendingDialogStartTransfer(void* parg);
\r
223 void SendingDialogOnReply2(void* parg, CDataStream& vRecv);
\r
224 void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
\r
228 class CYourAddressDialog : public CYourAddressDialogBase
\r
232 void OnListEndLabelEdit(wxListEvent& event);
\r
233 void OnListItemSelected(wxListEvent& event);
\r
234 void OnListItemActivated(wxListEvent& event);
\r
235 void OnButtonRename(wxCommandEvent& event);
\r
236 void OnButtonNew(wxCommandEvent& event);
\r
237 void OnButtonCopy(wxCommandEvent& event);
\r
238 void OnButtonOK(wxCommandEvent& event);
\r
239 void OnButtonCancel(wxCommandEvent& event);
\r
240 void OnClose(wxCloseEvent& event);
\r
244 CYourAddressDialog(wxWindow* parent);
\r
245 CYourAddressDialog(wxWindow* parent, const string& strInitSelected);
\r
248 wxString GetAddress();
\r
253 class CAddressBookDialog : public CAddressBookDialogBase
\r
257 void OnListEndLabelEdit(wxListEvent& event);
\r
258 void OnListItemSelected(wxListEvent& event);
\r
259 void OnListItemActivated(wxListEvent& event);
\r
260 void OnButtonEdit(wxCommandEvent& event);
\r
261 void OnButtonDelete(wxCommandEvent& event);
\r
262 void OnButtonNew(wxCommandEvent& event);
\r
263 void OnButtonCopy(wxCommandEvent& event);
\r
264 void OnButtonOK(wxCommandEvent& event);
\r
265 void OnButtonCancel(wxCommandEvent& event);
\r
266 void OnClose(wxCloseEvent& event);
\r
270 CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);
\r
274 wxString GetAddress();
\r
275 bool CheckIfMine(const string& strAddress, const string& strTitle);
\r
280 class CProductsDialog : public CProductsDialogBase
\r
284 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
285 void OnCombobox(wxCommandEvent& event);
\r
286 void OnButtonSearch(wxCommandEvent& event);
\r
287 void OnListItemActivated(wxListEvent& event);
\r
291 CProductsDialog(wxWindow* parent);
\r
294 vector<CProduct> m_vProduct;
\r
299 class CEditProductDialog : public CEditProductDialogBase
\r
303 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
304 void OnButtonDel0(wxCommandEvent& event);
\r
305 void OnButtonDel1(wxCommandEvent& event);
\r
306 void OnButtonDel2(wxCommandEvent& event);
\r
307 void OnButtonDel3(wxCommandEvent& event);
\r
308 void OnButtonDel4(wxCommandEvent& event);
\r
309 void OnButtonDel5(wxCommandEvent& event);
\r
310 void OnButtonDel6(wxCommandEvent& event);
\r
311 void OnButtonDel7(wxCommandEvent& event);
\r
312 void OnButtonDel8(wxCommandEvent& event);
\r
313 void OnButtonDel9(wxCommandEvent& event);
\r
314 void OnButtonDel10(wxCommandEvent& event);
\r
315 void OnButtonDel11(wxCommandEvent& event);
\r
316 void OnButtonDel12(wxCommandEvent& event);
\r
317 void OnButtonDel13(wxCommandEvent& event);
\r
318 void OnButtonDel14(wxCommandEvent& event);
\r
319 void OnButtonDel15(wxCommandEvent& event);
\r
320 void OnButtonDel16(wxCommandEvent& event);
\r
321 void OnButtonDel17(wxCommandEvent& event);
\r
322 void OnButtonDel18(wxCommandEvent& event);
\r
323 void OnButtonDel19(wxCommandEvent& event);
\r
324 void OnButtonAddField(wxCommandEvent& event);
\r
325 void OnButtonSend(wxCommandEvent& event);
\r
326 void OnButtonPreview(wxCommandEvent& event);
\r
327 void OnButtonCancel(wxCommandEvent& event);
\r
331 CEditProductDialog(wxWindow* parent);
\r
334 enum { FIELDS_MAX = 20 };
\r
335 wxTextCtrl* m_textCtrlLabel[FIELDS_MAX];
\r
336 wxTextCtrl* m_textCtrlField[FIELDS_MAX];
\r
337 wxButton* m_buttonDel[FIELDS_MAX];
\r
340 void ShowLine(int i, bool fShow=true);
\r
341 void OnButtonDel(wxCommandEvent& event, int n);
\r
342 void SetProduct(const CProduct& productIn);
\r
343 void GetProduct(CProduct& product);
\r
349 class CViewProductDialog : public CViewProductDialogBase
\r
353 void OnButtonSubmitForm(wxCommandEvent& event);
\r
354 void OnButtonCancelForm(wxCommandEvent& event);
\r
355 void OnButtonBack(wxCommandEvent& event);
\r
356 void OnButtonNext(wxCommandEvent& event);
\r
357 void OnButtonCancel(wxCommandEvent& event);
\r
361 CViewProductDialog(wxWindow* parent, const CProduct& productIn);
\r
362 ~CViewProductDialog();
\r
366 enum { FIELDS_MAX = 20 };
\r
367 wxStaticText* m_staticTextLabel[FIELDS_MAX];
\r
368 wxTextCtrl* m_textCtrlField[FIELDS_MAX];
\r
369 wxChoice* m_choiceField[FIELDS_MAX];
\r
371 void GetOrder(CWalletTx& order);
\r
372 void UpdateProductDisplay(bool fDetails);
\r
373 void OnReply1(wxCommandEvent& event);
\r
378 class CViewOrderDialog : public CViewOrderDialogBase
\r
382 void OnButtonOK(wxCommandEvent& event);
\r
386 CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived);
\r
394 class CEditReviewDialog : public CEditReviewDialogBase
\r
398 void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
\r
399 void OnButtonSubmit(wxCommandEvent& event);
\r
400 void OnButtonCancel(wxCommandEvent& event);
\r
404 CEditReviewDialog(wxWindow* parent);
\r
407 void GetReview(CReview& review);
\r
412 class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
\r
416 void OnButtonOK(wxCommandEvent& event) { EndModal(true); }
\r
417 void OnButtonCancel(wxCommandEvent& event) { EndModal(false); }
\r
418 void OnClose(wxCloseEvent& event) { EndModal(false); }
\r
420 void OnKeyDown(wxKeyEvent& event)
\r
422 if (event.GetKeyCode() == '\r' || event.GetKeyCode() == WXK_NUMPAD_ENTER)
\r
425 HandleCtrlA(event);
\r
430 CGetTextFromUserDialog(wxWindow* parent,
\r
431 const string& strCaption,
\r
432 const string& strMessage1,
\r
433 const string& strValue1="",
\r
434 const string& strMessage2="",
\r
435 const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
\r
437 m_staticTextMessage1->SetLabel(strMessage1);
\r
438 m_textCtrl1->SetValue(strValue1);
\r
439 if (!strMessage2.empty())
\r
441 m_staticTextMessage2->Show(true);
\r
442 m_staticTextMessage2->SetLabel(strMessage2);
\r
443 m_textCtrl2->Show(true);
\r
444 m_textCtrl2->SetValue(strValue2);
\r
445 SetSize(wxDefaultCoord, 180);
\r
450 string GetValue() { return (string)m_textCtrl1->GetValue(); }
\r
451 string GetValue1() { return (string)m_textCtrl1->GetValue(); }
\r
452 string GetValue2() { return (string)m_textCtrl2->GetValue(); }
\r
457 class CBitcoinTBIcon : public wxTaskBarIcon
\r
463 void OnLeftButtonDClick(wxTaskBarIconEvent&);
\r
464 void OnMenuExit(wxCommandEvent&);
\r
465 void OnMenuGenerate(wxCommandEvent&);
\r
466 void OnMenuRestore(wxCommandEvent&);
\r
471 void UpdateTooltip();
\r
472 virtual wxMenu *CreatePopupMenu();
\r
474 DECLARE_EVENT_TABLE()
\r