OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_UI_COCOA_PANELS_PANEL_STACK_WINDOW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PANELS_PANEL_STACK_WINDOW_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_STACK_WINDOW_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_STACK_WINDOW_COCOA_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <map> | 11 #include <map> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/mac/scoped_nsobject.h" | 14 #include "base/mac/scoped_nsobject.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "chrome/browser/ui/panels/native_panel_stack_window.h" | 16 #include "chrome/browser/ui/panels/native_panel_stack_window.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 @class BatchBoundsAnimationDelegate; | 19 @class BatchBoundsAnimationDelegate; |
20 class Panel; | 20 class Panel; |
21 class PanelStackWindowCocoa; | 21 class PanelStackWindowCocoa; |
22 | 22 |
23 // A native window that acts as the owner of all/partial panels in the stack, | 23 // A native window that acts as the owner of all/partial panels in the stack, |
24 // in order to make these panels appear as a single window. | 24 // in order to make these panels appear as a single window. |
25 class PanelStackWindowCocoa : public NativePanelStackWindow { | 25 class PanelStackWindowCocoa : public NativePanelStackWindow { |
26 public: | 26 public: |
27 explicit PanelStackWindowCocoa(NativePanelStackWindowDelegate* delegate); | 27 explicit PanelStackWindowCocoa(NativePanelStackWindowDelegate* delegate); |
28 virtual ~PanelStackWindowCocoa(); | 28 ~PanelStackWindowCocoa() override; |
29 | 29 |
30 // Notified by BatchBoundsAnimationDelegate about the ending of the bounds | 30 // Notified by BatchBoundsAnimationDelegate about the ending of the bounds |
31 // animation. | 31 // animation. |
32 void BoundsUpdateAnimationEnded(); | 32 void BoundsUpdateAnimationEnded(); |
33 | 33 |
34 protected: | 34 protected: |
35 // Overridden from NativePanelStackWindow: | 35 // Overridden from NativePanelStackWindow: |
36 virtual void Close() override; | 36 void Close() override; |
37 virtual void AddPanel(Panel* panel) override; | 37 void AddPanel(Panel* panel) override; |
38 virtual void RemovePanel(Panel* panel) override; | 38 void RemovePanel(Panel* panel) override; |
39 virtual void MergeWith(NativePanelStackWindow* another) override; | 39 void MergeWith(NativePanelStackWindow* another) override; |
40 virtual bool IsEmpty() const override; | 40 bool IsEmpty() const override; |
41 virtual bool HasPanel(Panel* panel) const override; | 41 bool HasPanel(Panel* panel) const override; |
42 virtual void MovePanelsBy(const gfx::Vector2d& delta) override; | 42 void MovePanelsBy(const gfx::Vector2d& delta) override; |
43 virtual void BeginBatchUpdatePanelBounds(bool animate) override; | 43 void BeginBatchUpdatePanelBounds(bool animate) override; |
44 virtual void AddPanelBoundsForBatchUpdate(Panel* panel, | 44 void AddPanelBoundsForBatchUpdate(Panel* panel, |
45 const gfx::Rect& bounds) override; | 45 const gfx::Rect& bounds) override; |
46 virtual void EndBatchUpdatePanelBounds() override; | 46 void EndBatchUpdatePanelBounds() override; |
47 virtual bool IsAnimatingPanelBounds() const override; | 47 bool IsAnimatingPanelBounds() const override; |
48 virtual void Minimize() override; | 48 void Minimize() override; |
49 virtual bool IsMinimized() const override; | 49 bool IsMinimized() const override; |
50 virtual void DrawSystemAttention(bool draw_attention) override; | 50 void DrawSystemAttention(bool draw_attention) override; |
51 virtual void OnPanelActivated(Panel* panel) override; | 51 void OnPanelActivated(Panel* panel) override; |
52 | 52 |
53 private: | 53 private: |
54 typedef std::list<Panel*> Panels; | 54 typedef std::list<Panel*> Panels; |
55 | 55 |
56 // The map value is old bounds of the panel. | 56 // The map value is old bounds of the panel. |
57 typedef std::map<Panel*, gfx::Rect> BoundsUpdates; | 57 typedef std::map<Panel*, gfx::Rect> BoundsUpdates; |
58 | 58 |
59 // Terminates current bounds animation, if any. | 59 // Terminates current bounds animation, if any. |
60 void TerminateBoundsAnimation(); | 60 void TerminateBoundsAnimation(); |
61 | 61 |
(...skipping 23 matching lines...) Expand all Loading... |
85 // Used to animate the bounds changes at a synchronized pace. | 85 // Used to animate the bounds changes at a synchronized pace. |
86 // Lifetime controlled manually, needs more than just |release| to terminate. | 86 // Lifetime controlled manually, needs more than just |release| to terminate. |
87 NSViewAnimation* bounds_animation_; | 87 NSViewAnimation* bounds_animation_; |
88 base::scoped_nsobject<BatchBoundsAnimationDelegate> | 88 base::scoped_nsobject<BatchBoundsAnimationDelegate> |
89 bounds_animation_delegate_; | 89 bounds_animation_delegate_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(PanelStackWindowCocoa); | 91 DISALLOW_COPY_AND_ASSIGN(PanelStackWindowCocoa); |
92 }; | 92 }; |
93 | 93 |
94 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_STACK_WINDOW_COCOA_H_ | 94 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_STACK_WINDOW_COCOA_H_ |
OLD | NEW |