]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridsel.h
non-pch universal build fix: combo.h should not include combobox.h
[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
20ceebaa
MW
12#ifndef __WXGRIDSEL_H__
13#define __WXGRIDSEL_H__
14
294f6bcb
SN
15#include "wx/defs.h"
16
c176a11a 17#if wxUSE_GRID
294f6bcb 18
294f6bcb
SN
19#include "wx/grid.h"
20
12f190b0 21class WXDLLIMPEXP_ADV wxGridSelection{
294f6bcb 22public:
b5808881
SN
23 wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel =
24 wxGrid::wxGridSelectCells );
294f6bcb
SN
25 bool IsSelection();
26 bool IsInSelection ( int row, int col );
f1567cdd 27 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
399b60a0 28 wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; }
723d1b1d 29 void SelectRow( int row,
ca65c044
WS
30 bool ControlDown = false, bool ShiftDown = false,
31 bool AltDown = false, bool MetaDown = false );
723d1b1d 32 void SelectCol( int col,
ca65c044
WS
33 bool ControlDown = false, bool ShiftDown = false,
34 bool AltDown = false, bool MetaDown = false );
5c8fc7c1
SN
35 void SelectBlock( int topRow, int leftCol,
36 int bottomRow, int rightCol,
ca65c044
WS
37 bool ControlDown = false, bool ShiftDown = false,
38 bool AltDown = false, bool MetaDown = false,
39 bool sendEvent = true );
d95b0c2b 40 void SelectCell( int row, int col,
ca65c044
WS
41 bool ControlDown = false, bool ShiftDown = false,
42 bool AltDown = false, bool MetaDown = false,
43 bool sendEvent = true );
d95b0c2b 44 void ToggleCellSelection( int row, int col,
ca65c044
WS
45 bool ControlDown = false,
46 bool ShiftDown = false,
47 bool AltDown = false, bool MetaDown = false );
294f6bcb
SN
48 void ClearSelection();
49
50 void UpdateRows( size_t pos, int numRows );
51 void UpdateCols( size_t pos, int numCols );
52
53private:
54 int BlockContain( int topRow1, int leftCol1,
b5808881
SN
55 int bottomRow1, int rightCol1,
56 int topRow2, int leftCol2,
57 int bottomRow2, int rightCol2 );
294f6bcb
SN
58 // returns 1, if Block1 contains Block2,
59 // -1, if Block2 contains Block1,
60 // 0, otherwise
61
62 int BlockContainsCell( int topRow, int leftCol,
b5808881
SN
63 int bottomRow, int rightCol,
64 int row, int col )
294f6bcb
SN
65 // returns 1, if Block contains Cell,
66 // 0, otherwise
67 {
68 return ( topRow <= row && row <= bottomRow &&
b5808881 69 leftCol <= col && col <= rightCol );
294f6bcb
SN
70 }
71
b5808881
SN
72 wxGridCellCoordsArray m_cellSelection;
73 wxGridCellCoordsArray m_blockSelectionTopLeft;
74 wxGridCellCoordsArray m_blockSelectionBottomRight;
75 wxArrayInt m_rowSelection;
76 wxArrayInt m_colSelection;
294f6bcb 77
b5808881
SN
78 wxGrid *m_grid;
79 wxGrid::wxGridSelectionModes m_selectionMode;
aa5b8857 80
12f190b0 81 friend class WXDLLIMPEXP_ADV wxGrid;
22f3361e
VZ
82
83 DECLARE_NO_COPY_CLASS(wxGridSelection)
294f6bcb
SN
84};
85
f7556ff0 86#endif // #ifndef wxUSE_GRID
20ceebaa 87#endif // #ifdef __WXGRIDSEL_H__
f7556ff0 88