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
,
25 wxGrid::wxGridSelectionModes sel
= wxGrid::wxGridSelectCells
);
28 bool IsInSelection(int row
, int col
);
29 bool IsInSelection(const wxGridCellCoords
& coords
)
31 return IsInSelection(coords
.GetRow(), coords
.GetCol());
34 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode
);
35 wxGrid::wxGridSelectionModes
GetSelectionMode() { return m_selectionMode
; }
36 void SelectRow( int row
,
37 bool ControlDown
= false, bool ShiftDown
= false,
38 bool AltDown
= false, bool MetaDown
= false );
39 void SelectCol( int col
,
40 bool ControlDown
= false, bool ShiftDown
= false,
41 bool AltDown
= false, bool MetaDown
= false );
42 void SelectBlock( int topRow
, int leftCol
,
43 int bottomRow
, int rightCol
,
44 bool ControlDown
= false, bool ShiftDown
= false,
45 bool AltDown
= false, bool MetaDown
= false,
46 bool sendEvent
= true );
47 void SelectCell( int row
, int col
,
48 bool ControlDown
= false, bool ShiftDown
= false,
49 bool AltDown
= false, bool MetaDown
= false,
50 bool sendEvent
= true );
51 void ToggleCellSelection( int row
, int col
,
52 bool ControlDown
= false,
53 bool ShiftDown
= false,
54 bool AltDown
= false, bool MetaDown
= false );
55 void ToggleCellSelection( const wxGridCellCoords
& coords
,
56 bool ControlDown
= false,
57 bool ShiftDown
= false,
58 bool AltDown
= false, bool MetaDown
= false )
60 ToggleCellSelection(coords
.GetRow(), coords
.GetCol(),
61 ControlDown
, ShiftDown
, AltDown
, MetaDown
);
64 void ClearSelection();
66 void UpdateRows( size_t pos
, int numRows
);
67 void UpdateCols( size_t pos
, int numCols
);
70 int BlockContain( int topRow1
, int leftCol1
,
71 int bottomRow1
, int rightCol1
,
72 int topRow2
, int leftCol2
,
73 int bottomRow2
, int rightCol2
);
74 // returns 1, if Block1 contains Block2,
75 // -1, if Block2 contains Block1,
78 int BlockContainsCell( int topRow
, int leftCol
,
79 int bottomRow
, int rightCol
,
81 // returns 1, if Block contains Cell,
84 return ( topRow
<= row
&& row
<= bottomRow
&&
85 leftCol
<= col
&& col
<= rightCol
);
88 wxGridCellCoordsArray m_cellSelection
;
89 wxGridCellCoordsArray m_blockSelectionTopLeft
;
90 wxGridCellCoordsArray m_blockSelectionBottomRight
;
91 wxArrayInt m_rowSelection
;
92 wxArrayInt m_colSelection
;
95 wxGrid::wxGridSelectionModes m_selectionMode
;
97 friend class WXDLLIMPEXP_FWD_ADV wxGrid
;
99 DECLARE_NO_COPY_CLASS(wxGridSelection
)
103 #endif // _WX_GENERIC_GRIDSEL_H_