]>
Commit | Line | Data |
---|---|---|
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 | ||
25 | class WXDLLEXPORT wxGridSelection{ | |
26 | public: | |
b5808881 SN |
27 | wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel = |
28 | wxGrid::wxGridSelectCells ); | |
294f6bcb SN |
29 | bool IsSelection(); |
30 | bool IsInSelection ( int row, int col ); | |
31 | void SelectRow( int row, bool addToSelected = FALSE ); | |
32 | void SelectCol( int col, bool addToSelected = FALSE ); | |
33 | void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol ); | |
34 | void SelectCell( int row, int col); | |
35 | void ToggleCellSelection( int row, int col); | |
36 | void ClearSelection(); | |
37 | ||
38 | void UpdateRows( size_t pos, int numRows ); | |
39 | void UpdateCols( size_t pos, int numCols ); | |
40 | ||
41 | private: | |
42 | int BlockContain( int topRow1, int leftCol1, | |
b5808881 SN |
43 | int bottomRow1, int rightCol1, |
44 | int topRow2, int leftCol2, | |
45 | int bottomRow2, int rightCol2 ); | |
294f6bcb SN |
46 | // returns 1, if Block1 contains Block2, |
47 | // -1, if Block2 contains Block1, | |
48 | // 0, otherwise | |
49 | ||
50 | int BlockContainsCell( int topRow, int leftCol, | |
b5808881 SN |
51 | int bottomRow, int rightCol, |
52 | int row, int col ) | |
294f6bcb SN |
53 | // returns 1, if Block contains Cell, |
54 | // 0, otherwise | |
55 | { | |
56 | return ( topRow <= row && row <= bottomRow && | |
b5808881 | 57 | leftCol <= col && col <= rightCol ); |
294f6bcb SN |
58 | } |
59 | ||
b5808881 SN |
60 | wxGridCellCoordsArray m_cellSelection; |
61 | wxGridCellCoordsArray m_blockSelectionTopLeft; | |
62 | wxGridCellCoordsArray m_blockSelectionBottomRight; | |
63 | wxArrayInt m_rowSelection; | |
64 | wxArrayInt m_colSelection; | |
294f6bcb | 65 | |
b5808881 SN |
66 | wxGrid *m_grid; |
67 | wxGrid::wxGridSelectionModes m_selectionMode; | |
294f6bcb SN |
68 | }; |
69 | ||
b5808881 SN |
70 | #endif // #ifdef __WXGRIDSEL_H__ |
71 | #endif // #ifndef wxUSE_NEW_GRID |