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