Home | History | Annotate | Download | only in views

Lines Matching refs:view

7 #include "ui/views/view.h"
52 // Whether to use accelerated compositing when necessary (e.g. when a view has a
90 // Returns the top view in |view|'s hierarchy.
91 const views::View* GetHierarchyRoot(const views::View* view) {
92 const views::View* root = view;
109 explicit PostEventDispatchHandler(View* owner)
140 View::ConvertPointToScreen(owner_, &location);
146 View* owner_;
158 const char View::kViewClassName[] = "View";
161 // View, public:
165 View::View()
193 View::~View() {
211 const Widget* View::GetWidget() const {
212 // The root view holds a reference to this view hierarchy's Widget.
216 Widget* View::GetWidget() {
217 return const_cast<Widget*>(const_cast<const View*>(this)->GetWidget());
220 void View::AddChildView(View* view) {
221 if (view->parent_ == this)
223 AddChildViewAt(view, child_count());
226 void View::AddChildViewAt(View* view, int index) {
227 CHECK_NE(view, this) << "You cannot add a view as its own child";
231 // If |view| has a parent, remove it from its parent.
232 View* parent = view->parent_;
233 const ui::NativeTheme* old_theme = view->GetNativeTheme();
236 ReorderChildView(view, index);
239 parent->DoRemoveChildView(view, true, true, false, this);
243 InitFocusSiblings(view, index);
245 // Let's insert the view.
246 view->parent_ = this;
247 children_.insert(children_.begin() + index, view);
249 ViewHierarchyChangedDetails details(true, this, view, parent);
251 for (View* v = this; v; v = v->parent_)
254 view->PropagateAddNotifications(details);
258 RegisterChildrenForVisibleBoundsNotification(view);
265 layout_manager_->ViewAdded(this, view);
271 // If any of the parent View is hidden, then the layers of the subtree
273 // inherit the visibility of the owner View.
277 void View::ReorderChildView(View* view, int index) {
278 DCHECK_EQ(view->parent_, this);
283 if (children_[index] == view)
286 const Views::iterator i(std::find(children_.begin(), children_.end(), view));
290 // Unlink the view first
291 View* next_focusable = view->next_focusable_view_;
292 View* prev_focusable = view->previous_focusable_view_;
299 InitFocusSiblings(view, index);
300 children_.insert(children_.begin() + index, view);
306 void View::RemoveChildView(View* view) {
307 DoRemoveChildView(view, true, true, false, NULL);
310 void View::RemoveAllChildViews(bool delete_children) {
316 bool View::Contains(const View* view) const {
317 for (const View* v = view; v; v = v->parent_) {
324 int View::GetIndexOf(const View* view) const {
325 Views::const_iterator i(std::find(children_.begin(), children_.end(), view));
331 void View::SetBounds(int x, int y, int width, int height) {
335 void View::SetBoundsRect(const gfx::Rect& bounds) {
346 // Paint where the view is currently.
357 void View::SetSize(const gfx::Size& size) {
361 void View::SetPosition(const gfx::Point& position) {
365 void View::SetX(int x) {
369 void View::SetY(int y) {
373 gfx::Rect View::GetContentsBounds() const {
380 gfx::Rect View::GetLocalBounds() const {
384 gfx::Rect View::GetLayerBoundsInPixel() const {
388 gfx::Insets View::GetInsets() const {
392 gfx::Rect View::GetVisibleBounds() const {
397 const View* view = this;
400 while (view != NULL && !vis_bounds.IsEmpty()) {
401 transform.ConcatTransform(view->GetTransform());
403 translation.Translate(static_cast<float>(view->GetMirroredX()),
404 static_cast<float>(view->y()));
407 vis_bounds = view->ConvertRectToParent(vis_bounds);
408 const View* ancestor = view->parent_;
412 } else if (!view->GetWidget()) {
413 // If the view has no Widget, we're not visible. Return an empty rect.
416 view = ancestor;
427 gfx::Rect View::GetBoundsInScreen() const {
429 View::ConvertPointToScreen(this, &origin);
433 gfx::Size View::GetPreferredSize() {
439 int View::GetBaseline() const {
443 void View::SizeToPreferredSize() {
449 gfx::Size View::GetMinimumSize() {
453 gfx::Size View::GetMaximumSize() {
457 int View::GetHeightForWidth(int w) {
463 void View::SetVisible(bool visible) {
465 // If the View is currently visible, schedule paint to refresh parent.
486 bool View::IsDrawn() const {
490 void View::SetEnabled(bool enabled) {
497 void View::OnEnabledChanged() {
503 gfx::Transform View::GetTransform() const {
507 void View::SetTransform(const gfx::Transform& transform) {
524 void View::SetPaintToLayer(bool paint_to_layer) {
533 ui::Layer* View::RecreateLayer() {
545 gfx::Rect View::GetMirroredBounds() const {
551 gfx::Point View::GetMirroredPosition() const {
555 int View::GetMirroredX() const {
559 int View::GetMirroredXForRect(const gfx::Rect& bounds) const {
564 int View::GetMirroredXInView(int x) const {
568 int View::GetMirroredXWithWidthInView(int x, int w) const {
574 void View::Layout() {
588 View* child = child_at(i);
596 void View::InvalidateLayout() {
604 LayoutManager* View::GetLayoutManager() const {
608 void View::SetLayoutManager(LayoutManager* layout_manager) {
619 const char* View::GetClassName() const {
623 View* View::GetAncestorWithClassName(const std::string& name) {
624 for (View* view = this; view; view = view->parent_) {
625 if (!strcmp(view->GetClassName(), name.c_str()))
626 return view;
631 const View* View::GetViewByID(int id) const {
633 return const_cast<View*>(this);
636 const View* view = child_at(i)->GetViewByID(id);
637 if (view)
638 return view;
643 View* View::GetViewByID(int id) {
644 return const_cast<View*>(const_cast<const View*>(this)->GetViewByID(id));
647 void View::SetGroup(int gid) {
653 int View::GetGroup() const {
657 bool View::IsGroupFocusTraversable() const {
661 void View::GetViewsInGroup(int group, Views* views) {
669 View* View::GetSelectedViewForGroup(int group) {
678 void View::ConvertPointToTarget(const View* source,
679 const View* target,
685 const View* root = GetHierarchyRoot(target);
704 void View::ConvertPointToWidget(const View* src, gfx::Point* p) {
712 void View::ConvertPointFromWidget(const View* dest, gfx::Point* p) {
720 void View::ConvertPointToScreen(const View* src, gfx::Point* p) {
724 // If the view is not connected to a tree, there's nothing we can do.
733 void View::ConvertPointFromScreen(const View* dst, gfx::Point* p) {
741 views::View::ConvertPointFromWidget(dst, p);
744 gfx::Rect View::ConvertRectToParent(const gfx::Rect& rect) const {
752 gfx::Rect View::ConvertRectToWidget(const gfx::Rect& rect) const {
754 for (const View* v = this; v; v = v->parent_)
761 void View::SchedulePaint() {
765 void View::SchedulePaintInRect(const gfx::Rect& rect) {
778 void View::Paint(gfx::Canvas* canvas) {
779 TRACE_EVENT1("views", "View::Paint", "class", GetClassName());
783 // Paint this View and its children, setting the clip rect to the bounds
784 // of this View and translating the origin to the local bounds' top left
788 // consideration whether or not the view uses a right-to-left layout so that
789 // we paint our view in its mirrored position if need be.
798 // where this view is located (related to its parent).
805 ui::ThemeProvider* View::GetThemeProvider() const {
810 const ui::NativeTheme* View::GetNativeTheme() const {
818 void View::set_use_acceleration_when_possible(bool use) {
823 bool View::get_use_acceleration_when_possible() {
829 View* View::GetEventHandlerForPoint(const gfx::Point& point) {
830 // Walk the child Views recursively looking for the View that most
833 View* child = child_at(i);
845 View* View::GetTooltipHandlerForPoint(const gfx::Point& point) {
849 // Walk the child Views recursively looking for the View that most
852 View* child = child_at(i);
858 View* handler = child->GetTooltipHandlerForPoint(point_in_child_coords);
865 gfx::NativeCursor View::GetCursor(const ui::MouseEvent& event) {
881 bool View::HitTestPoint(const gfx::Point& point) const {
885 bool View::HitTestRect(const gfx::Rect& rect) const {
910 bool View::IsMouseHovered() {
911 // If we haven't yet been placed in an onscreen view hierarchy, we can't be
927 bool View::OnMousePressed(const ui::MouseEvent& event) {
931 bool View::OnMouseDragged(const ui::MouseEvent& event) {
935 void View::OnMouseReleased(const ui::MouseEvent& event) {
938 void View::OnMouseCaptureLost() {
941 void View::OnMouseMoved(const ui::MouseEvent& event) {
944 void View::OnMouseEntered(const ui::MouseEvent& event) {
947 void View::OnMouseExited(const ui::MouseEvent& event) {
950 void View::SetMouseHandler(View* new_mouse_handler) {
956 bool View::OnKeyPressed(const ui::KeyEvent& event) {
960 bool View::OnKeyReleased(const ui::KeyEvent& event) {
964 bool View::OnMouseWheel(const ui::MouseWheelEvent& event) {
968 void View::OnKeyEvent(ui::KeyEvent* event) {
975 void View::OnMouseEvent(ui::MouseEvent* event) {
1017 void View::OnScrollEvent(ui::ScrollEvent* event) {
1020 void View::OnTouchEvent(ui::TouchEvent* event) {
1023 void View::OnGestureEvent(ui::GestureEvent* event) {
1026 ui::TextInputClient* View::GetTextInputClient() {
1030 InputMethod* View::GetInputMethod() {
1035 const InputMethod* View::GetInputMethod() const {
1040 bool View::CanAcceptEvent(const ui::Event& event) {
1044 ui::EventTarget* View::GetParentTarget() {
1050 void View::AddAccelerator(const ui::Accelerator& accelerator) {
1061 void View::RemoveAccelerator(const ui::Accelerator& accelerator) {
1088 void View::ResetAccelerators() {
1093 bool View::AcceleratorPressed(const ui::Accelerator& accelerator) {
1097 bool View::CanHandleAccelerators() const {
1103 bool View::HasFocus() const {
1108 View* View::GetNextFocusableView() {
1112 const View* View::GetNextFocusableView() const {
1116 View* View::GetPreviousFocusableView() {
1120 void View::SetNextFocusableView(View* view) {
1121 if (view)
1122 view->previous_focusable_view_ = this;
1123 next_focusable_view_ = view;
1126 bool View::IsFocusable() const {
1130 bool View::IsAccessibilityFocusable() const {
1134 FocusManager* View::GetFocusManager() {
1139 const FocusManager* View::GetFocusManager() const {
1144 void View::RequestFocus() {
1150 bool View::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
1154 FocusTraversable* View::GetFocusTraversable() {
1158 FocusTraversable* View::GetPaneFocusTraversable() {
1164 bool View::GetTooltipText(const gfx::Point& p, string16* tooltip) const {
1168 bool View::GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* loc) const {
1174 void View::ShowContextMenu(const gfx::Point& p,
1183 bool View::ShouldShowContextMenuOnMousePress() {
1189 bool View::GetDropFormats(
1195 bool View
1199 bool View::CanDrop(const OSExchangeData& data) {
1204 void View::OnDragEntered(const ui::DropTargetEvent& event) {
1207 int View::OnDragUpdated(const ui::DropTargetEvent& event) {
1211 void View::OnDragExited() {
1214 int View::OnPerformDrop(const ui::DropTargetEvent& event) {
1218 void View::OnDragDone() {
1222 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) {
1229 gfx::NativeViewAccessible View::GetNativeViewAccessible() {
1237 void View::NotifyAccessibilityEvent(
1253 void View::ScrollRectToVisible(const gfx::Rect& rect) {
1263 int View::GetPageScrollIncrement(ScrollView* scroll_view,
1268 int View::GetLineScrollIncrement(ScrollView* scroll_view,
1274 // View, protected:
1278 void View::OnBoundsChanged(const gfx::Rect& previous_bounds) {
1281 void View::PreferredSizeChanged() {
1287 bool View::NeedsNotificationWhenVisibleBoundsChange() const {
1291 void View::OnVisibleBoundsChanged() {
1296 void View::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) {
1299 void View::VisibilityChanged(View* starting_from, bool is_visible) {
1302 void View::NativeViewHierarchyChanged(bool attached,
1322 void View::PaintChildren(gfx::Canvas* canvas) {
1323 TRACE_EVENT1("views", "View::PaintChildren", "class", GetClassName());
1329 void View::OnPaint(gfx::Canvas* canvas) {
1330 TRACE_EVENT1("views", "View::OnPaint", "class", GetClassName());
1336 void View::OnPaintBackground(gfx::Canvas* canvas) {
1338 TRACE_EVENT2("views", "View::OnPaintBackground",
1345 void View::OnPaintBorder(gfx::Canvas* canvas) {
1347 TRACE_EVENT2("views", "View::OnPaintBorder",
1354 void View::OnPaintFocusBorder(gfx::Canvas* canvas) {
1366 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) {
1372 bool View::SetExternalTexture(ui::Texture* texture) {
1379 // child view has its own layer to paint into.
1387 gfx::Vector2d View::CalculateOffsetToAncestorWithLayer(
1401 void View::UpdateParentLayer() {
1414 void View::MoveLayerToParent(ui::Layer* parent_layer,
1429 void View::UpdateLayerVisibility() {
1433 for (const View* v = parent_; visible && v && !v->layer(); v = v->parent_)
1439 void View::UpdateChildLayerVisibility(bool ancestor_visible) {
1448 void View::UpdateChildLayerBounds(const gfx::Vector2d& offset) {
1453 View* child = child_at(i);
1460 void View::OnPaintLayer(gfx::Canvas* canvas) {
1466 void View::OnDeviceScaleFactorChanged(float device_scale_factor) {
1470 base::Closure View::PrepareForLayerBoundsChange() {
1474 void View::ReorderLayers() {
1475 View* v = this;
1492 // associated with a view (eg via a NativeViewHost). Always do the
1494 // is parented to the widget's layer regardless of whether the host view has
1500 void View::ReorderChildLayers(ui::Layer* parent_layer) {
1517 bool View::HasHitTestMask() const {
1521 void View::GetHitTestMask(gfx::Path* mask) const {
1525 View::DragInfo* View::GetDragInfo() {
1531 void View::OnFocus() {
1535 // view as the focus and that we still receive keyboard inputs.
1546 void View::OnBlur() {
1549 void View::Focus() {
1554 void View::Blur() {
1561 void View::TooltipTextChanged() {
1572 gfx::Point View::GetKeyboardContextMenuLocation() {
1582 int View::GetDragOperations(const gfx::Point& press_pt) {
1588 void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) {
1593 bool View::InDrag() {
1602 std::string View::PrintViewGraph(bool first) {
1606 std::string View::DoPrintViewGraph(bool first, View* view_with_children) {
1707 // View, private:
1711 void View::DragInfo::Reset() {
1716 void View::DragInfo::PossibleDrag(const gfx::Point& p) {
1723 void View::SchedulePaintBoundsChanged(SchedulePaintType type) {
1724 // If we have a layer and the View's size did not change, we do not need to
1729 // use SchedulePaint to invalidate the area occupied by the View.
1740 void View::PaintCommon(gfx::Canvas* canvas) {
1745 // If the View we are about to paint requested the canvas to be flipped, we
1747 // The canvas mirroring is undone once the View is done painting so that we
1764 void View::DoRemoveChildView(View* view,
1768 View* new_parent) {
1769 DCHECK(view);
1770 const Views::iterator i(std::find(children_.begin(), children_.end(), view));
1771 scoped_ptr<View> view_to_be_deleted;
1774 // Let's remove the view from the focus traversal.
1775 View* next_focusable = view->next_focusable_view_;
1776 View* prev_focusable = view->previous_focusable_view_;
1784 UnregisterChildrenForVisibleBoundsNotification(view);
1785 view->PropagateRemoveNotifications(this, new_parent);
1786 view->parent_ = NULL;
1787 view->UpdateLayerVisibility();
1789 if (delete_removed_view && !view->owned_by_client_)
1790 view_to_be_deleted.reset(view);
1799 layout_manager_->ViewRemoved(this, view);
1802 void View::PropagateRemoveNotifications(View* old_parent, View* new_parent) {
1807 for (View* v = this; v; v = v->parent_)
1811 void View::PropagateAddNotifications(
1818 void View::PropagateNativeViewHierarchyChanged(bool attached,
1828 void View::ViewHierarchyChangedImpl(
1834 // added to the view hierarchy.
1868 void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) {
1876 void View::PropagateVisibilityNotifications(View* start, bool is_visible) {
1882 void View::VisibilityChangedImpl(View* starting_from, bool is_visible) {
1886 void View::BoundsChanged(const gfx::Rect& previous_bounds) {
1928 // Notify interested Views that visible bounds within the root view may have
1939 void View::RegisterChildrenForVisibleBoundsNotification(View* view) {
1940 if (view->NeedsNotificationWhenVisibleBoundsChange())
1941 view->RegisterForVisibleBoundsNotification();
1942 for (int i = 0; i < view->child_count(); ++i)
1943 RegisterChildrenForVisibleBoundsNotification(view->child_at(i));
1947 void View::UnregisterChildrenForVisibleBoundsNotification(View* view) {
1948 if (view->NeedsNotificationWhenVisibleBoundsChange())
1949 view->UnregisterForVisibleBoundsNotification();
1950 for (int i = 0; i < view->child_count(); ++i)
1951 UnregisterChildrenForVisibleBoundsNotification(view->child_at(i));
1954 void View::RegisterForVisibleBoundsNotification() {
1959 for (View* ancestor = parent_; ancestor; ancestor = ancestor->parent_)
1963 void View::UnregisterForVisibleBoundsNotification() {
1968 for (View* ancestor = parent_; ancestor; ancestor = ancestor->parent_)
1972 void View::AddDescendantToNotify(View* view) {
1973 DCHECK(view);
1976 descendants_to_notify_->push_back(view);
1979 void View::RemoveDescendantToNotify(View* view) {
1980 DCHECK(view && descendants_to_notify_.get());
1982 descendants_to_notify_->begin(), descendants_to_notify_->end(), view));
1989 void View::SetLayerBounds(const gfx::Rect& bounds) {
1995 bool View::GetTransformRelativeTo(const View* ancestor,
1997 const View* p = this;
2014 bool View::ConvertPointForAncestor(const View* ancestor,
2025 bool View::ConvertPointFromAncestor(const View* ancestor,
2037 void View::CreateLayer() {
2038 // A new layer is being created for the view. So all the layers of the
2039 // sub-tree can inherit the visibility of the corresponding view.
2054 // to the view tree. Children of this layer were added in order
2064 void View::UpdateParentLayers() {
2074 void View::OrphanLayers() {
2079 // The layer belonging to this View has already been orphaned. It is not
2087 void View::ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer) {
2096 void View::DestroyLayer() {
2122 bool View::ProcessMousePressed(const ui::MouseEvent& event) {
2129 View::DragInfo* drag_info = GetDragInfo();
2149 // WARNING: we may have been deleted, don't use any View variables.
2157 bool View::ProcessMouseDragged(const ui::MouseEvent& event) {
2178 void View::ProcessMouseReleased(const ui::MouseEvent& event) {
2197 void View::RegisterPendingAccelerators() {
2205 // The view is not yet attached to a widget, defer registration until then.
2226 void View::UnregisterAccelerators(bool leave_data_intact) {
2248 void View::InitFocusSiblings(View* v, int index) {
2259 View* last_focusable_view = NULL;
2269 View* prev = children_[index - 1];
2280 View* prev = children_[index]->GetPreviousFocusableView();
2292 void View::PropagateThemeChanged() {
2298 void View::PropagateLocaleChanged() {
2306 void View::UpdateTooltip() {
2317 bool View::DoDrag(const ui::LocatedEvent& event,