Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: views/view.h

Issue 6347002: touch: Return an enum from OnTouchEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const gfx::Point& p, 71 const gfx::Point& p,
72 bool is_mouse_gesture) = 0; 72 bool is_mouse_gesture) = 0;
73 73
74 protected: 74 protected:
75 virtual ~ContextMenuController() {} 75 virtual ~ContextMenuController() {}
76 }; 76 };
77 77
78 // DragController is responsible for writing drag data for a view, as well as 78 // DragController is responsible for writing drag data for a view, as well as
79 // supplying the supported drag operations. Use DragController if you don't 79 // supplying the supported drag operations. Use DragController if you don't
80 // want to subclass. 80 // want to subclass.
81
82 class DragController { 81 class DragController {
83 public: 82 public:
84 // Writes the data for the drag. 83 // Writes the data for the drag.
85 virtual void WriteDragData(View* sender, 84 virtual void WriteDragData(View* sender,
86 const gfx::Point& press_pt, 85 const gfx::Point& press_pt,
87 OSExchangeData* data) = 0; 86 OSExchangeData* data) = 0;
88 87
89 // Returns the supported drag operations (see DragDropTypes for possible 88 // Returns the supported drag operations (see DragDropTypes for possible
90 // values). A drag is only started if this returns a non-zero value. 89 // values). A drag is only started if this returns a non-zero value.
91 virtual int GetDragOperations(View* sender, const gfx::Point& p) = 0; 90 virtual int GetDragOperations(View* sender, const gfx::Point& p) = 0;
92 91
93 // Returns true if a drag operation can be started. 92 // Returns true if a drag operation can be started.
94 // |press_pt| represents the coordinates where the mouse was initially 93 // |press_pt| represents the coordinates where the mouse was initially
95 // pressed down. |p| is the current mouse coordinates. 94 // pressed down. |p| is the current mouse coordinates.
96 virtual bool CanStartDrag(View* sender, 95 virtual bool CanStartDrag(View* sender,
97 const gfx::Point& press_pt, 96 const gfx::Point& press_pt,
98 const gfx::Point& p) = 0; 97 const gfx::Point& p) = 0;
99 98
100 protected: 99 protected:
101 virtual ~DragController() {} 100 virtual ~DragController() {}
102 }; 101 };
103 102
103 #if defined(TOUCH_UI)
104 // TouchEventObserver observes the touch event for the completion of a touch
105 // sequence.
106 class TouchEventObserver {
107 public:
108 // Invoked when a touch sequence ends.
109 virtual void OnTouchSequenceEnd() = 0;
110 };
111 #endif
112
104 ///////////////////////////////////////////////////////////////////////////// 113 /////////////////////////////////////////////////////////////////////////////
105 // 114 //
106 // View class 115 // View class
107 // 116 //
108 // A View is a rectangle within the views View hierarchy. It is the base 117 // A View is a rectangle within the views View hierarchy. It is the base
109 // class for all Views. 118 // class for all Views.
110 // 119 //
111 // A View is a container of other Views (there is no such thing as a Leaf 120 // A View is a container of other Views (there is no such thing as a Leaf
112 // View - makes code simpler, reduces type conversion headaches, design 121 // View - makes code simpler, reduces type conversion headaches, design
113 // mistakes etc) 122 // mistakes etc)
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 // Whether this view is enabled. 1121 // Whether this view is enabled.
1113 bool enabled_; 1122 bool enabled_;
1114 1123
1115 // Whether the view can be focused. 1124 // Whether the view can be focused.
1116 bool focusable_; 1125 bool focusable_;
1117 1126
1118 // Whether this view is focusable if the user requires full keyboard access, 1127 // Whether this view is focusable if the user requires full keyboard access,
1119 // even though it may not be normally focusable. 1128 // even though it may not be normally focusable.
1120 bool accessibility_focusable_; 1129 bool accessibility_focusable_;
1121 1130
1131 #if defined(TOUCH_UI)
1132 // The touch event handler should notify the observer when a touch-sequence
1133 // completely ends.
1134 TouchEventObserver* touch_event_observer_;
1135 #endif
1136
1122 private: 1137 private:
1123 friend class RootView; 1138 friend class RootView;
1124 friend class FocusManager; 1139 friend class FocusManager;
1125 friend class ViewStorage; 1140 friend class ViewStorage;
1126 1141
1127 // Used to track a drag. RootView passes this into 1142 // Used to track a drag. RootView passes this into
1128 // ProcessMousePressed/Dragged. 1143 // ProcessMousePressed/Dragged.
1129 struct DragInfo { 1144 struct DragInfo {
1130 // Sets possible_drag to false and start_x/y to 0. This is invoked by 1145 // Sets possible_drag to false and start_x/y to 0. This is invoked by
1131 // RootView prior to invoke ProcessMousePressed. 1146 // RootView prior to invoke ProcessMousePressed.
(...skipping 23 matching lines...) Expand all
1155 // method. If a drag is detected, DoDrag is invoked. 1170 // method. If a drag is detected, DoDrag is invoked.
1156 bool ProcessMousePressed(const MouseEvent& e, DragInfo* drop_info); 1171 bool ProcessMousePressed(const MouseEvent& e, DragInfo* drop_info);
1157 bool ProcessMouseDragged(const MouseEvent& e, DragInfo* drop_info); 1172 bool ProcessMouseDragged(const MouseEvent& e, DragInfo* drop_info);
1158 void ProcessMouseReleased(const MouseEvent& e, bool canceled); 1173 void ProcessMouseReleased(const MouseEvent& e, bool canceled);
1159 1174
1160 #if defined(TOUCH_UI) 1175 #if defined(TOUCH_UI)
1161 // RootView will invoke this with incoming TouchEvents. Returns the 1176 // RootView will invoke this with incoming TouchEvents. Returns the
1162 // the result of OnTouchEvent: true if the event was handled by the 1177 // the result of OnTouchEvent: true if the event was handled by the
1163 // callee. 1178 // callee.
1164 bool ProcessTouchEvent(const TouchEvent& e); 1179 bool ProcessTouchEvent(const TouchEvent& e);
1180
1181 // Set the touch event observer.
1182 void set_touch_event_observer(TouchEventObserver* observer) {
1183 touch_event_observer_ = observer;
1184 }
1165 #endif 1185 #endif
1166 1186
1167 // Starts a drag and drop operation originating from this view. This invokes 1187 // Starts a drag and drop operation originating from this view. This invokes
1168 // WriteDragData to write the data and GetDragOperations to determine the 1188 // WriteDragData to write the data and GetDragOperations to determine the
1169 // supported drag operations. When done, OnDragDone is invoked. 1189 // supported drag operations. When done, OnDragDone is invoked.
1170 void DoDrag(const MouseEvent& e, const gfx::Point& press_pt); 1190 void DoDrag(const MouseEvent& e, const gfx::Point& press_pt);
1171 1191
1172 // Removes |view| from the hierarchy tree. If |update_focus_cycle| is true, 1192 // Removes |view| from the hierarchy tree. If |update_focus_cycle| is true,
1173 // the next and previous focusable views of views pointing to this view are 1193 // the next and previous focusable views of views pointing to this view are
1174 // updated. If |update_tool_tip| is true, the tooltip is updated. If 1194 // updated. If |update_tool_tip| is true, the tooltip is updated. If
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 // The default value for how long to wait (in ms) before showing a menu 1349 // The default value for how long to wait (in ms) before showing a menu
1330 // button on hover. This value is used if the OS doesn't supply one. 1350 // button on hover. This value is used if the OS doesn't supply one.
1331 static const int kShowFolderDropMenuDelay; 1351 static const int kShowFolderDropMenuDelay;
1332 1352
1333 DISALLOW_COPY_AND_ASSIGN(View); 1353 DISALLOW_COPY_AND_ASSIGN(View);
1334 }; 1354 };
1335 1355
1336 } // namespace views 1356 } // namespace views
1337 1357
1338 #endif // VIEWS_VIEW_H_ 1358 #endif // VIEWS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698