Lines Matching refs:view
7 #include "ui/views/view.h"
70 // Returns the top view in |view|'s hierarchy.
71 const views::View* GetHierarchyRoot(const views::View* view) {
72 const views::View* root = view;
90 const char View::kViewClassName[] = "View";
93 // View, public:
97 View::View()
123 View::~View() {
143 const Widget* View::GetWidget() const {
144 // The root view holds a reference to this view hierarchy's Widget.
148 Widget* View::GetWidget() {
149 return const_cast<Widget*>(const_cast<const View*>(this)->GetWidget());
152 void View::AddChildView(View* view) {
153 if (view->parent_ == this)
155 AddChildViewAt(view, child_count());
158 void View::AddChildViewAt(View* view, int index) {
159 CHECK_NE(view, this) << "You cannot add a view as its own child";
163 // If |view| has a parent, remove it from its parent.
164 View* parent = view->parent_;
167 old_theme = view->GetNativeTheme();
169 ReorderChildView(view, index);
172 parent->DoRemoveChildView(view, true, true, false, this);
176 InitFocusSiblings(view, index);
178 // Let's insert the view.
179 view->parent_ = this;
180 children_.insert(children_.begin() + index, view);
182 // Instruct the view to recompute its root bounds on next Paint().
183 view->SetRootBoundsDirty(true);
187 const ui::NativeTheme* new_theme = view->GetNativeTheme();
189 view->PropagateNativeThemeChanged(new_theme);
192 ViewHierarchyChangedDetails details(true, this, view, parent);
194 for (View* v = this; v; v = v->parent_)
197 view->PropagateAddNotifications(details);
200 RegisterChildrenForVisibleBoundsNotification(view);
201 if (view->visible())
202 view->SchedulePaint();
206 layout_manager_->ViewAdded(this, view);
211 // If any of the parent View is hidden, then the layers of the subtree
213 // inherit the visibility of the owner View.
217 void View::ReorderChildView(View* view, int index) {
218 DCHECK_EQ(view->parent_, this);
223 if (children_[index] == view)
226 const Views::iterator i(std::find(children_.begin(), children_.end(), view));
230 // Unlink the view first
231 View* next_focusable = view->next_focusable_view_;
232 View* prev_focusable = view->previous_focusable_view_;
239 InitFocusSiblings(view, index);
240 children_.insert(children_.begin() + index, view);
245 void View::RemoveChildView(View* view) {
246 DoRemoveChildView(view, true, true, false, NULL);
249 void View::RemoveAllChildViews(bool delete_children) {
255 bool View::Contains(const View* view) const {
256 for (const View* v = view; v; v = v->parent_) {
263 int View::GetIndexOf(const View* view) const {
264 Views::const_iterator i(std::find(children_.begin(), children_.end(), view));
270 void View::SetBounds(int x, int y, int width, int height) {
274 void View::SetBoundsRect(const gfx::Rect& bounds) {
284 // Paint where the view is currently.
295 void View::SetSize(const gfx::Size& size) {
299 void View::SetPosition(const gfx::Point& position) {
303 void View::SetX(int x) {
307 void View::SetY(int y) {
311 gfx::Rect View::GetContentsBounds() const {
318 gfx::Rect View::GetLocalBounds() const {
322 gfx::Rect View::GetLayerBoundsInPixel() const {
326 gfx::Insets View::GetInsets() const {
330 gfx::Rect View::GetVisibleBounds() const {
335 const View* view = this;
338 while (view != NULL && !vis_bounds.IsEmpty()) {
339 transform.ConcatTransform(view->GetTransform());
341 translation.Translate(static_cast<float>(view->GetMirroredX()),
342 static_cast<float>(view->y()));
345 vis_bounds = view->ConvertRectToParent(vis_bounds);
346 const View* ancestor = view->parent_;
350 } else if (!view->GetWidget()) {
351 // If the view has no Widget, we're not visible. Return an empty rect.
354 view = ancestor;
365 gfx::Rect View::GetBoundsInScreen() const {
367 View::ConvertPointToScreen(this, &origin);
371 gfx::Size View::GetPreferredSize() const {
377 int View::GetBaseline() const {
381 void View::SizeToPreferredSize() {
387 gfx::Size View::GetMinimumSize() const {
391 gfx::Size View::GetMaximumSize() const {
395 int View::GetHeightForWidth(int w) const {
401 void View::SetVisible(bool visible) {
403 // If the View is currently visible, schedule paint to refresh parent.
431 bool View::IsDrawn() const {
435 void View::SetEnabled(bool enabled) {
443 void View::OnEnabledChanged() {
449 gfx::Transform View::GetTransform() const {
453 void View::SetTransform(const gfx::Transform& transform) {
470 void View::SetPaintToLayer(bool paint_to_layer) {
477 // from our old paint root, if we had one. Traverse up view tree to find old
479 View* old_paint_root = parent_;
506 gfx::Rect View::GetMirroredBounds() const {
512 gfx::Point View::GetMirroredPosition() const {
516 int View::GetMirroredX() const {
520 int View::GetMirroredXForRect(const gfx::Rect& bounds) const {
525 int View::GetMirroredXInView(int x) const {
529 int View::GetMirroredXWithWidthInView(int x, int w) const {
535 void View::Layout() {
549 View* child = child_at(i);
557 void View::InvalidateLayout() {
565 LayoutManager* View::GetLayoutManager() const {
569 void View::SetLayoutManager(LayoutManager* layout_manager) {
578 void View::SnapLayerToPixelBoundary() {
593 const char* View::GetClassName() const {
597 const View* View::GetAncestorWithClassName(const std::string& name) const {
598 for (const View* view = this; view; view = view->parent_) {
599 if (!strcmp(view->GetClassName(), name.c_str()))
600 return view;
605 View* View::GetAncestorWithClassName(const std::string& name) {
606 return const_cast<View*>(const_cast<const View*>(this)->
610 const View* View::GetViewByID(int id) const {
612 return const_cast<View*>(this);
615 const View* view = child_at(i)->GetViewByID(id);
616 if (view)
617 return view;
622 View* View::GetViewByID(int id) {
623 return const_cast<View*>(const_cast<const View*>(this)->GetViewByID(id));
626 void View::SetGroup(int gid) {
632 int View::GetGroup() const {
636 bool View::IsGroupFocusTraversable() const {
640 void View::GetViewsInGroup(int group, Views* views) {
648 View* View::GetSelectedViewForGroup(int group) {
657 void View::ConvertPointToTarget(const View* source,
658 const View* target,
665 const View* root = GetHierarchyRoot(target);
676 void View::ConvertRectToTarget(const View* source,
677 const View* target,
684 const View* root = GetHierarchyRoot(target);
695 void View::ConvertPointToWidget(const View* src, gfx::Point* p) {
703 void View::ConvertPointFromWidget(const View* dest, gfx::Point* p) {
711 void View::ConvertPointToScreen(const View* src, gfx::Point* p) {
715 // If the view is not connected to a tree, there's nothing we can do.
724 void View::ConvertPointFromScreen(const View* dst, gfx::Point* p) {
732 views::View::ConvertPointFromWidget(dst, p);
735 gfx::Rect View::ConvertRectToParent(const gfx::Rect& rect) const {
743 gfx::Rect View::ConvertRectToWidget(const gfx::Rect& rect) const {
745 for (const View* v = this; v; v = v->parent_)
752 void View::SchedulePaint() {
756 void View::SchedulePaintInRect(const gfx::Rect& rect) {
769 void View::Paint(gfx::Canvas* canvas, const CullSet& cull_set) {
773 TRACE_EVENT1("views", "View::Paint", "class", GetClassName());
777 // Paint this View and its children, setting the clip rect to the bounds
778 // of this View and translating the origin to the local bounds' top left
782 // consideration whether or not the view uses a right-to-left layout so that
783 // we paint our view in its mirrored position if need be.
793 // this view is located (related to its parent).
831 void View::set_background(Background* b) {
835 void View::SetBorder(scoped_ptr<Border> b) { border_ = b.Pass(); }
837 ui::ThemeProvider* View::GetThemeProvider() const {
842 const ui::NativeTheme* View::GetNativeTheme() const {
849 View* View::GetEventHandlerForPoint(const gfx::Point& point) {
853 View* View::GetEventHandlerForRect(const gfx::Rect& rect) {
857 bool View::CanProcessEventsWithinSubtree() const {
861 View* View::GetTooltipHandlerForPoint(const gfx::Point& point) {
866 // Walk the child Views recursively looking for the View that most
869 View* child = child_at(i);
875 View* handler = child->GetTooltipHandlerForPoint(point_in_child_coords);
882 gfx::NativeCursor View::GetCursor(const ui::MouseEvent& event) {
893 bool View::HitTestPoint(const gfx::Point& point) const {
897 bool View::HitTestRect(const gfx::Rect& rect) const {
901 bool View::IsMouseHovered() {
902 // If we haven't yet been placed in an onscreen view hierarchy, we can't be
918 bool View::OnMousePressed(const ui::MouseEvent& event) {
922 bool View::OnMouseDragged(const ui::MouseEvent& event) {
926 void View::OnMouseReleased(const ui::MouseEvent& event) {
929 void View::OnMouseCaptureLost() {
932 void View::OnMouseMoved(const ui::MouseEvent& event) {
935 void View::OnMouseEntered(const ui::MouseEvent& event) {
938 void View::OnMouseExited(const ui::MouseEvent& event) {
941 void View::SetMouseHandler(View* new_mouse_handler) {
947 bool View::OnKeyPressed(const ui::KeyEvent& event) {
951 bool View::OnKeyReleased(const ui::KeyEvent& event) {
955 bool View::OnMouseWheel(const ui::MouseWheelEvent& event) {
959 void View::OnKeyEvent(ui::KeyEvent* event) {
966 void View::OnMouseEvent(ui::MouseEvent* event) {
1010 void View::OnScrollEvent(ui::ScrollEvent* event) {
1013 void View::OnTouchEvent(ui::TouchEvent* event) {
1017 void View::OnGestureEvent(ui::GestureEvent* event) {
1020 ui::TextInputClient* View::GetTextInputClient() {
1024 InputMethod* View::GetInputMethod() {
1029 const InputMethod* View::GetInputMethod() const {
1035 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) {
1041 ViewTargeter* View::GetEffectiveViewTargeter() const {
1050 bool View::CanAcceptEvent(const ui::Event& event) {
1054 ui::EventTarget* View::GetParentTarget() {
1058 scoped_ptr<ui::EventTargetIterator> View::GetChildIterator() const {
1060 new ui::EventTargetIteratorImpl<View>(children_));
1063 ui::EventTargeter* View::GetEventTargeter() {
1067 void View::ConvertEventToTarget(ui::EventTarget* target,
1069 event->ConvertLocationToTarget(this, static_cast<View*>(target));
1074 void View::AddAccelerator(const ui::Accelerator& accelerator) {
1085 void View::RemoveAccelerator(const ui::Accelerator& accelerator) {
1112 void View::ResetAccelerators() {
1117 bool View::AcceleratorPressed(const ui::Accelerator& accelerator) {
1121 bool View::CanHandleAccelerators() const {
1127 bool View::HasFocus() const {
1132 View* View::GetNextFocusableView() {
1136 const View* View::GetNextFocusableView() const {
1140 View* View::GetPreviousFocusableView() {
1144 void View::SetNextFocusableView(View* view) {
1145 if (view)
1146 view->previous_focusable_view_ = this;
1147 next_focusable_view_ = view;
1150 void View::SetFocusable(bool focusable) {
1158 bool View::IsFocusable() const {
1162 bool View::IsAccessibilityFocusable() const {
1166 void View::SetAccessibilityFocusable(bool accessibility_focusable) {
1174 FocusManager* View::GetFocusManager() {
1179 const FocusManager* View::GetFocusManager() const {
1184 void View::RequestFocus() {
1190 bool View::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
1194 FocusTraversable* View::GetFocusTraversable() {
1198 FocusTraversable* View::GetPaneFocusTraversable() {
1204 bool View::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const {
1208 bool View::GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* loc) const {
1214 void View::ShowContextMenu(const gfx::Point& p,
1223 bool View::ShouldShowContextMenuOnMousePress() {
1229 bool View::GetDropFormats(
1235 bool View::AreDropTypesRequired() {
1239 bool View::CanDrop(const OSExchangeData& data) {
1244 void View::OnDragEntered(const ui::DropTargetEvent& event) {
1247 int View::OnDragUpdated(const ui::DropTargetEvent& event) {
1251 void View::OnDragExited() {
1254 int View::OnPerformDrop(const ui::DropTargetEvent& event) {
1258 void View::OnDragDone() {
1262 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) {
1269 gfx::NativeViewAccessible View::GetNativeViewAccessible() {
1277 void View::NotifyAccessibilityEvent(
1293 void View::ScrollRectToVisible(const gfx::Rect& rect) {
1303 int View::GetPageScrollIncrement(ScrollView* scroll_view,
1308 int View::GetLineScrollIncrement(ScrollView* scroll_view,
1314 // View, protected:
1318 void View::OnBoundsChanged(const gfx::Rect& previous_bounds) {
1321 void View::PreferredSizeChanged() {
1327 bool View::GetNeedsNotificationWhenVisibleBoundsChange() const {
1331 void View::OnVisibleBoundsChanged() {
1336 void View::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) {
1339 void View::VisibilityChanged(View* starting_from, bool is_visible) {
1342 void View::NativeViewHierarchyChanged() {
1354 void View::PaintChildren(gfx::Canvas* canvas, const CullSet& cull_set) {
1355 TRACE_EVENT1("views", "View::PaintChildren", "class", GetClassName());
1361 void View::OnPaint(gfx::Canvas* canvas) {
1362 TRACE_EVENT1("views", "View::OnPaint", "class", GetClassName());
1367 void View::OnPaintBackground(gfx::Canvas* canvas) {
1369 TRACE_EVENT2("views", "View::OnPaintBackground",
1376 void View::OnPaintBorder(gfx::Canvas* canvas) {
1378 TRACE_EVENT2("views", "View::OnPaintBorder",
1385 bool View::IsPaintRoot() {
1391 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) {
1397 gfx::Vector2d View::CalculateOffsetToAncestorWithLayer(
1411 void View::UpdateParentLayer() {
1424 void View::MoveLayerToParent(ui::Layer* parent_layer,
1439 void View::UpdateLayerVisibility() {
1441 for (const View* v = parent_; visible && v && !v->layer(); v = v->parent_)
1447 void View::UpdateChildLayerVisibility(bool ancestor_visible) {
1456 void View::UpdateChildLayerBounds(const gfx::Vector2d& offset) {
1461 View* child = child_at(i);
1468 void View::OnPaintLayer(gfx::Canvas* canvas) {
1474 void View::OnDelegatedFrameDamage(
1478 void View::OnDeviceScaleFactorChanged(float device_scale_factor) {
1485 base::Closure View::PrepareForLayerBoundsChange() {
1489 void View::ReorderLayers() {
1490 View* v = this;
1507 // associated with a view (eg via a NativeViewHost). Always do the
1509 // is parented to the widget's layer regardless of whether the host view has
1515 void View::ReorderChildLayers(ui::Layer* parent_layer) {
1532 View::DragInfo* View::GetDragInfo() {
1538 void View::OnFocus() {
1542 // view as the focus and that we still receive keyboard inputs.
1553 void View::OnBlur() {
1556 void View::Focus() {
1560 void View::Blur() {
1566 void View::TooltipTextChanged() {
1575 gfx::Point View::GetKeyboardContextMenuLocation() {
1585 int View::GetDragOperations(const gfx::Point& press_pt) {
1591 void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) {
1596 bool View::InDrag() {
1601 int View::GetHorizontalDragThreshold() {
1607 int View::GetVerticalDragThreshold() {
1617 std::string View::PrintViewGraph(bool first) {
1621 std::string View::DoPrintViewGraph(bool first, View* view_with_children) {
1721 // View, private:
1725 void View::DragInfo::Reset() {
1730 void View::DragInfo::PossibleDrag(const gfx::Point& p) {
1737 void View::SchedulePaintBoundsChanged(SchedulePaintType type) {
1738 // If we have a layer and the View's size did not change, we do not need to
1743 // use SchedulePaint to invalidate the area occupied by the View.
1754 void View::PaintCommon(gfx::Canvas* canvas, const CullSet& cull_set) {
1759 // If the View we are about to paint requested the canvas to be flipped, we
1761 // The canvas mirroring is undone once the View is done painting so that we
1778 void View::DoRemoveChildView(View* view,
1782 View* new_parent) {
1783 DCHECK(view);
1785 const Views::iterator i(std::find(children_.begin(), children_.end(), view));
1786 scoped_ptr<View> view_to_be_deleted;
1789 // Let's remove the view from the focus traversal.
1790 View* next_focusable = view->next_focusable_view_;
1791 View* prev_focusable = view->previous_focusable_view_;
1799 UnregisterChildrenForVisibleBoundsNotification(view);
1800 if (view->visible())
1801 view->SchedulePaint();
1802 GetWidget()->NotifyWillRemoveView(view);
1809 view->RemoveRootBounds(bounds_tree);
1811 view->PropagateRemoveNotifications(this, new_parent);
1812 view->parent_ = NULL;
1813 view->UpdateLayerVisibility();
1815 if (delete_removed_view && !view->owned_by_client_)
1816 view_to_be_deleted.reset(view);
1825 layout_manager_->ViewRemoved(this, view);
1828 void View::PropagateRemoveNotifications(View* old_parent, View* new_parent) {
1833 for (View* v = this; v; v = v->parent_)
1837 void View::PropagateAddNotifications(
1844 void View::PropagateNativeViewHierarchyChanged() {
1850 void View::ViewHierarchyChangedImpl(
1856 // added to the view hierarchy.
1883 void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) {
1891 void View::PropagateVisibilityNotifications(View* start, bool is_visible) {
1897 void View::VisibilityChangedImpl(View* starting_from, bool is_visible) {
1901 void View::BoundsChanged(const gfx::Rect& previous_bounds) {
1939 // Notify interested Views that visible bounds within the root view may have
1950 void View::RegisterChildrenForVisibleBoundsNotification(View* view) {
1951 if (view->GetNeedsNotificationWhenVisibleBoundsChange())
1952 view->RegisterForVisibleBoundsNotification();
1953 for (int i = 0; i < view->child_count(); ++i)
1954 RegisterChildrenForVisibleBoundsNotification(view->child_at(i));
1958 void View::UnregisterChildrenForVisibleBoundsNotification(View* view) {
1959 if (view->GetNeedsNotificationWhenVisibleBoundsChange())
1960 view->UnregisterForVisibleBoundsNotification();
1961 for (int i = 0; i < view->child_count(); ++i)
1962 UnregisterChildrenForVisibleBoundsNotification(view->child_at(i));
1965 void View::RegisterForVisibleBoundsNotification() {
1970 for (View* ancestor = parent_; ancestor; ancestor = ancestor->parent_)
1974 void View::UnregisterForVisibleBoundsNotification() {
1979 for (View* ancestor = parent_; ancestor; ancestor = ancestor->parent_)
1983 void View::AddDescendantToNotify(View* view) {
1984 DCHECK(view);
1987 descendants_to_notify_->push_back(view);
1990 void View::RemoveDescendantToNotify(View* view) {
1991 DCHECK(view && descendants_to_notify_.get());
1993 descendants_to_notify_->begin(), descendants_to_notify_->end(), view));
2000 void View::SetLayerBounds(const gfx::Rect& bounds) {
2005 void View::SetRootBoundsDirty(bool origin_changed) {
2019 void View::UpdateRootBounds(BoundsTree* tree, const gfx::Vector2d& offset) {
2029 TRACE_EVENT1("views", "View::UpdateRootBounds", "class", GetClassName());
2052 void View::RemoveRootBounds(BoundsTree* tree) {
2063 View::BoundsTree* View::GetBoundsTreeFromPaintRoot() {
2065 View* paint_root = this;
2078 bool View::GetTransformRelativeTo(const View* ancestor,
2080 const View* p = this;
2097 bool View::ConvertPointForAncestor(const View* ancestor,
2108 bool View::ConvertPointFromAncestor(const View* ancestor,
2118 bool View::ConvertRectForAncestor(const View* ancestor,
2127 bool View::ConvertRectFromAncestor(const View* ancestor,
2137 void View::CreateLayer() {
2138 // A new layer is being created for the view. So all the layers of the
2139 // sub-tree can inherit the visibility of the corresponding view.
2153 // to the view tree. Children of this layer were added in order
2163 void View::UpdateParentLayers() {
2173 void View::OrphanLayers() {
2178 // The layer belonging to this View has already been orphaned. It is not
2186 void View::ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer) {
2195 void View::DestroyLayer() {
2220 bool View::ProcessMousePressed(const ui::MouseEvent& event) {
2227 View::DragInfo* drag_info = GetDragInfo();
2258 // WARNING: we may have been deleted, don't use any View variables.
2266 bool View::ProcessMouseDragged(const ui::MouseEvent& event) {
2287 void View::ProcessMouseReleased(const ui::MouseEvent& event) {
2306 void View::RegisterPendingAccelerators() {
2314 // The view is not yet attached to a widget, defer registration until then.
2335 void View::UnregisterAccelerators(bool leave_data_intact) {
2354 void View::InitFocusSiblings(View* v, int index) {
2365 View* last_focusable_view = NULL;
2375 View* prev = children_[index - 1];
2386 View* prev = children_[index]->GetPreviousFocusableView();
2396 void View::AdvanceFocusIfNecessary() {
2397 // Focus should only be advanced if this is the focused view and has become
2398 // unfocusable. If the view is still focusable or is not focused, we can
2411 void View::PropagateThemeChanged() {
2417 void View::PropagateLocaleChanged() {
2425 void View::UpdateTooltip() {
2436 bool View::DoDrag(const ui::LocatedEvent& event,