KissCount/src/view/AccountPanel.h

99 lines
2.9 KiB
C
Raw Normal View History

2010-07-10 16:34:30 +02:00
/*
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 <http://www.gnu.org/licenses/>.
*/
#ifndef ACCOUNTPANEL_H
#define ACCOUNTPANEL_H
#include <wx/wx.h>
#include <wx/grid.h>
#include <wx/treectrl.h>
#include <wx/pie/pieplot.h>
#include <wx/chartpanel.h>
#include <wx/scrolwin.h>
2010-06-02 22:14:11 +02:00
#include "CalendarEditor.h"
2010-06-16 17:29:07 +02:00
#include "wxGridCellBitmapRenderer.h"
2010-05-16 20:09:18 +02:00
#define OWN_CYAN wxColour(0x99, 0xCC, 0xFF)
#define OWN_YELLOW wxColour(0xFF, 0xFF, 0x99)
#define OWN_GREEN wxColour(0x3D, 0xEB, 0x3D)
2010-07-03 11:19:02 +02:00
#define DEFAULT_FONT_NAME wxT("Liberation Sans")
2010-05-16 20:09:18 +02:00
#define DEFAULT_FONT_SIZE 12
2010-05-27 22:32:35 +02:00
#define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME);
2010-05-16 20:09:18 +02:00
#define DELETE_ICON "ressources/icons/process-stop.png"
#define CHECKED_ICON "ressources/icons/tick-icon.png"
2010-06-16 17:29:07 +02:00
#include <controller/KissCount.h>
#include "wxUI.h"
2010-05-16 10:35:34 +02:00
#include <model/model.h>
#include "GridAccount.h"
2010-05-24 20:14:15 +02:00
#include <wx/category/categorysimpledataset.h>
class wxUI;
class KissCount;
class AccountPanel: public wxScrolledWindow
{
2010-07-04 16:33:25 +02:00
public:
AccountPanel(KissCount* kiss, wxUI *parent);
2010-05-27 21:09:02 +02:00
~AccountPanel();
2010-05-16 10:35:34 +02:00
void ChangeUser();
2010-06-22 20:46:30 +02:00
void LoadYear(int year, bool showMonth=true);
2010-06-23 19:32:42 +02:00
void ShowMonth(int month, int year);
void GenerateMonth(int month, int year);
2010-06-02 22:14:11 +02:00
void OnOperationModified(wxGridEvent& event);
2010-06-12 15:59:27 +02:00
void OnAccountModified(wxGridEvent& event);
2010-06-22 15:51:51 +02:00
void OnTreeRightClick(wxTreeEvent& event);
void OnTreeChange(wxTreeEvent& event);
2010-06-23 14:25:00 +02:00
void OnMenuGenerate(wxCommandEvent& event);
void OnMenuDelete(wxCommandEvent& event);
2010-06-27 21:39:49 +02:00
void OnShow(wxShowEvent& event);
2010-06-29 21:43:29 +02:00
void OnCalendarChange(wxCalendarEvent& event);
2010-06-27 21:39:49 +02:00
int _curMonth, _curYear;
2010-06-02 22:14:11 +02:00
2010-07-04 16:33:25 +02:00
private:
KissCount* _kiss;
wxUI* _wxUI;
2010-06-27 21:44:24 +02:00
wxTreeCtrl _tree;
2010-06-29 21:43:29 +02:00
wxCalendarCtrl* _calendar;
2010-05-16 20:09:18 +02:00
GridAccount* _grid;
2010-06-02 22:14:11 +02:00
wxGrid *_statsGrid, *_accountsGrid;
PiePlot* _pie;
2010-05-27 21:09:02 +02:00
double *_categoriesValues;
2010-06-21 13:02:02 +02:00
std::map<wxString, int> _categoriesIndexes;
2010-07-03 11:48:53 +02:00
std::vector<Operation>* _curOperations;
2010-05-27 21:09:02 +02:00
wxString* _categories, *_accounts;
2010-06-02 22:14:11 +02:00
std::map<wxString, double> _accountsInitValues;
2010-05-27 21:09:02 +02:00
CategorySimpleDataset* _dataset;
2010-06-02 22:14:11 +02:00
int _fixCosts;
2010-05-27 21:09:02 +02:00
2010-06-02 22:14:11 +02:00
void InitStatsGrid(User* user);
void InitAccountsGrid(User* user, int month, int year);
2010-05-27 22:32:35 +02:00
void UpdateStats();
2010-07-03 11:48:53 +02:00
void InsertOperation(User* user, Operation* op, int line, bool fix);
2010-06-24 21:02:42 +02:00
void GetTreeSelection(int* month, int* year);
2010-06-02 22:14:11 +02:00
DECLARE_EVENT_TABLE();
};
#endif