Home | History | Annotate | Download | only in views

Lines Matching refs:view

83 // View class
85 // A View is a rectangle within the views View hierarchy. It is the base
88 // A View is a container of other Views (there is no such thing as a Leaf
89 // View - makes code simpler, reduces type conversion headaches, design
92 // The View contains basic properties for sizing (bounds), layout (flex,
95 // The View also uses a simple Box Layout Manager similar to XUL's
106 class VIEWS_EXPORT View : public ui::LayerDelegate,
111 typedef std::vector<View*> Views;
121 View* parent,
122 View* child,
123 View* move_view)
131 View* parent;
132 // The view being added or removed.
133 View* child;
138 // For the remove part of move, |move_view| is the new parent of the View
140 // For the add part of move, |move_view| is the old parent of the View being
142 View* move_view;
147 View();
148 virtual ~View();
150 // By default a View is owned by its parent unless specified otherwise here.
155 // Get the Widget that hosts this View, if any.
159 // Adds |view| as a child of this view, optionally at |index|.
160 void AddChildView(View* view);
161 void AddChildViewAt(View* view, int index);
163 // Moves |view| to the specified |index|. A negative value for |index| moves
164 // the view at the end.
165 void ReorderChildView(View* view, int index);
167 // Removes |view| from this view. The view's parent will change to NULL.
168 void RemoveChildView(View* view);
170 // Removes all the children from this view. If |delete_children| is true,
177 // Returns the child view at |index|.
178 const View* child_at(int index) const {
183 View* child_at(int index) {
184 return const_cast<View*>(const_cast<const View*>(this)->child_at(index));
187 // Returns the parent view.
188 const View* parent() const { return parent_; }
189 View* parent() { return parent_; }
191 // Returns true if |view| is contained within this View's hierarchy, even as
192 // an indirect descendant. Will return true if child is also this view.
193 bool Contains(const View* view) const;
195 // Returns the index of |view|, or -1 if |view| is not a child of this view.
196 int GetIndexOf(const View* view) const;
199 // Methods for obtaining and modifying the position and size of the view.
200 // Position is in the coordinate system of the view's parent.
223 // Returns the bounds of the content area of the view, i.e. the rectangle
224 // enclosed by the view's border.
227 // Returns the bounds of the view in its own coordinates (i.e. position is
241 // When traversing the View hierarchy in order to compute the bounds, the
243 // each View and therefore it will return the mirrored and transformed version
247 // Return the bounds of the View in screen coordinate system.
250 // Returns the baseline of this view, or -1 if this view has no baseline. The
254 // Get the size the View would like to be, if enough space were available.
257 // Convenience method that sizes this view to its preferred size.
260 // Gets the minimum size of the view. View's implementation invokes
264 // Gets the maximum size of the view. Currently only used for sizing shell
268 // Return the height necessary to display this view with the provided width.
269 // View's implementation returns the value from getPreferredSize.cy.
270 // Override if your View's preferred height depends upon the width (such
274 // Sets whether this view is visible. Painting is scheduled as needed. Also,
275 // clears focus if the focused view or one of its ancestors is set to be
279 // Return whether a view is visible
282 // Returns true if this view is drawn on screen.
285 // Set whether this view is enabled. A disabled view does not receive keyboard
287 // is invoked. Also, clears focus if the focused view is disabled.
290 // Returns whether the view is enabled.
293 // This indicates that the view completely fills its bounds in an opaque
297 // already exist for the View, but is a no-op in that case.
302 // Methods for setting transformations for a view (e.g. rotation, scaling).
306 // Clipping parameters. Clipping is done relative to the view bounds.
312 // Sets whether this view paints to a layer. A view paints to a layer if
314 // . the view has a non-identity transform.
316 // View creates the Layer only when it exists in a Widget with a non-NULL
322 // Methods for accessing the bounds and position of the view, relative to its
323 // parent. The position returned is mirrored if the parent view is using a RTL
327 // transparent to the View subclasses and therefore you should use the
333 // Given a rectangle specified in this View's coordinate system, the function
334 // computes the 'left' value for the mirrored rectangle within this View. If
335 // the View's UI layout is not right-to-left, then bounds.x() is returned.
337 // UI mirroring is transparent to most View subclasses and therefore there is
342 // Given the X coordinate of a point inside the View, this function returns
343 // the mirrored X coordinate of the point if the View's UI layout is
348 // a View with the bounds {0, 0, 100, 100} and a right-to-left layout:
355 // Given a X coordinate and a width inside the View, this function returns
356 // the mirrored X coordinate if the View's UI layout is right-to-left. If the
360 // a View with the bounds {0, 0, 100, 100} and a right-to-left layout:
373 // Mark this view and all parents to require a relayout. This ensures the
374 // next call to Layout() will propagate to this view, even if the bounds of
378 // Gets/Sets the Layout Manager used by this view to size and place its
380 // The LayoutManager is owned by the View and is deleted when the view is
386 // This has no effect if the view does not have an associated layer.
391 // The view class name.
394 // Return the receiving view's class name. A view class is a string which
395 // uniquely identifies the view class. It is intended to be used as a way to
396 // find out during run time if a view can be safely casted to a specific view
402 const View* GetAncestorWithClassName(const std::string& name) const;
403 View* GetAncestorWithClassName(const std::string& name);
405 // Recursively descends the view tree starting at this view, and returns
407 // Returns NULL if no matching child view is found.
408 virtual const View* GetViewByID(int id) const;
409 virtual View* GetViewByID(int id);
411 // Gets and sets the ID for this view. ID should be unique within the subtree
421 // Returns the group id of the view, or -1 if the id is not set yet.
426 // only the selected view from the group (obtained with
434 // Returns the View that is currently selected in |group|.
435 // The default implementation simply returns the first View found for that
437 virtual View* GetSelectedViewForGroup(int group);
442 // the mirrored position of the child Views if the parent View uses a
445 // Convert a point from the coordinate system of one View to another.
448 // the same view hierarchy.
450 static void ConvertPointToTarget(const View* source,
451 const View* target,
458 // the same view hierarchy.
460 static void ConvertRectToTarget(const View* source,
461 const View* target,
464 // Convert a point from a View's coordinate system to that of its Widget.
465 static void ConvertPointToWidget(const View* src, gfx::Point* point);
467 // Convert a point from the coordinate system of a View's Widget to that
468 // View's coordinate system.
469 static void ConvertPointFromWidget(const View* dest, gfx::Point* p);
471 // Convert a point from a View's coordinate system to that of the screen.
472 static void ConvertPointToScreen(const View* src, gfx::Point* point);
474 // Convert a point from a View's coordinate system to that of the screen.
475 static void ConvertPointFromScreen(const View* dst, gfx::Point* point);
477 // Applies transformation on the rectangle, which is in the view's coordinate
487 // Mark all or part of the View's bounds as dirty (needing repaint).
488 // |r| is in the View's coordinates.
489 // Rectangle |r| should be in the view's coordinate system. The
491 // system before propagating SchedulePaint up the view hierarchy.
496 // Called by the framework to paint a View. Performs translation and clipping
497 // for View coordinates and language direction as required, allows the View
515 // Returns the NativeTheme to use for this View. This calls through to
516 // GetNativeTheme() on the Widget this View is in. If this View is not in a
520 const_cast<const View*>(this)->GetNativeTheme());
527 // View::Paint() needs to be transformed such that anything drawn on the
528 // canvas object during View::Paint() is flipped horizontally.
531 // |flip_canvas_on_paint_for_rtl_ui_|). View subclasses that need to paint on
538 // Enables or disables flipping of the gfx::Canvas during View::Paint().
554 // functions are in the view's coordinates, except for a RootView.
559 View* GetEventHandlerForPoint(const gfx::Point& point);
561 // Returns the View that should be the target of an event having |rect| as
564 View* GetEventHandlerForRect(const gfx::Rect& rect);
567 // and supports tooltips. If the view does not contain the point, returns
569 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point);
571 // Return the cursor that should be used for this view or the default cursor.
583 // Returns true if |rect| intersects this view's bounds. |rect| is in the
587 // Returns true if this view or any of its descendants are permitted to
591 // Returns true if the mouse cursor is over |view| and mouse events are
595 // This method is invoked when the user clicks on this view.
668 // view hierarchy, events won't be sent.
671 virtual void SetMouseHandler(View* new_mouse_handler);
682 // if the view is focused. If the event has not been processed, the parent
695 // Returns the View's TextInputClient instance or NULL if the View doesn't
700 // Widget that contains this view. Returns NULL if this view is not part of a
701 // view hierarchy with a Widget.
705 // Sets a new ViewTargeter for the view, and returns the previous
710 // otherwise returns the ViewTargeter installed on our root view.
733 // Sets a keyboard accelerator for that view. When the user presses the
735 // Note that you can set multiple accelerators for a view by invoking this
740 // Removes the specified accelerator for this view.
743 // Removes all the keyboard accelerators for this view.
749 // Returns whether accelerators are enabled for this view. Accelerators are
750 // enabled if the containing widget is visible and the view is enabled() and
756 // Returns whether this view currently has the focus.
759 // Returns the view that should be selected next when pressing Tab.
760 View* GetNextFocusableView();
761 const View* GetNextFocusableView() const;
763 // Returns the view that should be selected next when pressing Shift-Tab.
764 View* GetPreviousFocusableView();
767 // makes the current view the precedent view of the specified one.
771 void SetNextFocusableView(View* view);
773 // Sets whether this view is capable of taking focus. It will clear focus if
774 // the focused view is set to be non-focusable.
775 // Note that this is false by default so that a view used as a container does
779 // Returns true if this view is |focusable_|, |enabled_| and drawn.
782 // Return whether this view is focusable when the user requires full keyboard
786 // Set whether this view can be made focusable if the user requires
788 // clear focus if the focused view is set to be non-focusable.
793 // Widget that contains this view. This can return NULL if this view is not
794 // part of a view hierarchy with a Widget.
798 // Request keyboard focus. The receiving view will become the focused view.
801 // Invoked when a view is about to be requested for focus due to the focus
824 // If this method returns an object, any view that's a direct or
825 // indirect child of this view will always use this FocusTraversable
831 // Gets the tooltip for this View. If the View does not have a tooltip,
832 // return false. If the View does have a tooltip, copy the tooltip into
834 // Any time the tooltip text that a View is displaying changes, it must
836 // |p| provides the coordinates of the mouse (relative to this view).
840 // Returns the location (relative to this View) for the text on the tooltip
847 // Sets the ContextMenuController. Setting this to non-null makes the View
861 // as it is always equal to the current View.
876 // During a drag and drop session when the mouse moves the view under the
878 // GetDropFormats methods. If the view returns true and the drag site can
879 // provide data in one of the formats, the view is asked if the drop data
881 // data is available the view is asked if it supports the drop (by way of
882 // the CanDrop method). If a view returns true from CanDrop,
883 // OnDragEntered is sent to the view when the mouse first enters the view,
884 // as the mouse moves around within the view OnDragUpdated is invoked.
885 // If the user releases the mouse over the view and OnDragUpdated returns a
887 // view or over another view that wants the drag, OnDragExited is invoked.
889 // Similar to mouse events, the deepest view under the mouse is first checked
890 // if it supports the drop (Drop). If the deepest view under
894 // Override and return the set of formats that can be dropped on this view.
896 // The default implementation returns false, which means the view doesn't
906 // A view that supports drag and drop must override this and return true if
907 // data contains a type that may be dropped on this view.
910 // OnDragEntered is invoked when the mouse enters this view during a drag and
916 // Invoked during a drag and drop session while the mouse is over the view.
923 // when the drag session was canceled and the mouse was over the view.
940 // Modifies |state| to reflect the current accessible state of this view.
943 // Returns an instance of the native accessibility interface for this view.
947 // occurred on this view, such as when the view is focused or when its
949 // cases where the view is a native control that's already sending a
956 // TODO(beng): Figure out if this can live somewhere other than View, i.e.
959 // Scrolls the specified region, in this View's coordinate system, to be
960 // visible. View's implementation passes the call onto the parent View (after
962 // the child view, such as Viewport, to override appropriately.
966 // to scroll relative to the visible bounds of the view. For example, a
998 // This is invoked by the target view if it detects the press may generate
1011 // Override to be notified when the bounds of the view have changed.
1014 // Called when the preferred size of a child view changed. This gives the
1016 virtual void ChildPreferredSizeChanged(View* child) {}
1018 // Called when the visibility of a child view changed. This gives the parent
1020 virtual void ChildVisibilityChanged(View* child) {}
1023 // if there is one. Be sure to call View::PreferredSizeChanged when
1027 // Override returning true when the view needs to be notified when its visible
1028 // bounds relative to the root view may have changed. Only used by
1032 // Notification that this View's visible bounds relative to the root view may
1033 // have changed. The visible bounds are the region of the View not clipped by
1037 // Override to be notified when the enabled state of this View has
1038 // changed. The default implementation calls SchedulePaint() on this View.
1047 // When a view is removed, it is invoked for all children and grand
1049 // view and all parents.
1051 // When a view is added, a notification is sent to the view, all its
1055 // required when a view is added or removed from a view hierarchy
1060 // When SetVisible() changes the visibility of a view, this method is
1061 // invoked for that view as well as all the children recursively.
1062 virtual void VisibilityChanged(View* starting_from, bool is_visible);
1065 // view is attached to has changed and the view hierarchy has not changed.
1067 // that the view is attached to is changed as a result of changing the view
1069 // FocusManager manages this view.
1078 // Override to provide rendering in any part of the View's bounds. Typically
1079 // this is the "contents" of the view. If you override this method you will
1091 // Returns true if this View is the root for paint events, and should
1098 // Returns the offset from this view to the nearest ancestor with a layer. If
1103 // Updates the view's layer's parent. Called when a view is added to a view
1104 // hierarchy, responsible for parenting the view's layer to the enclosing
1108 // If this view has a layer, the layer is reparented to |parent_layer| and its
1109 // bounds is set based on |point|. If this view does not have a layer, then
1111 // existing view to make sure all descendants that have layers are parented to
1115 // Called to update the bounds of any child layers within this View's
1126 // Finds the layer that this view paints to (it may belong to an ancestor
1127 // view), then reorders the immediate children of that layer to match the
1128 // order of the view tree.
1132 // order of the viewview are
1133 // reordered so that they are below any child layers not owned by a view.
1135 // with an associated view. Widget::ReorderNativeViews() may reorder layers
1136 // below layers owned by a view.
1146 // if a view can take focus right now.
1149 // Override to be notified when focus has changed either to or from this View.
1153 // Handle view focus/blur events for this view.
1179 // returns the middle of the visible region of this view.
1206 // Invoked when the NativeTheme associated with this View changes.
1214 // to a file to compile/view.
1222 std::string DoPrintViewGraph(bool first, View* view_with_children);
1249 // invoke OnPaint() on the View.
1254 // Removes |view| from the hierarchy tree. If |update_focus_cycle| is true,
1255 // the next and previous focusable views of views pointing to this view are
1257 // |delete_removed_view| is true, the view is also deleted (if it is parent
1259 // AddChildView() to a new parent. For this case, |new_parent| is the View
1260 // that |view| is going to be added to after the remove completes.
1261 void DoRemoveChildView(View* view,
1265 View* new_parent);
1268 // |old_parent| is the original parent of the View that was removed.
1269 // If |new_parent| is not NULL, the View that was removed will be reparented
1271 void PropagateRemoveNotifications(View* old_parent, View* new_parent);
1291 void PropagateVisibilityNotifications(View* from, bool is_visible);
1295 void VisibilityChangedImpl(View* starting_from, bool is_visible);
1302 // When a view is added to a hierarchy, it and all its children are asked if
1306 static void RegisterChildrenForVisibleBoundsNotification(View* view);
1307 static void UnregisterChildrenForVisibleBoundsNotification(View* view);
1311 // Adds/removes view to the list of descendants that are notified any time
1313 void AddDescendantToNotify(View* view);
1314 void RemoveDescendantToNotify(View* view);
1320 // root view bounds tree are no longer valid. If |origin_changed| is true sets
1329 // for example, when a view gets a layer and therefore becomes paint root. It
1334 // Traverse up the View hierarchy to the first ancestor that is a paint root
1342 // or NULL, |transform| is set to convert from root view coordinates to this.
1343 bool GetTransformRelativeTo(const View* ancestor,
1348 // Convert a point in the view's coordinate to an ancestor view's coordinate
1351 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const;
1353 // Convert a point in the ancestor's coordinate system to the view's
1356 // to the view's coordinate system.
1357 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const;
1359 // Convert a rect in the view's coordinate to an ancestor view's coordinate
1362 bool ConvertRectForAncestor(const View* ancestor, gfx::RectF* rect) const;
1364 // Convert a rect in the ancestor's coordinate system to the view's
1367 // to the view's coordinate system.
1368 bool ConvertRectFromAncestor(const View* ancestor, gfx::RectF* rect) const;
1372 // Creates the layer and related fields for this view.
1375 // Parents all un-parented layers within this view's hierarchy to this view's
1379 // Parents this view's layer to |parent_layer|, and sets its bounds and other
1380 // properties in accordance to |offset|, the view's offset from the
1385 // View itself, and all its parent Views are visible. This also updates
1394 // Destroys the layer associated with this view, and reparents any descendants
1406 // Registers this view's keyboard accelerators that are not registered to
1410 // Unregisters all the keyboard accelerators associated with this view.
1417 // Initialize the previous/next focusable views of the specified view relative
1418 // to the view at the specified index.
1419 void InitFocusSiblings(View* view, int index);
1421 // Helper function to advance focus, in case the currently focused view has
1427 // Used to propagate theme changed notifications from the root view to all
1431 // Used to propagate locale changed notifications from the root view to all
1438 // This must be invoked any time the View hierarchy changes in such a way
1439 // the view under the mouse differs. For example, if the bounds of a View is
1446 // Starts a drag and drop operation originating from this view. This invokes
1449 // in the view's coordinate system.
1459 // False if this View is owned by its parent - i.e. it will be deleted by its
1465 // The id of this View. Used to find this View.
1468 // The group of this view. Some view subclasses use this id to find other
1475 // This view's parent.
1476 View* parent_;
1478 // This view's children.
1483 // This View's bounds in the parent coordinate system.
1486 // Whether this view is visible.
1489 // Whether this view is enabled.
1492 // When this flag is on, a View receives a mouse-enter and mouse-leave event
1493 // even if a descendant View is the event-recipient for the real mouse
1495 // view into a child view, both the child view and this view receives
1496 // mouse-enter event. Similarly, if the mouse moves from inside a child view
1497 // and out of this view, then both views receive a mouse-leave event.
1498 // When this flag is turned off, if the mouse moves from inside this view into
1499 // a child view, then this view receives a mouse-leave event. When this flag
1501 // When the mouse moves from inside the child view out of the child view but
1502 // still into this view, this view receives a mouse-enter event if this flag
1515 // paint root view constructed the spatial database.
1518 // If this View IsPaintRoot() then this will be a pointer to a spatial data
1531 // Whether the view needs to be laid out.
1534 // The View's LayoutManager defines the sizing heuristics applied to child
1538 // Whether this View's layer should be snapped to the pixel boundary.
1551 // Indicates whether or not the gfx::Canvas object passed to View::Paint()
1553 // right-to-left locales for this View.
1573 // Next view to be focused when the Tab key is pressed.
1574 View* next_focusable_view_;
1576 // Next view to be focused when the Shift-Tab key combination is pressed.
1577 View* previous_focusable_view_;
1579 // Whether this view can be focused.
1582 // Whether this view is focusable if the user requires full keyboard access,
1601 // Belongs to this view, but it's reference-counted on some platforms
1605 DISALLOW_COPY_AND_ASSIGN(View);