OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_AURA_SHELL_TOPLEVEL_FRAME_VIEW_H_ |
| 6 #define UI_AURA_SHELL_TOPLEVEL_FRAME_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "ui/aura_shell/aura_shell_export.h" |
| 10 #include "ui/base/animation/animation_delegate.h" |
| 11 #include "views/controls/button/button.h" |
| 12 #include "views/window/non_client_view.h" |
| 13 |
| 14 namespace ui { |
| 15 class SlideAnimation; |
| 16 } |
| 17 |
| 18 namespace aura_shell { |
| 19 namespace internal { |
| 20 |
| 21 class SizingBorder; |
| 22 |
| 23 // A NonClientFrameView implementation for generic top-level windows in Aura. |
| 24 // TODO(beng): Find a way to automatically this for all top-level windows in |
| 25 // Aura. Right now windows have to override CreateNonClientFrameView |
| 26 // on WidgetDelegate to specify this. |
| 27 class AURA_SHELL_EXPORT ToplevelFrameView : public views::NonClientFrameView, |
| 28 public views::ButtonListener { |
| 29 public: |
| 30 ToplevelFrameView(); |
| 31 virtual ~ToplevelFrameView(); |
| 32 |
| 33 private: |
| 34 // Returns the height of the side/bottom non-client edges. |
| 35 int NonClientBorderThickness() const; |
| 36 |
| 37 // Returns the height of the top non-client edge - the caption. |
| 38 int NonClientTopBorderHeight() const; |
| 39 |
| 40 // Implementation of NonClientHitTest(). |
| 41 int NonClientHitTestImpl(const gfx::Point& point); |
| 42 |
| 43 // Shows the specified |sizing_border|, hiding all others. |
| 44 // If |sizing_border| is NULL, all other sizing borders are hidden. |
| 45 void ShowSizingBorder(SizingBorder* sizing_border); |
| 46 |
| 47 // Returns true if the specified point (in FrameView coordinates) hit-tests |
| 48 // against the specified child. |
| 49 bool PointIsInChildView(views::View* child, const gfx::Point& point) const; |
| 50 |
| 51 // Returns the bounds of the specified sizing border for its visible and |
| 52 // hidden states. |
| 53 gfx::Rect GetHiddenBoundsForSizingBorder(int frame_component) const; |
| 54 gfx::Rect GetVisibleBoundsForSizingBorder(int frame_component) const; |
| 55 |
| 56 // Overridden from views::NonClientFrameView: |
| 57 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
| 58 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 59 const gfx::Rect& client_bounds) const OVERRIDE; |
| 60 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
| 61 virtual void GetWindowMask(const gfx::Size& size, |
| 62 gfx::Path* window_mask) OVERRIDE; |
| 63 virtual void EnableClose(bool enable) OVERRIDE; |
| 64 virtual void ResetWindowControls() OVERRIDE; |
| 65 virtual void UpdateWindowIcon() OVERRIDE; |
| 66 |
| 67 // Overridden from views::View: |
| 68 virtual void Layout() OVERRIDE; |
| 69 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 70 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; |
| 71 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
| 72 virtual views::View* GetEventHandlerForPoint( |
| 73 const gfx::Point& point) OVERRIDE; |
| 74 |
| 75 // Overridden from views::ButtonListener: |
| 76 virtual void ButtonPressed(views::Button* sender, |
| 77 const views::Event& event) OVERRIDE; |
| 78 |
| 79 gfx::Rect client_view_bounds_; |
| 80 |
| 81 views::Button* close_button_; |
| 82 views::Button* zoom_button_; |
| 83 |
| 84 int current_hittest_code_; |
| 85 |
| 86 SizingBorder* left_edge_; |
| 87 SizingBorder* right_edge_; |
| 88 SizingBorder* bottom_edge_; |
| 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(ToplevelFrameView); |
| 91 }; |
| 92 |
| 93 } // namespace internal |
| 94 } // namespace aura_shell |
| 95 |
| 96 #endif // #ifndef UI_AURA_SHELL_TOPLEVEL_FRAME_VIEW_H_ |
OLD | NEW |