| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "chrome/browser/ui/cocoa/chrome_browser_window.h" | 10 #include "chrome/browser/ui/cocoa/chrome_browser_window.h" |
| 11 | 11 |
| 12 // Offsets from the top/left of the window frame to the top of the window | 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. | 13 // controls (zoom, close, miniaturize) for a window with a tabstrip. |
| 14 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromTop = 11; | 14 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromTop = 11; |
| 15 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromLeft = 11; | 15 const NSInteger kFramedWindowButtonsWithTabStripOffsetFromLeft = 11; |
| 16 | 16 |
| 17 // Offsets from the top/left of the window frame to the top of the window | 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. | 18 // controls (zoom, close, miniaturize) for a window without a tabstrip. |
| 19 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromTop = 4; | 19 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromTop = 4; |
| 20 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromLeft = 8; | 20 const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromLeft = 8; |
| 21 | 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. | 22 // Cocoa class representing a framed browser window. |
| 27 // We need to override NSWindow with our own class since we need access to all | 23 // 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 | 24 // 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. | 25 // this. We also handle our own window controls and custom window frame drawing. |
| 30 @interface FramedBrowserWindow : ChromeBrowserWindow { | 26 @interface FramedBrowserWindow : ChromeBrowserWindow { |
| 31 @private | 27 @private |
| 32 BOOL shouldHideTitle_; | 28 BOOL shouldHideTitle_; |
| 33 BOOL hasTabStrip_; | 29 BOOL hasTabStrip_; |
| 34 NSButton* closeButton_; | 30 NSButton* closeButton_; |
| 35 NSButton* miniaturizeButton_; | 31 NSButton* miniaturizeButton_; |
| 36 NSButton* zoomButton_; | 32 NSButton* zoomButton_; |
| 37 | 33 |
| 38 // Locks the window's frame and style mask. If it's set to YES, then the | 34 // Locks the window's frame and style mask. If it's set to YES, then the |
| 39 // frame and the style mask cannot be changed. | 35 // frame and the style mask cannot be changed. |
| 40 BOOL styleMaskLock_; | 36 BOOL styleMaskLock_; |
| 41 | 37 |
| 42 CGFloat windowButtonsInterButtonSpacing_; | 38 CGFloat windowButtonsInterButtonSpacing_; |
| 43 } | 39 } |
| 44 | 40 |
| 41 // The amount of window background image that is painted at the top of the |
| 42 // window, so that it shows behind the tap strip area. |
| 43 + (CGFloat)browserFrameViewPaintHeight; |
| 44 |
| 45 // Designated initializer. | 45 // Designated initializer. |
| 46 - (id)initWithContentRect:(NSRect)contentRect | 46 - (id)initWithContentRect:(NSRect)contentRect |
| 47 hasTabStrip:(BOOL)hasTabStrip; | 47 hasTabStrip:(BOOL)hasTabStrip; |
| 48 | 48 |
| 49 // Tells the window to suppress title drawing. | 49 // Tells the window to suppress title drawing. |
| 50 - (void)setShouldHideTitle:(BOOL)flag; | 50 - (void)setShouldHideTitle:(BOOL)flag; |
| 51 | 51 |
| 52 // When the lock is set to YES, the frame and style mask of the Window cannot be | 52 // When the lock is set to YES, the frame and style mask of the Window cannot be |
| 53 // changed. This is used to prevent AppKit from making these unwanted changes | 53 // changed. This is used to prevent AppKit from making these unwanted changes |
| 54 // to the window during exit fullscreen transition. It is very important to | 54 // to the window during exit fullscreen transition. It is very important to |
| (...skipping 28 matching lines...) Expand all Loading... |
| 83 | 83 |
| 84 // Undocumented Cocoa API to suppress drawing of the window's title. | 84 // Undocumented Cocoa API to suppress drawing of the window's title. |
| 85 // -setTitle: still works, but the title set only applies to the | 85 // -setTitle: still works, but the title set only applies to the |
| 86 // miniwindow and menus (and, importantly, Expose). Overridden to | 86 // miniwindow and menus (and, importantly, Expose). Overridden to |
| 87 // return |shouldHideTitle_|. | 87 // return |shouldHideTitle_|. |
| 88 -(BOOL)_isTitleHidden; | 88 -(BOOL)_isTitleHidden; |
| 89 | 89 |
| 90 @end | 90 @end |
| 91 | 91 |
| 92 #endif // CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_ | 92 #endif // CHROME_BROWSER_UI_COCOA_FRAMED_BROWSER_WINDOW_H_ |
| OLD | NEW |