Research
Timechain
Search Donate
Sponsors
Cake Wallet, private Bitcoin and Monero walletSideShift.ai, no-signup crypto exchangeOrangeRock, non-custodial bitcoin spot and perps tradingBraiins Hashpower, buy and sell Bitcoin hashrateeCash.com
Bitcoin v0.1.3 · 2009-01-12

ui.h

418 lines · plain text · MIT license (license.txt)
1// Copyright (c) 2009 Satoshi Nakamoto2// Distributed under the MIT/X11 software license, see the accompanying3// file license.txt or http://www.opensource.org/licenses/mit-license.php.45678DECLARE_EVENT_TYPE(wxEVT_CROSSTHREADCALL, -1)9DECLARE_EVENT_TYPE(wxEVT_REPLY1, -1)10DECLARE_EVENT_TYPE(wxEVT_REPLY2, -1)11DECLARE_EVENT_TYPE(wxEVT_REPLY3, -1)12DECLARE_EVENT_TYPE(wxEVT_TABLEADDED, -1)13DECLARE_EVENT_TYPE(wxEVT_TABLEUPDATED, -1)14DECLARE_EVENT_TYPE(wxEVT_TABLEDELETED, -1)1516enum17{18    UICALL_ADDORDER = 1,19    UICALL_UPDATEORDER,20};21222324extern void HandleCtrlA(wxKeyEvent& event);25extern string DateTimeStr(int64 nTime);26extern string FormatTxStatus(const CWalletTx& wtx);27extern void CrossThreadCall(int nID, void* pdata);28extern void MainFrameRepaint();29extern void Shutdown(void* parg);30313233343536class CMainFrame : public CMainFrameBase37{38protected:39    // Event handlers40    void OnClose(wxCloseEvent& event);41    void OnMouseEvents(wxMouseEvent& event);42    void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }43    void OnIdle(wxIdleEvent& event);44    void OnPaint(wxPaintEvent& event);45    void OnPaintListCtrl(wxPaintEvent& event);46    void OnMenuFileExit(wxCommandEvent& event);47    void OnMenuOptionsGenerate(wxCommandEvent& event);48    void OnMenuOptionsOptions(wxCommandEvent& event);49    void OnMenuHelpAbout(wxCommandEvent& event);50    void OnButtonSend(wxCommandEvent& event);51    void OnButtonAddressBook(wxCommandEvent& event);52    void OnSetFocusAddress(wxFocusEvent& event);53    void OnMouseEventsAddress(wxMouseEvent& event);54    void OnButtonCopy(wxCommandEvent& event);55    void OnButtonChange(wxCommandEvent& event);56    void OnListColBeginDrag(wxListEvent& event);57    void OnListItemActivatedAllTransactions(wxListEvent& event);58    void OnListItemActivatedProductsSent(wxListEvent& event);59    void OnListItemActivatedOrdersSent(wxListEvent& event);60    void OnListItemActivatedOrdersReceived(wxListEvent& event);61	62public:63    /** Constructor */64    CMainFrame(wxWindow* parent);65    ~CMainFrame();6667    // Custom68    bool fRefreshListCtrl;69    bool fRefreshListCtrlRunning;70    bool fOnSetFocusAddress;71    CBlockIndex* pindexBestLast;72    set<uint256> setUnmaturedDisplayed;7374    void OnCrossThreadCall(wxCommandEvent& event);75    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);76    void InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);77    void RefreshListCtrl();78    void RefreshStatus();79};8081828384class CTxDetailsDialog : public CTxDetailsDialogBase85{86protected:87    // Event handlers88    void OnButtonOK(wxCommandEvent& event);8990public:91    /** Constructor */92    CTxDetailsDialog(wxWindow* parent, CWalletTx wtx);9394    // State95    CWalletTx wtx;96};979899100class COptionsDialog : public COptionsDialogBase101{102protected:103    // Event handlers104    void OnKillFocusTransactionFee(wxFocusEvent& event);105    void OnButtonOK(wxCommandEvent& event);106    void OnButtonCancel(wxCommandEvent& event);107108public:109    /** Constructor */110    COptionsDialog(wxWindow* parent);111};112113114115class CAboutDialog : public CAboutDialogBase116{117protected:118    // Event handlers119    void OnButtonOK(wxCommandEvent& event);120121public:122    /** Constructor */123    CAboutDialog(wxWindow* parent);124};125126127128class CSendDialog : public CSendDialogBase129{130protected:131    // Event handlers132    void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }133    void OnTextAddress(wxCommandEvent& event);134    void OnKillFocusAmount(wxFocusEvent& event);135    void OnButtonAddressBook(wxCommandEvent& event);136    void OnButtonPaste(wxCommandEvent& event);137    void OnButtonSend(wxCommandEvent& event);138    void OnButtonCancel(wxCommandEvent& event);139	140public:141    /** Constructor */142    CSendDialog(wxWindow* parent, const wxString& strAddress="");143};144145146147class CSendingDialog : public CSendingDialogBase148{149public:150    // Event handlers151    void OnClose(wxCloseEvent& event);152    void OnButtonOK(wxCommandEvent& event);153    void OnButtonCancel(wxCommandEvent& event);154    void OnPaint(wxPaintEvent& event);155	156public:157    /** Constructor */158    CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn);159    ~CSendingDialog();160161    // State162    CAddress addr;163    int64 nPrice;164    CWalletTx wtx;165    wxDateTime start;166    string strStatus;167    bool fCanCancel;168    bool fAbort;169    bool fSuccess;170    bool fUIDone;171    bool fWorkDone;172173    void Close();174    void Repaint();175    bool Status();176    bool Status(const string& str);177    bool Error(const string& str);178    void StartTransfer();179    void OnReply2(CDataStream& vRecv);180    void OnReply3(CDataStream& vRecv);181};182183void SendingDialogStartTransfer(void* parg);184void SendingDialogOnReply2(void* parg, CDataStream& vRecv);185void SendingDialogOnReply3(void* parg, CDataStream& vRecv);186187188189class CYourAddressDialog : public CYourAddressDialogBase190{191protected:192    // Event handlers193    void OnListEndLabelEdit(wxListEvent& event);194    void OnListItemSelected(wxListEvent& event);195    void OnListItemActivated(wxListEvent& event);196    void OnButtonRename(wxCommandEvent& event);197    void OnButtonNew(wxCommandEvent& event);198    void OnButtonCopy(wxCommandEvent& event);199    void OnButtonOK(wxCommandEvent& event);200    void OnButtonCancel(wxCommandEvent& event);201    void OnClose(wxCloseEvent& event);202203public:204    /** Constructor */205    CYourAddressDialog(wxWindow* parent);206    CYourAddressDialog(wxWindow* parent, const string& strInitSelected);207208    // Custom209    wxString GetAddress();210};211212213214class CAddressBookDialog : public CAddressBookDialogBase215{216protected:217    // Event handlers218    void OnListEndLabelEdit(wxListEvent& event);219    void OnListItemSelected(wxListEvent& event);220    void OnListItemActivated(wxListEvent& event);221    void OnButtonEdit(wxCommandEvent& event);222    void OnButtonDelete(wxCommandEvent& event);223    void OnButtonNew(wxCommandEvent& event);224    void OnButtonCopy(wxCommandEvent& event);225    void OnButtonOK(wxCommandEvent& event);226    void OnButtonCancel(wxCommandEvent& event);227    void OnClose(wxCloseEvent& event);228229public:230    /** Constructor */231    CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);232233    // Custom234    bool fSending;235    wxString GetAddress();236};237238239240class CProductsDialog : public CProductsDialogBase241{242protected:243    // Event handlers244    void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }245    void OnCombobox(wxCommandEvent& event);246    void OnButtonSearch(wxCommandEvent& event);247    void OnListItemActivated(wxListEvent& event);248249public:250    /** Constructor */251    CProductsDialog(wxWindow* parent);252253    // Custom254    vector<CProduct> m_vProduct;255};256257258259class CEditProductDialog : public CEditProductDialogBase260{261protected:262    // Event handlers263    void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }264    void OnButtonDel0(wxCommandEvent& event);265    void OnButtonDel1(wxCommandEvent& event);266    void OnButtonDel2(wxCommandEvent& event);267    void OnButtonDel3(wxCommandEvent& event);268    void OnButtonDel4(wxCommandEvent& event);269    void OnButtonDel5(wxCommandEvent& event);270    void OnButtonDel6(wxCommandEvent& event);271    void OnButtonDel7(wxCommandEvent& event);272    void OnButtonDel8(wxCommandEvent& event);273    void OnButtonDel9(wxCommandEvent& event);274    void OnButtonDel10(wxCommandEvent& event);275    void OnButtonDel11(wxCommandEvent& event);276    void OnButtonDel12(wxCommandEvent& event);277    void OnButtonDel13(wxCommandEvent& event);278    void OnButtonDel14(wxCommandEvent& event);279    void OnButtonDel15(wxCommandEvent& event);280    void OnButtonDel16(wxCommandEvent& event);281    void OnButtonDel17(wxCommandEvent& event);282    void OnButtonDel18(wxCommandEvent& event);283    void OnButtonDel19(wxCommandEvent& event);284    void OnButtonAddField(wxCommandEvent& event);285    void OnButtonSend(wxCommandEvent& event);286    void OnButtonPreview(wxCommandEvent& event);287    void OnButtonCancel(wxCommandEvent& event);288289public:290    /** Constructor */291    CEditProductDialog(wxWindow* parent);292293    // Custom294    enum { FIELDS_MAX = 20 };295    wxTextCtrl* m_textCtrlLabel[FIELDS_MAX];296    wxTextCtrl* m_textCtrlField[FIELDS_MAX];297    wxButton*   m_buttonDel[FIELDS_MAX];298299    void LayoutAll();300    void ShowLine(int i, bool fShow=true);301    void OnButtonDel(wxCommandEvent& event, int n);302    void SetProduct(const CProduct& productIn);303    void GetProduct(CProduct& product);304305};306307308309class CViewProductDialog : public CViewProductDialogBase310{311protected:312    // Event handlers313    void OnButtonSubmitForm(wxCommandEvent& event);314    void OnButtonCancelForm(wxCommandEvent& event);315    void OnButtonBack(wxCommandEvent& event);316    void OnButtonNext(wxCommandEvent& event);317    void OnButtonCancel(wxCommandEvent& event);318319public:320    /** Constructor */321    CViewProductDialog(wxWindow* parent, const CProduct& productIn);322    ~CViewProductDialog();323324    // Custom325    CProduct product;326    enum { FIELDS_MAX = 20 };327    wxStaticText* m_staticTextLabel[FIELDS_MAX];328    wxTextCtrl*   m_textCtrlField[FIELDS_MAX];329    wxChoice*     m_choiceField[FIELDS_MAX];330331    void GetOrder(CWalletTx& order);332    void UpdateProductDisplay(bool fDetails);333    void OnReply1(wxCommandEvent& event);334};335336337338class CViewOrderDialog : public CViewOrderDialogBase339{340protected:341    // Event handlers342    void OnButtonOK(wxCommandEvent& event);343344public:345    /** Constructor */346    CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived);347348    // Custom349    bool fReceived;350};351352353354class CEditReviewDialog : public CEditReviewDialogBase355{356protected:357    // Event handlers358    void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }359    void OnButtonSubmit(wxCommandEvent& event);360    void OnButtonCancel(wxCommandEvent& event);361362public:363    /** Constructor */364    CEditReviewDialog(wxWindow* parent);365366    // Custom367    void GetReview(CReview& review);368};369370371372class CGetTextFromUserDialog : public CGetTextFromUserDialogBase373{374protected:375    // Event handlers376    void OnButtonOK(wxCommandEvent& event)     { EndModal(true); }377    void OnButtonCancel(wxCommandEvent& event) { EndModal(false); }378    void OnClose(wxCloseEvent& event)          { EndModal(false); }379380    void OnKeyDown(wxKeyEvent& event)381    {382        if (event.GetKeyCode() == '\r' || event.GetKeyCode() == WXK_NUMPAD_ENTER)383            EndModal(true);384        else385            HandleCtrlA(event);386    }387388public:389    /** Constructor */390    CGetTextFromUserDialog(wxWindow* parent,391                           const string& strCaption,392                           const string& strMessage1,393                           const string& strValue1="",394                           const string& strMessage2="",395                           const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)396    {397        m_staticTextMessage1->SetLabel(strMessage1);398        m_textCtrl1->SetValue(strValue1);399        if (!strMessage2.empty())400        {401            m_staticTextMessage2->Show(true);402            m_staticTextMessage2->SetLabel(strMessage2);403            m_textCtrl2->Show(true);404            m_textCtrl2->SetValue(strValue2);405            SetSize(wxDefaultCoord, 180);406        }407    }408409    // Custom410    string GetValue()  { return (string)m_textCtrl1->GetValue(); }411    string GetValue1() { return (string)m_textCtrl1->GetValue(); }412    string GetValue2() { return (string)m_textCtrl2->GetValue(); }413};414415416417418

Click a line number to link to it; use #L10-L20 for a range. "=" next to a version means the file is identical there.

0:000:00