]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridsel.h
Window management and sizer layout corrections
[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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/defs.h"
13
14#if defined(wxUSE_NEW_GRID) && (wxUSE_NEW_GRID)
15
16#ifndef __WXGRIDSEL_H__
17#define __WXGRIDSEL_H__
18
19#ifdef __GNUG__
20#pragma interface "gridsel.h"
21#endif
22
23#include "wx/grid.h"
24
25class WXDLLEXPORT wxGridSelection{
26public:
b5808881
SN
27 wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel =
28 wxGrid::wxGridSelectCells );
294f6bcb
SN
29 bool IsSelection();
30 bool IsInSelection ( int row, int col );
f1567cdd 31 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
399b60a0 32 wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; }
723d1b1d 33 void SelectRow( int row,
d95b0c2b
SN
34 bool ControlDown = FALSE, bool ShiftDown = FALSE,
35 bool AltDown = FALSE, bool MetaDown = FALSE );
723d1b1d 36 void SelectCol( int col,
d95b0c2b
SN
37 bool ControlDown = FALSE, bool ShiftDown = FALSE,
38 bool AltDown = FALSE, bool MetaDown = FALSE );
5c8fc7c1
SN
39 void SelectBlock( int topRow, int leftCol,
40 int bottomRow, int rightCol,
d95b0c2b
SN
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 );
294f6bcb
SN
52 void ClearSelection();
53
54 void UpdateRows( size_t pos, int numRows );
55 void UpdateCols( size_t pos, int numCols );
56
57private:
58 int BlockContain( int topRow1, int leftCol1,
b5808881
SN
59 int bottomRow1, int rightCol1,
60 int topRow2, int leftCol2,
61 int bottomRow2, int rightCol2 );
294f6bcb
SN
62 // returns 1, if Block1 contains Block2,
63 // -1, if Block2 contains Block1,
64 // 0, otherwise
65
66 int BlockContainsCell( int topRow, int leftCol,
b5808881
SN
67 int bottomRow, int rightCol,
68 int row, int col )
294f6bcb
SN
69 // returns 1, if Block contains Cell,
70 // 0, otherwise
71 {
72 return ( topRow <= row && row <= bottomRow &&
b5808881 73 leftCol <= col && col <= rightCol );
294f6bcb
SN
74 }
75
b5808881
SN
76 wxGridCellCoordsArray m_cellSelection;
77 wxGridCellCoordsArray m_blockSelectionTopLeft;
78 wxGridCellCoordsArray m_blockSelectionBottomRight;
79 wxArrayInt m_rowSelection;
80 wxArrayInt m_colSelection;
294f6bcb 81
b5808881
SN
82 wxGrid *m_grid;
83 wxGrid::wxGridSelectionModes m_selectionMode;
294f6bcb
SN
84};
85
b5808881
SN
86#endif // #ifdef __WXGRIDSEL_H__
87#endif // #ifndef wxUSE_NEW_GRID