KissCount/src/view/grid/wxGridCellTreeButtonEditor.cpp
2011-02-13 19:30:12 +01:00

77 lines
2.0 KiB
C++

/*
Copyright 2010-2011 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/>.
*/
#include "wxGridCellTreeButtonEditor.h"
wxGridCellEditor* wxGridCellTreeButtonEditor::Clone () const
{
return new wxGridCellTreeButtonEditor();
}
void wxGridCellTreeButtonEditor::BeginEdit (int row, int col, wxGrid *grid)
{
wxGridEvent evt(0, 0, NULL, row, col);
_row = row;
_col = col;
_grid = grid;
wxGridCellRenderer* pRenderer = _grid->GetCellRenderer(_row, _col);
((GridAccount*)_grid)->OnCellLeftClick(evt);
((wxGridCellTreeButtonRenderer*) pRenderer)->Invert();
pRenderer->DecRef();
}
void wxGridCellTreeButtonEditor::Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler)
{
}
bool wxGridCellTreeButtonEditor::EndEdit (int row, int col, /*const*/ wxGrid *grid/*, const wxString &oldval, wxString *newval*/)
{
return true;
}
void wxGridCellTreeButtonEditor::ApplyEdit (int row, int col, wxGrid *grid)
{}
void wxGridCellTreeButtonEditor::Reset ()
{}
wxString wxGridCellTreeButtonEditor::GetValue() const
{
wxGridCellRenderer* pRenderer = _grid->GetCellRenderer(_row, _col);
wxString res = ((wxGridCellTreeButtonRenderer*) pRenderer)->IsCollapsed() ? wxT("1") : wxT("0");
pRenderer->DecRef();
return res;
}
void wxGridCellTreeButtonEditor::SetSize (const wxRect &rect)
{
}
void wxGridCellTreeButtonEditor::Show (bool show, wxGridCellAttr *attr=NULL)
{
}