]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/gridsel.h
Fix to reflect wxUNIVERSAL conditions from header.
[wxWidgets.git] / include / wx / generic / gridsel.h
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 wxUSE_GRID
15
16 #ifndef __WXGRIDSEL_H__
17 #define __WXGRIDSEL_H__
18
19 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
20 #pragma interface "gridsel.h"
21 #endif
22
23 #include "wx/grid.h"
24
25 class WXDLLIMPEXP_ADV wxGridSelection{
26 public:
27 wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel =
28 wxGrid::wxGridSelectCells );
29 bool IsSelection();
30 bool IsInSelection ( int row, int col );
31 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
32 wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; }
33 void SelectRow( int row,
34 bool ControlDown = false, bool ShiftDown = false,
35 bool AltDown = false, bool MetaDown = false );
36 void SelectCol( int col,
37 bool ControlDown = false, bool ShiftDown = false,
38 bool AltDown = false, bool MetaDown = false );
39 void SelectBlock( int topRow, int leftCol,
40 int bottomRow, int rightCol,
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 );
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,
59 int bottomRow1, int rightCol1,
60 int topRow2, int leftCol2,
61 int bottomRow2, int rightCol2 );
62 // returns 1, if Block1 contains Block2,
63 // -1, if Block2 contains Block1,
64 // 0, otherwise
65
66 int BlockContainsCell( int topRow, int leftCol,
67 int bottomRow, int rightCol,
68 int row, int col )
69 // returns 1, if Block contains Cell,
70 // 0, otherwise
71 {
72 return ( topRow <= row && row <= bottomRow &&
73 leftCol <= col && col <= rightCol );
74 }
75
76 wxGridCellCoordsArray m_cellSelection;
77 wxGridCellCoordsArray m_blockSelectionTopLeft;
78 wxGridCellCoordsArray m_blockSelectionBottomRight;
79 wxArrayInt m_rowSelection;
80 wxArrayInt m_colSelection;
81
82 wxGrid *m_grid;
83 wxGrid::wxGridSelectionModes m_selectionMode;
84
85 friend class WXDLLIMPEXP_ADV wxGrid;
86
87 DECLARE_NO_COPY_CLASS(wxGridSelection)
88 };
89
90 #endif // #ifdef __WXGRIDSEL_H__
91 #endif // #ifndef wxUSE_GRID
92