KissCount/view/AccountPanel.h
2010-06-16 19:15:49 +02:00

74 lines
2.1 KiB
C++

#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 "CalendarEditor.h"
#include "wxGridCellBitmapRenderer.h"
#define OWN_CYAN wxColour(0x99, 0xCC, 0xFF)
#define OWN_YELLOW wxColour(0xFF, 0xFF, 0x99)
#define OWN_GREEN wxColour(0x3D, 0xEB, 0x3D)
#define DEFAULT_FONT_NAME _("Liberation Sans")
#define DEFAULT_FONT_SIZE 12
#define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME);
enum {DESCRIPTION, DATE, DEBIT, CREDIT, CATEGORY, ACCOUNT, DELETE, CHECKED, NUMBER_COLS_OPS};
enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS};
enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS};
enum {CALENDAR_TREE_ID=10, OPS_GRID_ID, ACCOUNTS_GRID_ID};
#define DELETE_ICON "ressources/process-stop.png"
#include <controller/KissCount.h>
#include "wxUI.h"
#include <model/model.h>
#include "GridAccount.h"
#include <wx/category/categorysimpledataset.h>
class wxUI;
class KissCount;
class AccountPanel: public wxPanel
{
public:
AccountPanel(KissCount* kiss, wxUI *parent);
~AccountPanel();
void ChangeUser();
void LoadYear(int year);
void ShowMonth(int year, int month);
void OnOperationModified(wxGridEvent& event);
void OnAccountModified(wxGridEvent& event);
private:
KissCount* _kiss;
wxUI* _wxUI;
wxTreeCtrl _tree;
GridAccount* _grid;
wxGrid *_statsGrid, *_accountsGrid;
PiePlot* _pie;
double *_categoriesValues;
std::map<wxString, int> _categoriesIndexes, _accountsIndexes;
std::vector<operation>* _curOperations;
int _curMonth, _curYear;
wxString* _categories, *_accounts;
std::map<wxString, double> _accountsInitValues;
CategorySimpleDataset* _dataset;
int _fixCosts;
void InitStatsGrid(User* user);
void InitAccountsGrid(User* user, int month, int year);
void UpdateStats();
void InsertOperation(User* user, operation* op, int line, bool fix);
DECLARE_EVENT_TABLE();
};
#endif