1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/gridsel.h
3 // Purpose: wxGridSelection
8 // Copyright: (c) Stefan Neis
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
14 #if defined(wxUSE_NEW_GRID) && (wxUSE_NEW_GRID)
16 #ifndef __WXGRIDSEL_H__
17 #define __WXGRIDSEL_H__
20 #pragma interface "gridsel.h"
25 class WXDLLEXPORT wxGridSelection
{
27 wxGridSelection( wxGrid
* grid
, wxGrid::wxGridSelectionModes sel
=
28 wxGrid::wxGridSelectCells
);
30 bool IsInSelection ( int row
, int col
);
31 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode
);
32 void SelectRow( int row
, bool addToSelected
= FALSE
);
33 void SelectCol( int col
, bool addToSelected
= FALSE
);
34 void SelectBlock( int topRow
, int leftCol
,
35 int bottomRow
, int rightCol
,
36 wxMouseEvent
* event
= 0, bool sendEvent
= TRUE
);
37 void SelectCell( int row
, int col
, bool sendEvent
= TRUE
);
38 void ToggleCellSelection( int row
, int col
);
39 void ClearSelection();
41 void UpdateRows( size_t pos
, int numRows
);
42 void UpdateCols( size_t pos
, int numCols
);
45 int BlockContain( int topRow1
, int leftCol1
,
46 int bottomRow1
, int rightCol1
,
47 int topRow2
, int leftCol2
,
48 int bottomRow2
, int rightCol2
);
49 // returns 1, if Block1 contains Block2,
50 // -1, if Block2 contains Block1,
53 int BlockContainsCell( int topRow
, int leftCol
,
54 int bottomRow
, int rightCol
,
56 // returns 1, if Block contains Cell,
59 return ( topRow
<= row
&& row
<= bottomRow
&&
60 leftCol
<= col
&& col
<= rightCol
);
63 wxGridCellCoordsArray m_cellSelection
;
64 wxGridCellCoordsArray m_blockSelectionTopLeft
;
65 wxGridCellCoordsArray m_blockSelectionBottomRight
;
66 wxArrayInt m_rowSelection
;
67 wxArrayInt m_colSelection
;
70 wxGrid::wxGridSelectionModes m_selectionMode
;
73 #endif // #ifdef __WXGRIDSEL_H__
74 #endif // #ifndef wxUSE_NEW_GRID