]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridsel.h
Minor corrections to make dist after reports
[wxWidgets.git] / include / wx / generic / gridsel.h
CommitLineData
294f6bcb
SN
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/gridsel.h
3// Purpose: wxGridSelection
4// Author: Stefan Neis
5// Modified by:
6// Created: 20/02/2000
7// RCS-ID: $$
8// Copyright: (c) Stefan Neis
65571936 9// Licence: wxWindows licence
294f6bcb
SN
10/////////////////////////////////////////////////////////////////////////////
11
df9fac6d
PC
12#ifndef _WX_GENERIC_GRIDSEL_H_
13#define _WX_GENERIC_GRIDSEL_H_
20ceebaa 14
294f6bcb
SN
15#include "wx/defs.h"
16
c176a11a 17#if wxUSE_GRID
294f6bcb 18
294f6bcb
SN
19#include "wx/grid.h"
20
df9fac6d
PC
21class WXDLLIMPEXP_ADV wxGridSelection
22{
294f6bcb 23public:
b5808881
SN
24 wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel =
25 wxGrid::wxGridSelectCells );
294f6bcb
SN
26 bool IsSelection();
27 bool IsInSelection ( int row, int col );
f1567cdd 28 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
399b60a0 29 wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; }
723d1b1d 30 void SelectRow( int row,
ca65c044
WS
31 bool ControlDown = false, bool ShiftDown = false,
32 bool AltDown = false, bool MetaDown = false );
723d1b1d 33 void SelectCol( int col,
ca65c044
WS
34 bool ControlDown = false, bool ShiftDown = false,
35 bool AltDown = false, bool MetaDown = false );
5c8fc7c1
SN
36 void SelectBlock( int topRow, int leftCol,
37 int bottomRow, int rightCol,
ca65c044
WS
38 bool ControlDown = false, bool ShiftDown = false,
39 bool AltDown = false, bool MetaDown = false,
40 bool sendEvent = true );
d95b0c2b 41 void SelectCell( int row, int col,
ca65c044
WS
42 bool ControlDown = false, bool ShiftDown = false,
43 bool AltDown = false, bool MetaDown = false,
44 bool sendEvent = true );
d95b0c2b 45 void ToggleCellSelection( int row, int col,
ca65c044
WS
46 bool ControlDown = false,
47 bool ShiftDown = false,
48 bool AltDown = false, bool MetaDown = false );
294f6bcb
SN
49 void ClearSelection();
50
51 void UpdateRows( size_t pos, int numRows );
52 void UpdateCols( size_t pos, int numCols );
53
54private:
55 int BlockContain( int topRow1, int leftCol1,
b5808881
SN
56 int bottomRow1, int rightCol1,
57 int topRow2, int leftCol2,
58 int bottomRow2, int rightCol2 );
294f6bcb
SN
59 // returns 1, if Block1 contains Block2,
60 // -1, if Block2 contains Block1,
61 // 0, otherwise
62
63 int BlockContainsCell( int topRow, int leftCol,
b5808881
SN
64 int bottomRow, int rightCol,
65 int row, int col )
294f6bcb
SN
66 // returns 1, if Block contains Cell,
67 // 0, otherwise
68 {
69 return ( topRow <= row && row <= bottomRow &&
b5808881 70 leftCol <= col && col <= rightCol );
294f6bcb
SN
71 }
72
b5808881
SN
73 wxGridCellCoordsArray m_cellSelection;
74 wxGridCellCoordsArray m_blockSelectionTopLeft;
75 wxGridCellCoordsArray m_blockSelectionBottomRight;
76 wxArrayInt m_rowSelection;
77 wxArrayInt m_colSelection;
294f6bcb 78
b5808881
SN
79 wxGrid *m_grid;
80 wxGrid::wxGridSelectionModes m_selectionMode;
aa5b8857 81
b5dbe15d 82 friend class WXDLLIMPEXP_FWD_ADV wxGrid;
22f3361e
VZ
83
84 DECLARE_NO_COPY_CLASS(wxGridSelection)
294f6bcb
SN
85};
86
df9fac6d
PC
87#endif // wxUSE_GRID
88#endif // _WX_GENERIC_GRIDSEL_H_