]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/gridsel.h
Added project files for wxUniv under MSW
[wxWidgets.git] / include / wx / generic / gridsel.h
... / ...
CommitLineData
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:
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
57private:
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
86#endif // #ifdef __WXGRIDSEL_H__
87#endif // #ifndef wxUSE_NEW_GRID