-
Notifications
You must be signed in to change notification settings - Fork 5
/
AccountPage.cpp
79 lines (63 loc) · 2.75 KB
/
AccountPage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/******************************************************************************
* wxVcashGUI: a GUI for Vcash, a decentralized currency
* for the internet (https://vcash.info).
*
* Copyright (c) The Vcash Developers
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
******************************************************************************/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/sizer.h>
#include <wx/stattext.h>
#endif
#include "AccountPage.h"
#include "VcashApp.h"
using namespace wxGUI;
AccountPage::AccountPage(VcashApp &vcashApp, wxWindow &parent) : wxPanel(&parent) {
vcashApp.view.accountPage = this;
balance = new wxStaticText(this, wxID_ANY, wxT("0"));
unconfirmed = new wxStaticText(this, wxID_ANY, wxT("0"));
stake = new wxStaticText(this, wxID_ANY, wxT("0"));
immature = new wxStaticText(this, wxID_ANY, wxT("0"));
balance->SetToolTip(wxT("Your confirmed balance"));
unconfirmed->SetToolTip(wxT("Your unconfirmed balance"));
stake->SetToolTip(wxT("Your staking balance"));
immature->SetToolTip(wxT("Your immature balance"));
const int cols = 2, vgap = 10, hgap = 20;
wxSizer *gridSizer = new wxGridSizer(cols, vgap, hgap);
gridSizer->Add(new wxStaticText(this, wxID_ANY, wxT("Balance:")), wxSizerFlags().Right());
gridSizer->Add(balance, wxSizerFlags().Left());
gridSizer->Add(new wxStaticText(this, wxID_ANY, wxT("Unconfirmed:")), wxSizerFlags().Right());
gridSizer->Add(unconfirmed, wxSizerFlags().Left());
gridSizer->Add(new wxStaticText(this, wxID_ANY, wxT("Stake:")), wxSizerFlags().Right());
gridSizer->Add(stake, wxSizerFlags().Left());
gridSizer->Add(new wxStaticText(this, wxID_ANY, wxT("Immature:")), wxSizerFlags().Right());
gridSizer->Add(immature, wxSizerFlags().Left());
wxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
sizerV->AddSpacer(vgap);
sizerV->Add(gridSizer, wxSizerFlags().Border(wxALL, hgap).Center());
SetSizerAndFit(sizerV);
#if !defined (__WXOSX__)
// This windows doesn't accept focus as it only shows information
Bind(wxEVT_SET_FOCUS, [&parent](wxFocusEvent &ev) {
parent.SetFocus();
ev.Skip();
});
#endif
}
void AccountPage::setBalance(const std::string &balance) {
this->balance->SetLabel(wxString(balance));
}
void AccountPage::setUnconfirmed(const std::string &unconfirmed) {
this->unconfirmed->SetLabel(wxString(unconfirmed));
}
void AccountPage::setStake(const std::string &stake) {
this->stake->SetLabel(wxString(stake));
}
void AccountPage::setImmature(const std::string &immature) {
this->immature->SetLabel(wxString(immature));
}