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__
19 #if defined(__GNUG__) && !defined(__APPLE__)
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 wxGrid::wxGridSelectionModes
GetSelectionMode() { return m_selectionMode
; }
33 void SelectRow( int row
,
34 bool ControlDown
= FALSE
, bool ShiftDown
= FALSE
,
35 bool AltDown
= FALSE
, bool MetaDown
= FALSE
);
36 void SelectCol( int col
,
37 bool ControlDown
= FALSE
, bool ShiftDown
= FALSE
,
38 bool AltDown
= FALSE
, bool MetaDown
= FALSE
);
39 void SelectBlock( int topRow
, int leftCol
,
40 int bottomRow
, int rightCol
,
41 bool ControlDown
= FALSE
, bool ShiftDown
= FALSE
,
42 bool AltDown
= FALSE
, bool MetaDown
= FALSE
,
43 bool sendEvent
= TRUE
);
44 void SelectCell( int row
, int col
,
45 bool ControlDown
= FALSE
, bool ShiftDown
= FALSE
,
46 bool AltDown
= FALSE
, bool MetaDown
= FALSE
,
47 bool sendEvent
= TRUE
);
48 void ToggleCellSelection( int row
, int col
,
49 bool ControlDown
= FALSE
,
50 bool ShiftDown
= FALSE
,
51 bool AltDown
= FALSE
, bool MetaDown
= FALSE
);
52 void ClearSelection();
54 void UpdateRows( size_t pos
, int numRows
);
55 void UpdateCols( size_t pos
, int numCols
);
58 int BlockContain( int topRow1
, int leftCol1
,
59 int bottomRow1
, int rightCol1
,
60 int topRow2
, int leftCol2
,
61 int bottomRow2
, int rightCol2
);
62 // returns 1, if Block1 contains Block2,
63 // -1, if Block2 contains Block1,
66 int BlockContainsCell( int topRow
, int leftCol
,
67 int bottomRow
, int rightCol
,
69 // returns 1, if Block contains Cell,
72 return ( topRow
<= row
&& row
<= bottomRow
&&
73 leftCol
<= col
&& col
<= rightCol
);
76 wxGridCellCoordsArray m_cellSelection
;
77 wxGridCellCoordsArray m_blockSelectionTopLeft
;
78 wxGridCellCoordsArray m_blockSelectionBottomRight
;
79 wxArrayInt m_rowSelection
;
80 wxArrayInt m_colSelection
;
83 wxGrid::wxGridSelectionModes m_selectionMode
;
88 #endif // #ifdef __WXGRIDSEL_H__
89 #endif // #ifndef wxUSE_NEW_GRID