OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CONTROLS_SINGLE_SPLIT_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SINGLE_SPLIT_VIEW_H_ |
6 #define UI_VIEWS_CONTROLS_SINGLE_SPLIT_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_SINGLE_SPLIT_VIEW_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 virtual void Layout() OVERRIDE; | 34 virtual void Layout() OVERRIDE; |
35 virtual std::string GetClassName() const OVERRIDE; | 35 virtual std::string GetClassName() const OVERRIDE; |
36 | 36 |
37 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 37 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
38 | 38 |
39 // SingleSplitView's preferred size is the sum of the preferred widths | 39 // SingleSplitView's preferred size is the sum of the preferred widths |
40 // and the max of the heights. | 40 // and the max of the heights. |
41 virtual gfx::Size GetPreferredSize() OVERRIDE; | 41 virtual gfx::Size GetPreferredSize() OVERRIDE; |
42 | 42 |
43 // Overriden to return a resize cursor when over the divider. | 43 // Overriden to return a resize cursor when over the divider. |
44 virtual gfx::NativeCursor GetCursor(const MouseEvent& event) OVERRIDE; | 44 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; |
45 | 45 |
46 Orientation orientation() const { | 46 Orientation orientation() const { |
47 return is_horizontal_ ? HORIZONTAL_SPLIT : VERTICAL_SPLIT; | 47 return is_horizontal_ ? HORIZONTAL_SPLIT : VERTICAL_SPLIT; |
48 } | 48 } |
49 | 49 |
50 void set_orientation(Orientation orientation) { | 50 void set_orientation(Orientation orientation) { |
51 is_horizontal_ = orientation == HORIZONTAL_SPLIT; | 51 is_horizontal_ = orientation == HORIZONTAL_SPLIT; |
52 } | 52 } |
53 | 53 |
54 void set_divider_offset(int divider_offset) { | 54 void set_divider_offset(int divider_offset) { |
(...skipping 12 matching lines...) Expand all Loading... |
67 // split view |bounds|, current divider offset and children visiblity. | 67 // split view |bounds|, current divider offset and children visiblity. |
68 // Does not change children view bounds. | 68 // Does not change children view bounds. |
69 void CalculateChildrenBounds(const gfx::Rect& bounds, | 69 void CalculateChildrenBounds(const gfx::Rect& bounds, |
70 gfx::Rect* leading_bounds, | 70 gfx::Rect* leading_bounds, |
71 gfx::Rect* trailing_bounds) const; | 71 gfx::Rect* trailing_bounds) const; |
72 | 72 |
73 void SetAccessibleName(const string16& name); | 73 void SetAccessibleName(const string16& name); |
74 | 74 |
75 protected: | 75 protected: |
76 // View overrides. | 76 // View overrides. |
77 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | 77 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
78 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; | 78 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
79 virtual void OnMouseCaptureLost() OVERRIDE; | 79 virtual void OnMouseCaptureLost() OVERRIDE; |
80 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 80 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
81 | 81 |
82 private: | 82 private: |
83 // This test calls OnMouse* functions. | 83 // This test calls OnMouse* functions. |
84 FRIEND_TEST_ALL_PREFIXES(SingleSplitViewTest, MouseDrag); | 84 FRIEND_TEST_ALL_PREFIXES(SingleSplitViewTest, MouseDrag); |
85 | 85 |
86 // Returns true if |x| or |y| is over the divider. | 86 // Returns true if |x| or |y| is over the divider. |
87 bool IsPointInDivider(const gfx::Point& p); | 87 bool IsPointInDivider(const gfx::Point& p); |
88 | 88 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // The accessible name of this view. | 129 // The accessible name of this view. |
130 string16 accessible_name_; | 130 string16 accessible_name_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(SingleSplitView); | 132 DISALLOW_COPY_AND_ASSIGN(SingleSplitView); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace views | 135 } // namespace views |
136 | 136 |
137 #endif // UI_VIEWS_CONTROLS_SINGLE_SPLIT_VIEW_H_ | 137 #endif // UI_VIEWS_CONTROLS_SINGLE_SPLIT_VIEW_H_ |
OLD | NEW |