Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / themed_window.h
blob0a55c2b13508edd8e23a29d7d1f658bb41499bf6
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.
5 #ifndef CHROME_BROWSER_UI_COCOA_THEMED_WINDOW_H_
6 #define CHROME_BROWSER_UI_COCOA_THEMED_WINDOW_H_
8 #import <Cocoa/Cocoa.h>
10 namespace ui {
11 class ThemeProvider;
13 using ui::ThemeProvider;
15 // Bit flags; mix-and-match as necessary.
16 enum {
17 THEMED_NORMAL = 0,
18 THEMED_INCOGNITO = 1 << 0,
19 THEMED_POPUP = 1 << 1,
20 THEMED_DEVTOOLS = 1 << 2
22 typedef NSUInteger ThemedWindowStyle;
24 // Indicates how the theme image should be aligned.
25 enum ThemeImageAlignment {
26 // Aligns the top of the theme image with the top of the frame. Use this
27 // for IDR_THEME_THEME_FRAME.*
28 THEME_IMAGE_ALIGN_WITH_FRAME,
29 // Aligns the top of the theme image with the top of the tabs.
30 // Use this for IDR_THEME_TAB_BACKGROUND and IDR_THEME_TOOLBAR.
31 THEME_IMAGE_ALIGN_WITH_TAB_STRIP
34 // Implemented by windows that support theming.
35 @interface NSWindow (ThemeProvider)
36 - (ThemeProvider*)themeProvider;
37 - (ThemedWindowStyle)themedWindowStyle;
39 // Returns the position in window coordinates that the top left of a theme
40 // image with |alignment| should be painted at. The result of this method can
41 // be used in conjunction with [NSGraphicsContext cr_setPatternPhase:] to set
42 // the offset of pattern colors.
43 - (NSPoint)themeImagePositionForAlignment:(ThemeImageAlignment)alignment;
44 @end
46 // Adopted by views that want to redraw when the theme changed, or when the
47 // window's active status changed.
48 @protocol ThemedWindowDrawing
50 // Called by the window controller when the theme changed.
51 - (void)windowDidChangeTheme;
53 // Called by the window controller when the window gained or lost main window
54 // status.
55 - (void)windowDidChangeActive;
57 @end
59 #endif // CHROME_BROWSER_UI_COCOA_THEMED_WINDOW_H_