OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_STACK_WINDOW_H_ | |
6 #define CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_STACK_WINDOW_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/strings/string16.h" | |
11 #include "ui/gfx/image/image.h" | |
12 | |
13 class Panel; | |
14 namespace gfx { | |
15 class Rect; | |
16 class Vector2d; | |
17 } | |
18 | |
19 class NativePanelStackWindowDelegate { | |
20 public: | |
21 // Returns the title representing the whole stack. | |
22 virtual base::string16 GetTitle() const = 0; | |
23 | |
24 // Returns the icon denoting the whole stack. | |
25 virtual gfx::Image GetIcon() const = 0; | |
26 | |
27 // Called when the batch bounds update is completed, i.e. animation ends. | |
28 virtual void PanelBoundsBatchUpdateCompleted() = 0; | |
29 }; | |
30 | |
31 // An interface that encapsulates the platform-specific behaviors that are | |
32 // needed to support multiple panels that are stacked together. A native | |
33 // window might be created to enclose all the panels in the stack. The lifetime | |
34 // of the class that implements this interface is managed by itself. | |
35 class NativePanelStackWindow { | |
36 public: | |
37 // Creates and returns a NativePanelStackWindow instance. Calling Close() will | |
38 // destruct the instance. | |
39 static NativePanelStackWindow* Create( | |
40 NativePanelStackWindowDelegate* delegate); | |
41 | |
42 virtual ~NativePanelStackWindow() {} | |
43 | |
44 virtual bool IsMinimized() const = 0; | |
45 | |
46 protected: | |
47 friend class StackedPanelCollection; | |
48 | |
49 // Called when the stack is to be closed. This will cause this instance to be | |
50 // self destructed after the native window closes. | |
51 virtual void Close() = 0; | |
52 | |
53 // Makes |panel| be enclosed by this stack window. | |
54 | |
55 // Adds |panel| to the set of panels grouped and shown inside this stack | |
56 // Window. It does not take ownership of |panel|. | |
57 virtual void AddPanel(Panel* panel) = 0; | |
58 | |
59 // Removes |panel| from the set of panels grouped and shown inside this stack | |
60 // window. | |
61 virtual void RemovePanel(Panel* panel) = 0; | |
62 | |
63 // Merges those panels grouped and shown inside |another| stack window into | |
64 // the set of panels grouped and shown inside this stack window. | |
65 virtual void MergeWith(NativePanelStackWindow* another) = 0; | |
66 | |
67 // Returns true if no panel is being shown inside this stack window. | |
68 virtual bool IsEmpty() const = 0; | |
69 | |
70 // Returns true if |panel| is being enclosed by this stack window. | |
71 virtual bool HasPanel(Panel* panel) const = 0; | |
72 | |
73 // Moves all panels instantly by |delta|. All the moves should be done | |
74 // simulatenously. | |
75 virtual void MovePanelsBy(const gfx::Vector2d& delta) = 0; | |
76 | |
77 // Changes the bounds of a set of panels synchronously. | |
78 virtual void BeginBatchUpdatePanelBounds(bool animate) = 0; | |
79 virtual void AddPanelBoundsForBatchUpdate(Panel* panel, | |
80 const gfx::Rect& new_bounds) = 0; | |
81 virtual void EndBatchUpdatePanelBounds() = 0; | |
82 | |
83 // Returns true if some panels within this stack window are still in the | |
84 // process of bounds animation. | |
85 virtual bool IsAnimatingPanelBounds() const = 0; | |
86 | |
87 // Minimizes all the panels in the stack as a whole via system. | |
88 virtual void Minimize() = 0; | |
89 | |
90 // Draws or clears the attention via system. The system might choose to | |
91 // flash the taskbar icon for attention. | |
92 virtual void DrawSystemAttention(bool draw_attention) = 0; | |
93 | |
94 // Called when the panel is activated. | |
95 virtual void OnPanelActivated(Panel* panel) = 0; | |
96 }; | |
97 | |
98 #endif // CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_STACK_WINDOW_H_ | |
OLD | NEW |