/* Copyright 2010 Grégory Soutadé This file is part of KissCount. 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. 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. You should have received a copy of the GNU General Public License along with KissCount. If not, see . */ #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_STATS_ID, ButtonPanel::OnButtonStats) EVT_BUTTON(BUTTON_SEARCH_ID, ButtonPanel::OnButtonSearch) 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::OnButtonStats(wxCommandEvent& event) { _wxUI->ShowStats(); } void ButtonPanel::OnButtonSearch(wxCommandEvent& event) { _wxUI->ShowSearch(); } void ButtonPanel::OnButtonPreferences(wxCommandEvent& event) { _wxUI->ShowPreferences(); } void ButtonPanel::OnButtonChangeUser(wxCommandEvent& event) { _wxUI->ChangeUser(); } void ButtonPanel::OnButtonAbout(wxCommandEvent& event) { wxMessageBox( _("Personal accounting software\n\nCopyright (C) 2010 Grégory Soutadé"), wxT("KissCount " APP_VERSION "\n\n"), 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); }