OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 5 #ifndef UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
6 #define UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 6 #define UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/views/controls/button/image_button.h" | 9 #include "ui/views/controls/button/image_button.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
11 #include "ui/views/window/non_client_view.h" | 11 #include "ui/views/window/non_client_view.h" |
12 | 12 |
| 13 class SkBitmap; |
13 namespace gfx { | 14 namespace gfx { |
14 class Canvas; | 15 class Canvas; |
15 class Font; | 16 class Font; |
16 class Size; | 17 class Size; |
17 class Path; | 18 class Path; |
18 class Point; | 19 class Point; |
19 } | 20 } |
20 | 21 |
21 namespace views { | 22 namespace views { |
22 | 23 |
| 24 class FrameBackground; |
| 25 |
23 /////////////////////////////////////////////////////////////////////////////// | 26 /////////////////////////////////////////////////////////////////////////////// |
24 // | 27 // |
25 // CustomFrameView | 28 // CustomFrameView |
26 // | 29 // |
27 // A ChromeView that provides the non client frame for Windows. This means | 30 // A ChromeView that provides the non client frame for Windows. This means |
28 // rendering the non-standard window caption, border, and controls. | 31 // rendering the non-standard window caption, border, and controls. |
29 // | 32 // |
30 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
31 class CustomFrameView : public NonClientFrameView, | 34 class CustomFrameView : public NonClientFrameView, |
32 public ButtonListener { | 35 public ButtonListener { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Returns true if the client edge should be drawn. This is true if | 87 // Returns true if the client edge should be drawn. This is true if |
85 // the window delegate wants a client edge and we are not maxmized. | 88 // the window delegate wants a client edge and we are not maxmized. |
86 bool ShouldShowClientEdge() const; | 89 bool ShouldShowClientEdge() const; |
87 | 90 |
88 // Paint various sub-components of this view. | 91 // Paint various sub-components of this view. |
89 void PaintRestoredFrameBorder(gfx::Canvas* canvas); | 92 void PaintRestoredFrameBorder(gfx::Canvas* canvas); |
90 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); | 93 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); |
91 void PaintTitleBar(gfx::Canvas* canvas); | 94 void PaintTitleBar(gfx::Canvas* canvas); |
92 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 95 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
93 | 96 |
| 97 // Compute aspects of the frame needed to paint the frame background. |
| 98 SkColor GetFrameColor() const; |
| 99 SkBitmap* GetFrameBitmap() const; |
| 100 |
94 // Layout various sub-components of this view. | 101 // Layout various sub-components of this view. |
95 void LayoutWindowControls(); | 102 void LayoutWindowControls(); |
96 void LayoutTitleBar(); | 103 void LayoutTitleBar(); |
97 void LayoutClientView(); | 104 void LayoutClientView(); |
98 | 105 |
99 // The bounds of the client view, in this view's coordinates. | 106 // The bounds of the client view, in this view's coordinates. |
100 gfx::Rect client_view_bounds_; | 107 gfx::Rect client_view_bounds_; |
101 | 108 |
102 // The layout rect of the title, if visible. | 109 // The layout rect of the title, if visible. |
103 gfx::Rect title_bounds_; | 110 gfx::Rect title_bounds_; |
104 | 111 |
105 // Window controls. | 112 // Window controls. |
106 ImageButton* close_button_; | 113 ImageButton* close_button_; |
107 ImageButton* restore_button_; | 114 ImageButton* restore_button_; |
108 ImageButton* maximize_button_; | 115 ImageButton* maximize_button_; |
109 ImageButton* minimize_button_; | 116 ImageButton* minimize_button_; |
110 ImageButton* window_icon_; | 117 ImageButton* window_icon_; |
111 bool should_show_minmax_buttons_; | 118 bool should_show_minmax_buttons_; |
112 bool should_show_client_edge_; | 119 bool should_show_client_edge_; |
113 | 120 |
114 // The window that owns this view. | 121 // The window that owns this view. |
115 Widget* frame_; | 122 Widget* frame_; |
116 | 123 |
| 124 // Background painter for the window frame. |
| 125 scoped_ptr<FrameBackground> frame_background_; |
| 126 |
117 // Initialize various static resources. | 127 // Initialize various static resources. |
118 static void InitClass(); | 128 static void InitClass(); |
119 static gfx::Font* title_font_; | 129 static gfx::Font* title_font_; |
120 | 130 |
121 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); | 131 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); |
122 }; | 132 }; |
123 | 133 |
124 } // namespace views | 134 } // namespace views |
125 | 135 |
126 #endif // UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 136 #endif // UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
OLD | NEW |