layout_manager.h 1.8 KB

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