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

Side by Side Diff: ui/views/view.h

Issue 6541030: View API/implementation cleanup:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « no previous file | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_VIEW_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 21 matching lines...) Expand all
32 class FocusTraversable; 32 class FocusTraversable;
33 class KeyEvent; 33 class KeyEvent;
34 class LayoutManager; 34 class LayoutManager;
35 class MouseEvent; 35 class MouseEvent;
36 class MouseWheelEvent; 36 class MouseWheelEvent;
37 class OSExchangeData; 37 class OSExchangeData;
38 class ThemeProvider; 38 class ThemeProvider;
39 class Widget; 39 class Widget;
40 40
41 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
42 // View class 42 // View
43 // 43 //
44 // View encapsulates rendering, layout and event handling for rectangles within 44 // View encapsulates rendering, layout and event handling for rectangles within
45 // a view hierarchy. 45 // a view hierarchy.
46 // 46 //
47 // Client code typically subclasses View and overrides virtual methods to 47 // Client code typically subclasses View and overrides virtual methods to
48 // handle painting, child view positioning and handle certain types of events. 48 // handle painting, child view positioning and handle certain types of events.
49 // 49 //
50 // Views are owned by their parent View unless specified otherwise. This means 50 // Views are owned by their parent View unless specified otherwise. This means
51 // that in most cases Views are automatically destroyed when the window that 51 // that in most cases Views are automatically destroyed when the window that
52 // contains them is destroyed. 52 // contains them is destroyed.
53 // 53 //
54 // TODO(beng): consider the visibility of many of these methods. 54 // TODO(beng): consider the visibility of many of these methods.
55 // consider making RootView a friend and making many private or 55 // consider making RootView a friend and making many private or
56 // protected. 56 // protected.
57
57 class View { 58 class View {
58 public: 59 public:
59 typedef std::vector<View*> ViewVector; 60 typedef std::vector<View*> Views;
60 61
61 // Creation and lifetime ----------------------------------------------------- 62 // Creation and lifetime -----------------------------------------------------
62 View(); 63 View();
63 virtual ~View(); 64 virtual ~View();
64 65
65 // By default a View is owned by its parent unless specified otherwise here. 66 // By default a View is owned by its parent unless specified otherwise here.
66 bool parent_owned() const { return parent_owned_; } 67 bool parent_owned() const { return parent_owned_; }
67 void set_parent_owned(bool parent_owned) { parent_owned_ = parent_owned; } 68 void set_parent_owned(bool parent_owned) { parent_owned_ = parent_owned; }
68 69
69 void set_drag_controller(DragController* drag_controller) { 70 void set_drag_controller(DragController* drag_controller) {
70 drag_controller_ = drag_controller; 71 drag_controller_ = drag_controller;
71 } 72 }
72 73
73 // Size and disposition ------------------------------------------------------ 74 // Size and disposition ------------------------------------------------------
74 75
75 void SetBounds(int x, int y, int width, int height);
76 void SetBoundsRect(const gfx::Rect& bounds);
77 void SetSize(const gfx::Size& size);
78 void SetPosition(const gfx::Point& position);
79 gfx::Rect bounds() const { return bounds_; } 76 gfx::Rect bounds() const { return bounds_; }
77 // TODO(pkasting): How is this different than bounds()?
Ben Goodger (Google) 2011/02/18 19:02:28 This returns the visible bounds of the view in the
Peter Kasting 2011/02/18 19:09:43 I updated the comment to try and capture that.
80 gfx::Rect GetVisibleBounds() const; 78 gfx::Rect GetVisibleBounds() const;
81 int x() const { return bounds_.x(); }
82 int y() const { return bounds_.y(); }
83 int width() const { return bounds_.width(); }
84 int height() const { return bounds_.height(); }
85
86 // Owned by the view.
87 void SetBorder(Border* border);
88 Border* border() { return border_.get(); }
89
90 // Returns the bounds of the content area of the view, i.e. the rectangle 79 // Returns the bounds of the content area of the view, i.e. the rectangle
91 // enclosed by the view's border. 80 // enclosed by the view's border.
92 gfx::Rect GetContentsBounds() const; 81 gfx::Rect GetContentsBounds() const;
82 void SetBounds(const gfx::Rect& bounds);
83
84 gfx::Point origin() const { return bounds().origin(); }
85 int x() const { return bounds().x(); }
86 int y() const { return bounds().y(); }
87 void SetOrigin(const gfx::Point& origin);
88
89 gfx::Size size() const { return bounds().size(); }
90 int width() const { return bounds().width(); }
91 int height() const { return bounds().height(); }
92 void SetSize(const gfx::Size& size);
93
94 // Owned by the view.
95 Border* border() { return border_.get(); }
96 void SetBorder(Border* border);
93 97
94 // Override to be notified when the bounds of a view have changed. 98 // Override to be notified when the bounds of a view have changed.
95 virtual void OnBoundsChanged(); 99 virtual void OnBoundsChanged();
96 100
97 virtual gfx::Size GetPreferredSize() const; 101 virtual gfx::Size GetPreferredSize() const;
98 virtual gfx::Size GetMinimumSize() const; 102 virtual gfx::Size GetMinimumSize() const;
99 103
100 void SetLayoutManager(LayoutManager* layout_manager); 104 void SetLayoutManager(LayoutManager* layout_manager);
101 virtual void Layout(); 105 virtual void Layout();
102 106
103 // If a View is not visible, it will not be rendered, focused, etc. 107 // If a View is not visible, it will not be rendered, focused, etc.
104 bool visible() const { return visible_; } 108 bool visible() const { return visible_; }
105 void SetVisible(bool visible); 109 void SetVisible(bool visible);
106 110
107 // Disabled Views will not receive mouse press/release events, nor can they be 111 // Disabled Views will not receive mouse press/release events, nor can they be
108 // focused. 112 // focused.
109 bool enabled() const { return enabled_; } 113 bool enabled() const { return enabled_; }
110 void SetEnabled(bool enabled); 114 void SetEnabled(bool enabled);
111 115
112 // Attributes ---------------------------------------------------------------- 116 // Attributes ----------------------------------------------------------------
113 117
114 int id() const { return id_; } 118 int id() const { return id_; }
115 void set_id(int id) { id_ = id; } 119 void set_id(int id) { id_ = id; }
116 int group() const { return group_; } 120 int group() const { return group_; }
117 void set_group(int group) { group_ = group; } 121 void set_group(int group) { group_ = group; }
118 122
119 // Returns the View within this View's hierarchy whose id matches that 123 // Returns the View within this View's hierarchy whose id matches that
120 // specified. 124 // specified.
121 View* GetViewById(int id) const; 125 View* GetViewByID(int id);
122 126
123 // Populates a ViewVector with the Views within this View's hierarchy that 127 // Populates |vec| with the Views within this View's hierarchy that match the
124 // match the specified group id. 128 // specified group id.
125 void GetViewsWithGroup(int group, ViewVector* vec) const; 129 void GetViewsInGroup(int group, Views* vec);
126 130
127 // TODO(beng): implementme 131 // TODO(beng): implementme
128 virtual View* GetSelectedViewForGroup(int group_id); 132 virtual View* GetSelectedViewForGroup(int group_id);
129 133
130 // Coordinate conversion ----------------------------------------------------- 134 // Coordinate conversion -----------------------------------------------------
131 135
132 // Converts a point from the coordinate system of |source| to |target|. 136 // Converts a point from the coordinate system of |source| to |target|.
133 static void ConvertPointToView(View* source, View* target, gfx::Point* point); 137 static void ConvertPointToView(const View& source,
138 const View& target,
139 gfx::Point* point);
134 140
135 // Converts a point from the coordinate system of |source| to the screen. 141 // Converts a point from the coordinate system of |source| to the screen.
136 // If |source| is not attached to a Widget that is in screen space, |point| is 142 // If |source| is not attached to a Widget that is in screen space, |point| is
137 // not modified. 143 // not modified.
138 static void ConvertPointToScreen(View* source, gfx::Point* point); 144 static void ConvertPointToScreen(const View& source, gfx::Point* point);
139 145
140 // Converts a point from the coordinate system of |source| to the Widget that 146 // Converts a point from the coordinate system of |source| to the Widget that
141 // most closely contains it. 147 // most closely contains it.
142 static void ConvertPointToWidget(View* source, gfx::Point* point); 148 static void ConvertPointToWidget(const View& source, gfx::Point* point);
143 149
144 // Tree operations ----------------------------------------------------------- 150 // Tree operations -----------------------------------------------------------
145 151
146 // Returns the Widget that contains this View, or NULL if it is not contained 152 // Returns the Widget that contains this View, or NULL if it is not contained
147 // within a Widget. 153 // within a Widget.
148 virtual Widget* GetWidget() const; 154 Widget* GetWidget() {
155 return const_cast<Widget*>(static_cast<const View*>(this)->GetWidget());
156 }
157 virtual const Widget* GetWidget() const;
149 158
150 // Adds a View as a child of this one, optionally at |index|. 159 // Adds a View as a child of this one, optionally at |index|.
151 void AddChildView(View* view); 160 void AddChildView(View* view);
152 void AddChildViewAt(View* view, size_t index); 161 void AddChildViewAt(View* view, size_t index);
153 162
154 // Removes a View as a child of this View. Does not delete the child. 163 // If |view| is a child of this View, removes it and optionally deletes it.
155 View* RemoveChildView(View* view); 164 void RemoveChildView(View* view, bool delete_child);
156 165
157 // Removes all View children of this View. Deletes the children if 166 // Removes all View children of this View. Deletes the children if
158 // |delete_children| is true. 167 // |delete_children| is true.
159 void RemoveAllChildViews(bool delete_children); 168 void RemoveAllChildViews(bool delete_children);
160 169
161 // Returns the View at the specified |index|. 170 // STL-style accessors.
162 View* GetChildViewAt(size_t index); 171 Views::const_iterator children_begin() { return children_.begin(); }
163 172 Views::const_iterator children_end() { return children_.end(); }
164 // Returns the number of child views. 173 Views::const_reverse_iterator children_rbegin() { return children_.rbegin(); }
165 size_t child_count() const { return children_.size(); } 174 Views::const_reverse_iterator children_rend() { return children_.rend(); }
175 size_t children_size() const { return children_.size(); }
176 bool children_empty() const { return children_.empty(); }
177 View* child_at(size_t index) {
178 DCHECK_LT(index, children_size());
179 return children_[index];
180 }
166 181
167 // Returns the parent View, or NULL if this View has no parent. 182 // Returns the parent View, or NULL if this View has no parent.
168 View* parent() const { return parent_; } 183 View* parent() { return parent_; }
184 const View* parent() const { return parent_; }
169 185
170 // Returns true if |child| is contained within this View's hierarchy, even as 186 // Returns true if |child| is contained within this View's hierarchy, even as
171 // an indirect descendant. Will return true if child is also this View. 187 // an indirect descendant. Will return true if child is also this View.
172 bool Contains(View* child); 188 bool Contains(const View& child) const;
173 189
174 // Painting ------------------------------------------------------------------ 190 // Painting ------------------------------------------------------------------
175 191
176 // Add all or part of a View's bounds to the enclosing Widget's invalid 192 // Add all or part of a View's bounds to the enclosing Widget's invalid
177 // rectangle. This will result in those areas being re-painted on the next 193 // rectangle. This will result in those areas being re-painted on the next
178 // update. 194 // update.
179 void Invalidate(); 195 void Invalidate();
180 virtual void InvalidateRect(const gfx::Rect& invalid_rect); 196 virtual void InvalidateRect(const gfx::Rect& invalid_rect);
181 197
182 // Input --------------------------------------------------------------------- 198 // Input ---------------------------------------------------------------------
183 199
184 // Returns true if the specified point is contained within this View or its 200 // Returns true if the specified point is contained within this View or its
185 // hit test mask. |point| is in this View's coordinates. 201 // hit test mask. |point| is in this View's coordinates.
186 bool HitTest(const gfx::Point& point) const; 202 bool HitTest(const gfx::Point& point) const;
187 203
188 // Accelerators -------------------------------------------------------------- 204 // Accelerators --------------------------------------------------------------
189 205
190 // Accelerator Registration. 206 // Accelerator Registration.
191 void AddAccelerator(const Accelerator& accelerator); 207 void AddAccelerator(const Accelerator& accelerator);
192 void RemoveAccelerator(const Accelerator& accelerator); 208 void RemoveAccelerator(const Accelerator& accelerator);
193 void RemoveAllAccelerators(); 209 void RemoveAllAccelerators();
194 210
195 // Focus --------------------------------------------------------------------- 211 // Focus ---------------------------------------------------------------------
196 212
197 // Manager. 213 // Manager.
198 FocusManager* GetFocusManager() const; 214 FocusManager* GetFocusManager();
215 const FocusManager* GetFocusManager() const;
199 216
200 // Traversal. 217 // Traversal.
201 virtual FocusTraversable* GetFocusTraversable() const; 218 virtual FocusTraversable* GetFocusTraversable();
202 View* GetNextFocusableView() const; 219 View* GetNextFocusableView();
203 View* GetPreviousFocusableView() const; 220 View* GetPreviousFocusableView();
204 221
205 // Attributes. 222 // Attributes.
223 bool is_focusable() const { return focusable_ && enabled_ && visible_; }
Ben Goodger (Google) 2011/02/18 19:02:28 This actually needs to be more complex in reality.
Peter Kasting 2011/02/18 19:09:43 Changed back to a non-inline function.
206 void set_focusable(bool focusable) { focusable_ = focusable; } 224 void set_focusable(bool focusable) { focusable_ = focusable; }
207 bool IsFocusable() const;
208 225
209 bool HasFocus() const; 226 bool HasFocus() const;
210 void RequestFocus(); 227 void RequestFocus();
211 228
212 // Context menus ------------------------------------------------------------- 229 // Context menus -------------------------------------------------------------
213 230
214 void set_context_menu_controller( 231 void set_context_menu_controller(
215 ContextMenuController* context_menu_controller) { 232 ContextMenuController* context_menu_controller) {
216 context_menu_controller_ = context_menu_controller; 233 context_menu_controller_ = context_menu_controller;
217 } 234 }
218 235
219 // Resources ----------------------------------------------------------------- 236 // Resources -----------------------------------------------------------------
220 237
221 ThemeProvider* GetThemeProvider() const; 238 ThemeProvider* GetThemeProvider();
222 239
223 protected: 240 protected:
224 // Tree operations ----------------------------------------------------------- 241 // Tree operations -----------------------------------------------------------
225 242
226 // Called on every view in the hierarchy when a view is added or removed. 243 // Called on every view in |parent|'s and |child|'s hierarchies, as well as
227 virtual void OnViewAdded(View* parent, View* child); 244 // ancestors, when |child| is added to or removed from |parent|.
228 virtual void OnViewRemoved(View* parent, View* child); 245 virtual void OnViewAdded(const View& parent, const View& child);
246 virtual void OnViewRemoved(const View& parent, const View& child);
229 247
230 // Called on a View when it is added or removed from a Widget. 248 // Called on a View when it is part of a hierarchy that has been added to or
249 // removed from a Widget.
231 virtual void OnViewAddedToWidget(); 250 virtual void OnViewAddedToWidget();
232 virtual void OnViewRemovedFromWidget(); 251 virtual void OnViewRemovedFromWidget();
233 252
234 // Painting ------------------------------------------------------------------ 253 // Painting ------------------------------------------------------------------
235 254
236 // Responsible for calling Paint() on child Views. Override to control the 255 // Responsible for calling Paint() on child Views. Override to control the
237 // order child Views are painted. 256 // order child Views are painted.
238 virtual void PaintChildren(gfx::Canvas* canvas); 257 virtual void PaintChildren(gfx::Canvas* canvas);
239 258
240 // Override to provide rendering in any part of the View's bounds. Typically 259 // Override to provide rendering in any part of the View's bounds. Typically
(...skipping 14 matching lines...) Expand all
255 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); 274 virtual void OnPaintFocusBorder(gfx::Canvas* canvas);
256 275
257 // Input --------------------------------------------------------------------- 276 // Input ---------------------------------------------------------------------
258 277
259 // Returns the visible View that would like to handle events occurring at the 278 // Returns the visible View that would like to handle events occurring at the
260 // specified |point|, in this View's coordinates. 279 // specified |point|, in this View's coordinates.
261 // This function is used by the event processing system in the Widget to 280 // This function is used by the event processing system in the Widget to
262 // locate views for event targeting. Override this function if you wish to 281 // locate views for event targeting. Override this function if you wish to
263 // specify a view other than the one most closely enclosing |point| to receive 282 // specify a view other than the one most closely enclosing |point| to receive
264 // notifications for events within it. 283 // notifications for events within it.
265 virtual View* GetEventHandlerForPoint(const gfx::Point& point) const; 284 virtual View* GetEventHandlerForPoint(const gfx::Point& point);
266 285
267 virtual gfx::NativeCursor GetCursorForPoint(const gfx::Point& point); 286 virtual gfx::NativeCursor GetCursorForPoint(const gfx::Point& point) const;
268 287
269 virtual bool OnKeyPressed(const KeyEvent& event); 288 virtual bool OnKeyPressed(const KeyEvent& event);
270 virtual bool OnKeyReleased(const KeyEvent& event); 289 virtual bool OnKeyReleased(const KeyEvent& event);
271 virtual bool OnMouseWheel(const MouseWheelEvent& event); 290 virtual bool OnMouseWheel(const MouseWheelEvent& event);
272 // To receive OnMouseDragged() or OnMouseReleased() events, overriding classes 291 // To receive OnMouseDragged() or OnMouseReleased() events, overriding classes
273 // must return true from this function. 292 // must return true from this function.
274 virtual bool OnMousePressed(const MouseEvent& event); 293 virtual bool OnMousePressed(const MouseEvent& event);
275 virtual bool OnMouseDragged(const MouseEvent& event); 294 virtual bool OnMouseDragged(const MouseEvent& event);
276 virtual void OnMouseReleased(const MouseEvent& event); 295 virtual void OnMouseReleased(const MouseEvent& event);
277 virtual void OnMouseCaptureLost(); 296 virtual void OnMouseCaptureLost();
278 virtual void OnMouseMoved(const MouseEvent& event); 297 virtual void OnMouseMoved(const MouseEvent& event);
279 virtual void OnMouseEntered(const MouseEvent& event); 298 virtual void OnMouseEntered(const MouseEvent& event);
280 virtual void OnMouseExited(const MouseEvent& event); 299 virtual void OnMouseExited(const MouseEvent& event);
281 300
282 // Accelerators -------------------------------------------------------------- 301 // Accelerators --------------------------------------------------------------
283 302
284 virtual bool OnAcceleratorPressed(const Accelerator& accelerator); 303 virtual bool OnAcceleratorPressed(const Accelerator& accelerator);
285 304
286 // Focus --------------------------------------------------------------------- 305 // Focus ---------------------------------------------------------------------
287 306
288 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& event) const; 307 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& event) const;
289 virtual bool IsGroupFocusTraversable() const; 308 virtual bool IsGroupFocusTraversable() const;
290 // TODO(beng): kill these, move to focus manager. 309 // TODO(beng): kill these, move to focus manager.
291 virtual bool IsFocusableInRootView() const; 310 virtual bool IsFocusableInRootView() const;
292 virtual bool IsAccessibilityFocusableInRootView() const; 311 virtual bool IsAccessibilityFocusableInRootView() const;
293 virtual FocusTraversable* GetPaneFocusTraversable() const; 312 virtual FocusTraversable* GetPaneFocusTraversable();
294 313
295 virtual void OnFocus(const FocusEvent& event); 314 virtual void OnFocus(const FocusEvent& event);
296 virtual void OnBlur(const FocusEvent& event); 315 virtual void OnBlur(const FocusEvent& event);
297 316
298 private: 317 private:
299 friend internal::RootView; 318 friend internal::RootView;
300 friend class FocusManager; 319 friend class FocusManager;
301 friend class FocusSearch; 320 friend class FocusSearch;
302 321
303 // State collected during a MousePressed event to detect possible drag 322 // State collected during a MousePressed event to detect possible drag
304 // operations. 323 // operations.
305 struct DragInfo { 324 struct DragInfo {
306 // Sets possible_drag to false and start_x/y to 0. This is invoked by 325 // Sets possible_drag to false and start_x/y to 0. This is invoked by
307 // RootView prior to invoke MousePressed(). 326 // RootView prior to invoke MousePressed().
308 void Reset(); 327 void Reset();
309 328
310 // Sets possible_drag to true and start_pt to the specified point. 329 // Sets possible_drag to true and start_pt to the specified point.
311 // This is invoked by the target view if it detects the press may generate 330 // This is invoked by the target view if it detects the press may generate
312 // a drag. 331 // a drag.
313 void PossibleDrag(const gfx::Point& point); 332 void PossibleDrag(const gfx::Point& point);
314 333
315 // Whether the press may generate a drag. 334 // Whether the press may generate a drag.
316 bool possible_drag; 335 bool possible_drag;
317 336
318 // Position of the mouse press in screen coordinates. 337 // Position of the mouse press in screen coordinates.
319 gfx::Point press_point; 338 gfx::Point press_point;
320 }; 339 };
321 340
322 // Tree operations ----------------------------------------------------------- 341 // Tree operations -----------------------------------------------------------
323 void NotifyHierarchyChanged(View* parent, View* child, bool is_add); 342
324 void NotifyHierarchyChangedUp(View* parent, View* child, bool is_add); 343 // Notifies all views in our and |child|'s hierarchies, as well as ancestors,
325 void NotifyHierarchyChangedDown(View* parent, View* child, bool is_add, 344 // that |child| was added to or removed from |this|.
345 void NotifyHierarchyChanged(View* child, bool is_add);
346
347 // Notifies all views in our hierarchy that |child| was added to or removed
348 // from |this|. |has_widget| is true iff |this| is in a widget.
Ben Goodger (Google) 2011/02/18 19:02:28 if
Peter Kasting 2011/02/18 19:09:43 No, I really meant iff ("if and only if").
349 void NotifyHierarchyChangedDown(const View& child,
350 bool is_add,
326 bool has_widget); 351 bool has_widget);
352
353 // Notifies |target| that |child| was added to or removed from |this|.
354 // |has_widget| is true iff |this| is in a widget.
327 void CallViewNotification(View* target, 355 void CallViewNotification(View* target,
328 View* parent, 356 const View& child,
329 View* child,
330 bool is_add, 357 bool is_add,
331 bool has_widget); 358 bool has_widget);
332 359
333 // Painting ------------------------------------------------------------------ 360 // Painting ------------------------------------------------------------------
334 361
335 // Called by the framework to paint a View. Performs translation and clipping 362 // Called by the framework to paint a View. Performs translation and clipping
336 // for View coordinates and language direction as required, allows the View 363 // for View coordinates and language direction as required, allows the View
337 // to paint itself via the various OnPaint*() event handlers and then paints 364 // to paint itself via the various OnPaint*() event handlers and then paints
338 // the hierarchy beneath it. 365 // the hierarchy beneath it.
339 void Paint(gfx::Canvas* canvas); 366 void Paint(gfx::Canvas* canvas);
340 367
341 // Input -------------------------------------------------------------- 368 // Input ---------------------------------------------------------------------
369
342 // These methods are designed to be called by the RootView. The RootView 370 // These methods are designed to be called by the RootView. The RootView
343 // should limit its interaction with the View to these methods and the public 371 // should limit its interaction with the View to these methods and the public
344 // API. 372 // API.
345 bool MousePressed(const MouseEvent& event, DragInfo* drag_info); 373 bool MousePressed(const MouseEvent& event, DragInfo* drag_info);
346 bool MouseDragged(const MouseEvent& event, DragInfo* drag_info); 374 bool MouseDragged(const MouseEvent& event, DragInfo* drag_info);
347 void MouseReleased(const MouseEvent& event); 375 void MouseReleased(const MouseEvent& event);
348 376
349 // Focus --------------------------------------------------------------------- 377 // Focus ---------------------------------------------------------------------
350 378
351 // Called when |child| is inserted into this View's children_ at |index|. 379 // Called when |child| is inserted into this View's children_ at |index|.
352 // Sets up next/previous focus views 380 // Sets up next/previous focus views
353 // TODO(beng): Move this to FocusManager. 381 // TODO(beng): Move this to FocusManager.
354 void InitFocusSiblings(View* child, size_t index); 382 void InitFocusSiblings(View* child, size_t index);
355 383
356 // Drag & Drop --------------------------------------------------------------- 384 // Drag & Drop ---------------------------------------------------------------
385
357 int GetDragOperations(const gfx::Point& point); 386 int GetDragOperations(const gfx::Point& point);
358 void WriteDragData(const gfx::Point& point, OSExchangeData* data); 387 void WriteDragData(const gfx::Point& point, OSExchangeData* data);
359 void StartShellDrag(const MouseEvent& event, const gfx::Point& press_point); 388 void StartShellDrag(const MouseEvent& event, const gfx::Point& press_point);
360 389
361 ////////////////////////////////////////////////////////////////////////////// 390 //////////////////////////////////////////////////////////////////////////////
362 391
363 // Creation and lifetime ----------------------------------------------------- 392 // Creation and lifetime -----------------------------------------------------
364 393
365 // True if the hierarchy (i.e. the parent View) is responsible for deleting 394 // True if the hierarchy (i.e. the parent View) is responsible for deleting
366 // this View. Default is true. 395 // this View. Default is true.
(...skipping 25 matching lines...) Expand all
392 // An identifier for a group of potentially related Views. 421 // An identifier for a group of potentially related Views.
393 int group_; 422 int group_;
394 423
395 // Tree operations ----------------------------------------------------------- 424 // Tree operations -----------------------------------------------------------
396 425
397 // The View's parent view. This is set and reset when the View is added and 426 // The View's parent view. This is set and reset when the View is added and
398 // removed from a hierarchy. 427 // removed from a hierarchy.
399 View* parent_; 428 View* parent_;
400 429
401 // The View's children. 430 // The View's children.
402 ViewVector children_; 431 Views children_;
403 432
404 // Focus --------------------------------------------------------------------- 433 // Focus ---------------------------------------------------------------------
405 434
406 // True if this View is focusable by the FocusManager. 435 // True if this View is focusable by the FocusManager.
407 bool focusable_; 436 bool focusable_;
408 437
409 // Focus siblings for this View. 438 // Focus siblings for this View.
410 View* next_focusable_view_; 439 View* next_focusable_view_;
411 View* prev_focusable_view_; 440 View* prev_focusable_view_;
412 441
(...skipping 24 matching lines...) Expand all
437 - rtl 466 - rtl
438 - l10n 467 - l10n
439 - mousewheel 468 - mousewheel
440 - more on painting 469 - more on painting
441 - layer stuff 470 - layer stuff
442 - investigate why assorted notifications are necessary 471 - investigate why assorted notifications are necessary
443 - native_widget_views 472 - native_widget_views
444 - native_widget_gtk 473 - native_widget_gtk
445 474
446 */ 475 */
OLDNEW
« no previous file with comments | « no previous file | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698