2018-05-30 10:52:19 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* This program 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 this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KICAD_WX_GRID_H
|
|
|
|
#define KICAD_WX_GRID_H
|
|
|
|
|
|
|
|
#include <wx/grid.h>
|
|
|
|
#include <grid_tricks.h>
|
|
|
|
|
|
|
|
class WX_GRID : public wxGrid
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor has to be wxFormBuilder-compatible
|
|
|
|
WX_GRID( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
2018-08-19 16:10:14 +00:00
|
|
|
long style = wxWANTS_CHARS, const wxString& name = wxGridNameStr );
|
|
|
|
|
|
|
|
~WX_GRID() override;
|
2018-05-30 10:52:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a tokenized string containing the shown column indexes.
|
|
|
|
* Tokens are separated by spaces.
|
|
|
|
*/
|
|
|
|
wxString GetShownColumns();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show/hide the grid columns based on a tokenized string of shown column indexes.
|
|
|
|
*/
|
|
|
|
void ShowHideColumns( const wxString& shownColumns );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide wxGrid's SetTable() method with one which doesn't mess up the grid column
|
|
|
|
* widths when setting the table.
|
|
|
|
*/
|
2018-08-19 16:10:14 +00:00
|
|
|
void SetTable( wxGridTableBase* table, bool aTakeOwnership = false );
|
2018-05-30 10:52:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Work-around for a bug in wxGrid which crashes when deleting the table if the
|
|
|
|
* cell edit control was not closed.
|
|
|
|
*/
|
|
|
|
void DestroyTable( wxGridTableBase* aTable );
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
/**
|
|
|
|
* Close any open cell edit controls.
|
|
|
|
* @param aQuietMode if true don't send events (ie: for row/col delete operations)
|
|
|
|
* @return false if validation failed
|
|
|
|
*/
|
|
|
|
bool CommitPendingChanges( bool aQuietMode = false );
|
|
|
|
|
2018-05-30 10:52:19 +00:00
|
|
|
protected:
|
|
|
|
void DrawColLabel( wxDC& dc, int col ) override;
|
2018-08-19 16:10:14 +00:00
|
|
|
|
|
|
|
bool m_weOwnTable;
|
2018-05-30 10:52:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //KICAD_WX_GRID_H
|