1// Copyright (c) 2011 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
5#ifndef CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_
6#define CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_
7#pragma once
8
9#import <Cocoa/Cocoa.h>
10
11#include "base/memory/scoped_nsobject.h"
12#include "chrome/browser/ui/cocoa/chrome_browser_window.h"
13
14// Offsets from the top/left of the window frame to the top of the window
15// controls (zoom, close, miniaturize) for a window with a tabstrip.
16const NSInteger kFramedWindowButtonsWithTabStripOffsetFromTop = 11;
17const NSInteger kFramedWindowButtonsWithTabStripOffsetFromLeft = 11;
18
19// Offsets from the top/left of the window frame to the top of the window
20// controls (zoom, close, miniaturize) for a window without a tabstrip.
21const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromTop = 4;
22const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromLeft = 8;
23
24// Offset between the window controls (zoom, close, miniaturize).
25const NSInteger kFramedWindowButtonsInterButtonSpacing = 7;
26
27// Cocoa class representing a framed browser window.
28// We need to override NSWindow with our own class since we need access to all
29// unhandled keyboard events and subclassing NSWindow is the only method to do
30// this. We also handle our own window controls and custom window frame drawing.
31@interface FramedBrowserWindow : ChromeBrowserWindow {
32 @private
33  BOOL shouldHideTitle_;
34  BOOL hasTabStrip_;
35  NSButton* closeButton_;
36  NSButton* miniaturizeButton_;
37  NSButton* zoomButton_;
38}
39
40// Tells the window to suppress title drawing.
41- (void)setShouldHideTitle:(BOOL)flag;
42
43@end
44
45@interface NSWindow (UndocumentedAPI)
46
47// Undocumented Cocoa API to suppress drawing of the window's title.
48// -setTitle: still works, but the title set only applies to the
49// miniwindow and menus (and, importantly, Expose).  Overridden to
50// return |shouldHideTitle_|.
51-(BOOL)_isTitleHidden;
52
53@end
54
55#endif  // CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_
56