2010-07-10 16:34:30 +02:00
|
|
|
/*
|
2010-08-26 21:28:15 +02:00
|
|
|
Copyright 2010 Grégory Soutadé
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
This file is part of KissCount.
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
KissCount is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
KissCount 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. See the
|
|
|
|
GNU General Public License for more details.
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
2010-07-10 16:34:30 +02:00
|
|
|
*/
|
|
|
|
|
2010-05-14 15:04:01 +02:00
|
|
|
#include "ButtonPanel.h"
|
|
|
|
|
2010-07-04 16:33:25 +02:00
|
|
|
enum {BUTTON_ACCOUNT_ID=1, BUTTON_STATS_ID, BUTTON_SEARCH_ID, BUTTON_PREFS_ID, BUTTON_CHANGE_USER_ID, BUTTON_ABOUT_ID, BUTTON_QUIT_ID};
|
2010-05-14 15:04:01 +02:00
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(ButtonPanel, wxPanel)
|
2010-07-04 16:33:25 +02:00
|
|
|
EVT_BUTTON(BUTTON_ACCOUNT_ID, ButtonPanel::OnButtonAccount)
|
2010-08-17 18:59:19 +02:00
|
|
|
EVT_BUTTON(BUTTON_STATS_ID, ButtonPanel::OnButtonStats)
|
2010-07-14 11:15:48 +02:00
|
|
|
EVT_BUTTON(BUTTON_SEARCH_ID, ButtonPanel::OnButtonSearch)
|
2010-07-04 16:33:25 +02:00
|
|
|
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)
|
2010-05-14 15:04:01 +02:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent)
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
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());
|
2010-05-14 15:04:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ButtonPanel::~ButtonPanel()
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
delete _account;
|
|
|
|
delete _stats;
|
|
|
|
delete _prefs;
|
|
|
|
delete _changeUser;
|
2010-05-14 15:04:01 +02:00
|
|
|
}
|
|
|
|
|
2010-05-17 18:03:21 +02:00
|
|
|
void ButtonPanel::OnButtonAccount(wxCommandEvent& event)
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
_wxUI->ShowAccount();
|
2010-05-17 18:03:21 +02:00
|
|
|
}
|
|
|
|
|
2010-08-17 18:59:19 +02:00
|
|
|
void ButtonPanel::OnButtonStats(wxCommandEvent& event)
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
_wxUI->ShowStats();
|
2010-08-17 18:59:19 +02:00
|
|
|
}
|
|
|
|
|
2010-07-14 11:15:48 +02:00
|
|
|
void ButtonPanel::OnButtonSearch(wxCommandEvent& event)
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
_wxUI->ShowSearch();
|
2010-07-14 11:15:48 +02:00
|
|
|
}
|
|
|
|
|
2010-05-17 18:03:21 +02:00
|
|
|
void ButtonPanel::OnButtonPreferences(wxCommandEvent& event)
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
_wxUI->ShowPreferences();
|
2010-05-17 18:03:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ButtonPanel::OnButtonChangeUser(wxCommandEvent& event)
|
2010-05-14 15:04:01 +02:00
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
_wxUI->ChangeUser();
|
2010-05-14 15:04:01 +02:00
|
|
|
}
|
2010-07-03 16:14:05 +02:00
|
|
|
|
|
|
|
void ButtonPanel::OnButtonAbout(wxCommandEvent& event)
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
wxMessageBox( _("Personal accounting software\n\nCopyright (C) 2010 Grégory Soutadé"),
|
2010-08-14 22:04:03 +02:00
|
|
|
wxT("KissCount " APP_VERSION "\n\n"),
|
2010-07-03 16:14:05 +02:00
|
|
|
wxOK | wxICON_INFORMATION, _wxUI );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ButtonPanel::OnButtonQuit(wxCommandEvent& event)
|
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
wxMessageDialog dialog(_wxUI, _("Quit KissCount ?"), wxT("KissCount"), wxYES_NO);
|
|
|
|
if (dialog.ShowModal() == wxID_NO)
|
2010-07-03 16:14:05 +02:00
|
|
|
{
|
2010-08-26 21:28:15 +02:00
|
|
|
return;
|
2010-07-03 16:14:05 +02:00
|
|
|
}
|
2010-08-26 21:28:15 +02:00
|
|
|
_wxUI->Close(true);
|
2010-07-03 16:14:05 +02:00
|
|
|
}
|