Merge pull request #190 from johnmaguire2013/tray.

Added balance to tooltip and send coin option to tray menu
This commit is contained in:
Gavin Andresen 2011-05-03 08:16:13 -07:00
commit 8737e1ee20
2 changed files with 15 additions and 3 deletions

17
ui.cpp
View file

@ -1859,6 +1859,7 @@ CSendDialog::CSendDialog(wxWindow* parent, const wxString& strAddress) : CSendDi
m_bitmapCheckMark->Show(false); m_bitmapCheckMark->Show(false);
fEnabledPrev = true; fEnabledPrev = true;
m_textCtrlAddress->SetFocus(); m_textCtrlAddress->SetFocus();
//// todo: should add a display of your balance for convenience //// todo: should add a display of your balance for convenience
#ifndef __WXMSW__ #ifndef __WXMSW__
wxFont fontTmp = m_staticTextInstructions->GetFont(); wxFont fontTmp = m_staticTextInstructions->GetFont();
@ -1867,7 +1868,7 @@ CSendDialog::CSendDialog(wxWindow* parent, const wxString& strAddress) : CSendDi
m_staticTextInstructions->SetFont(fontTmp); m_staticTextInstructions->SetFont(fontTmp);
SetSize(725, 180); SetSize(725, 180);
#endif #endif
// Set Icon // Set Icon
wxIcon iconSend; wxIcon iconSend;
iconSend.CopyFromBitmap(wxBitmap(send16noshadow_xpm)); iconSend.CopyFromBitmap(wxBitmap(send16noshadow_xpm));
@ -2605,6 +2606,7 @@ void CAddressBookDialog::OnClose(wxCloseEvent& event)
enum enum
{ {
ID_TASKBAR_RESTORE = 10001, ID_TASKBAR_RESTORE = 10001,
ID_TASKBAR_SEND,
ID_TASKBAR_OPTIONS, ID_TASKBAR_OPTIONS,
ID_TASKBAR_GENERATE, ID_TASKBAR_GENERATE,
ID_TASKBAR_EXIT, ID_TASKBAR_EXIT,
@ -2613,6 +2615,7 @@ enum
BEGIN_EVENT_TABLE(CMyTaskBarIcon, wxTaskBarIcon) BEGIN_EVENT_TABLE(CMyTaskBarIcon, wxTaskBarIcon)
EVT_TASKBAR_LEFT_DCLICK(CMyTaskBarIcon::OnLeftButtonDClick) EVT_TASKBAR_LEFT_DCLICK(CMyTaskBarIcon::OnLeftButtonDClick)
EVT_MENU(ID_TASKBAR_RESTORE, CMyTaskBarIcon::OnMenuRestore) EVT_MENU(ID_TASKBAR_RESTORE, CMyTaskBarIcon::OnMenuRestore)
EVT_MENU(ID_TASKBAR_SEND, CMyTaskBarIcon::OnMenuSend)
EVT_MENU(ID_TASKBAR_OPTIONS, CMyTaskBarIcon::OnMenuOptions) EVT_MENU(ID_TASKBAR_OPTIONS, CMyTaskBarIcon::OnMenuOptions)
EVT_MENU(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnMenuGenerate) EVT_MENU(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnMenuGenerate)
EVT_UPDATE_UI(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnUpdateUIGenerate) EVT_UPDATE_UI(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnUpdateUIGenerate)
@ -2624,9 +2627,9 @@ void CMyTaskBarIcon::Show(bool fShow)
static char pszPrevTip[200]; static char pszPrevTip[200];
if (fShow) if (fShow)
{ {
string strTooltip = _("Bitcoin"); string strTooltip = strprintf(_("Balance: %s"), FormatMoney(GetBalance()).c_str());
if (fGenerateBitcoins) if (fGenerateBitcoins)
strTooltip = _("Bitcoin - Generating"); strTooltip = strprintf(_("Bitcoin - Generating (Balance: %s)"), FormatMoney(GetBalance()).c_str());
if (fGenerateBitcoins && vNodes.empty()) if (fGenerateBitcoins && vNodes.empty())
strTooltip = _("Bitcoin - (not connected)"); strTooltip = _("Bitcoin - (not connected)");
@ -2665,6 +2668,13 @@ void CMyTaskBarIcon::OnMenuRestore(wxCommandEvent& event)
Restore(); Restore();
} }
void CMyTaskBarIcon::OnMenuSend(wxCommandEvent& event)
{
// Taskbar: Send
CSendDialog dialog(pframeMain);
dialog.ShowModal();
}
void CMyTaskBarIcon::OnMenuOptions(wxCommandEvent& event) void CMyTaskBarIcon::OnMenuOptions(wxCommandEvent& event)
{ {
// Since it's modal, get the main window to do it // Since it's modal, get the main window to do it
@ -2706,6 +2716,7 @@ wxMenu* CMyTaskBarIcon::CreatePopupMenu()
{ {
wxMenu* pmenu = new wxMenu; wxMenu* pmenu = new wxMenu;
pmenu->Append(ID_TASKBAR_RESTORE, _("&Open Bitcoin")); pmenu->Append(ID_TASKBAR_RESTORE, _("&Open Bitcoin"));
pmenu->Append(ID_TASKBAR_SEND, _("&Send Bitcoins"));
pmenu->Append(ID_TASKBAR_OPTIONS, _("O&ptions...")); pmenu->Append(ID_TASKBAR_OPTIONS, _("O&ptions..."));
pmenu->AppendCheckItem(ID_TASKBAR_GENERATE, _("&Generate Coins"))->Check(fGenerateBitcoins); pmenu->AppendCheckItem(ID_TASKBAR_GENERATE, _("&Generate Coins"))->Check(fGenerateBitcoins);
#ifndef __WXMAC_OSX__ // Mac has built-in quit menu #ifndef __WXMAC_OSX__ // Mac has built-in quit menu

1
ui.h
View file

@ -323,6 +323,7 @@ protected:
// Event handlers // Event handlers
void OnLeftButtonDClick(wxTaskBarIconEvent& event); void OnLeftButtonDClick(wxTaskBarIconEvent& event);
void OnMenuRestore(wxCommandEvent& event); void OnMenuRestore(wxCommandEvent& event);
void OnMenuSend(wxCommandEvent& event);
void OnMenuOptions(wxCommandEvent& event); void OnMenuOptions(wxCommandEvent& event);
void OnUpdateUIGenerate(wxUpdateUIEvent& event); void OnUpdateUIGenerate(wxUpdateUIEvent& event);
void OnMenuGenerate(wxCommandEvent& event); void OnMenuGenerate(wxCommandEvent& event);