Home | History | Annotate | Download | only in views
      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_VIEWS_VIEW_MODEL_UTILS_H_
      6 #define UI_VIEWS_VIEW_MODEL_UTILS_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "ui/views/views_export.h"
     10 
     11 namespace views {
     12 
     13 class View;
     14 class ViewModel;
     15 
     16 class VIEWS_EXPORT ViewModelUtils {
     17  public:
     18   enum Alignment {
     19     HORIZONTAL,
     20     VERTICAL
     21   };
     22 
     23   // Sets the bounds of each view to its ideal bounds.
     24   static void SetViewBoundsToIdealBounds(const ViewModel& model);
     25 
     26   // Returns true if the Views in |model| are at their ideal bounds.
     27   static bool IsAtIdealBounds(const ViewModel& model);
     28 
     29   // Returns the index to move |view| to based on a coordinate of |x| and |y|.
     30   static int DetermineMoveIndex(const ViewModel& model,
     31                                 View* view,
     32                                 Alignment alignment,
     33                                 int x,
     34                                 int y);
     35 
     36  private:
     37   DISALLOW_IMPLICIT_CONSTRUCTORS(ViewModelUtils);
     38 };
     39 
     40 }  // namespace views
     41 
     42 #endif  // UI_VIEWS_VIEW_MODEL_UTILS_H_
     43