Lines Matching defs:View
80 // View class
82 // A View is a rectangle within the views View hierarchy. It is the base
85 // A View is a container of other Views (there is no such thing as a Leaf
86 // View - makes code simpler, reduces type conversion headaches, design
89 // The View contains basic properties for sizing (bounds), layout (flex,
92 // The View also uses a simple Box Layout Manager similar to XUL's
103 class VIEWS_EXPORT View : public ui::LayerDelegate,
108 typedef std::vector<View*> Views;
118 View* parent,
119 View* child,
120 View* move_view)
128 View* parent;
129 // The view being added or removed.
130 View* child;
135 // For the remove part of move, |move_view| is the new parent of the View
137 // For the add part of move, |move_view| is the old parent of the View being
139 View* move_view;
144 View();
145 virtual ~View();
147 // By default a View is owned by its parent unless specified otherwise here.
152 // Get the Widget that hosts this View, if any.
156 // Adds |view| as a child of this view, optionally at |index|.
157 void AddChildView(View* view);
158 void AddChildViewAt(View* view, int index);
160 // Moves |view| to the specified |index|. A negative value for |index| moves
161 // the view at the end.
162 void ReorderChildView(View* view, int index);
164 // Removes |view| from this view. The view's parent will change to NULL.
165 void RemoveChildView(View* view);
167 // Removes all the children from this view. If |delete_children| is true,
174 // Returns the child view at |index|.
175 const View* child_at(int index) const {
180 View* child_at(int index) {
181 return const_cast<View*>(const_cast<const View*>(this)->child_at(index));
184 // Returns the parent view.
185 const View* parent() const { return parent_; }
186 View* parent() { return parent_; }
188 // Returns true if |view| is contained within this View's hierarchy, even as
189 // an indirect descendant. Will return true if child is also this view.
190 bool Contains(const View* view) const;
192 // Returns the index of |view|, or -1 if |view| is not a child of this view.
193 int GetIndexOf(const View* view) const;
196 // Methods for obtaining and modifying the position and size of the view.
197 // Position is in the coordinate system of the view's parent.
220 // Returns the bounds of the content area of the view, i.e. the rectangle
221 // enclosed by the view's border.
224 // Returns the bounds of the view in its own coordinates (i.e. position is
238 // When traversing the View hierarchy in order to compute the bounds, the
240 // each View and therefore it will return the mirrored and transformed version
244 // Return the bounds of the View in screen coordinate system.
247 // Returns the baseline of this view, or -1 if this view has no baseline. The
251 // Get the size the View would like to be, if enough space were available.
254 // Convenience method that sizes this view to its preferred size.
257 // Gets the minimum size of the view. View's implementation invokes
261 // Gets the maximum size of the view. Currently only used for sizing shell
265 // Return the height necessary to display this view with the provided width.
266 // View's implementation returns the value from getPreferredSize.cy.
267 // Override if your View's preferred height depends upon the width (such
271 // Set whether this view is visible. Painting is scheduled as needed.
274 // Return whether a view is visible
277 // Returns true if this view is drawn on screen.
280 // Set whether this view is enabled. A disabled view does not receive keyboard
285 // Returns whether the view is enabled.
288 // This indicates that the view completely fills its bounds in an opaque
292 // already exist for the View, but is a no-op in that case.
297 // Methods for setting transformations for a view (e.g. rotation, scaling).
301 // Clipping parameters. Clipping is done relative to the view bounds.
307 // Sets whether this view paints to a layer. A view paints to a layer if
309 // . the view has a non-identity transform.
311 // View creates the Layer only when it exists in a Widget with a non-NULL
315 // Recreates a layer for the view and returns the old layer. After this call,
316 // the View no longer has a pointer to the old layer (so it won't be able to
319 // Returns NULL and does not recreate layer if view does not own its layer.
324 // Methods for accessing the bounds and position of the view, relative to its
325 // parent. The position returned is mirrored if the parent view is using a RTL
329 // transparent to the View subclasses and therefore you should use the
335 // Given a rectangle specified in this View's coordinate system, the function
336 // computes the 'left' value for the mirrored rectangle within this View. If
337 // the View's UI layout is not right-to-left, then bounds.x() is returned.
339 // UI mirroring is transparent to most View subclasses and therefore there is
344 // Given the X coordinate of a point inside the View, this function returns
345 // the mirrored X coordinate of the point if the View's UI layout is
350 // a View with the bounds {0, 0, 100, 100} and a right-to-left layout:
357 // Given a X coordinate and a width inside the View, this function returns
358 // the mirrored X coordinate if the View's UI layout is right-to-left. If the
362 // a View with the bounds {0, 0, 100, 100} and a right-to-left layout:
375 // Mark this view and all parents to require a relayout. This ensures the
376 // next call to Layout() will propagate to this view, even if the bounds of
380 // Gets/Sets the Layout Manager used by this view to size and place its
382 // The LayoutManager is owned by the View and is deleted when the view is
389 // The view class name.
392 // Return the receiving view's class name. A view class is a string which
393 // uniquely identifies the view class. It is intended to be used as a way to
394 // find out during run time if a view can be safely casted to a specific view
400 View* GetAncestorWithClassName(const std::string& name);
402 // Recursively descends the view tree starting at this view, and returns
404 // Returns NULL if no matching child view is found.
405 virtual const View* GetViewByID(int id) const;
406 virtual View* GetViewByID(int id);
408 // Gets and sets the ID for this view. ID should be unique within the subtree
418 // Returns the group id of the view, or -1 if the id is not set yet.
423 // only the selected view from the group (obtained with
431 // Returns the View that is currently selected in |group|.
432 View found for that
434 virtual View* GetSelectedViewForGroup(int group);
439 // the mirrored position of the child Views if the parent View uses a
442 // Convert a point from the coordinate system of one View to another.
445 // the same view hierarchy.
447 static void ConvertPointToTarget(const View* source,
448 const View* target,
451 // Convert a point from a View's coordinate system to that of its Widget.
452 static void ConvertPointToWidget(const View* src, gfx::Point* point);
454 // Convert a point from the coordinate system of a View's Widget to that
455 // View's coordinate system.
456 static void ConvertPointFromWidget(const View* dest, gfx::Point* p);
458 // Convert a point from a View's coordinate system to that of the screen.
459 static void ConvertPointToScreen(const View* src, gfx::Point* point);
461 // Convert a point from a View's coordinate system to that of the screen.
462 static void ConvertPointFromScreen(const View* dst, gfx::Point* point);
464 // Applies transformation on the rectangle, which is in the view's coordinate
474 // Mark all or part of the View's bounds as dirty (needing repaint).
475 // |r| is in the View's coordinates.
476 // Rectangle |r| should be in the view's coordinate system. The
478 // system before propagating SchedulePaint up the view hierarchy.
483 // Called by the framework to paint a View. Performs translation and clipping
484 // for View coordinates and language direction as required, allows the View
507 // Returns the NativeTheme to use for this View. This calls through to
508 // GetNativeTheme() on the Widget this View is in. If this View is not in a
512 const_cast<const View*>(this)->GetNativeTheme());
519 // View::Paint() needs to be transformed such that anything drawn on the
520 // canvas object during View::Paint() is flipped horizontally.
523 // |flip_canvas_on_paint_for_rtl_ui_|). View subclasses that need to paint on
530 // Enables or disables flipping of the gfx::Canvas during View::Paint().
552 // view's coordinates, except for a RootView.
556 virtual View* GetEventHandlerForPoint(const gfx::Point& point);
559 // and supports tooltips. If the view does not contain the point, returns
561 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point);
563 // Return the cursor that should be used for this view or the default cursor.
574 // Tests whether |rect| intersects this view's bounds.
577 // Returns true if the mouse cursor is over |view| and mouse events are
581 // This method is invoked when the user clicks on this view.
654 // view hierarchy, events won't be sent.
657 virtual void SetMouseHandler(View* new_mouse_handler);
668 // if the view is focused. If the event has not been processed, the parent
681 // Returns the View's TextInputClient instance or NULL if the View doesn't
686 // Widget that contains this view. Returns NULL if this view is not part of a
687 // view hierarchy with a Widget.
704 // Sets a keyboard accelerator for that view. When the user presses the
706 // Note that you can set multiple accelerators for a view by invoking this
711 // Removes the specified accelerator for this view.
714 // Removes all the keyboard accelerators for this view.
720 // Returns whether accelerators are enabled for this view. Accelerators are
721 // enabled if the containing widget is visible and the view is enabled() and
727 // Returns whether this view currently has the focus.
730 // Returns the view that should be selected next when pressing Tab.
731 View* GetNextFocusableView();
732 const View* GetNextFocusableView() const;
734 // Returns the view that should be selected next when pressing Shift-Tab.
735 View* GetPreviousFocusableView();
738 // makes the current view the precedent view of the specified one.
742 void SetNextFocusableView(View* view);
744 // Sets whether this view is capable of taking focus.
745 // Note that this is false by default so that a view used as a container does
749 // Returns true if this view is capable of taking focus.
752 // Returns true if this view is |focusable_|, |enabled_| and drawn.
755 // Return whether this view is focusable when the user requires full keyboard
759 // Set whether this view can be made focusable if the user requires
767 // Widget that contains this view. This can return NULL if this view is not
768 // part of a view hierarchy with a Widget.
772 // Request keyboard focus. The receiving view will become the focused view.
775 // Invoked when a view is about to be requested for focus due to the focus
798 // If this method returns an object, any view that's a direct or
799 // indirect child of this view will always use this FocusTraversable
805 // Gets the tooltip for this View. If the View does not have a tooltip,
806 // return false. If the View does have a tooltip, copy the tooltip into
808 // Any time the tooltip text that a View is displaying changes, it must
810 // |p| provides the coordinates of the mouse (relative to this view).
813 // Returns the location (relative to this View) for the text on the tooltip
820 // Sets the ContextMenuController. Setting this to non-null makes the View
834 // as it is always equal to the current View.
849 // During a drag and drop session when the mouse moves the view under the
851 // GetDropFormats methods. If the view returns true and the drag site can
852 // provide data in one of the formats, the view is asked if the drop data
854 // data is available the view is asked if it supports the drop (by way of
855 // the CanDrop method). If a view returns true from CanDrop,
856 // OnDragEntered is sent to the view when the mouse first enters the view,
857 // as the mouse moves around within the view OnDragUpdated is invoked.
858 // If the user releases the mouse over the view and OnDragUpdated returns a
860 // view or over another view that wants the drag, OnDragExited is invoked.
862 // Similar to mouse events, the deepest view under the mouse is first checked
863 // if it supports the drop (Drop). If the deepest view under
867 // Override and return the set of formats that can be dropped on this view.
869 // The default implementation returns false, which means the view doesn't
879 // A view that supports drag and drop must override this and return true if
880 // data contains a type that may be dropped on this view.
883 // OnDragEntered is invoked when the mouse enters this view during a drag and
889 // Invoked during a drag and drop session while the mouse is over the view.
896 // when the drag session was canceled and the mouse was over the view.
913 // Modifies |state| to reflect the current accessible state of this view.
916 // Returns an instance of the native accessibility interface for this view.
920 // occurred on this view, such as when the view is focused or when its
922 // cases where the view is a native control that's already sending a
929 // TODO(beng): Figure out if this can live somewhere other than View, i.e.
932 // Scrolls the specified region, in this View's coordinate system, to be
933 // visible. View's implementation passes the call onto the parent View (after
935 // the child view, such as Viewport, to override appropriately.
939 // to scroll relative to the visible bounds of the view. For example, a
971 // This is invoked by the target view if it detects the press may generate
984 // Override to be notified when the bounds of the view have changed.
987 // Called when the preferred size of a child view changed. This gives the
989 virtual void ChildPreferredSizeChanged(View* child) {}
991 // Called when the visibility of a child view changed. This gives the parent
993 virtual void ChildVisibilityChanged(View* child) {}
996 // if there is one. Be sure to call View::PreferredSizeChanged when
1000 // Override returning true when the view needs to be notified when its visible
1001 // bounds relative to the root view may have changed. Only used by
1005 // Notification that this View's visible bounds relative to the root view may
1006 // have changed. The visible bounds are the region of the View not clipped by
1010 // Override to be notified when the enabled state of this View has
1011 // changed. The default implementation calls SchedulePaint() on this View.
1018 // When a view is removed, it is invoked for all children and grand
1020 // view and all parents.
1022 // When a view is added, a notification is sent to the view, all its
1026 // required when a view is added or removed from a view hierarchy
1031 // When SetVisible() changes the visibility of a view, this method is
1032 // invoked for that view as well as all the children recursively.
1033 virtual void VisibilityChanged(View* starting_from, bool is_visible);
1035 // Called when the native view hierarchy changed.
1036 // |attached| is true if that view has been attached to a new NativeView
1038 // |native_view| is the NativeView this view was attached/detached from, and
1039 // |root_view| is the root view associated with the NativeView.
1040 // Views created without a native view parent don't have a focus manager.
1053 // Override to provide rendering in any part of the View's bounds. Typically
1054 // this is the "contents" of the view. If you override this method you will
1072 // This creates a layer for the view, if one does not exist. It then
1073 // passes the texture to a layer associated with the view. While an external
1074 // texture is set, the view will not update the layer contents.
1081 // Returns the offset from this view to the nearest ancestor with a layer. If
1086 // Updates the view's layer's parent. Called when a view is added to a view
1087 // hierarchy, responsible for parenting the view's layer to the enclosing
1091 // If this view has a layer, the layer is reparented to |parent_layer| and its
1092 // bounds is set based on |point|. If this view does not have a layer, then
1094 // existing view to make sure all descendants that have layers are parented to
1099 // Called to update the bounds of any child layers within this View's
1108 // Finds the layer that this view paints to (it may belong to an ancestor
1109 // view), then reorders the immediate children of that layer to match the
1110 // order of the view tree.
1114 // order of the view tree. Child layers which are owned by a view are
1115 // reordered so that they are below any child layers not owned by a view.
1117 // with an associated view. Widget::ReorderNativeViews() may reorder layers
1118 // below layers owned by a view.
1123 // Called by HitTestRect() to see if this View has a custom hit test mask. If
1125 // mask. Default value is false, in which case the View will hit-test against
1137 // Override to be notified when focus has changed either to or from this View.
1141 // Handle view focus/blur events for this view.
1167 // returns the middle of the visible region of this view.
1194 // Invoked when the NativeTheme associated with this View changes.
1202 // to a file to compile/view.
1210 std::string DoPrintViewGraph(bool first, View* view_with_children);
1234 // invoke OnPaint() on the View.
1239 // Removes |view| from the hierarchy tree. If |update_focus_cycle| is true,
1240 // the next and previous focusable views of views pointing to this view are
1242 // |delete_removed_view| is true, the view is also deleted (if it is parent
1244 // AddChildView() to a new parent. For this case, |new_parent| is the View
1245 // that |view| is going to be added to after the remove completes.
1246 void DoRemoveChildView(View* view,
1250 View* new_parent);
1253 // |old_parent| is the original parent of the View that was removed.
1254 // If |new_parent| is not NULL, the View that was removed will be reparented
1256 void PropagateRemoveNotifications(View* old_parent, View* new_parent);
1278 void PropagateVisibilityNotifications(View* from, bool is_visible);
1282 void VisibilityChangedImpl(View* starting_from, bool is_visible);
1289 // When a view is added to a hierarchy, it and all its children are asked if
1293 static void RegisterChildrenForVisibleBoundsNotification(View* view);
1294 static void UnregisterChildrenForVisibleBoundsNotification(View* view);
1298 // Adds/removes view to the list of descendants that are notified any time
1300 void AddDescendantToNotify(View* view);
1301 void RemoveDescendantToNotify(View* view);
1310 // or NULL, |transform| is set to convert from root view coordinates to this.
1311 bool GetTransformRelativeTo(const View* ancestor,
1316 // Convert a point in the view's coordinate to an ancestor view's coordinate
1319 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const;
1321 // Convert a point in the ancestor's coordinate system to the view's
1323 // point was successfully from the ancestor's coordinate system to the view's
1325 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const;
1329 // Creates the layer and related fields for this view.
1332 // Parents all un-parented layers within this view's hierarchy to this view's
1336 // Parents this view's layer to |parent_layer|, and sets its bounds and other
1337 // properties in accordance to |offset|, the view's offset from the
1342 // View itself, and all its parent Views are visible. This also updates
1351 // Destroys the layer associated with this view, and reparents any descendants
1363 // Registers this view's keyboard accelerators that are not registered to
1367 // Unregisters all the keyboard accelerators associated with this view.
1374 // Initialize the previous/next focusable views of the specified view relative
1375 // to the view at the specified index.
1376 void InitFocusSiblings(View* view, int index);
1380 // Used to propagate theme changed notifications from the root view to all
1384 // Used to propagate locale changed notifications from the root view to all
1391 // This must be invoked any time the View hierarchy changes in such a way
1392 // the view under the mouse differs. For example, if the bounds of a View is
1399 // Starts a drag and drop operation originating from this view. This invokes
1402 // in the view's coordinate system.
1412 // False if this View is owned by its parent - i.e. it will be deleted by its
1418 // The id of this View. Used to find this View.
1421 // The group of this view. Some view subclasses use this id to find other
1428 // This view's parent.
1429 View* parent_;
1431 // This view's children.
1436 // This View's bounds in the parent coordinate system.
1439 // Whether this view is visible.
1442 // Whether this view is enabled.
1445 // When this flag is on, a View receives a mouse-enter and mouse-leave event
1446 // even if a descendant View is the event-recipient for the real mouse
1448 // view into a child view, both the child view and this view receives
1449 // mouse-enter event. Similarly, if the mouse moves from inside a child view
1450 // and out of this view, then both views receive a mouse-leave event.
1451 // When this flag is turned off, if the mouse moves from inside this view into
1452 // a child view, then this view receives a mouse-leave event. When this flag
1454 // When the mouse moves from inside the child view out of the child view but
1455 // still into this view, this view receives a mouse-enter event if this flag
1475 // Whether the view needs to be laid out.
1478 // The View's LayoutManager defines the sizing heuristics applied to child
1495 // Indicates whether or not the gfx::Canvas object passed to View::Paint()
1497 // right-to-left locales for this View.
1521 // Next view to be focused when the Tab key is pressed.
1522 View* next_focusable_view_;
1524 // Next view to be focused when the Shift-Tab key combination is pressed.
1525 View* previous_focusable_view_;
1527 // Whether this view can be focused.
1530 // Whether this view is focusable if the user requires full keyboard access,
1549 // Belongs to this view, but it's reference-counted on some platforms
1553 DISALLOW_COPY_AND_ASSIGN(View);