]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/gridsel.h
added more HP-UX charset names
[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#ifndef __WXGRIDSEL_H__
13#define __WXGRIDSEL_H__
14
15#include "wx/defs.h"
16
17#if wxUSE_GRID
18
19#include "wx/grid.h"
20
21class WXDLLIMPEXP_ADV wxGridSelection{
22public:
23 wxGridSelection( wxGrid * grid, wxGrid::wxGridSelectionModes sel =
24 wxGrid::wxGridSelectCells );
25 bool IsSelection();
26 bool IsInSelection ( int row, int col );
27 void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
28 wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; }
29 void SelectRow( int row,
30 bool ControlDown = false, bool ShiftDown = false,
31 bool AltDown = false, bool MetaDown = false );
32 void SelectCol( int col,
33 bool ControlDown = false, bool ShiftDown = false,
34 bool AltDown = false, bool MetaDown = false );
35 void SelectBlock( int topRow, int leftCol,
36 int bottomRow, int rightCol,
37 bool ControlDown = false, bool ShiftDown = false,
38 bool AltDown = false, bool MetaDown = false,
39 bool sendEvent = true );
40 void SelectCell( int row, int col,
41 bool ControlDown = false, bool ShiftDown = false,
42 bool AltDown = false, bool MetaDown = false,
43 bool sendEvent = true );
44 void ToggleCellSelection( int row, int col,
45 bool ControlDown = false,
46 bool ShiftDown = false,
47 bool AltDown = false, bool MetaDown = false );
48 void ClearSelection();
49
50 void UpdateRows( size_t pos, int numRows );
51 void UpdateCols( size_t pos, int numCols );
52
53private:
54 int BlockContain( int topRow1, int leftCol1,
55 int bottomRow1, int rightCol1,
56 int topRow2, int leftCol2,
57 int bottomRow2, int rightCol2 );
58 // returns 1, if Block1 contains Block2,
59 // -1, if Block2 contains Block1,
60 // 0, otherwise
61
62 int BlockContainsCell( int topRow, int leftCol,
63 int bottomRow, int rightCol,
64 int row, int col )
65 // returns 1, if Block contains Cell,
66 // 0, otherwise
67 {
68 return ( topRow <= row && row <= bottomRow &&
69 leftCol <= col && col <= rightCol );
70 }
71
72 wxGridCellCoordsArray m_cellSelection;
73 wxGridCellCoordsArray m_blockSelectionTopLeft;
74 wxGridCellCoordsArray m_blockSelectionBottomRight;
75 wxArrayInt m_rowSelection;
76 wxArrayInt m_colSelection;
77
78 wxGrid *m_grid;
79 wxGrid::wxGridSelectionModes m_selectionMode;
80
81 friend class WXDLLIMPEXP_ADV wxGrid;
82
83 DECLARE_NO_COPY_CLASS(wxGridSelection)
84};
85
86#endif // #ifndef wxUSE_GRID
87#endif // #ifdef __WXGRIDSEL_H__
88