Accounts events caught
This commit is contained in:
@@ -4,6 +4,7 @@ static wxString colsName[] = {_("Description"), _("Date"), _("Debit"), _("Credit
|
||||
|
||||
BEGIN_EVENT_TABLE(AccountPanel, wxPanel)
|
||||
EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, AccountPanel::OnOperationModified)
|
||||
EVT_GRID_CMD_CELL_CHANGE(ACCOUNTS_GRID_ID, AccountPanel::OnAccountModified)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent), _tree(this, CALENDAR_TREE_ID)
|
||||
@@ -329,7 +330,7 @@ void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix
|
||||
}
|
||||
else
|
||||
{
|
||||
_grid->SetCellEditor(line, DATE, new CalendarEditor(0, _curMonth, _curYear));
|
||||
_grid->SetCellEditor(line, DATE, new CalendarEditor(1, _curMonth, _curYear));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,3 +602,13 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||
|
||||
inModification = false ;
|
||||
}
|
||||
|
||||
void AccountPanel::OnAccountModified(wxGridEvent& event)
|
||||
{
|
||||
User* user = _kiss->GetUser();
|
||||
int row = event.GetRow();
|
||||
double amount;
|
||||
|
||||
_accountsGrid->GetCellValue(row, event.GetCol()).ToDouble(&amount);
|
||||
_kiss->SetAccountAmount(_curMonth, _curYear, user->GetAccountId(_accounts[row]), amount);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
void ShowMonth(int year, int month);
|
||||
|
||||
void OnOperationModified(wxGridEvent& event);
|
||||
void OnAccountModified(wxGridEvent& event);
|
||||
|
||||
private:
|
||||
KissCount* _kiss;
|
||||
|
||||
@@ -22,14 +22,13 @@ void CalendarEditor::BeginEdit(int row, int col, wxGrid *grid)
|
||||
|
||||
wxGridCellEditor* CalendarEditor::Clone() const
|
||||
{
|
||||
std::cout << "Cloned\n" ;
|
||||
return new CalendarEditor(_day, _month, _year);
|
||||
}
|
||||
|
||||
void CalendarEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler)
|
||||
{
|
||||
_parent = parent;
|
||||
_calendar->Create(parent, id, wxDateTime(_day, _month, _year));
|
||||
_calendar->Create(_parent, id, wxDateTime(_day, _month, _year));
|
||||
_calendar->EnableHolidayDisplay(false);
|
||||
_calendar->EnableMonthChange(false);
|
||||
_calendar->EnableYearChange(false);
|
||||
|
||||
Reference in New Issue
Block a user