| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 5 #ifndef VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
| 6 #define VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 6 #define VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
| 7 | 7 |
| 8 #include "views/controls/button/image_button.h" | 8 #include "views/controls/button/image_button.h" |
| 9 #include "views/window/non_client_view.h" | 9 #include "views/window/non_client_view.h" |
| 10 #include "views/window/window.h" | 10 #include "views/window/window.h" |
| 11 #include "views/window/window_resources.h" | 11 #include "views/window/window_resources.h" |
| 12 | 12 |
| 13 namespace gfx{ | 13 namespace gfx{ |
| 14 class Canvas; |
| 14 class Font; | 15 class Font; |
| 15 class Size; | 16 class Size; |
| 16 class Path; | 17 class Path; |
| 17 class Point; | 18 class Point; |
| 18 } | 19 } |
| 19 class ChromeCanvas; | |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 | 22 |
| 23 /////////////////////////////////////////////////////////////////////////////// | 23 /////////////////////////////////////////////////////////////////////////////// |
| 24 // | 24 // |
| 25 // CustomFrameView | 25 // CustomFrameView |
| 26 // | 26 // |
| 27 // A ChromeView that provides the non client frame for Windows. This means | 27 // A ChromeView that provides the non client frame for Windows. This means |
| 28 // rendering the non-standard window caption, border, and controls. | 28 // rendering the non-standard window caption, border, and controls. |
| 29 // | 29 // |
| 30 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
| 31 class CustomFrameView : public NonClientFrameView, | 31 class CustomFrameView : public NonClientFrameView, |
| 32 public ButtonListener { | 32 public ButtonListener { |
| 33 public: | 33 public: |
| 34 explicit CustomFrameView(Window* frame); | 34 explicit CustomFrameView(Window* frame); |
| 35 virtual ~CustomFrameView(); | 35 virtual ~CustomFrameView(); |
| 36 | 36 |
| 37 // Overridden from views::NonClientFrameView: | 37 // Overridden from views::NonClientFrameView: |
| 38 virtual gfx::Rect GetBoundsForClientView() const; | 38 virtual gfx::Rect GetBoundsForClientView() const; |
| 39 virtual gfx::Rect GetWindowBoundsForClientBounds( | 39 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 40 const gfx::Rect& client_bounds) const; | 40 const gfx::Rect& client_bounds) const; |
| 41 virtual gfx::Point GetSystemMenuPoint() const; | 41 virtual gfx::Point GetSystemMenuPoint() const; |
| 42 virtual int NonClientHitTest(const gfx::Point& point); | 42 virtual int NonClientHitTest(const gfx::Point& point); |
| 43 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask); | 43 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask); |
| 44 virtual void EnableClose(bool enable); | 44 virtual void EnableClose(bool enable); |
| 45 virtual void ResetWindowControls(); | 45 virtual void ResetWindowControls(); |
| 46 | 46 |
| 47 // View overrides: | 47 // View overrides: |
| 48 virtual void Paint(ChromeCanvas* canvas); | 48 virtual void Paint(gfx::Canvas* canvas); |
| 49 virtual void Layout(); | 49 virtual void Layout(); |
| 50 virtual gfx::Size GetPreferredSize(); | 50 virtual gfx::Size GetPreferredSize(); |
| 51 | 51 |
| 52 // ButtonListener implementation: | 52 // ButtonListener implementation: |
| 53 virtual void ButtonPressed(Button* sender); | 53 virtual void ButtonPressed(Button* sender); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 // Returns the thickness of the border that makes up the window frame edges. | 56 // Returns the thickness of the border that makes up the window frame edges. |
| 57 // This does not include any client edge. | 57 // This does not include any client edge. |
| 58 int FrameBorderThickness() const; | 58 int FrameBorderThickness() const; |
| 59 | 59 |
| 60 // Returns the thickness of the entire nonclient left, right, and bottom | 60 // Returns the thickness of the entire nonclient left, right, and bottom |
| 61 // borders, including both the window frame and any client edge. | 61 // borders, including both the window frame and any client edge. |
| 62 int NonClientBorderThickness() const; | 62 int NonClientBorderThickness() const; |
| 63 | 63 |
| 64 // Returns the height of the entire nonclient top border, including the window | 64 // Returns the height of the entire nonclient top border, including the window |
| 65 // frame, any title area, and any connected client edge. | 65 // frame, any title area, and any connected client edge. |
| 66 int NonClientTopBorderHeight() const; | 66 int NonClientTopBorderHeight() const; |
| 67 | 67 |
| 68 // A bottom border, and, in restored mode, a client edge are drawn at the | 68 // A bottom border, and, in restored mode, a client edge are drawn at the |
| 69 // bottom of the titlebar. This returns the total height drawn. | 69 // bottom of the titlebar. This returns the total height drawn. |
| 70 int BottomEdgeThicknessWithinNonClientHeight() const; | 70 int BottomEdgeThicknessWithinNonClientHeight() const; |
| 71 | 71 |
| 72 // Calculates multiple values related to title layout. Returns the height of | 72 // Calculates multiple values related to title layout. Returns the height of |
| 73 // the entire titlebar including any connected client edge. | 73 // the entire titlebar including any connected client edge. |
| 74 int TitleCoordinates(int* title_top_spacing, | 74 int TitleCoordinates(int* title_top_spacing, |
| 75 int* title_thickness) const; | 75 int* title_thickness) const; |
| 76 | 76 |
| 77 // Paint various sub-components of this view. | 77 // Paint various sub-components of this view. |
| 78 void PaintRestoredFrameBorder(ChromeCanvas* canvas); | 78 void PaintRestoredFrameBorder(gfx::Canvas* canvas); |
| 79 void PaintMaximizedFrameBorder(ChromeCanvas* canvas); | 79 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); |
| 80 void PaintTitleBar(ChromeCanvas* canvas); | 80 void PaintTitleBar(gfx::Canvas* canvas); |
| 81 void PaintRestoredClientEdge(ChromeCanvas* canvas); | 81 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
| 82 | 82 |
| 83 // Layout various sub-components of this view. | 83 // Layout various sub-components of this view. |
| 84 void LayoutWindowControls(); | 84 void LayoutWindowControls(); |
| 85 void LayoutTitleBar(); | 85 void LayoutTitleBar(); |
| 86 void LayoutClientView(); | 86 void LayoutClientView(); |
| 87 | 87 |
| 88 // The bounds of the client view, in this view's coordinates. | 88 // The bounds of the client view, in this view's coordinates. |
| 89 gfx::Rect client_view_bounds_; | 89 gfx::Rect client_view_bounds_; |
| 90 | 90 |
| 91 // The layout rect of the title, if visible. | 91 // The layout rect of the title, if visible. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 105 // Initialize various static resources. | 105 // Initialize various static resources. |
| 106 static void InitClass(); | 106 static void InitClass(); |
| 107 static gfx::Font* title_font_; | 107 static gfx::Font* title_font_; |
| 108 | 108 |
| 109 DISALLOW_EVIL_CONSTRUCTORS(CustomFrameView); | 109 DISALLOW_EVIL_CONSTRUCTORS(CustomFrameView); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace views | 112 } // namespace views |
| 113 | 113 |
| 114 #endif // #ifndef VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 114 #endif // #ifndef VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
| OLD | NEW |