view_model_utils.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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_VIEWS_VIEW_MODEL_UTILS_H_
  5. #define UI_VIEWS_VIEW_MODEL_UTILS_H_
  6. #include <stddef.h>
  7. #include "ui/views/views_export.h"
  8. namespace views {
  9. class View;
  10. class ViewModelBase;
  11. class VIEWS_EXPORT ViewModelUtils {
  12. public:
  13. ViewModelUtils() = delete;
  14. ViewModelUtils(const ViewModelUtils&) = delete;
  15. ViewModelUtils& operator=(const ViewModelUtils&) = delete;
  16. // Sets the bounds of each view to its ideal bounds.
  17. static void SetViewBoundsToIdealBounds(const ViewModelBase& model);
  18. // Returns true if the Views in |model| are at their ideal bounds.
  19. static bool IsAtIdealBounds(const ViewModelBase& model);
  20. // Returns the index to move |view| to based on a coordinate of |x| and |y|.
  21. static size_t DetermineMoveIndex(const ViewModelBase& model,
  22. View* view,
  23. bool is_horizontal,
  24. int x,
  25. int y);
  26. };
  27. } // namespace views
  28. #endif // UI_VIEWS_VIEW_MODEL_UTILS_H_