Move directories, fix a bug into month generation (tree), add tooltips
This commit is contained in:
84
src/view/ButtonPanel.cpp
Normal file
84
src/view/ButtonPanel.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
#include "ButtonPanel.h"
|
||||
|
||||
enum {BUTTON_ACCOUNT_ID=1, BUTTON_STATS_ID, BUTTON_SEARCH_ID, BUTTON_PREFS_ID, BUTTON_CHANGE_USER_ID, BUTTON_ABOUT_ID, BUTTON_QUIT_ID};
|
||||
|
||||
BEGIN_EVENT_TABLE(ButtonPanel, wxPanel)
|
||||
EVT_BUTTON(BUTTON_ACCOUNT_ID, ButtonPanel::OnButtonAccount)
|
||||
EVT_BUTTON(BUTTON_PREFS_ID, ButtonPanel::OnButtonPreferences)
|
||||
EVT_BUTTON(BUTTON_CHANGE_USER_ID, ButtonPanel::OnButtonChangeUser)
|
||||
EVT_BUTTON(BUTTON_ABOUT_ID, ButtonPanel::OnButtonAbout)
|
||||
EVT_BUTTON(BUTTON_QUIT_ID, ButtonPanel::OnButtonQuit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent)
|
||||
{
|
||||
wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
|
||||
_account = new wxBitmapButton(this, BUTTON_ACCOUNT_ID, wxBitmap(wxT(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
_stats = new wxBitmapButton(this, BUTTON_STATS_ID, wxBitmap(wxT(STATS_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
_search = new wxBitmapButton(this, BUTTON_SEARCH_ID, wxBitmap(wxT(SEARCH_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
_prefs = new wxBitmapButton(this, BUTTON_PREFS_ID, wxBitmap(wxT(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
_changeUser = new wxBitmapButton(this, BUTTON_CHANGE_USER_ID, wxBitmap(wxT(CHANGE_USER_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
_about = new wxBitmapButton(this, BUTTON_ABOUT_ID, wxBitmap(wxT(ABOUT_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
_quit = new wxBitmapButton(this, BUTTON_QUIT_ID, wxBitmap(wxT(QUIT_ICON)), wxDefaultPosition, wxSize(128, 128));
|
||||
|
||||
SetSizer(hbox);
|
||||
|
||||
_account->SetToolTip(_("Operations"));
|
||||
_stats->SetToolTip(_("Statistics"));
|
||||
_search->SetToolTip(_("Search"));
|
||||
_prefs->SetToolTip(_("Preferences"));
|
||||
_changeUser->SetToolTip(_("Change user"));
|
||||
_about->SetToolTip(_("About"));
|
||||
_quit->SetToolTip(_("Quit"));
|
||||
|
||||
hbox->Add(_account);
|
||||
hbox->Add(_stats);
|
||||
hbox->Add(_search);
|
||||
hbox->Add(_prefs);
|
||||
hbox->Add(_changeUser);
|
||||
hbox->Add(_about);
|
||||
hbox->Add(_quit);
|
||||
|
||||
Fit();
|
||||
SetMinSize(GetSize());
|
||||
}
|
||||
|
||||
ButtonPanel::~ButtonPanel()
|
||||
{
|
||||
delete _account;
|
||||
delete _stats;
|
||||
delete _prefs;
|
||||
delete _changeUser;
|
||||
}
|
||||
|
||||
void ButtonPanel::OnButtonAccount(wxCommandEvent& event)
|
||||
{
|
||||
_wxUI->ShowAccount();
|
||||
}
|
||||
|
||||
void ButtonPanel::OnButtonPreferences(wxCommandEvent& event)
|
||||
{
|
||||
_wxUI->ShowPreferences();
|
||||
}
|
||||
|
||||
void ButtonPanel::OnButtonChangeUser(wxCommandEvent& event)
|
||||
{
|
||||
_wxUI->ChangeUser();
|
||||
}
|
||||
|
||||
void ButtonPanel::OnButtonAbout(wxCommandEvent& event)
|
||||
{
|
||||
wxMessageBox( _("KissCount v0.1\n\nPersonal accounting software\n\nCopyright (C) 2010 Grégory Soutadé"),
|
||||
wxT("KissCount"),
|
||||
wxOK | wxICON_INFORMATION, _wxUI );
|
||||
}
|
||||
|
||||
void ButtonPanel::OnButtonQuit(wxCommandEvent& event)
|
||||
{
|
||||
wxMessageDialog dialog(_wxUI, _("Quit KissCount ?"), wxT("KissCount"), wxYES_NO);
|
||||
if (dialog.ShowModal() == wxID_NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_wxUI->Close(true);
|
||||
}
|
Reference in New Issue
Block a user