]>
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 | |
65571936 | 9 | // Licence: wxWindows licence |
294f6bcb SN |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #include "wx/defs.h" | |
13 | ||
c176a11a | 14 | #if wxUSE_GRID |
294f6bcb SN |
15 | |
16 | #ifndef __WXGRIDSEL_H__ | |
17 | #define __WXGRIDSEL_H__ | |
18 | ||
12028905 | 19 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
294f6bcb SN |
20 | #pragma interface "gridsel.h" |
21 | #endif | |
22 | ||
23 | #include "wx/grid.h" | |
24 | ||
12f190b0 | 25 | class WXDLLIMPEXP_ADV wxGridSelection{ |
294f6bcb | 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 ); | |
f1567cdd | 31 | void SetSelectionMode(wxGrid::wxGridSelectionModes selmode); |
399b60a0 | 32 | wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; } |
723d1b1d | 33 | void SelectRow( int row, |
ca65c044 WS |
34 | bool ControlDown = false, bool ShiftDown = false, |
35 | bool AltDown = false, bool MetaDown = false ); | |
723d1b1d | 36 | void SelectCol( int col, |
ca65c044 WS |
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, | |
ca65c044 WS |
41 | bool ControlDown = false, bool ShiftDown = false, |
42 | bool AltDown = false, bool MetaDown = false, | |
43 | bool sendEvent = true ); | |
d95b0c2b | 44 | void SelectCell( int row, int col, |
ca65c044 WS |
45 | bool ControlDown = false, bool ShiftDown = false, |
46 | bool AltDown = false, bool MetaDown = false, | |
47 | bool sendEvent = true ); | |
d95b0c2b | 48 | void ToggleCellSelection( int row, int col, |
ca65c044 WS |
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 | ||
57 | private: | |
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; | |
aa5b8857 | 84 | |
12f190b0 | 85 | friend class WXDLLIMPEXP_ADV wxGrid; |
22f3361e VZ |
86 | |
87 | DECLARE_NO_COPY_CLASS(wxGridSelection) | |
294f6bcb SN |
88 | }; |
89 | ||
b5808881 | 90 | #endif // #ifdef __WXGRIDSEL_H__ |
f7556ff0 JS |
91 | #endif // #ifndef wxUSE_GRID |
92 |