Fix nasty inverted Grid Tree bug

This commit is contained in:
Grégory Soutadé 2010-10-02 10:25:40 +02:00
parent 135e702eb1
commit 6bd42b26a8
2 changed files with 6 additions and 5 deletions

View File

@ -239,7 +239,7 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
if (op && op->meta)
{
SetCellRenderer(line, TREE, new wxGridCellTreeButtonRenderer(true));
SetCellRenderer(line, TREE, new wxGridCellTreeButtonRenderer());
SetCellEditor(line, TREE, new wxGridCellTreeButtonEditor());
SetReadOnly(line, DATE, true);
@ -377,7 +377,7 @@ void GridAccount::OnCellLeftClick(wxGridEvent& evt)
#endif
}
// hack to prevent selection from being lost when click combobox
if (evt.GetCol() == 0 && IsInSelection(evt.GetRow(), evt.GetCol()))
if (/*evt.GetCol() == 0 && */IsInSelection(evt.GetRow(), evt.GetCol()))
{
//m_selTemp = m_selection;
m_selection = NULL;
@ -503,7 +503,6 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
op = _displayedOperations[row];
// Invert not already applied
if (!treeRenderer->IsCollapsed())
{
for (i=1, it=op->childs.begin(); it!=op->childs.end(); it++, i++)

View File

@ -33,13 +33,15 @@ void wxGridCellTreeButtonEditor::BeginEdit (int row, int col, wxGrid *grid)
_grid = grid;
wxGridCellRenderer* pRenderer = _grid->GetCellRenderer(_row, _col);
((GridAccount*)_grid)->OnCellLeftClick(evt);
((wxGridCellTreeButtonRenderer*) pRenderer)->Invert();
pRenderer->DecRef();
((GridAccount*)_grid)->OnCellLeftClick(evt);
}
void wxGridCellTreeButtonEditor::Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler)
{
}