git.ithinksw.org
/
ITKit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Getting things in order for the bigger stuff...
[ITKit.git]
/
ITTabView.m
diff --git
a/ITTabView.m
b/ITTabView.m
index
d601171
..
66f0bcc
100755
(executable)
--- a/
ITTabView.m
+++ b/
ITTabView.m
@@
-17,6
+17,7
@@
if ( (self = [super initWithFrame:frame]) ) {
_draggedTab = nil;
_allowsDragging = NO;
if ( (self = [super initWithFrame:frame]) ) {
_draggedTab = nil;
_allowsDragging = NO;
+ _requiredModifiers = NSCommandKeyMask;
}
return self;
}
}
return self;
}
@@
-24,6
+25,7
@@
- (void)setAllowsDragging:(bool)flag
{
_allowsDragging = flag;
- (void)setAllowsDragging:(bool)flag
{
_allowsDragging = flag;
+ _requiredModifiers = NSCommandKeyMask;
}
- (bool)allowsDragging
}
- (bool)allowsDragging
@@
-31,6
+33,16
@@
return _allowsDragging;
}
return _allowsDragging;
}
+- (void)setRequiredModifiers:(unsigned int)modifiers
+{
+ _requiredModifiers = modifiers;
+}
+
+- (unsigned int)requiredModifiers
+{
+ return _requiredModifiers;
+}
+
- (void)moveTab:(NSTabViewItem *)tab toIndex:(int)index
{
if ([self indexOfTabViewItem:tab] != index)
- (void)moveTab:(NSTabViewItem *)tab toIndex:(int)index
{
if ([self indexOfTabViewItem:tab] != index)
@@
-44,8
+56,9
@@
- (void)mouseDown:(NSEvent *)event
{
- (void)mouseDown:(NSEvent *)event
{
- if ([self allowsDragging]) {
- NSPoint clickedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
+ if ((_requiredModifiers == 0 || ([[NSApp currentEvent] modifierFlags] & _requiredModifiers)) && [self allowsDragging]) {
+ NSPoint clickedPoint;
+ clickedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
NSTabViewItem *clickedTab = [self tabViewItemAtPoint:clickedPoint];
_draggedTab = clickedTab;
}
NSTabViewItem *clickedTab = [self tabViewItemAtPoint:clickedPoint];
_draggedTab = clickedTab;
}
@@
-54,7
+67,7
@@
- (void)mouseUp:(NSEvent *)event
{
- (void)mouseUp:(NSEvent *)event
{
- if ([self allowsDragging]) {
+ if (
_draggedTab &&
[self allowsDragging]) {
NSPoint releasedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
NSTabViewItem *releasedTab = [self tabViewItemAtPoint:releasedPoint];
if (releasedTab && ![releasedTab isEqualTo:_draggedTab]) {
NSPoint releasedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
NSTabViewItem *releasedTab = [self tabViewItemAtPoint:releasedPoint];
if (releasedTab && ![releasedTab isEqualTo:_draggedTab]) {
@@
-67,7
+80,7
@@
- (void)mouseDragged:(NSEvent *)event
{
- (void)mouseDragged:(NSEvent *)event
{
- if ([self allowsDragging]) {
+ if (
_draggedTab &&
[self allowsDragging]) {
NSPoint currentPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
NSTabViewItem *curTab = [self tabViewItemAtPoint:currentPoint];
if (curTab && ![curTab isEqualTo:_draggedTab]) {
NSPoint currentPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
NSTabViewItem *curTab = [self tabViewItemAtPoint:currentPoint];
if (curTab && ![curTab isEqualTo:_draggedTab]) {
@@
-78,4
+91,5
@@
[super mouseDragged:event];
}
[super mouseDragged:event];
}
+
@end
@end