-
Notifications
You must be signed in to change notification settings - Fork 36
/
MBTableGridContentView.h
162 lines (135 loc) · 4.37 KB
/
MBTableGridContentView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
Copyright (c) 2008 Matthew Ball - http://www.mattballdesign.com
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#import <Cocoa/Cocoa.h>
#define MBTableGridColumnHeaderHeight 19.0
#define MBTableGridRowHeaderWidth 40.0
@class MBTableGrid, MBTableGridCell;
/**
* @brief \c MBTableGridContentView provides the actual display
* and editing capabilities of MBTableGrid. It is designed
* to be placed inside a scroll view.
*/
@interface MBTableGridContentView : NSView {
NSInteger mouseDownColumn;
NSInteger mouseDownRow;
NSInteger editedColumn;
NSInteger editedRow;
NSImage *cursorImage;
NSInteger dropColumn;
NSInteger dropRow;
NSTimer *autoscrollTimer;
BOOL isDraggingColumnOrRow;
MBTableGridCell *_cell;
}
/**
* @name The Grid View
*/
/**
* @{
*/
/**
* @brief Returns the \c MBTableGrid the receiver
* belongs to.
*/
- (MBTableGrid *)tableGrid;
/**
* @}
*/
/**
* @name Editing Values
*/
/**
* @{
*/
/**
* @brief Begin editing the currently-selected
* cell. If multiple cells are selected,
* selects the top-left one and begins
* editing its value.
*/
- (void)editSelectedCell:(id)sender;
/**
* @}
*/
/**
* @name Layout Support
*/
/**
* @{
*/
/**
* @brief Returns the rectangle containing the column at
* a given index.
* @param columnIndex The index of a column in the receiver.
* @return The rectangle containing the column at \c columnIndex.
* Returns \c NSZeroRect if \c columnIndex lies outside
* the range of valid column indices for the receiver.
* @see frameOfCellAtColumn:row:
* @see rectOfRow:
*/
- (NSRect)rectOfColumn:(NSUInteger)columnIndex;
/**
* @brief Returns the rectangle containing the row at a
* given index.
* @param rowIndex The index of a row in the receiver.
* @return The rectangle containing the row at \c rowIndex.
* Returns \c NSZeroRect if \c rowIndex lies outside
* the range of valid column indices for the receiver.
* @see frameOfCellAtColumn:row:
* @see rectOfColumn:
*/
- (NSRect)rectOfRow:(NSUInteger)rowIndex;
/**
* @brief Returns a rectangle locating the cell that lies at
* the intersection of \c columnIndex and \c rowIndex.
* @param columnIndex The index of the column containing the cell
* whose rectangle you want.
* @param rowIndex The index of the row containing the cell
* whose rectangle you want.
* @return A rectangle locating the cell that lies at the intersection
* of \c columnIndex and \c rowIndex. Returns \c NSZeroRect if
* \c columnIndex or \c rowIndex is greater than the number of
* columns or rows in the receiver.
* @see rectOfColumn:
* @see rectOfRow:
*/
- (NSRect)frameOfCellAtColumn:(NSUInteger)columnIndex row:(NSUInteger)rowIndex;
/**
* @brief Returns the index of the column a given point lies in.
* @param aPoint A point in the coordinate system of the receiver.
* @return The index of the column \c aPoint lies in, or \c NSNotFound if \c aPoint
* lies outside the receiver's bounds.
* @see rowAtPoint:
*/
- (NSInteger)columnAtPoint:(NSPoint)aPoint;
/**
* @brief Returns the index of the row a given point lies in.
* @param aPoint A point in the coordinate system of the receiver.
* @return The index of the row \c aPoint lies in, or \c NSNotFound if \c aPoint
* lies outside the receiver's bounds.
* @see columnAtPoint:
*/
- (NSInteger)rowAtPoint:(NSPoint)aPoint;
/**
* @}
*/
@end