1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/gridsel.h
3 // Purpose: wxGridSelection
8 // Copyright: (c) Stefan Neis
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WXGRIDSEL_H__
13 #define __WXGRIDSEL_H__
21 class WXDLLIMPEXP_ADV wxGridSelection
{
23 wxGridSelection( wxGrid
* grid
, wxGrid::wxGridSelectionModes sel
=
24 wxGrid::wxGridSelectCells
);
26 bool IsInSelection ( int row
, int col
);
27 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode
);
28 wxGrid::wxGridSelectionModes
GetSelectionMode() { return m_selectionMode
; }
29 void SelectRow( int row
,
30 bool ControlDown
= false, bool ShiftDown
= false,
31 bool AltDown
= false, bool MetaDown
= false );
32 void SelectCol( int col
,
33 bool ControlDown
= false, bool ShiftDown
= false,
34 bool AltDown
= false, bool MetaDown
= false );
35 void SelectBlock( int topRow
, int leftCol
,
36 int bottomRow
, int rightCol
,
37 bool ControlDown
= false, bool ShiftDown
= false,
38 bool AltDown
= false, bool MetaDown
= false,
39 bool sendEvent
= true );
40 void SelectCell( int row
, int col
,
41 bool ControlDown
= false, bool ShiftDown
= false,
42 bool AltDown
= false, bool MetaDown
= false,
43 bool sendEvent
= true );
44 void ToggleCellSelection( int row
, int col
,
45 bool ControlDown
= false,
46 bool ShiftDown
= false,
47 bool AltDown
= false, bool MetaDown
= false );
48 void ClearSelection();
50 void UpdateRows( size_t pos
, int numRows
);
51 void UpdateCols( size_t pos
, int numCols
);
54 int BlockContain( int topRow1
, int leftCol1
,
55 int bottomRow1
, int rightCol1
,
56 int topRow2
, int leftCol2
,
57 int bottomRow2
, int rightCol2
);
58 // returns 1, if Block1 contains Block2,
59 // -1, if Block2 contains Block1,
62 int BlockContainsCell( int topRow
, int leftCol
,
63 int bottomRow
, int rightCol
,
65 // returns 1, if Block contains Cell,
68 return ( topRow
<= row
&& row
<= bottomRow
&&
69 leftCol
<= col
&& col
<= rightCol
);
72 wxGridCellCoordsArray m_cellSelection
;
73 wxGridCellCoordsArray m_blockSelectionTopLeft
;
74 wxGridCellCoordsArray m_blockSelectionBottomRight
;
75 wxArrayInt m_rowSelection
;
76 wxArrayInt m_colSelection
;
79 wxGrid::wxGridSelectionModes m_selectionMode
;
81 friend class WXDLLIMPEXP_ADV wxGrid
;
83 DECLARE_NO_COPY_CLASS(wxGridSelection
)
86 #endif // #ifndef wxUSE_GRID
87 #endif // #ifdef __WXGRIDSEL_H__