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