Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / framed_browser_window.h
1 // Copyright (c) 2012 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
8 #import <Cocoa/Cocoa.h>
9
10 #include "chrome/browser/ui/cocoa/chrome_browser_window.h"
11
12 // Offsets from the top/left of the window frame to the top of the window
13 // controls (zoom, close, miniaturize) for a window with a tabstrip.
14 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromTop = 11;
15 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromLeft = 11;
16
17 // Offsets from the top/left of the window frame to the top of the window
18 // controls (zoom, close, miniaturize) for a window without a tabstrip.
19 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromTop = 4;
20 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromLeft = 8;
21
22 // The amount of window background image that is painted at the top of the
23 // window, so that it shows behind the tap strip area.
24 const CGFloat kBrowserFrameViewPaintHeight = 60.0;
25
26 // Cocoa class representing a framed browser window.
27 // We need to override NSWindow with our own class since we need access to all
28 // unhandled keyboard events and subclassing NSWindow is the only method to do
29 // this. We also handle our own window controls and custom window frame drawing.
30 @interface FramedBrowserWindow : ChromeBrowserWindow {
31  @private
32   BOOL shouldHideTitle_;
33   BOOL hasTabStrip_;
34   NSButton* closeButton_;
35   NSButton* miniaturizeButton_;
36   NSButton* zoomButton_;
37
38   CGFloat windowButtonsInterButtonSpacing_;
39 }
40
41 // Designated initializer.
42 - (id)initWithContentRect:(NSRect)contentRect
43               hasTabStrip:(BOOL)hasTabStrip;
44
45 // Tells the window to suppress title drawing.
46 - (void)setShouldHideTitle:(BOOL)flag;
47
48 // Returns the desired spacing between window control views.
49 - (CGFloat)windowButtonsInterButtonSpacing;
50
51 // Calls the superclass's implementation of |-toggleFullScreen:|.
52 - (void)toggleSystemFullScreen;
53
54 // Called by CustomFrameView to determine a custom location for the Lion
55 // fullscreen button. Returns NSZeroPoint to use the Lion default.
56 - (NSPoint)fullScreenButtonOriginAdjustment;
57
58 // Draws the window theme into the specified rect. Returns whether a theme was
59 // drawn (whether incognito or full pattern theme; an overlay image doesn't
60 // count).
61 + (BOOL)drawWindowThemeInDirtyRect:(NSRect)dirtyRect
62                            forView:(NSView*)view
63                             bounds:(NSRect)bounds
64               forceBlackBackground:(BOOL)forceBlackBackground;
65
66 // Gets the color to draw title text.
67 - (NSColor*)titleColor;
68
69 @end
70
71 @interface NSWindow (UndocumentedAPI)
72
73 // Undocumented Cocoa API to suppress drawing of the window's title.
74 // -setTitle: still works, but the title set only applies to the
75 // miniwindow and menus (and, importantly, Expose).  Overridden to
76 // return |shouldHideTitle_|.
77 -(BOOL)_isTitleHidden;
78
79 @end
80
81 #endif  // CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_