Tabs drag only with command-drag.
[ITKit.git] / Showcase / Controller.m
index a2ca8d9..d7808c7 100755 (executable)
@@ -20,6 +20,7 @@
 {
     [self createStatusItem];
     [testTextField setCastsShadow:YES];
+    [tabView setAllowsDragging:YES];
     statusWindow = [ITTransientStatusWindow sharedWindow];
 //  [tabView setAllowsDragging:YES];
 }
                            textWidth,
                            textHeight);
     textField = [[[ITTextField alloc] initWithFrame:textRect] autorelease];
+    [textField setEditable:NO];
+    [textField setSelectable:NO];
     [textField setBordered:NO];
     [textField setDrawsBackground:NO];
     [textField setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:18]];
     [[statusWindow contentView] setNeedsDisplay:YES];
 }
 
-/*
-- (IBAction)foo:(id)sender
-{
-
-    maxLineHeight = ( ( maxLineHeight > [cdImage size].height ) ? maxLineHeight : [cdImage size].height );
-    
-    totalWidth  = ( ITTSWPADDING + [cdImage size].width + ITTSWSPACING + maxLineWidth + ITTSWPADDING );
-    totalHeight = ( ITTSWPADDING + maxLineHeight + ITTSWPADDING );
-
-    totalWidth  = ( ( totalWidth  > ITTSWMINW ) ? totalWidth  : ITTSWMINW );
-
-
-    [statusWindow setFrame:NSMakeRect(72.0, 72.0, totalWidth, totalHeight)
-                   display:YES];
-
-    textField = [[[ITTextField alloc] initWithFrame:
-        NSMakeRect((24.0 + [cdImage size].width + 32.0), 24.0, maxLineWidth, maxLineHeight)] autorelease];
-    [[statusWindow contentView] addSubview:textField];
-    [textField setBordered:NO];
-    [textField setDrawsBackground:NO];
-    [textField setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:18]];
-    [textField setTextColor:[NSColor whiteColor]];
-    [textField setCastsShadow:YES];
-    [textField setStringValue:text];
-
-
-    [[statusWindow contentView] lockFocus];
-    [cdImage compositeToPoint:NSMakePoint(ITTSWPADDING, ( ITTSWPADDING + ((maxLineHeight - [cdImage size].height) / ITTSWPADDING)) )
-                    operation:NSCompositeSourceOver];
-    [[statusWindow contentView] unlockFocus];
-}
-*/
-
 - (IBAction)showStatusWindow:(id)sender
 {
 //    [[statusWindow contentView] setNeedsDisplay:YES];
                    animate:YES];
 }
 
+- (IBAction)hideStatusWindow:(id)sender
+{
+    [statusWindow orderOut:self];
+}
+
+- (IBAction)setRotation:(id)sender
+{
+    [statusWindow setRotation:([sender floatValue] * (pi / 180))];
+}
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark ITTransientStatusWindow SUPPORT
+/*************************************************************************/
+
+- (IBAction)toggleTabDragging:(id)sender
+{
+    if ([sender state] == NSOnState) {
+        [tabView setAllowsDragging:YES];
+    } else {
+        [tabView setAllowsDragging:NO];
+    }
+}
+
+- (IBAction)toggleCommandDragging:(id)sender
+{
+    if ([sender state] == NSOnState) {
+        [tabView setRequiredModifiers:NSCommandKeyMask];
+    } else {
+        [tabView setRequiredModifiers:0];
+    }
+}
+
+- (IBAction)toggleControlDragging:(id)sender
+{
+}
+
+- (IBAction)toggleOptionDragging:(id)sender
+{
+}
+
+- (IBAction)toggleShiftDragging:(id)sender
+{
+}
 
 /*************************************************************************/
 #pragma mark -