]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/gridsel.h
Changed wxGridCellCoords from long to int (get rid of most HP warnings?)
[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 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:
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 void SelectRow( int row, bool addToSelected = FALSE,
33 bool ControlDown = FALSE, bool ShiftDown = FALSE,
34 bool AltDown = FALSE, bool MetaDown = FALSE );
35 void SelectCol( int col, bool addToSelected = FALSE,
36 bool ControlDown = FALSE, bool ShiftDown = FALSE,
37 bool AltDown = FALSE, bool MetaDown = FALSE );
38 void SelectBlock( int topRow, int leftCol,
39 int bottomRow, int rightCol,
40 bool ControlDown = FALSE, bool ShiftDown = FALSE,
41 bool AltDown = FALSE, bool MetaDown = FALSE,
42 bool sendEvent = TRUE );
43 void SelectCell( int row, int col,
44 bool ControlDown = FALSE, bool ShiftDown = FALSE,
45 bool AltDown = FALSE, bool MetaDown = FALSE,
46 bool sendEvent = TRUE );
47 void ToggleCellSelection( int row, int col,
48 bool ControlDown = FALSE,
49 bool ShiftDown = FALSE,
50 bool AltDown = FALSE, bool MetaDown = FALSE );
51 void ClearSelection();
52
53 void UpdateRows( size_t pos, int numRows );
54 void UpdateCols( size_t pos, int numCols );
55
56 private:
57 int BlockContain( int topRow1, int leftCol1,
58 int bottomRow1, int rightCol1,
59 int topRow2, int leftCol2,
60 int bottomRow2, int rightCol2 );
61 // returns 1, if Block1 contains Block2,
62 // -1, if Block2 contains Block1,
63 // 0, otherwise
64
65 int BlockContainsCell( int topRow, int leftCol,
66 int bottomRow, int rightCol,
67 int row, int col )
68 // returns 1, if Block contains Cell,
69 // 0, otherwise
70 {
71 return ( topRow <= row && row <= bottomRow &&
72 leftCol <= col && col <= rightCol );
73 }
74
75 wxGridCellCoordsArray m_cellSelection;
76 wxGridCellCoordsArray m_blockSelectionTopLeft;
77 wxGridCellCoordsArray m_blockSelectionBottomRight;
78 wxArrayInt m_rowSelection;
79 wxArrayInt m_colSelection;
80
81 wxGrid *m_grid;
82 wxGrid::wxGridSelectionModes m_selectionMode;
83 };
84
85 #endif // #ifdef __WXGRIDSEL_H__
86 #endif // #ifndef wxUSE_NEW_GRID