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 ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ 6 #define ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ 7 8 #include "ash/ash_export.h" 9 #include "base/basictypes.h" 10 #include "ui/gfx/font.h" 11 #include "ui/views/window/non_client_view.h" 12 13 namespace views { 14 class ImageView; 15 } 16 17 namespace ash { 18 19 class FrameCaptionButtonContainerView; 20 class FrameBorderHitTestController; 21 class HeaderPainter; 22 23 class ASH_EXPORT PanelFrameView : public views::NonClientFrameView { 24 public: 25 // Internal class name. 26 static const char kViewClassName[]; 27 28 enum FrameType { 29 FRAME_NONE, 30 FRAME_ASH 31 }; 32 33 PanelFrameView(views::Widget* frame, FrameType frame_type); 34 virtual ~PanelFrameView(); 35 36 // Overridden from views::View: 37 virtual const char* GetClassName() const OVERRIDE; 38 39 private: 40 void InitHeaderPainter(); 41 42 // Height from top of window to top of client area. 43 int NonClientTopBorderHeight() const; 44 45 // Overridden from views::NonClientFrameView: 46 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; 47 virtual gfx::Rect GetWindowBoundsForClientBounds( 48 const gfx::Rect& client_bounds) const OVERRIDE; 49 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; 50 virtual void GetWindowMask(const gfx::Size& size, 51 gfx::Path* window_mask) OVERRIDE; 52 virtual void ResetWindowControls() OVERRIDE; 53 virtual void UpdateWindowIcon() OVERRIDE; 54 virtual void UpdateWindowTitle() OVERRIDE; 55 56 // Overridden from views::View: 57 virtual gfx::Size GetMinimumSize() OVERRIDE; 58 virtual void Layout() OVERRIDE; 59 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 60 61 // Child View class describing the panel's title bar behavior 62 // and buttons, owned by the view hierarchy 63 views::Widget* frame_; 64 FrameCaptionButtonContainerView* caption_button_container_; 65 views::ImageView* window_icon_; 66 gfx::Rect client_view_bounds_; 67 const gfx::Font title_font_; 68 69 // Helper class for painting the header. 70 scoped_ptr<HeaderPainter> header_painter_; 71 72 // Updates the hittest bounds overrides based on the window show type. 73 scoped_ptr<FrameBorderHitTestController> frame_border_hit_test_controller_; 74 75 DISALLOW_COPY_AND_ASSIGN(PanelFrameView); 76 }; 77 78 } 79 80 #endif // ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ 81