summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/chrome_browser_window.h
blob: 19a846f350cfe2cf5dad2f932d6bb3f8a3eeb4bd (plain)
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
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_COCOA_CHROME_BROWSER_WINDOW_H_
#define CHROME_BROWSER_COCOA_CHROME_BROWSER_WINDOW_H_

#import <Cocoa/Cocoa.h>

#include "base/scoped_nsobject.h"
#include "chrome/browser/cocoa/chrome_event_processing_window.h"

// Offset from the top of the window frame to the top of the window controls
// (zoom, close, miniaturize) for a window with a tabstrip.
const NSInteger kChromeWindowButtonsWithTabStripOffsetFromTop = 6;

// Offset from the top of the window frame to the top of the window controls
// (zoom, close, miniaturize) for a window without a tabstrip.
const NSInteger kChromeWindowButtonsWithoutTabStripOffsetFromTop = 4;

// Offset from the left of the window frame to the top of the window controls
// (zoom, close, miniaturize).
const NSInteger kChromeWindowButtonsOffsetFromLeft = 8;

// Offset between the window controls (zoom, close, miniaturize).
const NSInteger kChromeWindowButtonsInterButtonSpacing = 7;

// Cocoa class representing a Chrome browser window.
// We need to override NSWindow with our own class since we need access to all
// unhandled keyboard events and subclassing NSWindow is the only method to do
// this. We also handle our own window controls and custom window frame drawing.
@interface ChromeBrowserWindow : ChromeEventProcessingWindow {
 @private
  BOOL shouldHideTitle_;
  NSButton* closeButton_;
  NSButton* miniaturizeButton_;
  NSButton* zoomButton_;
  BOOL entered_;
  scoped_nsobject<NSTrackingArea> widgetTrackingArea_;
}

// Tells the window to suppress title drawing.
- (void)setShouldHideTitle:(BOOL)flag;

// Return true if the mouse is currently in our tracking area for our window
// widgets.
- (BOOL)mouseInGroup:(NSButton*)widget;

// Update the tracking areas for our window widgets as appropriate.
- (void)updateTrackingAreas;

@end

@interface ChromeBrowserWindow (UndocumentedAPI)

// Undocumented Cocoa API to suppress drawing of the window's title.
// -setTitle: still works, but the title set only applies to the
// miniwindow and menus (and, importantly, Expose).  Overridden to
// return |shouldHideTitle_|.
-(BOOL)_isTitleHidden;

@end

#endif  // CHROME_BROWSER_COCOA_CHROME_BROWSER_WINDOW_H_