CTFloatingBarBackingView.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) 2010 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #import "CTFloatingBarBackingView.h"
  5. #import "CTBrowserFrameView.h"
  6. @implementation CTFloatingBarBackingView
  7. - (void)drawRect:(NSRect)rect {
  8. NSWindow* window = [self window];
  9. BOOL isMainWindow = [window isMainWindow];
  10. if (isMainWindow)
  11. [[NSColor windowFrameColor] set];
  12. else
  13. [[NSColor windowBackgroundColor] set];
  14. NSRectFill(rect);
  15. // TODO(rohitrao): Don't assume -22 here.
  16. // [CTBrowserFrameView drawWindowThemeInDirtyRect:rect
  17. // forView:self
  18. // bounds:[self bounds]
  19. // offset:NSMakePoint(0, -22)
  20. // forceBlackBackground:YES];
  21. }
  22. // Eat all mouse events (and do *not* pass them on to the next responder!).
  23. - (void)mouseDown:(NSEvent*)event {}
  24. - (void)rightMouseDown:(NSEvent*)event {}
  25. - (void)otherMouseDown:(NSEvent*)event {}
  26. - (void)rightMouseUp:(NSEvent*)event {}
  27. - (void)otherMouseUp:(NSEvent*)event {}
  28. - (void)mouseMoved:(NSEvent*)event {}
  29. - (void)mouseDragged:(NSEvent*)event {}
  30. - (void)rightMouseDragged:(NSEvent*)event {}
  31. - (void)otherMouseDragged:(NSEvent*)event {}
  32. // Eat this too, except that ...
  33. - (void)mouseUp:(NSEvent*)event {
  34. // a double-click in the blank area should try to minimize, to be consistent
  35. // with double-clicks on the contiguous tab strip area. (It'll fail and beep.)
  36. if ([event clickCount] == 2 &&
  37. (![NSWindow respondsToSelector:@selector(_shouldMiniaturizeOnDoubleClick)] ||
  38. [NSWindow performSelector:@selector(_shouldMiniaturizeOnDoubleClick)]))
  39. [[self window] performMiniaturize:self];
  40. }
  41. @end // @implementation FloatingBarBackingView