OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_VIEW_MODEL_H_ | 5 #ifndef UI_VIEWS_VIEW_MODEL_H_ |
6 #define UI_VIEWS_VIEW_MODEL_H_ | 6 #define UI_VIEWS_VIEW_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 void set_ideal_bounds(int index, const gfx::Rect& bounds) { | 52 void set_ideal_bounds(int index, const gfx::Rect& bounds) { |
53 entries_[index].ideal_bounds = bounds; | 53 entries_[index].ideal_bounds = bounds; |
54 } | 54 } |
55 | 55 |
56 const gfx::Rect& ideal_bounds(int index) const { | 56 const gfx::Rect& ideal_bounds(int index) const { |
57 return entries_[index].ideal_bounds; | 57 return entries_[index].ideal_bounds; |
58 } | 58 } |
59 | 59 |
| 60 void set_ideal_visibility(int index, bool visibility) { |
| 61 entries_[index].ideal_visibility = visibility; |
| 62 } |
| 63 |
| 64 bool ideal_visibility(int index) const { |
| 65 return entries_[index].ideal_visibility; |
| 66 } |
| 67 |
60 // Returns the index of the specified view, or -1 if the view isn't in the | 68 // Returns the index of the specified view, or -1 if the view isn't in the |
61 // model. | 69 // model. |
62 int GetIndexOfView(const View* view) const; | 70 int GetIndexOfView(const View* view) const; |
63 | 71 |
64 private: | 72 private: |
65 struct Entry { | 73 struct Entry { |
66 Entry() : view(NULL) {} | 74 Entry() : view(NULL), ideal_visibility(false) {} |
67 | 75 |
68 View* view; | 76 View* view; |
69 gfx::Rect ideal_bounds; | 77 gfx::Rect ideal_bounds; |
| 78 bool ideal_visibility; |
70 }; | 79 }; |
71 typedef std::vector<Entry> Entries; | 80 typedef std::vector<Entry> Entries; |
72 | 81 |
73 Entries entries_; | 82 Entries entries_; |
74 | 83 |
75 DISALLOW_COPY_AND_ASSIGN(ViewModel); | 84 DISALLOW_COPY_AND_ASSIGN(ViewModel); |
76 }; | 85 }; |
77 | 86 |
78 } // namespace views | 87 } // namespace views |
79 | 88 |
80 #endif // UI_VIEWS_VIEW_MODEL_H_ | 89 #endif // UI_VIEWS_VIEW_MODEL_H_ |
OLD | NEW |