OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 968 |
969 protected: | 969 protected: |
970 // Returns whether this view can accept focus. | 970 // Returns whether this view can accept focus. |
971 // A view can accept focus if it's enabled, focusable and visible. | 971 // A view can accept focus if it's enabled, focusable and visible. |
972 // This method is intended for views to use when calculating preferred size. | 972 // This method is intended for views to use when calculating preferred size. |
973 // The FocusManager and other places use IsFocusableInRootView. | 973 // The FocusManager and other places use IsFocusableInRootView. |
974 virtual bool IsFocusable() const; | 974 virtual bool IsFocusable() const; |
975 | 975 |
976 // Called when the UI theme has changed, overriding allows individual Views to | 976 // Called when the UI theme has changed, overriding allows individual Views to |
977 // do special cleanup and processing (such as dropping resource caches). | 977 // do special cleanup and processing (such as dropping resource caches). |
978 // Subclasses that override this method must call the base class | 978 // To dispatch a theme changed notification, call |
979 // implementation to ensure child views are processed. | 979 // RootView::NotifyThemeChanged(). |
980 // Can only be called by subclasses. To dispatch a theme changed notification, | 980 virtual void OnThemeChanged() { } |
981 // call this method on the RootView. | |
982 virtual void ThemeChanged(); | |
983 | 981 |
984 // Called when the locale has changed, overriding allows individual Views to | 982 // Called when the locale has changed, overriding allows individual Views to |
985 // update locale-dependent strings. | 983 // update locale-dependent strings. |
986 virtual void LocaleChanged() { } | 984 // To dispatch a locale changed notification, call |
| 985 // RootView::NotifyLocaleChanged(). |
| 986 virtual void OnLocaleChanged() { } |
987 | 987 |
988 #ifndef NDEBUG | 988 #ifndef NDEBUG |
989 // Returns true if the View is currently processing a paint. | 989 // Returns true if the View is currently processing a paint. |
990 virtual bool IsProcessingPaint() const; | 990 virtual bool IsProcessingPaint() const; |
991 #endif | 991 #endif |
992 | 992 |
993 // Returns the location, in screen coordinates, to show the context menu at | 993 // Returns the location, in screen coordinates, to show the context menu at |
994 // when the context menu is shown from the keyboard. This implementation | 994 // when the context menu is shown from the keyboard. This implementation |
995 // returns the middle of the visible region of this view. | 995 // returns the middle of the visible region of this view. |
996 // | 996 // |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 // a drag. | 1130 // a drag. |
1131 void PossibleDrag(const gfx::Point& p); | 1131 void PossibleDrag(const gfx::Point& p); |
1132 | 1132 |
1133 // Whether the press may generate a drag. | 1133 // Whether the press may generate a drag. |
1134 bool possible_drag; | 1134 bool possible_drag; |
1135 | 1135 |
1136 // Coordinates of the mouse press. | 1136 // Coordinates of the mouse press. |
1137 gfx::Point start_pt; | 1137 gfx::Point start_pt; |
1138 }; | 1138 }; |
1139 | 1139 |
1140 // Propagates locale changed notification from the root view downside. | 1140 // Used to propagate theme changed notifications from the root view to all |
1141 // Invokes LocaleChanged() for every view in the hierarchy. | 1141 // views in the hierarchy. |
1142 virtual void NotifyLocaleChanged(); | 1142 virtual void PropagateThemeChanged(); |
| 1143 |
| 1144 // Used to propagate locale changed notifications from the root view to all |
| 1145 // views in the hierarchy. |
| 1146 virtual void PropagateLocaleChanged(); |
1143 | 1147 |
1144 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX | 1148 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX |
1145 // method. If a drag is detected, DoDrag is invoked. | 1149 // method. If a drag is detected, DoDrag is invoked. |
1146 bool ProcessMousePressed(const MouseEvent& e, DragInfo* drop_info); | 1150 bool ProcessMousePressed(const MouseEvent& e, DragInfo* drop_info); |
1147 bool ProcessMouseDragged(const MouseEvent& e, DragInfo* drop_info); | 1151 bool ProcessMouseDragged(const MouseEvent& e, DragInfo* drop_info); |
1148 void ProcessMouseReleased(const MouseEvent& e, bool canceled); | 1152 void ProcessMouseReleased(const MouseEvent& e, bool canceled); |
1149 | 1153 |
1150 // Starts a drag and drop operation originating from this view. This invokes | 1154 // Starts a drag and drop operation originating from this view. This invokes |
1151 // WriteDragData to write the data and GetDragOperations to determine the | 1155 // WriteDragData to write the data and GetDragOperations to determine the |
1152 // supported drag operations. When done, OnDragDone is invoked. | 1156 // supported drag operations. When done, OnDragDone is invoked. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 // The default value for how long to wait (in ms) before showing a menu | 1319 // The default value for how long to wait (in ms) before showing a menu |
1316 // button on hover. This value is used if the OS doesn't supply one. | 1320 // button on hover. This value is used if the OS doesn't supply one. |
1317 static const int kShowFolderDropMenuDelay; | 1321 static const int kShowFolderDropMenuDelay; |
1318 | 1322 |
1319 DISALLOW_COPY_AND_ASSIGN(View); | 1323 DISALLOW_COPY_AND_ASSIGN(View); |
1320 }; | 1324 }; |
1321 | 1325 |
1322 } // namespace views | 1326 } // namespace views |
1323 | 1327 |
1324 #endif // VIEWS_VIEW_H_ | 1328 #endif // VIEWS_VIEW_H_ |
OLD | NEW |