Commited John Labenski's patch giving access to the low level selection

representation (Patch 579754).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis 2002-09-07 13:58:25 +00:00
parent ecd69fb6e9
commit aa5b885706
4 changed files with 91 additions and 10 deletions

View File

@ -647,6 +647,44 @@ your own labels.
Returns the height of the specified row.
\membersection{wxGrid::GetSelectionMode}\label{wxgridgetselectionmode}
\constfunc{wxGrid::wxGridSelectionModes}{GetSelectionMode}{\void}
Returns the current selection mode, see \helpref{wxGrid::SetSelectionMode}{wxgridsetselectionmode}.
\membersection{wxGrid::GetSelectedCells}\label{wxgridgetselectedcells}
\constfunc{wxGridCellCoordsArray}{GetSelectedCells}{\void}
Returns an array of singly selected cells.
\membersection{wxGrid::GetSelectedCols}\label{wxgridgetselectedcols}
\constfunc{wxArrayInt}{GetSelectedCols}{\void}
Returns an array of selected cols.
\membersection{wxGrid::GetSelectedRows}\label{wxgridgetselectedrows}
\constfunc{wxArrayInt}{GetSelectedRows}{\void}
Returns an array of selected rows.
\membersection{wxGrid::GetSelectionBlockTopLeft}\label{wxgridgetselectionblocktopleft}
\constfunc{wxGridCellCoordsArray}{GetSelectionBlockTopLeft}{\void}
Returns an array of the top left corners of blocks of selected cells,
see \helpref{wxGrid::GetSelectionBlockBottomRight}{wxgridgetselectionblockbottomright}.
\membersection{wxGrid::GetSelectionBlockBottomRight}\label{wxgridgetselectionblockbottomright}
\constfunc{wxGridCellCoordsArray}{GetSelectionBlockBottomRight}{\void}
Returns an array of the bottom right corners of blocks of selected cells,
see \helpref{wxGrid::GetSelectionBlockTopLeft}{wxgridgetselectionblocktopleft}.
\membersection{wxGrid::GetTable}\label{wxgridgettable}
\constfunc{wxGridTableBase *}{GetTable}{\void}
@ -714,6 +752,14 @@ Returns FALSE if the whole grid has been set as read-only or TRUE otherwise.
See \helpref{wxGrid::EnableEditing}{wxgridenableediting} for more information about
controlling the editing status of grid cells.
\membersection{wxGrid::IsInSelection}\label{wxgridisinselection}
\constfunc{bool}{IsInSelection}{\param{int }{row}, \param{int }{col}}
\constfunc{bool}{IsInSelection}{\param{const wxGridCellCoords\& }{coords}}
Is this cell currently selected.
\membersection{wxGrid::IsReadOnly}\label{wxgridisreadonly}
\constfunc{bool}{IsReadOnly}{\param{int }{row}, \param{int }{col}}
@ -1251,14 +1297,6 @@ Returns the grid row that corresponds to the logical y coordinate. Returns
wxNOT\_FOUND if there is no row at the y position.
\membersection{wxGrid::IsInSelection}\label{wxgridisinselection}
\func{bool}{IsInSelection}{\param{int }{row}, \param{int }{col}}
\func{bool}{IsInSelection}{\param{const wxGridCellCoords\& }{coords}}
\membersection{wxGrid::BlockToDeviceRect}\label{wxgridblocktodevicerect}
\func{wxRect}{BlockToDeviceRect}{\param{const wxGridCellCoords \& }{topLeft}, \param{const wxGridCellCoords \& }{bottomRight}}

View File

@ -1029,6 +1029,7 @@ public:
wxGrid::wxGridSelectCells );
void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
wxGrid::wxGridSelectionModes GetSelectionMode() const;
// ------ grid dimensions
//
@ -1355,7 +1356,7 @@ public:
// make the cell editable/readonly
void SetReadOnly(int row, int col, bool isReadOnly = TRUE);
// ------ selections of blocks of cells
// ------ select blocks of cells
//
void SelectRow( int row, bool addToSelected = FALSE );
void SelectCol( int col, bool addToSelected = FALSE );
@ -1374,7 +1375,7 @@ public:
bool IsSelection();
// ------ deselection
// ------ deselect blocks or cells
//
void DeselectRow( int row );
void DeselectCol( int col );
@ -1387,6 +1388,11 @@ public:
bool IsInSelection( const wxGridCellCoords& coords ) const
{ return IsInSelection( coords.GetRow(), coords.GetCol() ); }
wxGridCellCoordsArray GetSelectedCells() const;
wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
wxArrayInt GetSelectedRows() const;
wxArrayInt GetSelectedCols() const;
// This function returns the rectangle that encloses the block of cells
// limited by TopLeft and BottomRight cell in device coords and clipped

View File

@ -81,6 +81,8 @@ private:
wxGrid *m_grid;
wxGrid::wxGridSelectionModes m_selectionMode;
friend class wxGrid;
};
#endif // #ifdef __WXGRIDSEL_H__

View File

@ -3721,6 +3721,14 @@ void wxGrid::SetSelectionMode(wxGrid::wxGridSelectionModes selmode)
m_selection->SetSelectionMode( selmode );
}
wxGrid::wxGridSelectionModes wxGrid::GetSelectionMode() const
{
wxCHECK_MSG( m_created, wxGrid::wxGridSelectCells,
wxT("Called wxGrid::GetSelectionMode() before calling CreateGrid()") );
return m_selection->GetSelectionMode();
}
bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
wxGrid::wxGridSelectionModes selmode )
{
@ -9375,6 +9383,33 @@ bool wxGrid::IsInSelection( int row, int col ) const
col <= m_selectingBottomRight.GetCol() )) );
}
wxGridCellCoordsArray wxGrid::GetSelectedCells() const
{
if (!m_selection) { wxGridCellCoordsArray a; return a; }
return m_selection->m_cellSelection;
}
wxGridCellCoordsArray wxGrid::GetSelectionBlockTopLeft() const
{
if (!m_selection) { wxGridCellCoordsArray a; return a; }
return m_selection->m_blockSelectionTopLeft;
}
wxGridCellCoordsArray wxGrid::GetSelectionBlockBottomRight() const
{
if (!m_selection) { wxGridCellCoordsArray a; return a; }
return m_selection->m_blockSelectionTopLeft;
}
wxArrayInt wxGrid::GetSelectedRows() const
{
if (!m_selection) { wxArrayInt a; return a; }
return m_selection->m_rowSelection;
}
wxArrayInt wxGrid::GetSelectedCols() const
{
if (!m_selection) { wxArrayInt a; return a; }
return m_selection->m_colSelection;
}
void wxGrid::ClearSelection()
{
m_selectingTopLeft = wxGridNoCellCoords;