OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 VIEWS_VIEW_H_ | 5 #ifndef VIEWS_VIEW_H_ |
6 #define VIEWS_VIEW_H_ | 6 #define VIEWS_VIEW_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 virtual void WriteDragData(int press_x, int press_y, OSExchangeData* data); | 1013 virtual void WriteDragData(int press_x, int press_y, OSExchangeData* data); |
1014 | 1014 |
1015 // Invoked from DoDrag after the drag completes. This implementation does | 1015 // Invoked from DoDrag after the drag completes. This implementation does |
1016 // nothing, and is intended for subclasses to do cleanup. | 1016 // nothing, and is intended for subclasses to do cleanup. |
1017 virtual void OnDragDone(); | 1017 virtual void OnDragDone(); |
1018 | 1018 |
1019 // Returns whether we're in the middle of a drag session that was initiated | 1019 // Returns whether we're in the middle of a drag session that was initiated |
1020 // by us. | 1020 // by us. |
1021 bool InDrag(); | 1021 bool InDrag(); |
1022 | 1022 |
| 1023 // Returns how much the mouse needs to move in one direction to start a |
| 1024 // drag. These methods cache in a platform-appropriate way. These values are |
| 1025 // used by the public static method ExceededDragThreshold(). |
| 1026 static int GetHorizontalDragThreshold(); |
| 1027 static int GetVerticalDragThreshold(); |
| 1028 |
1023 // Whether this view is enabled. | 1029 // Whether this view is enabled. |
1024 bool enabled_; | 1030 bool enabled_; |
1025 | 1031 |
1026 // Whether the view can be focused. | 1032 // Whether the view can be focused. |
1027 bool focusable_; | 1033 bool focusable_; |
1028 | 1034 |
1029 private: | 1035 private: |
1030 friend class RootView; | 1036 friend class RootView; |
1031 friend class FocusManager; | 1037 friend class FocusManager; |
1032 friend class ViewStorage; | 1038 friend class ViewStorage; |
(...skipping 11 matching lines...) Expand all Loading... |
1044 void PossibleDrag(int x, int y); | 1050 void PossibleDrag(int x, int y); |
1045 | 1051 |
1046 // Whether the press may generate a drag. | 1052 // Whether the press may generate a drag. |
1047 bool possible_drag; | 1053 bool possible_drag; |
1048 | 1054 |
1049 // Coordinates of the mouse press. | 1055 // Coordinates of the mouse press. |
1050 int start_x; | 1056 int start_x; |
1051 int start_y; | 1057 int start_y; |
1052 }; | 1058 }; |
1053 | 1059 |
1054 // Returns how much the mouse needs to move in one direction to start a | |
1055 // drag. These methods cache in a platform-appropriate way. These values are | |
1056 // used by the public static method ExceededDragThreshold(). | |
1057 static int GetHorizontalDragThreshold(); | |
1058 static int GetVerticalDragThreshold(); | |
1059 | |
1060 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX | 1060 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX |
1061 // method. If a drag is detected, DoDrag is invoked. | 1061 // method. If a drag is detected, DoDrag is invoked. |
1062 bool ProcessMousePressed(const MouseEvent& e, DragInfo* drop_info); | 1062 bool ProcessMousePressed(const MouseEvent& e, DragInfo* drop_info); |
1063 bool ProcessMouseDragged(const MouseEvent& e, DragInfo* drop_info); | 1063 bool ProcessMouseDragged(const MouseEvent& e, DragInfo* drop_info); |
1064 void ProcessMouseReleased(const MouseEvent& e, bool canceled); | 1064 void ProcessMouseReleased(const MouseEvent& e, bool canceled); |
1065 | 1065 |
1066 // Starts a drag and drop operation originating from this view. This invokes | 1066 // Starts a drag and drop operation originating from this view. This invokes |
1067 // WriteDragData to write the data and GetDragOperations to determine the | 1067 // WriteDragData to write the data and GetDragOperations to determine the |
1068 // supported drag operations. When done, OnDragDone is invoked. | 1068 // supported drag operations. When done, OnDragDone is invoked. |
1069 void DoDrag(const MouseEvent& e, int press_x, int press_y); | 1069 void DoDrag(const MouseEvent& e, int press_x, int press_y); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 // is going to be flipped horizontally (using the appropriate transform) on | 1203 // is going to be flipped horizontally (using the appropriate transform) on |
1204 // right-to-left locales for this View. | 1204 // right-to-left locales for this View. |
1205 bool flip_canvas_on_paint_for_rtl_ui_; | 1205 bool flip_canvas_on_paint_for_rtl_ui_; |
1206 | 1206 |
1207 DISALLOW_COPY_AND_ASSIGN(View); | 1207 DISALLOW_COPY_AND_ASSIGN(View); |
1208 }; | 1208 }; |
1209 | 1209 |
1210 } // namespace views | 1210 } // namespace views |
1211 | 1211 |
1212 #endif // VIEWS_VIEW_H_ | 1212 #endif // VIEWS_VIEW_H_ |
OLD | NEW |