• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 UI_AURA_LAYOUT_MANAGER_H_
6 #define UI_AURA_LAYOUT_MANAGER_H_
7 
8 #include "base/basictypes.h"
9 #include "ui/aura/aura_export.h"
10 
11 namespace gfx {
12 class Rect;
13 }
14 
15 namespace aura {
16 class Window;
17 
18 // An interface implemented by an object that places child windows.
19 class AURA_EXPORT LayoutManager {
20  public:
21   LayoutManager();
22   virtual ~LayoutManager();
23 
24   // Invoked when the window is resized.
25   virtual void OnWindowResized() = 0;
26 
27   // Invoked when the window |child| has been added.
28   virtual void OnWindowAddedToLayout(Window* child) = 0;
29 
30   // Invoked prior to removing |window|.
31   virtual void OnWillRemoveWindowFromLayout(Window* child) = 0;
32 
33   // Invoked after removing |window|.
34   virtual void OnWindowRemovedFromLayout(Window* child) = 0;
35 
36   // Invoked when the |SetVisible()| is invoked on the window |child|.
37   // |visible| is the value supplied to |SetVisible()|. If |visible| is true,
38   // window->IsVisible() may still return false. See description in
39   // Window::IsVisible() for details.
40   virtual void OnChildWindowVisibilityChanged(Window* child, bool visible) = 0;
41 
42   // Invoked when |Window::SetBounds| is called on |child|.
43   // Implementation must call |SetChildBoundsDirect| to change the
44   // |child|'s bounds. LayoutManager may modify |requested_bounds|
45   // before applying, or ignore the request.
46   virtual void SetChildBounds(Window* child,
47                               const gfx::Rect& requested_bounds) = 0;
48 
49  protected:
50   // Sets the child's bounds forcibly. LayoutManager is responsible
51   // for checking the state and make sure the bounds are correctly
52   // adjusted.
53   void SetChildBoundsDirect(aura::Window* child, const gfx::Rect& bounds);
54 };
55 
56 }  // namespace aura
57 
58 #endif  // UI_AURA_LAYOUT_MANAGER_H_
59