Home | History | Annotate | Download | only in panels
      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/aura/aura_export.h"
     11 #include "ui/gfx/font.h"
     12 #include "ui/views/controls/button/button.h"  // ButtonListener
     13 #include "ui/views/window/non_client_view.h"
     14 
     15 namespace views {
     16 class ImageButton;
     17 }
     18 
     19 namespace ash {
     20 
     21 class FramePainter;
     22 
     23 class ASH_EXPORT PanelFrameView : public views::NonClientFrameView,
     24                                   public views::ButtonListener {
     25  public:
     26   // Internal class name.
     27   static const char kViewClassName[];
     28 
     29   enum FrameType {
     30     FRAME_NONE,
     31     FRAME_ASH
     32   };
     33 
     34   PanelFrameView(views::Widget* frame, FrameType frame_type);
     35   virtual ~PanelFrameView();
     36 
     37   // Overridden from views::View:
     38   virtual const char* GetClassName() const OVERRIDE;
     39 
     40  private:
     41   void InitFramePainter();
     42 
     43   // Overridden from views::NonClientFrameView:
     44   virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
     45   virtual gfx::Rect GetWindowBoundsForClientBounds(
     46       const gfx::Rect& client_bounds) const OVERRIDE;
     47   virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
     48   virtual void GetWindowMask(const gfx::Size& size,
     49                              gfx::Path* window_mask) OVERRIDE;
     50   virtual void ResetWindowControls() OVERRIDE;
     51   virtual void UpdateWindowIcon() OVERRIDE;
     52   virtual void UpdateWindowTitle() OVERRIDE;
     53 
     54   // Overridden from views::View:
     55   virtual gfx::Size GetMinimumSize() OVERRIDE;
     56   virtual void Layout() OVERRIDE;
     57   virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
     58 
     59   // Overridden from views::ButtonListener:
     60   virtual void ButtonPressed(views::Button* sender,
     61                              const ui::Event& event) OVERRIDE;
     62 
     63   // Child View class describing the panel's title bar behavior
     64   // and buttons, owned by the view hierarchy
     65   scoped_ptr<FramePainter> frame_painter_;
     66   views::Widget* frame_;
     67   views::ImageButton* close_button_;
     68   views::ImageButton* minimize_button_;
     69   views::ImageButton* window_icon_;
     70   gfx::Rect client_view_bounds_;
     71   const gfx::Font title_font_;
     72 
     73   DISALLOW_COPY_AND_ASSIGN(PanelFrameView);
     74 };
     75 
     76 }
     77 
     78 #endif // ASH_WM_PANELS_PANEL_FRAME_VIEW_H_
     79